1 /* defs.h 4.15 85/02/04 */ 2 3 #include <stdio.h> 4 #include <ctype.h> 5 #include <errno.h> 6 #include <pwd.h> 7 #include <grp.h> 8 #include <sys/param.h> 9 #include <sys/dir.h> 10 #include <sys/stat.h> 11 #include <sys/time.h> 12 #include <netinet/in.h> 13 14 /* 15 * The version number should be changed whenever the protocol changes. 16 */ 17 #define VERSION 3 18 19 #define MAILCMD "/usr/lib/sendmail -oi -t" 20 21 /* defines for yacc */ 22 #define EQUAL 1 23 #define LP 2 24 #define RP 3 25 #define SM 4 26 #define ARROW 5 27 #define COLON 6 28 #define DCOLON 7 29 #define NAME 8 30 #define STRING 9 31 #define INSTALL 10 32 #define NOTIFY 11 33 #define EXCEPT 12 34 #define PATTERN 13 35 #define SPECIAL 14 36 #define OPTION 15 37 38 /* lexical definitions */ 39 #define QUOTE 0200 /* used internally for quoted characters */ 40 #define TRIM 0177 /* Mask to strip quote bit */ 41 42 /* table sizes */ 43 #define HASHSIZE 1021 44 #define INMAX 3500 45 46 /* option flags */ 47 #define VERIFY 0x1 48 #define WHOLE 0x2 49 #define YOUNGER 0x4 50 #define COMPARE 0x8 51 #define REMOVE 0x10 52 #define FOLLOW 0x20 53 #define IGNLNKS 0x40 54 55 /* expand type definitions */ 56 #define E_VARS 0x1 57 #define E_SHELL 0x2 58 #define E_TILDE 0x4 59 #define E_ALL 0x7 60 61 /* actions for lookup() */ 62 #define LOOKUP 0 63 #define INSERT 1 64 #define REPLACE 2 65 66 #define ISDIR(m) (((m) & S_IFMT) == S_IFDIR) 67 68 #define ALLOC(x) (struct x *) malloc(sizeof(struct x)) 69 70 struct namelist { /* for making lists of strings */ 71 char *n_name; 72 struct namelist *n_next; 73 }; 74 75 struct subcmd { 76 short sc_type; /* type - INSTALL,NOTIFY,EXCEPT,SPECIAL */ 77 short sc_options; 78 char *sc_name; 79 struct namelist *sc_args; 80 struct subcmd *sc_next; 81 }; 82 83 struct cmd { 84 int c_type; /* type - ARROW,DCOLON */ 85 char *c_name; /* hostname or time stamp file name */ 86 char *c_label; /* label for partial update */ 87 struct namelist *c_files; 88 struct subcmd *c_cmds; 89 struct cmd *c_next; 90 }; 91 92 struct linkbuf { 93 ino_t inum; 94 dev_t devnum; 95 int count; 96 char pathname[BUFSIZ]; 97 struct linkbuf *nextp; 98 }; 99 100 extern int debug; /* debugging flag */ 101 extern int nflag; /* NOP flag, don't execute commands */ 102 extern int qflag; /* Quiet. don't print messages */ 103 extern int options; /* global options */ 104 105 extern int nerrs; /* number of errors seen */ 106 extern int rem; /* remote file descriptor */ 107 extern int iamremote; /* acting as remote server */ 108 extern char tmpfile[]; /* file name for logging changes */ 109 extern struct linkbuf *ihead; /* list of files with more than one link */ 110 extern struct passwd *pw; /* pointer to static area used by getpwent */ 111 extern struct group *gr; /* pointer to static area used by getgrent */ 112 extern char host[]; /* host name of master copy */ 113 extern char buf[]; /* general purpose buffer */ 114 extern int errno; /* system error number */ 115 extern char *sys_errlist[]; 116 117 char *makestr(); 118 struct namelist *makenl(); 119 struct subcmd *makesubcmd(); 120 struct namelist *lookup(); 121 struct namelist *expand(); 122 char *exptilde(); 123 char *malloc(); 124 char *rindex(); 125 char *index(); 126