Annotation of coherent/d/bin/uucheck/uucheck.h, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: #include <sys/stat.h>
                      3: 
                      4: #ifndef EXTERN
                      5: #      ifdef MAIN
                      6: #              define EXTERN
                      7: #              define EQUALS(v)        = v
                      8: #      else
                      9: #              define EXTERN   extern
                     10: #              define EQUALS(v)
                     11: #      endif
                     12: #endif EXTERN
                     13: 
                     14: #define TRUE   (1==1)
                     15: #define FALSE  (1==2)
                     16: 
                     17: typedef        int boolean;
                     18: 
                     19: #define BIG    1024    /* Max size of a big string.  */
                     20: 
                     21: /* Handy macros.  */
                     22: #define MESSAGE(m)     if(!silent) { printf(m); }
                     23: #define WARNING(m)     warning=TRUE;if (!silent) { printf("Warning: "); printf(m); }
                     24: #define ERROR(m)       error=TRUE;if (!silent) { printf("ERROR: "); printf(m); }
                     25: #define VERBOSE(m)     if (!silent && verbose) { printf(m); }
                     26: #define REALLYVERBOSE(m)       if (!silent && reallyverbose) { printf(m); }
                     27: #define FIX(c)         if (fix) {MESSAGE("Fixing...\n"); c}
                     28: 
                     29: /*
                     30:  * For both RETURN and EXIT, 0 means no error, 1 means warning,
                     31:  * 2 means error detected, 3 means fatal error (cannot recover at all),
                     32:  * and 255 means internal error.
                     33:  * Error codes 3 and 255 are sent immediately to exit.
                     34:  */
                     35: #define RETURN         return(error?2:(warning?1:0))
                     36: #define EXIT   exit(error?2:(warning?1:0))
                     37: #define FATAL(m,d)     fprintf(stderr, "FATAL: ");fprintf(stderr, m, d);exit(3);
                     38: #define CHECK_RETURN(c)        switch (c) {  case 0: break; case 1: warning=TRUE; break; case 2: error=TRUE; break; default: FATAL("uucheck: Invalid return value in %s\n", #c); }
                     39: 
                     40: #define USAGE "uucheck: usage: uucheck [-s[ilent]] [-v[erbose]] [-f[ix]]\n"
                     41: 
                     42: /* Constants */
                     43: #define NAMEFILE "/etc/uucpname"   /* Where to find the official site name.  */
                     44: #define MAX_NAME       14      /* 14 characters is maximum length for a uucp sitename.*/
                     45: #define MAX_UNIQUE     7       /* Name must be unique within first 7 characters.  */
                     46: #define LIB    "/usr/lib/uucp" /* Most non-spool uucp files live here.  */
                     47: #define BIN    "/usr/bin"      /* Where to find the rest of the uucp executables. */
                     48: #define SPOOL  "/usr/spool/uucp" /* All uucp spool files live under this directory. */
                     49: 
                     50: #define TMP_FILE       "/tmp/uuckXXXXXX"       /* Temp file for general use.  */
                     51: #define CONTROL_FILES  "L-devices L.sys Permissions"
                     52: #define LDEV           "L-devices"
                     53: #define LSYS           "L.sys"
                     54: #define PERMISSIONS    "Permissions"
                     55: #define PASSWD "/etc/passwd"
                     56: 
                     57: /* File permissions stuff.  */
                     58: 
                     59: /* Standard minimal mode is normal file, readable by owner.  */
                     60: #define MODE_READABLE  S_IFREG|S_IREAD
                     61: 
                     62: struct filestruct {
                     63:        char *name;
                     64:        char *uid;
                     65:        char *gid;
                     66:        int mode;
                     67: };
                     68: 
                     69: 
                     70: /* Flags to activate different portions of the test system.  */
                     71: EXTERN boolean do_sitename;
                     72: EXTERN boolean do_lockfiles;
                     73: EXTERN boolean do_fileperms;
                     74: EXTERN boolean do_devices;
                     75: EXTERN boolean do_sys;
                     76: EXTERN boolean do_permissions;
                     77: EXTERN boolean do_log;
                     78: 
                     79: /* Error condition flags.  */
                     80: EXTERN boolean warning;
                     81: EXTERN boolean error;
                     82: 
                     83: /* Mode flags set by command line arguments.  */
                     84: EXTERN boolean silent; /* Generate no output if set.  Overrides verbose.  */
                     85: EXTERN boolean verbose; /* Generate verbose output if set.  */
                     86:                /* Verbose output generally includes recommended fixes.  */
                     87: EXTERN boolean reallyverbose; /* Generate really verbose output if set.  */
                     88:                /* Really verbose output tells what is being checked.  */
                     89: EXTERN boolean fix;    /* Attempt to fix problems if set.  */
                     90: 
                     91: EXTERN char bigbuf[BIG];
                     92: EXTERN char command[BIG];
                     93: 
                     94: /* Function declarations.  */
                     95: void parse_args();
                     96: int chk_sitename();
                     97: int chk_lockfiles();
                     98: int chk_fileperms();
                     99: int chk_Ldevices();
                    100: int chk_Lsys();
                    101: int chk_Permissions();
                    102: int chk_Log();
                    103: int statfile();
                    104: int createfile();

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.