1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
2: /* $Header: par.h,v 1.1 84/07/04 17:57:16 timo Exp $ */
3:
4: #include <stdio.h>
5: #define EQ ==
6: #define NE !=
7: #define EOS '\0'
8: #define ERR (-1)
9:
10: #ifdef MFILE
11: #define MDOTS "... "
12: #else
13: #define MDOTS ""
14: #endif
15:
16: #define ERM {fprintf(stderr, "%s: ", pname); fprintf(stderr,
17: #define MRE ); exit(ERR); }
18:
19: #ifdef lint
20: int __void__; /* to tell `lint' not to care */
21: #define VOID(x) (__void__ = (int)(x))
22: #else lint
23: #define VOID(x) (x)
24: #endif lint
25:
26: FILE *ifile; /* input file */
27: char *iname; /* input name */
28: char *pname; /* program name */
29:
30: main(pargc, pargv) char *pargv[]; {
31: register int argc;
32: register char **argv;
33:
34: pname = pargv[0];
35: argc = pargc-1;
36: argv = pargv+1;
37: while (argc > 0 && argv[0][0] EQ '-' && argv[0][1] NE EOS) {
38: #ifdef OPTIONS
39: register int nop = options(argc, argv);
40: if (nop EQ ERR)
41: ERM "options are [%s] [ file %s]\n",
42: OPTIONS, MDOTS
43: MRE
44: argc -= nop;
45: argv += nop;
46: #else
47: ERM "parameters are [ file %s]\n", MDOTS MRE
48: #endif
49: }
50: #ifndef MFILE
51: if (argc > 1)
52: ERM "arg count\n" MRE
53: #endif
54: do {
55: if (argc EQ 0 || (argv[0][0] EQ '-' && argv[0][1] EQ EOS)) {
56: iname = "standard input";
57: ifile = stdin;
58: }
59: else {
60: iname = *argv;
61: ifile = fopen(iname, "r");
62: #ifndef MFILE
63: if (ifile EQ NULL)
64: ERM "cannot open %s\n", iname MRE
65: #endif
66: }
67: process();
68: if (ifile NE NULL && ifile NE stdin)
69: VOID(fclose(ifile));
70: } while (++argv, --argc > 0);
71: exit(0);
72: }
Defined functions
main
defined in line
30;
never used
Defined variables
iname
defined in line
27; used 4 times
pname
defined in line
28; used 2 times
Defined macros
EOS
defined in line
7; used 2 times
EQ
defined in line
5; used 10 times
ERM
defined in line
16; used 4 times
ERR
defined in line
8; used 4 times
MDOTS
defined in line
13; used 2 times
MRE
defined in line
17; used 4 times
NE
defined in line
6; used 4 times
VOID
defined in line
23; used 2 times
Usage of this include