1*33587Srick /* @(#)uucp.h 5.12 02/24/88 */ 213632Ssam 318624Sralph #include <stdio.h> 413632Ssam 513632Ssam /* 613632Ssam * Determine local uucp name of this machine. 713632Ssam * Define one of the following: 813632Ssam * 913632Ssam * For UCB 4.1A and later systems, you will have the gethostname(2) call. 1013632Ssam * If this call exists, define GETHOSTNAME. 1113632Ssam * 1213632Ssam * For USG 3.0 and later systems, you will have the uname(2) call. 1313632Ssam * If this call exists, define UNAME. 1413632Ssam * 1513632Ssam * Some systems have a line of the form '#define sysname "myuucpname",' 1613632Ssam * in the file /usr/include/whoami.h, to identify their machine. 1713632Ssam * If your site does that, define WHOAMI. 1813632Ssam * 1913632Ssam * If your site has <whoami.h>, but you do not want to read 2013632Ssam * that file every time uucp runs, you can compile sysname into uucp. 2113632Ssam * This is faster and more reliable, but binaries do not port. 2213632Ssam * If you want to do that, define CCWHOAMI. 2313632Ssam * 2413632Ssam * Some systems put the local uucp name in a single-line file 2513632Ssam * named /etc/uucpname or /local/uucpname. 2613632Ssam * If your site does that, define UUNAME. 2713632Ssam * 2813632Ssam * Systems running 3Com's UNET will have the getmyhname() call. 2913632Ssam * If you want to, define GETMYHNAME. 3013632Ssam * 3117842Sralph * You should also define MYNAME to be your uucp name. 3213632Ssam * 3313632Ssam * For each of the above that are defined, uucp checks them in order. 3413632Ssam * It stops on the first method that returns a non null name. 3513632Ssam * If everything fails, it uses "unknown" for the system name. 3613632Ssam */ 3723681Sbloom #define GETHOSTNAME /**/ 3823681Sbloom /* #define UNAME /**/ 3923681Sbloom /* #define WHOAMI /**/ 4023681Sbloom /* #define CCWHOAMI /**/ 4123681Sbloom /* #define UUNAME /**/ 4223681Sbloom /* #define GETMYHNAME /**/ 4313632Ssam /* If the above fails ... */ 4423681Sbloom #define MYNAME "erehwon" 4513632Ssam 4613632Ssam /* 4713632Ssam * If you have it, include <sysexits.h> to use exit 4813632Ssam * codes that will be understood by sendmail. 4913632Ssam * Otherwise, define EX_NOHOST, EX_CANTCREAT, and EX_NOINPUT. 5013632Ssam */ 5113632Ssam #include <sysexits.h> 5223681Sbloom /*#define EX_NOINPUT 66 /**/ 5323681Sbloom /*#define EX_NOHOST 68 /**/ 5423681Sbloom /*#define EX_CANTCREAT 73 /**/ 5513632Ssam 5613632Ssam /* 5713632Ssam * Define the various kinds of connections to include. 5813632Ssam * The complete list is in the condevs array in condevs.c 5913632Ssam */ 6026152Sbloom #define ATT2224 /* AT&T 2224 */ 6125269Sbloom #define BSDTCP /* 4.2bsd or 2.9bsd TCP/IP */ 6226152Sbloom #define CDS224 /* Concord Data Systems 2400 */ 6325269Sbloom /* #define DATAKIT /* ATT's datakit */ 6417872Sralph #define DF02 /* Dec's DF02/DF03 */ 6518624Sralph #define DF112 /* Dec's DF112 */ 6625269Sbloom #define DN11 /* "standard" DEC dialer */ 6717872Sralph #define HAYES /* Hayes' Smartmodem */ 6826152Sbloom #define HAYES2400 /* Hayes' 2400 baud Smartmodem */ 6925269Sbloom /* #define MICOM /* Micom Mux port */ 7025269Sbloom #define NOVATION /* Novation modem */ 7125269Sbloom #define PAD /* X.25 PAD */ 7218624Sralph #define PENRIL /* PENRIL Dialer */ 7325269Sbloom /* #define PNET /* Purdue network */ 7425269Sbloom #define RVMACS /* Racal-Vadic MACS 820 dialer, 831 adaptor */ 7525269Sbloom /* #define SYTEK /* Sytek Local Area Net */ 7625269Sbloom /* #define UNETTCP /* 3Com's UNET */ 7726152Sbloom #define USR2400 /* USRobotics Courier 2400 */ 7817872Sralph #define VA212 /* Racal-Vadic 212 */ 7917872Sralph #define VA811S /* Racal-Vadic 811S dialer, 831 adaptor */ 8017842Sralph #define VA820 /* Racal-Vadic 820 dialer, 831 adaptor */ 8125269Sbloom #define VADIC /* Racal-Vadic 345x */ 8225269Sbloom #define VENTEL /* Ventel Dialer */ 8317872Sralph #define VMACS /* Racal-Vadic MACS 811 dialer, 831 adaptor */ 8413632Ssam 8526152Sbloom #if defined(USR2400) && !defined(HAYES) 8626152Sbloom #define HAYES 8726152Sbloom #endif USR2400 && !HAYES 8826152Sbloom 8917842Sralph #if defined(UNETTCP) || defined(BSDTCP) 9017842Sralph #define TCPIP 9117842Sralph #endif 9217842Sralph 9313632Ssam /* 9425707Sbloom * We need a timer to write slowly to certain modems. 9525707Sbloom * and for generating breaks. 9625707Sbloom * 9723728Sbloom * define INTERVALTIMER to use 4.[23] bsd interval timer. 9813632Ssam * define FASTTIMER if you have the nap() system call. 9913632Ssam * define FTIME if you have the ftime() system call. 10013632Ssam * define BUSYLOOP if you must do a busy loop. 10113632Ssam * Look at uucpdelay() in condevs.c for details. 10213632Ssam */ 10323681Sbloom #define INTERVALTIMER 10425269Sbloom /*#define FASTTIMER /**/ 10525269Sbloom /*#define FTIME /**/ 10625269Sbloom /*#define BUSYLOOP /**/ 10713632Ssam 10813632Ssam /* 10913632Ssam * If your site is using "ndir.h" to retrofit the Berkeley 11013632Ssam * directory reading routines, define NDIR. 11113632Ssam * You will probably also have to set LIBNDIR in Makefile. 11213632Ssam * Otherwise, <dir.h> is assumed to have the Berkeley directory definitions. 11313632Ssam */ 11423681Sbloom /*#define NDIR /**/ 11513632Ssam 11613632Ssam /* 11723681Sbloom * If yours is a BTL system III, IV, V or so-on site, define USG. 11813632Ssam */ 11923681Sbloom /*#define USG /**/ 12013632Ssam 12117842Sralph /* 12223728Sbloom * If you are running 4.3bsd, define BSD4_3 and BSD4_2 12323728Sbloom * If you are just running 4.2bsd, define BSD4_2 12426152Sbloom * If you are running the BRL version of 4.2BSD define BRL4_2, NOT BSD4_3 12517842Sralph */ 12623728Sbloom #define BSD4_3 /**/ 12723681Sbloom #define BSD4_2 /**/ 12826152Sbloom /*#define BRL4_2 /**/ 12917842Sralph 13026152Sbloom #if defined(BRL4_2) && !defined(BSD4_2) 13126152Sbloom #define BSD4_2 13226152Sbloom #undef BSD4_3 13326152Sbloom #endif BRL4_2 13426152Sbloom 13517842Sralph /* 13623681Sbloom * If you are running 2.9bsd, define BSD2_9 13723681Sbloom */ 13823681Sbloom /*#define BSD2_9 /**/ 13923681Sbloom 14023681Sbloom /* 14117842Sralph * If you are using /etc/inetd with 4.2bsd, define BSDINETD 14217842Sralph */ 14323681Sbloom #define BSDINETD /**/ 14417842Sralph 14523728Sbloom /* 14626152Sbloom * If you are running 4.3bsd or BRL 4.2, you are running the inetd 14723728Sbloom */ 14823728Sbloom 14926152Sbloom #if (defined(BSD4_3) || defined(BRL4_2)) && !defined(BSDINETD) 15023728Sbloom #define BSDINETD 15126152Sbloom #endif (BSD4_3 ||BRL4_2) && !BSDINETD 15223728Sbloom 15317842Sralph /*#define VMSDTR /* Turn on modem control on vms(works DTR) for 15417842Sralph develcon and gandalf ports to gain access */ 15518624Sralph /* 15618624Sralph * If you want to use the same modem for dialing in and out define 15718624Sralph * DIALINOUT to be the localtion of the acucntrl program 15818624Sralph */ 15923681Sbloom /* #define DIALINOUT "/usr/lib/uucp/acucntrl" /**/ 16017842Sralph 16123681Sbloom /* 16223681Sbloom * If you want all ACU lines to be DIALINOUT, define ALLACUINOUT 16323681Sbloom */ 16423681Sbloom /* #define ALLACUINOUT /**/ 16513632Ssam 16613632Ssam /* define the value of WFMASK - for umask call - used for all uucp work files */ 16713632Ssam #define WFMASK 0137 16813632Ssam 16913632Ssam /* define the value of LOGMASK - for LOGFILE, SYSLOG, ERRLOG */ 17023681Sbloom #define LOGMASK 0133 17113632Ssam 17213632Ssam /* All files are given at least the following at the final destination */ 17313632Ssam /* It is also the default mode, so '666' is recommended */ 17413632Ssam /* and 444 is minimal (minimally useful, maximally annoying) */ 17513632Ssam #define BASEMODE 0666 17613632Ssam 17717842Sralph /* 17817842Sralph * Define NOSTRANGERS if you don't want to accept transactions from 17917842Sralph * sites that are not in your L.sys file (see cico.c) 18017842Sralph */ 18123681Sbloom #define NOSTRANGERS /**/ 18226152Sbloom 18317842Sralph /* 18417842Sralph * Traditionally LCK (lock) files have been kept in /usr/spool/uucp. 18517842Sralph * If you want that define LOCKDIR to be ".". 18625269Sbloom * If you want the locks kept in a subdirectory, define LOCKDIR as "LCK". 18717842Sralph * Good news about LCK. subdirectory: the directory can be mode 777 so 18817842Sralph * unprivileged programs can share the uucp locking system, 18917842Sralph * and the subdirectory keeps down clutter in the main directory. 19017842Sralph * The BAD news: you have to change 'tip' and another programs that 19117842Sralph * know where the LCK files are kept, and you have to change your /etc/rc 19217842Sralph * if your rc cleans out the lock files (as it should). 19317842Sralph */ 19425269Sbloom /*#define LOCKDIR "LCK" /**/ 19523681Sbloom #define LOCKDIR "." /**/ 19613632Ssam 19725269Sbloom /* 19817842Sralph * If you want uucp and uux to copy the data files by default, 19917842Sralph * don't define DONTCOPY (This is the way older 4bsd uucps worked) 20017842Sralph * If you want uucp and uux to use the original files instead of 20117842Sralph * copies, define DONTCOPY (This is the way System III and V work) 20217842Sralph */ 20323681Sbloom #define DONTCOPY /**/ 20417842Sralph 20517842Sralph /* 20618624Sralph * Very few (that I know of) systems use the sequence checking feature. 20717842Sralph * If you are not going to use it (hint: you are not), 20817842Sralph * do not define GNXSEQ. This saves precious room on PDP11s. 20917842Sralph */ 21023681Sbloom /*#define GNXSEQ /* comment this out to save space */ 21117842Sralph 21218624Sralph /* 21318624Sralph * If you want the logfile stored in a file for each site instead 21418624Sralph * of one file 21518624Sralph * define LOGBYSITE as the directory to put the files in 21618624Sralph */ 21723681Sbloom /*#define LOGBYSITE "/usr/spool/uucp/LOG" /**/ 21818624Sralph 219*33587Srick /* 220*33587Srick * If you are doing rebilling and need connect accounting, 221*33587Srick * define DO_CONNECT_ACCOUNTING 222*33587Srick */ 223*33587Srick /*#define DO_CONNECT_ACCOUNTING /**/ 224*33587Srick 22513632Ssam #define XQTDIR "/usr/spool/uucp/XTMP" 22613632Ssam #define SQFILE "/usr/lib/uucp/SQFILE" 22713632Ssam #define SQTMP "/usr/lib/uucp/SQTMP" 22813632Ssam #define SLCKTIME 5400 /* system/device timeout (LCK.. files) */ 22913632Ssam #define SEQFILE "/usr/lib/uucp/SEQF" 23013632Ssam #define SYSFILE "/usr/lib/uucp/L.sys" 23113632Ssam #define DEVFILE "/usr/lib/uucp/L-devices" 23213632Ssam #define DIALFILE "/usr/lib/uucp/L-dialcodes" 23313632Ssam #define USERFILE "/usr/lib/uucp/USERFILE" 23413632Ssam #define CMDFILE "/usr/lib/uucp/L.cmds" 23518624Sralph #define ALIASFILE "/usr/lib/uucp/L.aliases" 23613632Ssam 23713632Ssam #define SPOOL "/usr/spool/uucp" 23813632Ssam #define SYSLOG "/usr/spool/uucp/SYSLOG" 23913632Ssam #define PUBDIR "/usr/spool/uucppublic" 24013632Ssam 24126152Sbloom #define SQLOCK "SQ" 24225269Sbloom #define SEQLOCK "SEQL" 24313632Ssam #define CMDPRE 'C' 24413632Ssam #define DATAPRE 'D' 24513632Ssam #define XQTPRE 'X' 24613632Ssam 24723681Sbloom #define LOGFILE "/usr/spool/uucp/LOGFILE" 24823681Sbloom #define ERRLOG "/usr/spool/uucp/ERRLOG" 24923681Sbloom #define CMDSDIR "/usr/spool/uucp/C." 25023681Sbloom #define DATADIR "/usr/spool/uucp/D." 25123681Sbloom #define XEQTDIR "/usr/spool/uucp/X." 25213632Ssam 25313632Ssam #define RMTDEBUG "AUDIT" 25417842Sralph #define CORRUPT "CORRUPT" 25513632Ssam #define SQTIME 60 25613632Ssam #define TRYCALLS 2 /* number of tries to dial call */ 25713632Ssam 258*33587Srick #define LLEN 150 25917842Sralph #define MAXRQST 250 26017842Sralph 26113632Ssam #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s); else 26213632Ssam 26317842Sralph #define ASSERT(e, s1, s2, i1) if (!(e)) {assert(s1, s2, i1);cleanup(FAIL);}else 26413632Ssam 26525269Sbloom #define delock(dev) rmlock(dev) 26625269Sbloom #define mlock(dev) ulockf(dev, SLCKTIME) 26725269Sbloom 26823681Sbloom #define SAME 0 26923681Sbloom #define ANYREAD 0004 27023681Sbloom #define ANYWRITE 02 27123681Sbloom #define FAIL -1 27223681Sbloom #define SUCCESS 0 27323681Sbloom #define CNULL (char *) 0 27423681Sbloom #define STBNULL (struct sgttyb *) 0 27523681Sbloom #define MASTER 1 27623681Sbloom #define SLAVE 0 27723681Sbloom #define MAXFULLNAME 255 27823681Sbloom #define MAXMSGTIME 45 27923681Sbloom #define NAMESIZE 255 28023681Sbloom #define MAXBASENAME 14 28123681Sbloom #define SYSNSIZE (MAXBASENAME-1-1-1-4) 28223681Sbloom #define EOTMSG "\04\n\04\n" 28323681Sbloom #define CALLBACK 1 28423681Sbloom #define ONEDAY 86400L 28513632Ssam 28613632Ssam /* commands */ 28713632Ssam #define SHELL "/bin/sh" 28817842Sralph #define MAIL "/usr/lib/sendmail" 28913632Ssam #define UUCICO "/usr/lib/uucp/uucico" 29013632Ssam #define UUXQT "/usr/lib/uucp/uuxqt" 29113632Ssam #define UUCP "uucp" 29213632Ssam 29313632Ssam /* call connect fail stuff */ 29413632Ssam #define CF_SYSTEM -1 29513632Ssam #define CF_TIME -2 29613632Ssam #define CF_LOCK -3 29713632Ssam #define CF_NODEV -4 29813632Ssam #define CF_DIAL -5 29913632Ssam #define CF_LOGIN -6 30013632Ssam 30123681Sbloom #define F_NAME 0 30223681Sbloom #define F_TIME 1 30323681Sbloom #define F_LINE 2 30423681Sbloom #define F_CLASS 3 /* an optional prefix and the speed */ 30523681Sbloom #define F_PHONE 4 30623681Sbloom #define F_LOGIN 5 30713632Ssam 30823681Sbloom #define MAXPH 60 /* maximum length of a phone number */ 30913632Ssam 31013632Ssam /* This structure tells how to get to a device */ 31113632Ssam struct condev { 31213632Ssam char *CU_meth; /* method, such as 'ACU' or 'DIR' */ 31313632Ssam char *CU_brand; /* brand, such as 'Hayes' or 'Vadic' */ 31413632Ssam int (*CU_gen)(); /* what to call to search for brands */ 31513632Ssam int (*CU_open)(); /* what to call to open brand */ 31613632Ssam int (*CU_clos)(); /* what to call to close brand */ 31713632Ssam }; 31813632Ssam 31913632Ssam /* This structure tells about a device */ 32013632Ssam struct Devices { 32117842Sralph #define D_type D_arg[0] 32217842Sralph #define D_line D_arg[1] 32317842Sralph #define D_calldev D_arg[2] 32417842Sralph #define D_class D_arg[3] 32517842Sralph #define D_brand D_arg[4] 32617842Sralph #define D_CHAT 5 32717842Sralph int D_numargs; 32817842Sralph int D_speed; 32917842Sralph char *D_arg[20]; 33017842Sralph char D_argbfr[100]; 33113632Ssam }; 33213632Ssam 33313632Ssam /* system status stuff */ 33413632Ssam #define SS_OK 0 33513632Ssam #define SS_NODEVICE 1 33613632Ssam #define SS_CALLBACK 2 33713632Ssam #define SS_INPROGRESS 3 33823681Sbloom #define SS_FAIL 4 33913632Ssam #define SS_BADSEQ 5 34017842Sralph #define SS_WRONGTIME 6 34113632Ssam 34213632Ssam /* fail/retry parameters */ 34323681Sbloom #define RETRYTIME 600 34423681Sbloom #define MAXRECALLS 25 34513632Ssam 34613632Ssam /* stuff for command execution */ 34713632Ssam #define X_RQDFILE 'F' 34813632Ssam #define X_STDIN 'I' 34913632Ssam #define X_STDOUT 'O' 35013632Ssam #define X_CMD 'C' 35113632Ssam #define X_USER 'U' 35213632Ssam #define X_SENDFILE 'S' 35313632Ssam #define X_NONOTI 'N' 35417842Sralph #define X_RETURNTO 'R' 35513632Ssam #define X_NONZERO 'Z' 35625269Sbloom #define X_LOCK "XQT" 35723681Sbloom #define X_LOCKTIME 3600L 35813632Ssam 35923681Sbloom #define WKDSIZE 100 /* size of work dir name */ 36013632Ssam 36118624Sralph #include <sys/types.h> 36218624Sralph #ifndef USG 36318624Sralph #include <sys/timeb.h> 36418624Sralph #else USG 36518624Sralph struct timeb 36618624Sralph { 36718624Sralph time_t time; 36818624Sralph unsigned short millitm; 36918624Sralph short timezone; 37018624Sralph short dstflag; 37118624Sralph }; 37223681Sbloom #define rindex strrchr 37323681Sbloom #define index strchr 37418624Sralph #endif USG 37518624Sralph 37618624Sralph extern struct timeb Now; 37718624Sralph 37813632Ssam extern int Ifn, Ofn; 37918624Sralph extern char *Rmtname; 38013632Ssam extern char User[]; 38113632Ssam extern char Loginuser[]; 38213632Ssam extern char *Spool; 38313632Ssam extern char Myname[]; 38417842Sralph extern char Myfullname[]; 38513632Ssam extern int Debug; 38613632Ssam extern int Bspeed; 38713632Ssam extern char Wrkdir[]; 38823681Sbloom extern time_t Retrytime; 38917842Sralph extern short Usrf; 39017842Sralph extern int IsTcpIp; 39113632Ssam extern char Progname[]; 39213632Ssam extern int (*CU_end)(); 39313632Ssam extern struct condev condevs[]; 39417842Sralph extern char NOLOGIN[]; 39513632Ssam 39617842Sralph extern char DLocal[], DLocalX[], *subfile(), *subdir(); 39713632Ssam 39813632Ssam /* Commonly called routines which return non-int value */ 39913632Ssam extern char *ttyname(), *strcpy(), *strcat(), *index(), *rindex(), 40017842Sralph *fgets(), *calloc(), *malloc(), *fdig(), *ttyname(), 40123681Sbloom *cfgets(), *getwd(), *strpbrk(), *strncpy(); 40213632Ssam extern long lseek(); 40313992Sgray extern FILE *rpopen(); 40423681Sbloom extern time_t time(); 40517842Sralph 40617842Sralph extern char _FAILED[], CANTOPEN[], DEVNULL[]; 40723681Sbloom 40823681Sbloom #ifdef lint 40923681Sbloom /* This horrible gross kludge is the only way I know to 41023681Sbloom * convince lint that signal(SIGINT,SIG_IGN) is legal. It hates SIG_IGN. 41123681Sbloom */ 41223681Sbloom #ifdef SIG_IGN 41323681Sbloom #undef SIG_IGN 41423681Sbloom #endif /* SIG_IGN */ 41523681Sbloom #define SIG_IGN main 41623681Sbloom extern int main(); 41723681Sbloom #ifdef DEBUG 41823681Sbloom #undef DEBUG 41923681Sbloom #endif DEBUG 42023681Sbloom #define DEBUG(a,b,c) 42123681Sbloom #endif /* lint */ 422