uucp.h (7c478bd9) uucp.h (61961e0f)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 5 unchanged lines hidden (view full) ---

14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

--- 5 unchanged lines hidden (view full) ---

14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22
22/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23/* All Rights Reserved */
24/* All Rights Reserved */
24
25
25
26/*
26/*
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
27 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
29 */
30
28 * Use is subject to license terms.
29 */
30
31#pragma ident "%Z%%M% %I% %E% SMI"
32
33#ifndef _UUCP_H
31#ifndef _UUCP_H
34#define _UUCP_H
32#define _UUCP_H
35
33
36#if !defined(__STDC__)
37#define const /* XXX - what a hack */
38#endif
34#pragma ident "%Z%%M% %I% %E% SMI"
39
40#include <sys/types.h>
41#include <unistd.h>
42#include <stdlib.h>
43#include <string.h>
35
36#include <sys/types.h>
37#include <unistd.h>
38#include <stdlib.h>
39#include <string.h>
44#include "parms.h"
40#include <parms.h>
45
41
46#ifdef DIAL
47#define EXTERN static
48#define GLOBAL static
49#else
50#define EXTERN extern
51#define GLOBAL
52#endif
53
54#ifdef BSD4_2
55#define V7
56#undef NONAP
57#undef FASTTIMER
58#endif /* BSD4_2 */
59
60#ifdef FASTTIMER
61#undef NONAP
62#endif
63
64#ifdef V8
65#define V7
66#endif /* V8 */
67
68#include <stdio.h>
69#include <ctype.h>
70#include <setjmp.h>
71#include <sys/param.h>
42#include <stdio.h>
43#include <ctype.h>
44#include <setjmp.h>
45#include <sys/param.h>
72
73/*
74 * param.h includes types.h and signal.h in 4bsd
75 */
76#ifdef V7
77#include <sgtty.h>
78#include <sys/timeb.h>
79#else /* !V7 */
80#include <termio.h>
46#include <termio.h>
81#include <sys/types.h>
82#include <signal.h>
83#include <fcntl.h>
47#include <signal.h>
48#include <fcntl.h>
84#endif
85
86#include <sys/stat.h>
87#include <utime.h>
88#include <dirent.h>
49#include <sys/stat.h>
50#include <utime.h>
51#include <dirent.h>
89
90#ifdef BSD4_2
91#include <sys/time.h>
92#else /* !BSD4_2 */
93#include <time.h>
52#include <time.h>
94#endif
95
96#include <sys/times.h>
97#include <errno.h>
53#include <sys/times.h>
54#include <errno.h>
98
99#ifdef ATTSV
100#include <sys/mkdev.h>
55#include <sys/mkdev.h>
101#endif /* ATTSV */
56#include <strings.h>
57#include <ulimit.h>
58#include <sys/utsname.h>
59#include <ustat.h>
102
60
103#ifdef RT
104#include "rt/types.h"
105#include "rt/unix/param.h"
106#include "rt/stat.h"
107#include <sys/ustat.h>
108#endif /* RT */
61#ifdef __cplusplus
62extern "C" {
63#endif
109
110/* what mode should user files be allowed to have upon creation? */
111/* NOTE: This does not allow setuid or execute bits on transfer. */
64
65/* what mode should user files be allowed to have upon creation? */
66/* NOTE: This does not allow setuid or execute bits on transfer. */
112#define LEGALMODE (mode_t) 0666
67#define LEGALMODE (mode_t)0666
113
114/* what mode should public files have upon creation? */
68
69/* what mode should public files have upon creation? */
115#define PUB_FILEMODE (mode_t) 0666
70#define PUB_FILEMODE (mode_t)0666
116
117/* what mode should log files have upon creation? */
71
72/* what mode should log files have upon creation? */
118#define LOGFILEMODE (mode_t) 0644
73#define LOGFILEMODE (mode_t)0644
119
120/* what mode should C. files have upon creation? */
74
75/* what mode should C. files have upon creation? */
121#define CFILEMODE (mode_t) 0644
76#define CFILEMODE (mode_t)0644
122
123/* what mode should D. files have upon creation? */
77
78/* what mode should D. files have upon creation? */
124#define DFILEMODE (mode_t) 0600
79#define DFILEMODE (mode_t)0600
125
126/* define the value of PUBMASK, used for creating "public" directories */
80
81/* define the value of PUBMASK, used for creating "public" directories */
127#define PUBMASK (mode_t) 0000
82#define PUBMASK (mode_t)0000
128
129/* what mode should public directories have upon creation? */
83
84/* what mode should public directories have upon creation? */
130#define PUB_DIRMODE (mode_t) 0777
85#define PUB_DIRMODE (mode_t)0777
131
132/* define the value of DIRMASK, used for creating "system" subdirectories */
86
87/* define the value of DIRMASK, used for creating "system" subdirectories */
133#define DIRMASK (mode_t) 0022
88#define DIRMASK (mode_t)0022
134
89
135#define MAXSTART 300 /* how long to wait on startup */
90#define MAXSTART 300 /* how long to wait on startup */
136
137/* define the last characters for ACU (used for 801/212 dialers) */
91
92/* define the last characters for ACU (used for 801/212 dialers) */
138#define ACULAST "<"
93#define ACULAST "<"
139
94
140/* caution - the fillowing names are also in Makefile
141 * any changes here have to also be made there
95/*
96 * caution - the fillowing names are also in Makefile
97 * any changes here have to also be made there
142 *
143 * it's a good idea to make directories .foo, since this ensures
144 * that they'll be ignored by processes that search subdirectories in SPOOL
145 *
98 *
99 * it's a good idea to make directories .foo, since this ensures
100 * that they'll be ignored by processes that search subdirectories in SPOOL
101 *
146 * XQTDIR=/var/uucp/.Xqtdir
147 * CORRUPT=/var/uucp/.Corrupt
148 * LOGDIR=/var/uucp/.Log
149 * SEQDIR=/var/uucp/.Sequence
150 * STATDIR=/var/uucp/.Status
151 *
102 * XQTDIR = /var/uucp/.Xqtdir
103 * CORRUPT = /var/uucp/.Corrupt
104 * LOGDIR = /var/uucp/.Log
105 * SEQDIR = /var/uucp/.Sequence
106 * STATDIR = /var/uucp/.Status
152 */
153
154/* where to put the STST. files? */
107 */
108
109/* where to put the STST. files? */
155#define STATDIR (const char *)"/var/uucp/.Status"
110#define STATDIR (const char *)"/var/uucp/.Status"
156
157/* where should logfiles be kept? */
111
112/* where should logfiles be kept? */
158#define LOGUUX (const char *)"/var/uucp/.Log/uux"
159#define LOGUUXQT (const char *)"/var/uucp/.Log/uuxqt"
160#define LOGUUCP (const char *)"/var/uucp/.Log/uucp"
161#define LOGCICO (const char *)"/var/uucp/.Log/uucico"
162#define CORRUPTDIR (const char *)"/var/uucp/.Corrupt"
113#define LOGUUX (const char *)"/var/uucp/.Log/uux"
114#define LOGUUXQT (const char *)"/var/uucp/.Log/uuxqt"
115#define LOGUUCP (const char *)"/var/uucp/.Log/uucp"
116#define LOGCICO (const char *)"/var/uucp/.Log/uucico"
117#define CORRUPTDIR (const char *)"/var/uucp/.Corrupt"
163
164/* some sites use /var/uucp/.XQTDIR here */
165/* use caution since things are linked into there */
118
119/* some sites use /var/uucp/.XQTDIR here */
120/* use caution since things are linked into there */
166#define XQTDIR (const char *)"/var/uucp/.Xqtdir"
121#define XQTDIR (const char *)"/var/uucp/.Xqtdir"
167
168/* how much of a system name can we print in a [CX]. file? */
169/* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */
122
123/* how much of a system name can we print in a [CX]. file? */
124/* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */
170#define SYSNSIZE (MAXBASENAME - 7)
125#define SYSNSIZE (MAXBASENAME - 7)
171
172#ifdef USRSPOOLLOCKS
126
127#ifdef USRSPOOLLOCKS
173#define LOCKPRE (const char *)"/var/spool/locks/LCK."
128#define LOCKPRE (const char *)"/var/spool/locks/LCK."
174#else
129#else
175#define LOCKPRE (const char *)"/var/spool/uucp/LCK."
130#define LOCKPRE (const char *)"/var/spool/uucp/LCK."
176#endif /* USRSPOOLLOCKS */
177
131#endif /* USRSPOOLLOCKS */
132
178#define SQFILE (const char *)"/etc/uucp/SQFILE"
179#define SQTMP (const char *)"/etc/uucp/SQTMP"
180#define SLCKTIME 5400 /* system/device timeout (LCK.. files) */
181#define DIALCODES (const char *)"/etc/uucp/Dialcodes"
182#define PERMISSIONS (const char *)"/etc/uucp/Permissions"
133#define SQFILE (const char *)"/etc/uucp/SQFILE"
134#define SQTMP (const char *)"/etc/uucp/SQTMP"
135#define SLCKTIME 5400 /* system/device timeout (LCK.. files) */
136#define DIALCODES (const char *)"/etc/uucp/Dialcodes"
137#define PERMISSIONS (const char *)"/etc/uucp/Permissions"
183
138
184#define SPOOL (const char *)"/var/spool/uucp"
185#define SEQDIR (const char *)"/var/uucp/.Sequence"
139#define SPOOL (const char *)"/var/spool/uucp"
140#define SEQDIR (const char *)"/var/uucp/.Sequence"
186
141
187#define X_LOCKTIME 3600
142#define X_LOCKTIME 3600
188#ifdef USRSPOOLLOCKS
143#ifdef USRSPOOLLOCKS
189#define SEQLOCK (const char *)"/var/spool/locks/LCK.SQ."
190#define SQLOCK (const char *)"/var/spool/locks/LCK.SQ"
191#define X_LOCK (const char *)"/var/spool/locks/LCK.X"
192#define S_LOCK (const char *)"/var/spool/locks/LCK.S"
193#define L_LOCK (const char *)"/var/spool/locks/LK"
194#define X_LOCKDIR (const char *)"/var/spool/locks" /* must be dir part of above */
144#define SEQLOCK (const char *)"/var/spool/locks/LCK.SQ."
145#define SQLOCK (const char *)"/var/spool/locks/LCK.SQ"
146#define X_LOCK (const char *)"/var/spool/locks/LCK.X"
147#define S_LOCK (const char *)"/var/spool/locks/LCK.S"
148#define L_LOCK (const char *)"/var/spool/locks/LK"
149#define X_LOCKDIR (const char *)"/var/spool/locks"
150 /* must be dir part of above */
195#else
151#else
196#define SEQLOCK (const char *)"/var/spool/uucp/LCK.SQ."
197#define SQLOCK (const char *)"/var/spool/uucp/LCK.SQ"
198#define X_LOCK (const char *)"/var/spool/uucp/LCK.X"
199#define S_LOCK (const char *)"/var/spool/uucp/LCK.S"
200#define L_LOCK (const char *)"/var/spool/uucp/LK"
201#define X_LOCKDIR (const char *)"/var/spool/uucp" /* must be dir part of above */
152#define SEQLOCK (const char *)"/var/spool/uucp/LCK.SQ."
153#define SQLOCK (const char *)"/var/spool/uucp/LCK.SQ"
154#define X_LOCK (const char *)"/var/spool/uucp/LCK.X"
155#define S_LOCK (const char *)"/var/spool/uucp/LCK.S"
156#define L_LOCK (const char *)"/var/spool/uucp/LK"
157#define X_LOCKDIR (const char *)"/var/spool/uucp"
158 /* must be dir part of above */
202#endif /* USRSPOOLLOCKS */
159#endif /* USRSPOOLLOCKS */
203#define X_LOCKPRE (const char *)"LCK.X" /* must be last part of above */
160#define X_LOCKPRE (const char *)"LCK.X" /* must be last part of above */
204
161
205#define PUBDIR (const char *)"/var/spool/uucppublic"
206#define ADMIN (const char *)"/var/uucp/.Admin"
207#define ERRLOG (const char *)"/var/uucp/.Admin/errors"
208#define SYSLOG (const char *)"/var/uucp/.Admin/xferstats"
209#define RMTDEBUG (const char *)"/var/uucp/.Admin/audit"
210#define CLEANUPLOGFILE (const char *)"/var/uucp/.Admin/uucleanup"
211#define CMDLOG (const char *)"/var/uucp/.Admin/command"
212#define PERFLOG (const char *)"/var/uucp/.Admin/perflog"
213#define ACCOUNT (const char *)"/var/uucp/.Admin/account"
214#define SECURITY (const char *)"/var/uucp/.Admin/security"
162#define PUBDIR (const char *)"/var/spool/uucppublic"
163#define ADMIN (const char *)"/var/uucp/.Admin"
164#define ERRLOG (const char *)"/var/uucp/.Admin/errors"
165#define SYSLOG (const char *)"/var/uucp/.Admin/xferstats"
166#define RMTDEBUG (const char *)"/var/uucp/.Admin/audit"
167#define CLEANUPLOGFILE (const char *)"/var/uucp/.Admin/uucleanup"
168#define CMDLOG (const char *)"/var/uucp/.Admin/command"
169#define PERFLOG (const char *)"/var/uucp/.Admin/perflog"
170#define ACCOUNT (const char *)"/var/uucp/.Admin/account"
171#define SECURITY (const char *)"/var/uucp/.Admin/security"
215
216#define WORKSPACE (const char *)"/var/uucp/.Workspace"
217
172
173#define WORKSPACE (const char *)"/var/uucp/.Workspace"
174
218#define SQTIME 60
219#define TRYCALLS 2 /* number of tries to dial call */
220#define MINULIMIT (1L<<11) /* minimum reasonable ulimit */
175#define SQTIME 60
176#define TRYCALLS 2 /* number of tries to dial call */
177#define MINULIMIT (1L<<11) /* minimum reasonable ulimit */
221#define MAX_LOCKTRY 5 /* number of attempts to lock device */
222
223/*
178#define MAX_LOCKTRY 5 /* number of attempts to lock device */
179
180/*
224 * CDEBUG is for communication line debugging
225 * DEBUG is for program debugging
181 * CDEBUG is for communication line debugging
182 * DEBUG is for program debugging
226 * #define SMALL to compile without the DEBUG code
227 */
228
183 * #define SMALL to compile without the DEBUG code
184 */
185
229#ifndef DIAL
230#define CDEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
231#else
232#define CDEBUG(l, f, s)
233#define SMALL
234#endif
186#define CDEBUG(l, f, s)
187#define SMALL
235
236#ifndef SMALL
188
189#ifndef SMALL
237#define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
190#define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
238#else
191#else
239#define DEBUG(l, f, s)
192#define DEBUG(l, f, s)
240#endif /* SMALL */
241
242/*
243 * VERBOSE is used by cu and ct to inform the user of progress
244 * In other programs, the Value of Verbose is always 0.
245 */
193#endif /* SMALL */
194
195/*
196 * VERBOSE is used by cu and ct to inform the user of progress
197 * In other programs, the Value of Verbose is always 0.
198 */
246#define VERBOSE(f, s) { if (Verbose > 0) fprintf(stderr, f, s); }
199#define VERBOSE(f, s) { if (Verbose > 0) (void) fprintf(stderr, f, s); }
247
200
248#define PREFIX(pre, str) (strncmp((pre), (str), strlen(pre)) == SAME)
249#define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
250#define EQUALS(a,b) ((a != CNULL) && (b != CNULL) && (strcmp((a),(b))==SAME))
251#define EQUALSN(a,b,n) ((a != CNULL) && (b != CNULL) && (strncmp((a),(b),(n))==SAME))
252#define LASTCHAR(s) (s+strlen(s)-1)
201#define PREFIX(pre, str) (strncmp((pre), (str), strlen(pre)) == SAME)
202#define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
203#define EQUALS(a, b) ((a != CNULL) && (b != CNULL) && \
204 (strcmp((a), (b)) == SAME))
205#define EQUALSN(a, b, n) ((a != CNULL) && (b != CNULL) && \
206 (strncmp((a), (b), (n)) == SAME))
207#define LASTCHAR(s) (s+strlen(s)-1)
253
208
254#define SAME 0
255#define ANYREAD 04
256#define ANYWRITE 02
257#define FAIL -1
258#define SUCCESS 0
259#define NULLCHAR '\0'
260#define CNULL (char *) 0
261#define STBNULL (struct sgttyb *) 0
262#define MASTER 1
263#define SLAVE 0
264#define MAXBASENAME 14 /* should be DIRSIZ but that is now fs dependent */
265#define MAXFULLNAME BUFSIZ
266#define MAXNAMESIZE 64 /* /var/spool/uucp/<14 chars>/<14 chars>+slop */
267#define CONNECTTIME 30
268#define EXPECTTIME 45
269#define MSGTIME 60
270#define NAMESIZE MAXBASENAME+1
209#define SAME 0
210#define ANYREAD 04
211#define ANYWRITE 02
212#define FAIL -1
213#define SUCCESS 0
214#define NULLCHAR '\0'
215#define CNULL (char *)0
216#define STBNULL (struct sgttyb *)0
217#define MASTER 1
218#define SLAVE 0
219#define MAXBASENAME 14 /* should be DIRSIZ but that is now fs dependent */
220#define MAXFULLNAME BUFSIZ
221#define MAXNAMESIZE 64 /* /var/spool/uucp/<14 chars>/<14 chars>+slop */
222#define CONNECTTIME 30
223#define EXPECTTIME 45
224#define MSGTIME 60
225#define NAMESIZE MAXBASENAME+1
271#define SIZEOFPID 10 /* maximum number of digits in a pid */
226#define SIZEOFPID 10 /* maximum number of digits in a pid */
272#define EOTMSG "\004\n\004\n"
273#define CALLBACK 1
227#define EOTMSG "\004\n\004\n"
228#define CALLBACK 1
274
275/* manifests for sysfiles.c's sysaccess() */
276/* check file access for REAL user id */
277#define ACCESS_SYSTEMS 1
278#define ACCESS_DEVICES 2
279#define ACCESS_DIALERS 3
280/* check file access for EFFECTIVE user id */
281#define EACCESS_SYSTEMS 4
282#define EACCESS_DEVICES 5
283#define EACCESS_DIALERS 6
284
285/* manifest for chkpth flag */
229
230/* manifests for sysfiles.c's sysaccess() */
231/* check file access for REAL user id */
232#define ACCESS_SYSTEMS 1
233#define ACCESS_DEVICES 2
234#define ACCESS_DIALERS 3
235/* check file access for EFFECTIVE user id */
236#define EACCESS_SYSTEMS 4
237#define EACCESS_DEVICES 5
238#define EACCESS_DIALERS 6
239
240/* manifest for chkpth flag */
286#define CK_READ 0
287#define CK_WRITE 1
241#define CK_READ 0
242#define CK_WRITE 1
288
289/*
290 * commands
291 */
243
244/*
245 * commands
246 */
292#define SHELL (const char *)"/usr/bin/sh"
293#define MAIL (const char *)"mail"
294#define UUCICO (const char *)"/usr/lib/uucp/uucico"
295#define UUXQT (const char *)"/usr/lib/uucp/uuxqt"
296#define UUX (const char *)"/usr/bin/uux"
297#define UUCP (const char *)"/usr/bin/uucp"
247#define SHELL (const char *)"/usr/bin/sh"
248#define MAIL (const char *)"mail"
249#define UUCICO (const char *)"/usr/lib/uucp/uucico"
250#define UUXQT (const char *)"/usr/lib/uucp/uuxqt"
251#define UUX (const char *)"/usr/bin/uux"
252#define UUCP (const char *)"/usr/bin/uucp"
298
299
300/* system status stuff */
253
254
255/* system status stuff */
301#define SS_OK 0
302#define SS_NO_DEVICE 1
303#define SS_TIME_WRONG 2
304#define SS_INPROGRESS 3
305#define SS_CONVERSATION 4
306#define SS_SEQBAD 5
307#define SS_LOGIN_FAILED 6
308#define SS_DIAL_FAILED 7
309#define SS_BAD_LOG_MCH 8
310#define SS_LOCKED_DEVICE 9
311#define SS_ASSERT_ERROR 10
312#define SS_BADSYSTEM 11
313#define SS_CANT_ACCESS_DEVICE 12
314#define SS_DEVICE_FAILED 13 /* used for interface failure */
315#define SS_WRONG_MCH 14
316#define SS_CALLBACK 15
317#define SS_RLOCKED 16
318#define SS_RUNKNOWN 17
319#define SS_RLOGIN 18
320#define SS_UNKNOWN_RESPONSE 19
321#define SS_STARTUP 20
322#define SS_CHAT_FAILED 21
323#define SS_CALLBACK_LOOP 22
256#define SS_OK 0
257#define SS_NO_DEVICE 1
258#define SS_TIME_WRONG 2
259#define SS_INPROGRESS 3
260#define SS_CONVERSATION 4
261#define SS_SEQBAD 5
262#define SS_LOGIN_FAILED 6
263#define SS_DIAL_FAILED 7
264#define SS_BAD_LOG_MCH 8
265#define SS_LOCKED_DEVICE 9
266#define SS_ASSERT_ERROR 10
267#define SS_BADSYSTEM 11
268#define SS_CANT_ACCESS_DEVICE 12
269#define SS_DEVICE_FAILED 13 /* used for interface failure */
270#define SS_WRONG_MCH 14
271#define SS_CALLBACK 15
272#define SS_RLOCKED 16
273#define SS_RUNKNOWN 17
274#define SS_RLOGIN 18
275#define SS_UNKNOWN_RESPONSE 19
276#define SS_STARTUP 20
277#define SS_CHAT_FAILED 21
278#define SS_CALLBACK_LOOP 22
324
279
325#define MAXPH 60 /* maximum phone string size */
280#define MAXPH 60 /* maximum phone string size */
326#define MAXC BUFSIZ
327
328#define TRUE 1
329#define FALSE 0
281#define MAXC BUFSIZ
282
283#define TRUE 1
284#define FALSE 0
330#define NAMEBUF 32
285#define NAMEBUF 32
331
332/* The call structure is used by ct.c, cu.c, and dial.c. */
333
334struct call {
335 char *speed; /* transmission baud rate */
336 char *line; /* device name for outgoing line */
337 char *telno; /* ptr to tel-no digit string */
338 char *type; /* type of device to use for call. */
339};
340
341/* structure of an Systems file line */
286
287/* The call structure is used by ct.c, cu.c, and dial.c. */
288
289struct call {
290 char *speed; /* transmission baud rate */
291 char *line; /* device name for outgoing line */
292 char *telno; /* ptr to tel-no digit string */
293 char *type; /* type of device to use for call. */
294};
295
296/* structure of an Systems file line */
342#define F_MAX 50 /* max number of fields in Systems file line */
343#define F_NAME 0
344#define F_TIME 1
345#define F_TYPE 2
346#define F_CLASS 3 /* an optional prefix and the speed */
347#define F_PHONE 4
348#define F_LOGIN 5
297#define F_MAX 50 /* max number of fields in Systems file line */
298#define F_NAME 0
299#define F_TIME 1
300#define F_TYPE 2
301#define F_CLASS 3 /* an optional prefix and the speed */
302#define F_PHONE 4
303#define F_LOGIN 5
349
350/* structure of an Devices file line */
304
305/* structure of an Devices file line */
351#define D_TYPE 0
352#define D_LINE 1
353#define D_CALLDEV 2
354#define D_CLASS 3
355#define D_CALLER 4
356#define D_ARG 5
357#define D_MAX 50 /* max number of fields in Devices file line */
306#define D_TYPE 0
307#define D_LINE 1
308#define D_CALLDEV 2
309#define D_CLASS 3
310#define D_CALLER 4
311#define D_ARG 5
312#define D_MAX 50 /* max number of fields in Devices file line */
358
313
359#define D_ACU 1
360#define D_DIRECT 2
361#define D_PROT 4
314#define D_ACU 1
315#define D_DIRECT 2
316#define D_PROT 4
362
317
363#define GRADES "/etc/uucp/Grades"
318#define GRADES "/etc/uucp/Grades"
364
365#define D_QUEUE 'Z' /* default queue */
366
367/* past here, local changes are not recommended */
319
320#define D_QUEUE 'Z' /* default queue */
321
322/* past here, local changes are not recommended */
368#define CMDPRE 'C'
369#define DATAPRE 'D'
370#define XQTPRE 'X'
323#define CMDPRE 'C'
324#define DATAPRE 'D'
325#define XQTPRE 'X'
371
372/*
373 * stuff for command execution
374 */
326
327/*
328 * stuff for command execution
329 */
375#define X_RQDFILE 'F'
376#define X_STDIN 'I'
377#define X_STDOUT 'O'
378#define X_STDERR 'E'
379#define X_CMD 'C'
380#define X_USER 'U'
381#define X_BRINGBACK 'B'
382#define X_MAILF 'M'
383#define X_RETADDR 'R'
384#define X_COMMENT '#'
385#define X_NONZERO 'Z'
386#define X_SENDNOTHING 'N'
387#define X_SENDZERO 'n'
330#define X_RQDFILE 'F'
331#define X_STDIN 'I'
332#define X_STDOUT 'O'
333#define X_STDERR 'E'
334#define X_CMD 'C'
335#define X_USER 'U'
336#define X_BRINGBACK 'B'
337#define X_MAILF 'M'
338#define X_RETADDR 'R'
339#define X_COMMENT '#'
340#define X_NONZERO 'Z'
341#define X_SENDNOTHING 'N'
342#define X_SENDZERO 'n'
388
389
390/* This structure describes call routines */
391struct caller {
392 const char *CA_type;
393 int (*CA_caller)();
394};
395

