/* * Name: PrintCommand * * Description: Prints a Command structure as returned by parse on stdout. * */ void PrintCommand (int n, Command *cmd) { printf("Parse returned %d:\n", n); printf(" stdin : %s\n", cmd->rstdin ? cmd->rstdin : "<none>" ); printf(" stdout: %s\n", cmd->rstdout ? cmd->rstdout : "<none>" ); printf(" bg : %s\n", cmd->bakground ? "yes" : "no"); PrintPgm(cmd->pgm); }
/* * Name: PrintPgm * * Description: Prints a list of Pgm:s * */ void PrintPgm(Pgm *p) { if (p == NULL) { return; } else { char **pl = p->pgmlist; /* The list is in reversed order so print * it reversed to get right */ PrintPgm(p->next); printf(" ["); while (*pl) { printf("%s ", *pl++); } printf("]\n"); } }