2017-04-25 14:41:48 +02:00
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "textio/textio.h"
|
|
|
|
|
|
|
|
|
|
#ifndef lint
|
|
|
|
|
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 $";
|
|
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
|
|
main()
|
|
|
|
|
{
|
|
|
|
|
char str[100];
|
|
|
|
|
char *args[4];
|
|
|
|
|
int argCount;
|
|
|
|
|
|
|
|
|
|
TxInitTerm();
|
|
|
|
|
|
|
|
|
|
strcpy(str, "");
|
|
|
|
|
|
|
|
|
|
while (strcmp(str,"q") != 0)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
TxPrintf("-->");
|
2020-05-23 23:13:14 +02:00
|
|
|
TxGetLine(str, 99);
|
2017-04-25 14:41:48 +02:00
|
|
|
TxPrintf("Line is '%s'\n", str);
|
|
|
|
|
if (!ParsSplit(str, 3, &argCount, args))
|
|
|
|
|
TxError("Parser failed\n");
|
|
|
|
|
|
|
|
|
|
TxPrintf("ARgc = %d\n", argCount);
|
|
|
|
|
for (i = 0; i < argCount; i++)
|
|
|
|
|
{
|
|
|
|
|
TxPrintf(" arg %d: '%s'\n", i, args[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TxCloseTerm();
|
|
|
|
|
}
|