home *** CD-ROM | disk | FTP | other *** search
- /*
- doit: here is where the real purpose of the program is actually
- carried out.
-
- for each command, run it and look for problems.
- write results from this run back out.
-
- need to change from popen to ps_open.
-
- Kenneth Ingham
-
- Copyright (C) 1987 The University of New Mexico
- */
-
- #include "defs.h"
-
- doit()
- {
- extern struct cmd_st *clist;
- extern int vflag;
- extern int cmd_ok;
- extern FILE *hf;
-
- char line[MAX_STR];
- struct cmd_st *p;
- struct old_cmd_st *prev_results, *find_prev_cmd();
- FILE *ps, *popen();
-
- /* run commands */
- for (p=clist; p != NULL; p=p->next) {
- cmd_ok = True;
- if (vflag)
- printf("Executing: '%s'\n\n", p->pipeline);
- if (p->key.rel_fmt != NULL)
- fprintf(hf, "%s\n", p->pipeline);
- /* get prev results for comparison */
- prev_results = find_prev_cmd(p->pipeline);
- ps = popen(p->pipeline, "r");
- while (fgets(line, MAX_STR, ps) != NULL) {
- line[strlen(line)-1] = '\0';
- if (vflag)
- printf(" Read: '%s'\n",line);
- checkline(p, line, prev_results);
- }
- if (!cmd_ok)
- printf("\n");
- }
- }
-