|
|
1.1 root 1: /* parse_args - parse arguments to uucheck.
2: * Possible arguments are:
3: * -s or -silent no output
4: * -v or -verbose verbose output
5: * -f or -fix fix as much as possible, must be root to use
6: */
7:
8: #include "uucheck.h"
9:
10: void
11: parse_args(argc, argv)
12: int argc;
13: char *argv[];
14: {
15: int i;
16:
17: silent = FALSE; /* Generate no output if set. Overrides verbose. */
18: verbose = FALSE; /* Generate verbose output if set. */
19: reallyverbose = FALSE; /* Generate really verbose output if set. */
20: fix = FALSE; /* Attempt to fix problems if set. */
21:
22: do_sitename = TRUE;
23: do_lockfiles = TRUE;
24: do_fileperms = TRUE;
25: do_devices = TRUE;
26: do_sys = TRUE;
27: do_permissions = TRUE;
28: do_log = TRUE;
29:
30: for (i = 1; i < argc; ++i) {
31: if ( (strcmp(argv[i], "-s") == 0) ||
32: (strcmp(argv[i], "-silent") == 0) ){
33: silent = TRUE;
34: continue;
35: } /* if argv[i] == -silent */
36:
37: if ( (strcmp(argv[i], "-v") == 0) ||
38: (strcmp(argv[i], "-verbose") == 0) ){
39: if(verbose) {
40: reallyverbose = TRUE;
41: } else {
42: verbose = TRUE;
43: } /* if already verbose */
44: continue;
45: } /* if argv[i] == -verbose */
46:
47: if ( (strcmp(argv[i], "-f") == 0) ||
48: (strcmp(argv[i], "-fix") == 0) ){
49: #ifndef DEBUG
50: if(getuid() == 0) {
51: fix = TRUE;
52: } else {
53: fprintf(stderr, "Only root can fix.\n");
54: } /* if I'm root */
55: #else /* DEBUG */
56: fix = TRUE;
57: #endif /* DEBUG */
58: continue;
59: } /* if argv[i] == -fix */
60:
61: fprintf(stderr, USAGE);
62: exit(255);
63: } /* for i = 1 to argc */
64:
65:
66: } /* parse_args() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.