Tabs to spaces, more consistent formatting, childs -> children, typos in
[AROS.git] / test / dos / readitemloop.c
blob780fc4ffe19594e4c6ca454d633458c84932f1e4
2 #include <proto/alib.h>
3 #include <dos/rdargs.h>
4 #include <proto/dos.h>
7 int __nocommandline = 1;
9 /* No newline in the end!!! Important!!! */
10 static char text[] = "WORD1 WORD2 WORD3";
11 static char buf[256];
13 int main(void)
15 struct CSource cs;
16 int i;
17 LONG res;
19 cs.CS_Buffer = text;
20 cs.CS_Length = sizeof(text) - 1;
21 cs.CS_CurChr = 0;
23 i = 1;
26 res = ReadItem(buf, sizeof(buf), &cs);
28 Printf("Step %ld, result %ld, buffer %s, CurChr %ld\n", i++, res, buf, cs.CS_CurChr);
29 if (i == 10)
31 Printf("ERROR: Unrecoverable loop detected!\n");
32 break;
34 } while (res != ITEM_NOTHING);
36 return 0;