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