/**************************************************************/ /* */ /* UNIX 1 / WS 92/93 Gruppe ux803 */ /* 3. Uebung - Aufgabe 2 - test.c */ /* */ /* Vorname Name Matrikelnr. */ /* --------- ------- ------------- */ /* Dietmar Dierks 125761 */ /* Roman Czyborra 127221 */ /* Torsten Buller 117894 */ /* Gerasimos Paliatsaras 140956 */ /* */ /**************************************************************/ #include "line.h" #include "parser.h" #define BUFLEN 256 static char buffer [BUFLEN], *res, **p; static struct kommando *struc, *cmd; static int input () { printf ("\\__testparse->"); res = readline (buffer, BUFLEN); printf ("%s\n", res); return (res ? 1 : 0); } main() { while (input()) { for (cmd = struc = parseline (buffer); cmd ; cmd = cmd -> next) { printf ("->\nnum_tok1 = %d\n", cmd -> num_tok1); if (cmd -> num_tok1) { printf ("token_1 = "); for (p = cmd -> token_1; *p; ++p) printf ("\"%s\"%c", *p, p[1] ? ',' : '\n'); } if (cmd -> inp_tok) printf ("inp_tok = \"%s\"\n", cmd -> inp_tok); if (cmd -> is_pipe) { printf ("is_pipe\nnum_tok2 = %d\ntoken_2 = ", cmd -> num_tok2); for (p = cmd -> token_2; *p; ++p) printf ("\"%s\"%c", *p, p[1] ? ',' : '\n'); } if (cmd -> out_tok) printf ("out_tok = \"%s\"\n", cmd -> out_tok); if (cmd -> is_ampersand) printf ("is_ampersand\n"); } forget (struc); } }