--- 16 unchanged lines hidden (view full) ---

412struct nstat {
413 pid_t t_pid; /* process id */
414 time_t t_start; /* start time */
415 time_t t_scall; /* start call to system */
416 time_t t_ecall; /* end call to system */
417 time_t t_tacu; /* acu time */
418 time_t t_tlog; /* login time */
419 time_t t_sftp; /* start file transfer protocol */
343
344
345/* This structure describes call routines */
346struct caller {
347 const char *CA_type;
348 int (*CA_caller)();
349};
350

--- 16 unchanged lines hidden (view full) ---

367struct nstat {
368 pid_t t_pid; /* process id */
369 time_t t_start; /* start time */
370 time_t t_scall; /* start call to system */
371 time_t t_ecall; /* end call to system */
372 time_t t_tacu; /* acu time */
373 time_t t_tlog; /* login time */
374 time_t t_sftp; /* start file transfer protocol */
420 time_t t_sxf; /* start xfer */
421 time_t t_exf; /* end xfer */
375 time_t t_sxf; /* start xfer */
376 time_t t_exf; /* end xfer */
422 time_t t_eftp; /* end file transfer protocol */
423 time_t t_qtime; /* time file queued */
424 int t_ndial; /* # of dials */
425 int t_nlogs; /* # of login trys */
426 struct tms t_tbb; /* start execution times */
427 struct tms t_txfs; /* xfer start times */
377 time_t t_eftp; /* end file transfer protocol */
378 time_t t_qtime; /* time file queued */
379 int t_ndial; /* # of dials */
380 int t_nlogs; /* # of login trys */
381 struct tms t_tbb; /* start execution times */
382 struct tms t_txfs; /* xfer start times */
428 struct tms t_txfe; /* xfer end times */
383 struct tms t_txfe; /* xfer end times */
429 struct tms t_tga; /* garbage execution times */
430};
431
432/* This structure describes the values from Limits file */
433struct limits {
434 int totalmax; /* overall limit */
435 int sitemax; /* limit per site */
436 char mode[64]; /* uucico mode */
437};
438
439/* external declarations */
440
384 struct tms t_tga; /* garbage execution times */
385};
386
387/* This structure describes the values from Limits file */
388struct limits {
389 int totalmax; /* overall limit */
390 int sitemax; /* limit per site */
391 char mode[64]; /* uucico mode */
392};
393
394/* external declarations */
395
441EXTERN ssize_t (*Read)(), (*Write)();
442#if defined(__STDC__)
443EXTERN int (*Ioctl)(int,int,...);
444#else
445EXTERN int (*Ioctl)();
446#endif
447#ifndef DIAL
448EXTERN int Ifn, Ofn;
449#endif
450EXTERN int Debug, Verbose;
451EXTERN uid_t Uid, Euid; /* user-id and effective-uid */
452#ifndef DIAL
453EXTERN long Ulimit;
454#endif
455EXTERN mode_t Dev_mode; /* save device mode here */
456#ifndef DIAL
457EXTERN char Wrkdir[];
458#endif
459EXTERN long Retrytime;
460#ifndef DIAL
461EXTERN char **Env;
462EXTERN char Uucp[];
463EXTERN char Pchar;
464EXTERN struct nstat Nstat;
465#endif
466EXTERN char Dc[]; /* line name */
467#ifndef DIAL
468EXTERN int Seqn; /* sequence # */
469EXTERN int Role;
470EXTERN int Sgrades; /* flag for administrator defined service grades */
471EXTERN char Grade;
472EXTERN char Logfile[];
473EXTERN char Rmtname[];
474EXTERN char JobGrade[];
475EXTERN char User[];
476EXTERN char Loginuser[];
477#endif
478EXTERN const char *Spool;
479EXTERN const char *Pubdir;
480#ifndef DIAL
481EXTERN char Myname[];
482#endif
483EXTERN char Progname[];
484#ifndef DIAL
485EXTERN char RemSpool[];
486#endif
487EXTERN char *Bnptr; /* used when BASENAME macro is expanded */
396static ssize_t (*Read)(), (*Write)();
397static int (*Ioctl)(int, int, ...);
398static int Debug, Verbose;
399static uid_t Uid, Euid; /* user-id and effective-uid */
400static mode_t Dev_mode; /* save device mode here */
401static long Retrytime;
402static char Dc[]; /* line name */
403static const char *Spool;
404static const char *Pubdir;
405static char Progname[];
406static char *Bnptr; /* used when BASENAME macro is expanded */
488extern char *sys_errlist[];
407extern char *sys_errlist[];
489#ifndef DIAL
490EXTERN int SizeCheck; /* ulimit check supported flag */
491EXTERN long RemUlimit; /* remote ulimit if supported */
492EXTERN int Restart; /* checkpoint restart supported flag */
493#endif
494
408
495#ifndef DIAL
496EXTERN char Jobid[]; /* Jobid of current C. file */
497#endif
498EXTERN int Uerror; /* global error code */
499EXTERN char *UerrorText[]; /* text for error code */
409static int Uerror; /* global error code */
410static char *UerrorText[]; /* text for error code */
500
501/* Some global I need for section 2 and section 3 routines */
502extern char *optarg; /* for getopt() */
503extern int optind; /* for getopt() */
504
411
412/* Some global I need for section 2 and section 3 routines */
413extern char *optarg; /* for getopt() */
414extern int optind; /* for getopt() */
415
505#define UERRORTEXT UerrorText[Uerror]
506#define UTEXT(x) UerrorText[x]
416#define UERRORTEXT UerrorText[Uerror]
417#define UTEXT(x) UerrorText[x]
507
508/* things get kind of tricky beyond this point -- please stay out */
509
418
419/* things get kind of tricky beyond this point -- please stay out */
420
510#ifdef ATTSV
511#define index strchr
512#define rindex strrchr
513#define vfork fork
514#define ATTSVKILL
515#define UNAME
516#else
517#define strchr index
518#define strrchr rindex
519#endif
520
521#ifndef DIAL
522
523#if defined(sparc)
524#define _STAT _stat
525#else /* !sparc */
526#define _STAT stat
527#endif /* sparc */
528
529EXTERN struct stat __s_;
530#define READANY(f) ((_STAT((f),&__s_)==0) && ((__s_.st_mode&(0004))!=0) )
531#define READSOME(f) ((_STAT((f),&__s_)==0) && ((__s_.st_mode&(0444))!=0) )
532
533#define WRITEANY(f) ((_STAT((f),&__s_)==0) && ((__s_.st_mode&(0002))!=0) )
534#define DIRECTORY(f) ((_STAT((f),&__s_)==0) && ((__s_.st_mode&(S_IFMT))==S_IFDIR) )
535#define NOTEMPTY(f) ((_STAT((f),&__s_)==0) && (__s_.st_size!=0) )
536#endif
537
538/* standard functions used */
539
540extern char *strcat(), *strcpy(), *strncpy(), *strrchr();
541extern char *strchr(), *strpbrk();
542extern char *index(), *rindex(), *getlogin(), *ttyname(); /*, *malloc();
543extern char *calloc(); */
544extern time_t time();
545extern int pipe(), close(), getopt();
546extern struct tm *localtime();
547extern FILE *popen();
548#ifdef BSD4_2
549extern char *sprintf();
550#endif /* BSD4_2 */
551
552/* uucp functions and subroutine */
421/* uucp functions and subroutine */
553EXTERN void (*genbrk)();
422static void (*genbrk)();
554extern int iswrk(), gtwvec(); /* anlwrk.c */
555extern void findgrade(); /* grades.c */
556extern void chremdir(), mkremdir(); /* chremdir.c */
557extern void toCorrupt(); /* cpmv.c */
558extern int xmv(); /* cpmv.c */
559
423extern int iswrk(), gtwvec(); /* anlwrk.c */
424extern void findgrade(); /* grades.c */
425extern void chremdir(), mkremdir(); /* chremdir.c */
426extern void toCorrupt(); /* cpmv.c */
427extern int xmv(); /* cpmv.c */
428
560EXTERN int getargs(); /* getargs.c */
561EXTERN void bsfix(); /* getargs.c */
429static int getargs(); /* getargs.c */
430static void bsfix(); /* getargs.c */
562extern char *getprm(); /* getprm.c */
563
564extern char *next_token(); /* permission.c */
565extern char *nextarg(); /* permission.c */
566extern int getuline(); /* permission.c */
567
431extern char *getprm(); /* getprm.c */
432
433extern char *next_token(); /* permission.c */
434extern char *nextarg(); /* permission.c */
435extern int getuline(); /* permission.c */
436
568#if defined(__STDC__)
569EXTERN void logent(const char *, const char *); /* logent.c */
570EXTERN void syslog(), closelog(); /* logent.c */
571#else
572EXTERN void logent(), syslog(), closelog(); /* logent.c */
573#endif
437static void logent(const char *, const char *); /* logent.c */
574extern void commandlog(); /* logent.c */
575extern time_t millitick(); /* logent.c */
576
577extern unsigned long getfilesize(); /* statlog.c */
438extern void commandlog(); /* logent.c */
439extern time_t millitick(); /* logent.c */
440
441extern unsigned long getfilesize(); /* statlog.c */
578extern void putfilesize(); /* statlog.c */
442extern void putfilesize(); /* statlog.c */
579
443
580EXTERN char *protoString(); /* permission.c */
581extern int logFind(), mchFind(); /* permission.c */
582extern int chkperm(), chkpth(); /* permission.c */
583extern int cmdOK(), switchRole(); /* permission.c */
584extern int callBack(), requestOK(); /* permission.c */
585extern int noSpool(); /* permission.c */
586extern void myName(); /* permission.c */
587
588extern int mkdirs(); /* expfile.c */
589extern int scanlimit(); /* limits.c */
590extern void systat(); /* systat.c */
444extern int logFind(), mchFind(); /* permission.c */
445extern int chkperm(), chkpth(); /* permission.c */
446extern int cmdOK(), switchRole(); /* permission.c */
447extern int callBack(), requestOK(); /* permission.c */
448extern int noSpool(); /* permission.c */
449extern void myName(); /* permission.c */
450
451extern int mkdirs(); /* expfile.c */
452extern int scanlimit(); /* limits.c */
453extern void systat(); /* systat.c */
591EXTERN int fd_mklock(), fd_cklock(); /* ulockf.c */
592EXTERN int fn_cklock(); /* ulockf.c */
593EXTERN int mklock(), cklock(), mlock(); /* ulockf.c */
594EXTERN void fd_rmlock(), delock(), rmlock(); /* ulockf.c */
454static int fd_mklock(); /* ulockf.c */
455static int mklock(), cklock(); /* ulockf.c */
456static void fd_rmlock(), rmlock(); /* ulockf.c */
595extern char *timeStamp(); /* utility.c */
457extern char *timeStamp(); /* utility.c */
596#if defined(__STDC__)
597EXTERN void assert(const char *s1, const char *s2,
458static void assert(const char *s1, const char *s2,
598 int i1, const char *s3, int i2); /* utility.c */
459 int i1, const char *s3, int i2); /* utility.c */
599#else
600EXTERN void assert(); /* utility.c */
601#endif
602EXTERN void errent(); /* utility.c */
603extern void uucpname(); /* uucpname.c */
604extern int versys(); /* versys.c */
605extern void xuuxqt(), xuucico(); /* xqt.c */
460extern void uucpname(); /* uucpname.c */
461extern int versys(); /* versys.c */
462extern void xuuxqt(), xuucico(); /* xqt.c */
606EXTERN void cleanup(); /* misc main.c */
463static void cleanup(); /* misc main.c */
607
464
608#define ASSERT(e, s1, s2, i1) if (!(e)) {\
609 assert(s1, s2, i1, __FILE__, __LINE__);\
610 cleanup(FAIL);};
611
612#ifdef ATTSV
613unsigned sleep();
614void exit(), setbuf();
615long ulimit();
616#else /* !ATTSV */
617int sleep(), exit(), setbuf(), ftime();
618#endif
619
620#ifdef UNAME
621#include <sys/utsname.h>
622#endif /* UNAME */
623
624#ifndef NOUSTAT
625#ifdef V7USTAT
626struct ustat {
627 daddr_t f_tfree; /* total free */
628 ino_t f_tinode; /* total inodes free */
465#define ASSERT(e, s1, s2, i1) if (!(e)) { \
466 assert(s1, s2, i1, __FILE__, __LINE__); \
467 cleanup(FAIL); \
629};
468};
630#else /* !NOUSTAT && !V7USTAT */
631#include <ustat.h>
632#endif /* V7USTAT */
633#endif /* NOUSTAT */
634
469
635#ifdef BSD4_2
636char *gethostname();
637#endif /* BSD4_2 */
638
639/* messages */
470/* messages */
640EXTERN const char Ct_OPEN[];
641EXTERN const char Ct_WRITE[];
642EXTERN const char Ct_READ[];
643EXTERN const char Ct_CREATE[];
644EXTERN const char Ct_ALLOCATE[];
645EXTERN const char Ct_LOCK[];
646EXTERN const char Ct_STAT[];
647EXTERN const char Ct_CHOWN[];
648EXTERN const char Ct_CHMOD[];
649EXTERN const char Ct_LINK[];
650EXTERN const char Ct_CHDIR[];
651EXTERN const char Ct_UNLINK[];
652EXTERN const char Wr_ROLE[];
653EXTERN const char Ct_CORRUPT[];
654EXTERN const char Ct_FORK[];
655EXTERN const char Ct_CLOSE[];
656EXTERN const char Ct_BADOWN[];
657EXTERN const char Fl_EXISTS[];
471static const char Ct_OPEN[];
472static const char Ct_WRITE[];
473static const char Ct_READ[];
474static const char Ct_CREATE[];
475static const char Ct_ALLOCATE[];
476static const char Ct_LOCK[];
477static const char Ct_STAT[];
478static const char Ct_CHOWN[];
479static const char Ct_CHMOD[];
480static const char Ct_LINK[];
481static const char Ct_CHDIR[];
482static const char Ct_UNLINK[];
483static const char Wr_ROLE[];
484static const char Ct_CORRUPT[];
485static const char Ct_FORK[];
486static const char Ct_CLOSE[];
487static const char Ct_BADOWN[];
488static const char Fl_EXISTS[];
658
489
490#ifdef __cplusplus
491}
659#endif
492#endif
493
494#endif /* _UUCP_H */