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