Try to fix SIGIO problem with Sun machines, h_errno with
[unix-history] / usr / src / usr.bin / rdist / defs.h
CommitLineData
7172eb74
DF
1/*
2 * Copyright (c) 1983 Regents of the University of California.
0718fb71 3 * All rights reserved.
7172eb74 4 *
0718fb71 5 * Redistribution and use in source and binary forms are permitted
b36fc510
KB
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.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
0718fb71 16 *
b36fc510 17 * @(#)defs.h 5.4 (Berkeley) %G%
7172eb74 18 */
ca9611a8
RC
19
20#include <stdio.h>
21#include <ctype.h>
22#include <errno.h>
23#include <pwd.h>
24#include <grp.h>
55669d5b 25#include <sys/param.h>
ca9611a8
RC
26#include <sys/dir.h>
27#include <sys/stat.h>
28#include <sys/time.h>
29#include <netinet/in.h>
30
9b81f83a 31/*
0fccdfef 32 * The version number should be changed whenever the protocol changes.
9b81f83a 33 */
a3e6fd64 34#define VERSION 3
9b81f83a
RC
35
36#define MAILCMD "/usr/lib/sendmail -oi -t"
ca9611a8
RC
37
38 /* defines for yacc */
d1dee8e8
RC
39#define EQUAL 1
40#define LP 2
41#define RP 3
42#define SM 4
43#define ARROW 5
86d7a5c5
RC
44#define COLON 6
45#define DCOLON 7
46#define NAME 8
47#define STRING 9
48#define INSTALL 10
49#define NOTIFY 11
50#define EXCEPT 12
4085f36f
RC
51#define PATTERN 13
52#define SPECIAL 14
53#define OPTION 15
82572cb6
RC
54
55 /* lexical definitions */
56#define QUOTE 0200 /* used internally for quoted characters */
57#define TRIM 0177 /* Mask to strip quote bit */
ca9611a8
RC
58
59 /* table sizes */
d1dee8e8
RC
60#define HASHSIZE 1021
61#define INMAX 3500
82572cb6 62
3024eb6f 63 /* option flags */
d1dee8e8
RC
64#define VERIFY 0x1
65#define WHOLE 0x2
66#define YOUNGER 0x4
024fde5b 67#define COMPARE 0x8
e8109cf8 68#define REMOVE 0x10
a3e6fd64
RC
69#define FOLLOW 0x20
70#define IGNLNKS 0x40
d1dee8e8 71
d6bccb44
RC
72 /* expand type definitions */
73#define E_VARS 0x1
74#define E_SHELL 0x2
75#define E_TILDE 0x4
76#define E_ALL 0x7
77
0fccdfef
RC
78 /* actions for lookup() */
79#define LOOKUP 0
80#define INSERT 1
81#define REPLACE 2
82
d1dee8e8 83#define ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
ca9611a8
RC
84
85#define ALLOC(x) (struct x *) malloc(sizeof(struct x))
86
0fccdfef
RC
87struct namelist { /* for making lists of strings */
88 char *n_name;
89 struct namelist *n_next;
90};
91
92struct subcmd {
93 short sc_type; /* type - INSTALL,NOTIFY,EXCEPT,SPECIAL */
94 short sc_options;
95 char *sc_name;
96 struct namelist *sc_args;
97 struct subcmd *sc_next;
ca9611a8
RC
98};
99
0fccdfef
RC
100struct cmd {
101 int c_type; /* type - ARROW,DCOLON */
102 char *c_name; /* hostname or time stamp file name */
86d7a5c5 103 char *c_label; /* label for partial update */
0fccdfef
RC
104 struct namelist *c_files;
105 struct subcmd *c_cmds;
106 struct cmd *c_next;
107};
a3e6fd64
RC
108
109struct linkbuf {
110 ino_t inum;
111 dev_t devnum;
112 int count;
113 char pathname[BUFSIZ];
ac288309 114 char target[BUFSIZ];
a3e6fd64
RC
115 struct linkbuf *nextp;
116};
117
ca9611a8
RC
118extern int debug; /* debugging flag */
119extern int nflag; /* NOP flag, don't execute commands */
120extern int qflag; /* Quiet. don't print messages */
f7770429 121extern int options; /* global options */
ca9611a8 122
0fccdfef 123extern int nerrs; /* number of errors seen */
ca9611a8
RC
124extern int rem; /* remote file descriptor */
125extern int iamremote; /* acting as remote server */
82572cb6 126extern char tmpfile[]; /* file name for logging changes */
a3e6fd64 127extern struct linkbuf *ihead; /* list of files with more than one link */
e8109cf8
RC
128extern struct passwd *pw; /* pointer to static area used by getpwent */
129extern struct group *gr; /* pointer to static area used by getgrent */
ca9611a8 130extern char host[]; /* host name of master copy */
ca9611a8
RC
131extern char buf[]; /* general purpose buffer */
132extern int errno; /* system error number */
133extern char *sys_errlist[];
134
0fccdfef
RC
135char *makestr();
136struct namelist *makenl();
137struct subcmd *makesubcmd();
138struct namelist *lookup();
139struct namelist *expand();
d6bccb44 140char *exptilde();
3024eb6f 141char *malloc();
ca9611a8 142char *rindex();
82572cb6 143char *index();