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