Copyright clean-up (part 1):
[AROS.git] / test / dos / readitemloop.c
blob94106d993fcf7755bf0ab9bd0755aa2253e3ba72
1 /*
2 Copyright © 1995-2014, 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 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, buf, cs.CS_CurChr);
33 if (i == 10)
35 Printf("ERROR: Unrecoverable loop detected!\n");
36 break;
38 } while (res != ITEM_NOTHING);
40 return 0;