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