1
2 #include <stdio.h>
3 #include "textio/textio.h"
4
5 #ifndef lint
6 static char rcsid[] = "$Header: /usr/cvsroot/magic-8.0/utils/parsetest.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
7 #endif /* not lint */
8
main()9 main()
10 {
11 char str[100];
12 char *args[4];
13 int argCount;
14
15 TxInitTerm();
16
17 strcpy(str, "");
18
19 while (strcmp(str,"q") != 0)
20 {
21 int i;
22
23 TxPrintf("-->");
24 TxGetLine(str, 99);
25 TxPrintf("Line is '%s'\n", str);
26 if (!ParsSplit(str, 3, &argCount, args))
27 TxError("Parser failed\n");
28
29 TxPrintf("ARgc = %d\n", argCount);
30 for (i = 0; i < argCount; i++)
31 {
32 TxPrintf(" arg %d: '%s'\n", i, args[i]);
33 }
34 }
35
36 TxCloseTerm();
37 }
38