a little more debug to help diagnose boot failure
[AROS.git] / test / dos / readitemloop.c
blob5d1f7a17b35318c4660d80f0ff316137624b3139
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/alib.h>
7 #include <dos/rdargs.h>
8 #include <proto/dos.h>
11 int __nocommandline = 1;
13 /* No newline in the end! Important! */
14 static char text[] = "WORD1 WORD2 WORD3";
15 static char buf[256];
17 int main(void)
19 struct CSource cs;
20 int i;
21 LONG result = RETURN_OK, res;
23 cs.CS_Buffer = text;
24 cs.CS_Length = sizeof(text) - 1;
25 cs.CS_CurChr = 0;
27 i = 1;
30 res = ReadItem(buf, sizeof(buf), &cs);
32 Printf("Step %ld, result %ld, buffer %s, CurChr %ld\n", i++, res,
33 buf, cs.CS_CurChr);
34 if (i == 10)
36 Printf("ERROR: Unrecoverable loop detected!\n");
37 result = RETURN_ERROR;
38 break;
41 while (res != ITEM_NOTHING);
43 return result;