home *** CD-ROM | disk | FTP | other *** search
- /*
- main: main routine for the watcher program.
-
- read from a file describing commands (pipelines) to execute, formats of
- the output, max changes allowed (% or absolute), and max & min
- values for various fields.
- problems noticed are reported.
- as a side effect, be able to pretty print the description file
- (originally use to verify parsing).
-
- format:
- (command)\tformat :
- \tfield\tchange\tmax\tmin
- .
- .
- .
-
- See yacc file for complete grammar description of control file.
-
- outline of program:
- parse control file and build data structures.
- run each pipeline and compare output to previous output (only
- save relevant fields; save directory is either default
- or command line specified; no previous file or format
- changed (ie we are watching different or new fields) we
- create new file and next time we do compare).
- differences that are not allowable are reported.
-
- Usage of program:
- watcher [-p] [-v] [-h histfile] [-f controlfile]
-
- -p : pretty print control file as a verification of parse
- (default no pretty print). This option prevents
- processing of control file.
- -v : be verbose when doing work; useful for debugging.
- -h : file in which to save output for future compare (default
- ./watcher.history).
- -f : controlfile to use (default ./watcherfile or ./Watcherfile).
-
- Note that the basic data structures are all linear linked lists, with
- many items in the list being heads of other lists. When problems
- occur, get out the pencil and paper and start drawing the lists.
-
- Kenneth Ingham
-
- Copyright (C) 1987 The University of New Mexico
- */
-
- #include "defs.h"
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- extern int parse_error;
- extern struct cmd_st *clist;
- extern int pflag;
-
- do_args(argc, argv);
- init();
-
- if (yyparse() == 1 || parse_error) {
- fprintf(stderr, "%s: parse error in control file.\n", NAME);
- exit(1);
- }
-
- if (clist == NULL) {
- fprintf(stderr, "No command list to execute!\n");
- exit(1);
- }
-
- if (pflag)
- pp(clist);
- else {
- read_hist();
- open_hf(); /* for writing our history */
- doit();
- }
- }
-