Annotation of researchv10no/cmd/uucp/uucp.h, revision 1.1

1.1     ! root        1: #include "parms.h"
        !             2: 
        !             3: #ifdef BSD4_2
        !             4: #define V7
        !             5: #undef NONAP
        !             6: #undef FASTTIMER
        !             7: #endif
        !             8: 
        !             9: #ifdef FASTTIMER
        !            10: #undef NONAP
        !            11: #endif
        !            12: 
        !            13: #ifdef V8
        !            14: #define V7
        !            15: #endif V8
        !            16: 
        !            17: #include <stdio.h>
        !            18: #include <ctype.h>
        !            19: #include <setjmp.h>
        !            20: #include <sys/param.h>
        !            21: 
        !            22: #if defined (ATTSV) && ! defined (CDLIMIT)
        !            23: #include <sys/fmgr.h>
        !            24: #endif
        !            25: 
        !            26: /*
        !            27:  * param.h includes types.h and signal.h in 4bsd
        !            28:  */
        !            29: #ifdef V7
        !            30: #include <sys/timeb.h>
        !            31: #else
        !            32: #include <termio.h>
        !            33: #include <sys/types.h>
        !            34: #include <signal.h>
        !            35: #include <fcntl.h>
        !            36: #endif
        !            37: 
        !            38: #include <sys/stat.h>
        !            39: #ifdef READDIR
        !            40: #include <ndir.h>
        !            41: #endif
        !            42: #ifdef V8
        !            43: #define        V8DIRSIZ 14     /* to truncate, to make legal filenames */
        !            44: #endif
        !            45: 
        !            46: #ifdef BSD4_2
        !            47: #include <sys/time.h>
        !            48: #else
        !            49: #include <time.h>
        !            50: #endif
        !            51: 
        !            52: #include <sys/times.h>
        !            53: #include <errno.h>
        !            54: 
        !            55: #ifdef ATTSV
        !            56: #include <sys/sysmacros.h>
        !            57: #endif ATTSV
        !            58: 
        !            59: #ifdef RT
        !            60: #include "rt/types.h"
        !            61: #include "rt/unix/param.h"
        !            62: #include "rt/stat.h"
        !            63: #include <sys/ustat.h>
        !            64: #endif RT
        !            65: 
        !            66: /* what mode should D. files have upon creation? */
        !            67: #define DFILEMODE 0600
        !            68: 
        !            69: /* what mode should C. files have upon creation? */
        !            70: #define CFILEMODE 0644
        !            71: 
        !            72: /* define the value of DIRMASK, for umask call */
        !            73: /* used for creating system subdirectories */
        !            74: #define DIRMASK 0022
        !            75: 
        !            76: #define MAXSTART       300     /* how long to wait on startup */
        !            77: 
        !            78: /* define the last characters for ACU  (used for 801/212 dialers) */
        !            79: #define ACULAST "<"
        !            80: 
        !            81: /*  caution - the fillowing names are also in Makefile 
        !            82:  *    any changes here have to also be made there
        !            83:  *
        !            84:  * it's a good idea to make directories .foo, since this ensures
        !            85:  * that they'll be ignored by processes that search subdirectories in SPOOL
        !            86:  *
        !            87:  *  XQTDIR=/usr/spool/uucp/.Xqtdir
        !            88:  *  CORRUPT=/usr/spool/uucp/.Corrupt
        !            89:  *  LOGDIR=/usr/spool/uucp/.Log
        !            90:  *  SEQDIR=/usr/spool/uucp/.Sequence
        !            91:  *  STATDIR=/usr/spool/uucp/.Status
        !            92:  *  
        !            93:  */
        !            94: 
        !            95: /* where to put the STST. files? */
        !            96: #define STATDIR                "/usr/spool/uucp/.Status"
        !            97: 
        !            98: /* where should logfiles be kept? */
        !            99: #define LOGUUX         "/usr/spool/uucp/.Log/uux"
        !           100: #define LOGUUXQT       "/usr/spool/uucp/.Log/uuxqt"
        !           101: #define LOGUUCP                "/usr/spool/uucp/.Log/uucp"
        !           102: #define LOGCICO                "/usr/spool/uucp/.Log/uucico"
        !           103: #define CORRUPTDIR     "/usr/spool/uucp/.Corrupt"
        !           104: 
        !           105: /* some sites use /usr/lib/uucp/.XQTDIR here */
        !           106: /* use caution since things are linked into there */
        !           107: #define XQTDIR         "/usr/spool/uucp/.Xqtdir"
        !           108: 
        !           109: /* how much of a system name can we print in a [CX]. file? */
        !           110: /* MAXBASENAME - 1 (pre) - 1 ('.') - 1 (grade) - 4 (sequence number) */
        !           111: #define SYSNSIZE (MAXBASENAME - 7)
        !           112: 
        !           113: #ifdef USRSPOOLLOCKS
        !           114: #define LOCKPRE                "/usr/spool/locks/LCK."
        !           115: #else
        !           116: #define LOCKPRE                "/usr/spool/uucp/LCK."
        !           117: #endif USRSPOOLLOCKS
        !           118: 
        !           119: #define SQFILE         "/usr/lib/uucp/SQFILE"
        !           120: #define SQTMP          "/usr/lib/uucp/SQTMP"
        !           121: #define SLCKTIME       5400    /* system/device timeout (LCK.. files) */
        !           122: #define SYSFILE                "/usr/lib/uucp/Systems"
        !           123: #define DEVFILE                "/usr/lib/uucp/Devices"
        !           124: #define DIALERFILE     "/usr/lib/uucp/Dialers"
        !           125: #define DIALFILE       "/usr/lib/uucp/Dialcodes"
        !           126: #define PFILE          "/usr/lib/uucp/Permissions"
        !           127: 
        !           128: #define SPOOL          "/usr/spool/uucp"
        !           129: #define SEQDIR         "/usr/spool/uucp/.Sequence"
        !           130: 
        !           131: #define X_LOCKTIME     3600
        !           132: #ifdef USRSPOOLLOCKS
        !           133: #define SEQLOCK                "/usr/spool/locks/LCK.SQ."
        !           134: #define SQLOCK         "/usr/spool/locks/LCK.SQ"
        !           135: #define X_LOCK         "/usr/spool/locks/LCK.X"
        !           136: #define S_LOCK         "/usr/spool/locks/LCK.S"
        !           137: #define X_LOCKDIR      "/usr/spool/locks"      /* must be dir part of above */
        !           138: #else
        !           139: #define SEQLOCK                "/usr/spool/uucp/LCK.SQ."
        !           140: #define SQLOCK         "/usr/spool/uucp/LCK.SQ"
        !           141: #define X_LOCK         "/usr/spool/uucp/LCK.X"
        !           142: #define S_LOCK         "/usr/spool/uucp/LCK.S"
        !           143: #define X_LOCKDIR      "/usr/spool/uucp"       /* must be dir part of above */
        !           144: #endif USRSPOOLLOCKS
        !           145: #define X_LOCKPRE      "LCK.X"         /* must be last part of above */
        !           146: 
        !           147: #define PUBDIR         "/usr/spool/uucppublic"
        !           148: #define ADMIN          "/usr/spool/uucp/.Admin"
        !           149: #define ERRLOG         "/usr/spool/uucp/.Admin/errors"
        !           150: #define SYSLOG         "/usr/spool/uucp/.Admin/xferstats"
        !           151: #define RMTDEBUG       "/usr/spool/uucp/.Admin/audit"
        !           152: #define CLEANUPLOGFILE "/usr/spool/uucp/.Admin/uucleanup"
        !           153: 
        !           154: #define        WORKSPACE       "/usr/spool/uucp/.Workspace"
        !           155: 
        !           156: #define SQTIME         60
        !           157: #define TRYCALLS       2       /* number of tries to dial call */
        !           158: #define MINULIMIT      (1L<<11)        /* minimum reasonable ulimit */
        !           159: 
        !           160: /*
        !           161:  * CDEBUG is for communication line debugging 
        !           162:  * DEBUG is for program debugging 
        !           163:  * #define SMALL to compile without the DEBUG code
        !           164:  */
        !           165: #define CDEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
        !           166: #ifndef SMALL
        !           167: #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s)
        !           168: #else
        !           169: #define DEBUG(l, f, s)
        !           170: #endif SMALL
        !           171: 
        !           172: /*
        !           173:  * VERBOSE is used by cu and ct to inform the user
        !           174:  * about the progress of connection attempts.
        !           175:  * In uucp, this will be NULL.
        !           176:  */
        !           177: 
        !           178: #ifdef STANDALONE
        !           179: #define VERBOSE(f, s) if (Verbose > 0) fprintf(stderr, f, s); else
        !           180: #else
        !           181: #define VERBOSE(f, s)
        !           182: #endif
        !           183: 
        !           184: #define PREFIX(pre, str)       (strncmp((pre), (str), strlen(pre)) == SAME)
        !           185: #define BASENAME(str, c) ((Bnptr = strrchr((str), c)) ? (Bnptr + 1) : (str))
        !           186: #define EQUALS(a,b)    ((a) && (b) && (strcmp((a),(b))==SAME))
        !           187: #define EQUALSN(a,b,n) ((a) && (b) && (strncmp((a),(b),(n))==SAME))
        !           188: #define LASTCHAR(s)    (s+strlen(s)-1)
        !           189: 
        !           190: #define SAME 0
        !           191: #define ANYREAD 04
        !           192: #define ANYWRITE 02
        !           193: #define FAIL -1
        !           194: #define SUCCESS 0
        !           195: #define NULLCHAR       '\0'
        !           196: #define CNULL (char *) 0
        !           197: #define STBNULL (struct sgttyb *) 0
        !           198: #define MASTER 1
        !           199: #define SLAVE 0
        !           200: #define MAXBASENAME 14 /* should be DIRSIZ but 4.2bsd prohibits that */
        !           201: #define MAXFULLNAME BUFSIZ
        !           202: #define MAXNAMESIZE    64      /* /usr/spool/uucp/<14 chars>/<14 chars>+slop */
        !           203: #define MAXMSGTIME 33
        !           204: #define MAXEXPECTTIME 45
        !           205: #define MAXCHARTIME 15
        !           206: #define NAMESIZE MAXBASENAME+1
        !           207: #define        SIZEOFPID       10              /* maximum number of digits in a pid */
        !           208: #define EOTMSG "\004\n\004\n"
        !           209: #define CALLBACK 1
        !           210: 
        !           211: /* manifest for chkpth flag */
        !           212: #define CK_READ                0
        !           213: #define CK_WRITE       1
        !           214: 
        !           215: /*
        !           216:  * commands
        !           217:  */
        !           218: #define SHELL          "/bin/sh"
        !           219: #define UUCICO         "/usr/lib/uucp/uucico"
        !           220: #define UUSCHED                "/usr/lib/uucp/uusched"
        !           221: #define UUXQT          "/usr/lib/uucp/uuxqt"
        !           222: #define UUCP           "uucp"
        !           223: #ifdef V7
        !           224: #define        UUPS            "/usr/lib/uucp/uups"
        !           225: #endif
        !           226: 
        !           227: 
        !           228: /* system status stuff */
        !           229: #define SS_OK                  0
        !           230: #define SS_NO_DEVICE           1
        !           231: #define SS_TIME_WRONG          2
        !           232: #define SS_INPROGRESS          3
        !           233: #define SS_CONVERSATION                4
        !           234: #define SS_SEQBAD              5
        !           235: #define SS_LOGIN_FAILED                6
        !           236: #define SS_DIAL_FAILED         7
        !           237: #define SS_BAD_LOG_MCH         8
        !           238: #define SS_LOCKED_DEVICE       9
        !           239: #define SS_ASSERT_ERROR                10
        !           240: #define SS_BADSYSTEM           11
        !           241: #define SS_CANT_ACCESS_DEVICE  12
        !           242: #define SS_DEVICE_FAILED       13      /* No longer used */
        !           243: #define SS_WRONG_MCH           14
        !           244: #define SS_CALLBACK            15
        !           245: #define SS_RLOCKED             16
        !           246: #define SS_RUNKNOWN            17
        !           247: #define SS_RLOGIN              18
        !           248: #define SS_UNKNOWN_RESPONSE    19
        !           249: #define SS_STARTUP             20
        !           250: #define SS_CHAT_FAILED         21
        !           251: 
        !           252: #define MAXPH  60      /* maximum phone string size */
        !           253: #define        MAXC    BUFSIZ
        !           254: 
        !           255: #define        TRUE    1
        !           256: #define        FALSE   0
        !           257: #define NAMEBUF        32
        !           258: 
        !           259: /* structure of an Systems file line */
        !           260: #define F_MAX  50      /* max number of fields in Systems file line */
        !           261: #define F_NAME 0
        !           262: #define F_TIME 1
        !           263: #define F_TYPE 2
        !           264: #define F_CLASS 3      /* an optional prefix and the speed */
        !           265: #define F_PHONE 4
        !           266: #define F_LOGIN 5
        !           267: 
        !           268: /* structure of an Devices file line */
        !           269: #define D_TYPE 0
        !           270: #define D_LINE 1
        !           271: #define D_CALLDEV 2
        !           272: #define D_CLASS 3
        !           273: #define D_CALLER 4
        !           274: #define D_ARG 5
        !           275: #define D_MAX  50      /* max number of fields in Devices file line */
        !           276: 
        !           277: #define D_ACU 1
        !           278: #define D_DIRECT 2
        !           279: #define D_PROT 4
        !           280: 
        !           281: /* past here, local changes are not recommended */
        !           282: #define CMDPRE         'C'
        !           283: #define DATAPRE                'D'
        !           284: #define XQTPRE         'X'
        !           285: 
        !           286: /*
        !           287:  * stuff for command execution
        !           288:  */
        !           289: #define X_RQDFILE      'F'
        !           290: #define X_STDIN                'I'
        !           291: #define X_STDOUT       'O'
        !           292: #define X_CMD          'C'
        !           293: #define X_USER         'U'
        !           294: #define X_BRINGBACK    'B'
        !           295: #define X_MAILF                'M'
        !           296: #define X_RETADDR      'R'
        !           297: #define X_COMMENT      '#'
        !           298: #define X_NONZERO      'Z'
        !           299: #define X_SENDNOTHING  'N'
        !           300: #define X_SENDZERO     'n'
        !           301: 
        !           302: 
        !           303: /* This structure describes call routines */
        !           304: struct caller {
        !           305:        char    *CA_type;
        !           306:        int     (*CA_caller)();
        !           307: };
        !           308: 
        !           309: /* This structure describes dialing routines */
        !           310: struct dialer {
        !           311:        char    *DI_type;
        !           312:        int     (*DI_dialer)();
        !           313: };
        !           314: 
        !           315: struct nstat {
        !           316:        int     t_pid;          /* process id                           */
        !           317:        long    t_start;        /* process id                           */
        !           318:        time_t  t_beg;          /* start  time                          */
        !           319:        time_t  t_scall;        /* start call to system                 */
        !           320:        time_t  t_ecall;        /* end call to system                   */
        !           321:        time_t  t_tacu;         /* acu time                             */
        !           322:        time_t  t_tlog;         /* login time                           */
        !           323:        time_t  t_sftp;         /* start file transfer protocol         */
        !           324:        time_t  t_sxf;          /* start xfer                           */
        !           325:        time_t  t_exf;          /* end xfer                             */
        !           326:        time_t  t_eftp;         /* end file transfer protocol           */
        !           327:        time_t  t_qtime;        /* time file queued                     */
        !           328:        int     t_ndial;        /* # of dials                           */
        !           329:        int     t_nlogs;        /* # of login trys                      */
        !           330:        struct tms t_tbb;       /* start execution times                */
        !           331:        struct tms t_txfs;      /* xfer start times                     */
        !           332:        struct tms t_txfe;      /* xfer end times                       */
        !           333:        struct tms t_tga;       /* garbage execution times              */
        !           334: };
        !           335: 
        !           336: /* external declarations */
        !           337: 
        !           338: extern int Ifn, Ofn;
        !           339: extern int Debug, Verbose;
        !           340: extern int Bspeed;
        !           341: extern int Uid, Euid;          /* user-id and effective-uid */
        !           342: extern char Wrkdir[];
        !           343: extern long Retrytime;
        !           344: extern char **Env;
        !           345: extern char Uucp[];
        !           346: extern char Pchar;
        !           347: extern struct nstat Nstat;
        !           348: extern char Dc[];                      /* line name                    */
        !           349: extern char Fwdname[];         /* foward name                  */
        !           350: extern int Seqn;                       /* sequence #                   */
        !           351: extern int Role;
        !           352: extern char Logfile[];
        !           353: extern int linebaudrate;       /* adjust sleep time on read in pk driver */
        !           354: extern char Rmtname[];
        !           355: extern char User[];
        !           356: extern char Loginuser[];
        !           357: extern char *Thisdir;
        !           358: extern char *Spool;
        !           359: extern char *Pubdir;
        !           360: extern char Myname[];
        !           361: extern char Progname[];
        !           362: extern char RemSpool[];
        !           363: extern char *Bnptr;            /* used when BASENAME macro is expanded */
        !           364: extern char *sys_errlist[];
        !           365: 
        !           366: extern char Jobid[];           /* Jobid of current C. file */
        !           367: extern int Uerror;             /* global error code */
        !           368: extern char *UerrorText[];     /* text for error code */
        !           369: 
        !           370: /*     Some global I need for section 2 and section 3 routines */
        !           371: extern errno;
        !           372: extern char *optarg;   /* for getopt() */
        !           373: extern int optind;     /* for getopt() */
        !           374: 
        !           375: 
        !           376: #define UERRORTEXT             UerrorText[Uerror]
        !           377: #define UTEXT(x)               UerrorText[x]
        !           378: 
        !           379: /* things get kind of gross beyond this point -- please stay out */
        !           380: 
        !           381: #define index strchr
        !           382: #define rindex strrchr 
        !           383: #ifdef ATTSV
        !           384: #define vfork fork
        !           385: #define ATTSVKILL
        !           386: #define UNAME
        !           387: #endif
        !           388: 
        !           389: #ifdef lint
        !           390: #define VERSION(x)     ;
        !           391: #define ASSERT(e, s1, s2, i1)  ;
        !           392: 
        !           393: #else
        !           394: 
        !           395: #define VERSION(x)     static  char    sccsid[] = "x";
        !           396: #define ASSERT(e, s1, s2, i1) if (!(e)) {\
        !           397:        assert(s1, s2, i1, sccsid, __FILE__, __LINE__);\
        !           398:        cleanup(FAIL);};
        !           399: #endif
        !           400: 
        !           401: extern struct stat __s_;
        !           402: #define READANY(f)     ((stat((f),&__s_)==0) && ((__s_.st_mode&(0004))!=0) )
        !           403: #define READSOME(f)    ((stat((f),&__s_)==0) && ((__s_.st_mode&(0444))!=0) )
        !           404: 
        !           405: #define WRITEANY(f)    ((stat((f),&__s_)==0) && ((__s_.st_mode&(0002))!=0) )
        !           406: #define DIRECTORY(f)   ((stat((f),&__s_)==0) && ((__s_.st_mode&(S_IFMT))==S_IFDIR) )
        !           407: #define NOTEMPTY(f)    ((stat((f),&__s_)==0) && (__s_.st_size!=0) )
        !           408: 
        !           409: #ifndef READDIR
        !           410: #define DIR FILE
        !           411: #define opendir(x) fopen((x), "r")
        !           412: #define closedir(x) fclose((x))
        !           413: #endif
        !           414: 
        !           415: /* standard functions used */
        !           416: 
        !           417: extern char    *strcat(), *strcpy(), *strncpy(), *strrchr();
        !           418: extern char    *strchr(), *strpbrk();
        !           419: extern char    *index(), *rindex(), *getlogin(), *ttyname(), *malloc();
        !           420: extern char    *calloc();
        !           421: extern long    times(), lseek(), atol();
        !           422: extern time_t  time();
        !           423: extern int     strlen(), strcmp(), strncmp();
        !           424: extern int     execle(), fork(), pipe(), close(), fcntl(), getopt();
        !           425: extern struct tm       *localtime();
        !           426: extern FILE    *popen();
        !           427: 
        !           428: /* uucp functions and subroutine */
        !           429: extern int     anlwrk(), iswrk(), gtwvec();            /* anlwrk.c */
        !           430: extern void    chremdir(), mkremdir();                 /* chremdir.c */
        !           431: extern         void toCorrupt();                       /* cpmv.c  */
        !           432: extern         int xcp(), xmv();                       /* cpmv.c  */
        !           433: 
        !           434: extern int     getargs();                              /* getargs.c */
        !           435: extern void    bsfix();                                /* getargs.c */
        !           436: extern char    *getprm();                              /* getprm.c */
        !           437: 
        !           438: extern void    logent(), syslog(), closelog();         /* logent.c */
        !           439: extern time_t  millitick();                            /* logent.c */
        !           440: 
        !           441: extern char    *protoString();                         /* permission.c */
        !           442: extern         logFind(), mchFind();                   /* permission.c */
        !           443: extern         chkperm(), chkpth();                    /* permission.c */
        !           444: extern         cmdOK(), switchRole();                  /* permission.c */
        !           445: extern         callBack(), requestOK();                /* permission.c */
        !           446: extern void    myName();                               /* permission.c */
        !           447: 
        !           448: extern void    systat();                               /* systat.c */
        !           449: extern int     ulockf(), checkLock(), delock();        /* ulockf.c */
        !           450: extern int     mlock();                                /* ulockf.c */
        !           451: extern void    rmlock(), ultouch();                    /* ulockf.c */
        !           452: extern char    *timeStamp();                           /* utility.c */
        !           453: extern void    assert(), errent();                     /* utility.c */
        !           454: extern void    uucpname();                             /* uucpname.c */
        !           455: extern int     versys();                               /* versys.c */
        !           456: extern void    xuuxqt(), xuucico();                    /* xqt.c */
        !           457: 
        !           458: #ifdef ATTSV
        !           459: unsigned       sleep();
        !           460: void   exit(), setbuf();
        !           461: long   ulimit();
        !           462: #else
        !           463: int    sleep(), exit(), setbuf(), ftime();
        !           464: #endif
        !           465: 
        !           466: #ifndef NOUSTAT
        !           467: #ifdef V7USTAT
        !           468: struct  ustat {
        !           469:        daddr_t f_tfree;        /* total free */
        !           470:        ino_t   f_tinode;       /* total inodes free */
        !           471: };
        !           472: #else
        !           473: #include <ustat.h>
        !           474: #endif
        !           475: #endif
        !           476: 
        !           477: #ifdef UNAME
        !           478: #include <sys/utsname.h>
        !           479: #endif
        !           480: 
        !           481: #ifdef BSD4_2
        !           482: char *gethostname();
        !           483: #endif
        !           484: 
        !           485: /* messages */
        !           486: extern char *Ct_OPEN;
        !           487: extern char *Ct_WRITE;
        !           488: extern char *Ct_READ;
        !           489: extern char *Ct_CREATE;
        !           490: extern char *Ct_ALLOCATE;
        !           491: extern char *Ct_LOCK;
        !           492: extern char *Ct_STAT;
        !           493: extern char *Ct_CHOWN;
        !           494: extern char *Ct_CHMOD;
        !           495: extern char *Ct_LINK;
        !           496: extern char *Ct_CHDIR;
        !           497: extern char *Ct_UNLINK;
        !           498: extern char *Wr_ROLE;
        !           499: extern char *Ct_CORRUPT;
        !           500: extern char *Ct_FORK;
        !           501: extern char *Ct_CLOSE;
        !           502: extern char *Fl_EXISTS;
        !           503: extern char *Ue_BADSYSTEM;
        !           504: extern char *Ue_TIME_WRONG;
        !           505: extern char *Ue_SYSTEM_LOCKED;
        !           506: extern char *Ue_NO_DEVICE;
        !           507: extern char *Ue_DIAL_FAILED;
        !           508: extern char *Ue_LOGIN_FAILED;
        !           509: extern char *Ue_SEQBAD;
        !           510: extern char *Ue_BAD_LOG_MCH;
        !           511: extern char *Ue_WRONG_MCH;
        !           512: extern char *Ue_LOCKED_DEVICE;
        !           513: extern char *Ue_ASSERT_ERROR;
        !           514: extern char *Ue_CANT_ACCESS_DEVICE;
        !           515: extern char *Ue_DEVICE_FAILED;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.