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