2 * Copyright (c) 1983 Regents of the University of California.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
14 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
15 * Use is subject to license terms.
21 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/types.h>
35 #include <sys/param.h>
38 #include <netinet/in.h>
41 * The version number should be changed whenever the protocol changes.
45 #define MAILCMD "/usr/lib/sendmail -oi -t"
47 /* defines for yacc */
64 /* lexical definitions */
65 #define QUOTE 0200 /* used internally for quoted characters */
66 #define TRIM 0177 /* Mask to strip quote bit */
71 #define LINESIZE BUFSIZ
81 #define OBITS "\020\1VERIFY\2WHOLE\3YOUNGER\4COMPARE\5REMOVE\6FOLLOW\7IGNLNKS"
83 /* expand type definitions */
89 /* actions for lookup() */
94 #define ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
96 #define ALLOC(x) (struct x *)malloc(sizeof (struct x))
98 struct namelist
{ /* for making lists of strings */
100 struct namelist
*n_next
;
104 short sc_type
; /* type - INSTALL,NOTIFY,EXCEPT,SPECIAL */
107 struct namelist
*sc_args
;
108 struct subcmd
*sc_next
;
112 int c_type
; /* type - ARROW,DCOLON */
113 char *c_name
; /* hostname or time stamp file name */
114 char *c_label
; /* label for partial update */
115 struct namelist
*c_files
;
116 struct subcmd
*c_cmds
;
124 char pathname
[LINESIZE
];
125 char target
[LINESIZE
];
126 struct linkbuf
*nextp
;
129 extern int debug
; /* debugging flag */
130 extern int nflag
; /* NOP flag, don't execute commands */
131 extern int qflag
; /* Quiet. don't print messages */
132 extern int options
; /* global options */
134 extern int nerrs
; /* number of errors seen */
135 extern int rem
; /* remote file descriptor */
136 extern int iamremote
; /* acting as remote server */
137 extern char Tmpfile
[]; /* file name for logging changes */
138 extern struct linkbuf
*ihead
; /* list of files with more than one link */
139 extern struct passwd
*pw
; /* pointer to static area used by getpwent */
140 extern struct group
*gr
; /* pointer to static area used by getgrent */
141 extern char host
[]; /* host name of master copy */
142 extern char buf
[]; /* general purpose buffer */
145 struct namelist
*makenl();
146 struct subcmd
*makesubcmd();
147 struct namelist
*lookup();
148 struct namelist
*expand();