Annotation of researchv10no/lbin/mailx/hdr/def.h, revision 1.1

1.1     ! root        1: #ident "@(#)def.h      1.5 'attmail mail(1) command'"
        !             2: #ident "@(#)mailx:hdr/def.h    1.5.2.1"
        !             3: /*     Copyright (c) 1984 AT&T */
        !             4: /*       All Rights Reserved   */
        !             5: 
        !             6: /*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
        !             7: /*     The copyright notice above does not evidence any        */
        !             8: /*     actual or intended publication of such source code.     */
        !             9: 
        !            10: #ident "@(#)mailx:hdr/def.h    1.5"
        !            11: 
        !            12: #include <sys/types.h>
        !            13: #include <signal.h>
        !            14: #include <stdio.h>
        !            15: #include <fcntl.h>
        !            16: #include <string.h>
        !            17: #include <setjmp.h>
        !            18: #include <time.h>
        !            19: #include <sys/stat.h>
        !            20: #include <ctype.h>
        !            21: #include <errno.h>
        !            22: #ifndef preSVr4
        !            23: # include <maillock.h>                                         /* adb */
        !            24: # include <unistd.h>
        !            25: # include <stdlib.h>
        !            26: # include <ulimit.h>
        !            27: #endif
        !            28: #include "local.h"
        !            29: #include "uparm.h"
        !            30: 
        !            31: /*
        !            32:  * mailx -- a modified version of a University of California at Berkeley
        !            33:  *     mail program
        !            34:  */
        !            35: 
        !            36: #ifdef preSVr4 /* support for void* */
        !            37: # define VOID          char
        !            38: #else
        !            39: # define VOID          void
        !            40: #endif
        !            41: 
        !            42: #define        SENDESC         '~'             /* Default escape for sending */
        !            43: #define        NMLSIZE         1024            /* max names in a message list */
        !            44: #define        PATHSIZE        1024            /* Size of pathnames throughout */
        !            45: #define        HSHSIZE         19              /* Hash size for aliases and vars */
        !            46: #define        LINESIZE        5120            /* max readable line width */
        !            47: #define        STRINGSIZE      ((unsigned) 128)/* Dynamic allocation units */
        !            48: #define        MAXARGC         1024            /* Maximum list of raw strings */
        !            49: #define        NOSTR           ((char *) 0)    /* Nill string pointer */
        !            50: #define        NOSTRPTR        ((char **) 0)   /* Nill pointer to string pointer */
        !            51: #define        NOINTPTR        ((int *) 0)     /* Nill pointer */
        !            52: #define        MAXEXP          25              /* Maximum expansion of aliases */
        !            53: 
        !            54: #define        equal(a, b)     (strcmp(a,b)==0)/* A nice function to string compare */
        !            55: #define fopen(s,t)     my_fopen(s,t)   /* Keep a list of all opened files */
        !            56: #define fclose(s)      my_fclose(s)    /* delete closed file from the list*/
        !            57: #define        plural(n)       ((n) == 1 ? "" : "s")
        !            58: 
        !            59: struct message {
        !            60:        long    m_block;                /* block number of this message */
        !            61:        long    m_offset;               /* offset in block of message */
        !            62:        long    m_size;                 /* Bytes in the message */
        !            63:        long    m_lines;                /* Lines in the message */
        !            64:        long    m_clen;                 /* Content-Length of the mesg   */
        !            65:        short   m_flag;                 /* flags, see below */
        !            66:        char    m_text;                 /* TRUE if the contents is text */
        !            67:                                        /* False otherwise              */
        !            68: };
        !            69: 
        !            70: typedef struct fplst {
        !            71:        FILE    *fp;
        !            72:        struct  fplst   *next;
        !            73: } NODE;
        !            74: 
        !            75: /*
        !            76:  * flag bits.
        !            77:  */
        !            78: 
        !            79: #define        MUSED           (1<<0)          /* entry is used, but this bit isn't */
        !            80: #define        MDELETED        (1<<1)          /* entry has been deleted */
        !            81: #define        MSAVED          (1<<2)          /* entry has been saved */
        !            82: #define        MTOUCH          (1<<3)          /* entry has been noticed */
        !            83: #define        MPRESERVE       (1<<4)          /* keep entry in sys mailbox */
        !            84: #define        MMARK           (1<<5)          /* message is marked! */
        !            85: #define        MODIFY          (1<<6)          /* message has been modified */
        !            86: #define        MNEW            (1<<7)          /* message has never been seen */
        !            87: #define        MREAD           (1<<8)          /* message has been read sometime. */
        !            88: #define        MSTATUS         (1<<9)          /* message status has changed */
        !            89: #define        MBOX            (1<<10)         /* Send this to mbox, regardless */
        !            90: 
        !            91: #define        H_AFWDCNT       1               /* "Auto-Forward-Count:"  */
        !            92: #define        H_AFWDFROM      2               /* "Auto-Forwarded-From:" */
        !            93: #define        H_CLEN          3               /* "Content-Length:"      */
        !            94: #define        H_CTYPE         4               /* "Content-Type:"        */
        !            95: #define        H_DATE          5               /* "Date:"                */
        !            96: #define        H_DEFOPTS       6               /* "Default-Options:"     */
        !            97: #define        H_EOH           7               /* "End-of-Header:"       */
        !            98: #define        H_FROM          8               /* "From "                */
        !            99: #define        H_FROM1         9               /* ">From "               */
        !           100: #define        H_FROM2         10              /* "From: "               */
        !           101: #define        H_MTSID         11              /* "MTS-Message-ID:"      */
        !           102: #define        H_MTYPE         12              /* "Message-Type:"        */
        !           103: #define        H_MVERS         13              /* "Message-Version:"     */
        !           104: #define        H_MSVC          14              /* "Message-Service:"     */
        !           105: #define        H_RECEIVED      15              /* "Received:"            */
        !           106: #define        H_RVERS         16              /* "Report-Version:"      */
        !           107: #define        H_STATUS        17              /* "Status:"              */
        !           108: #define        H_SUBJ          18              /* "Subject:"             */
        !           109: #define        H_TO            19              /* "To:"                  */
        !           110: #define        H_TCOPY         20              /* ">To:"                 */
        !           111: #define        H_TROPTS        21              /* "Transport-Options:"   */
        !           112: #define        H_UAID          22              /* "UA-Content-ID:"       */
        !           113: #define        H_DAFWDFROM     23              /* Hold A-F-F when sending Del. Notf. */
        !           114: #define        H_DTCOPY        24              /* Hold ">To:" when sending Del. Notf.*/
        !           115: #define        H_DRECEIVED     25              /* Hold Rcvd: when sending Del. Notf.*/
        !           116: #define H_CONT         26              /* Continuation of previous line */
        !           117: #define H_NAMEVALUE    27              /* unrecognized "name: value" hdr line*/
        !           118: 
        !           119: /*
        !           120:  * Format of the command description table.
        !           121:  * The actual table is declared and initialized
        !           122:  * in lex.c
        !           123:  */
        !           124: 
        !           125: struct cmd {
        !           126:        char    *c_name;                /* Name of command */
        !           127:        int     (*c_func)();            /* Implementor of the command */
        !           128:        short   c_argtype;              /* Type of arglist (see below) */
        !           129:        short   c_msgflag;              /* Required flags of messages */
        !           130:        short   c_msgmask;              /* Relevant flags of messages */
        !           131: };
        !           132: 
        !           133: /* can't initialize unions */
        !           134: 
        !           135: #define        c_minargs c_msgflag             /* Minimum argcount for RAWLIST */
        !           136: #define        c_maxargs c_msgmask             /* Max argcount for RAWLIST */
        !           137: 
        !           138: /*
        !           139:  * Argument types.
        !           140:  */
        !           141: 
        !           142: #define        MSGLIST  0              /* Message list type */
        !           143: #define        STRLIST  1              /* A pure string */
        !           144: #define        RAWLIST  2              /* Shell string list */
        !           145: #define        NOLIST   3              /* Just plain 0 */
        !           146: #define        NDMLIST  4              /* Message list, no defaults */
        !           147: 
        !           148: #define        P       040             /* Autoprint dot after command */
        !           149: #define        I       0100            /* Interactive command bit */
        !           150: #define        M       0200            /* Legal from send mode bit */
        !           151: #define        W       0400            /* Illegal when read only bit */
        !           152: #define        F       01000           /* Is a conditional command */
        !           153: #define        T       02000           /* Is a transparent command */
        !           154: #define        R       04000           /* Cannot be called from collect */
        !           155: 
        !           156: /*
        !           157:  * Oft-used mask values
        !           158:  */
        !           159: 
        !           160: #define        MMNORM          (MDELETED|MSAVED)/* Look at both save and delete bits */
        !           161: #define        MMNDEL          MDELETED        /* Look only at deleted bit */
        !           162: 
        !           163: /*
        !           164:  * Structure used to return a break down of a head
        !           165:  * line
        !           166:  */
        !           167: 
        !           168: struct headline {
        !           169:        char    *l_from;        /* The name of the sender */
        !           170:        char    *l_tty;         /* His tty string (if any) */
        !           171:        char    *l_date;        /* The entire date string */
        !           172: };
        !           173: 
        !           174: #define        GTO     1               /* Grab To: line */
        !           175: #define        GSUBJECT 2              /* Likewise, Subject: line */
        !           176: #define        GCC     4               /* And the Cc: line */
        !           177: #define        GBCC    8               /* And also the Bcc: line */
        !           178: #define        GDEFOPT 16              /* And the Default-Options: lines */
        !           179: #define        GNL     32              /* Print blank line after */
        !           180: #define GOTHER 64              /* Other header lines */
        !           181: #define        GMASK   (GTO|GSUBJECT|GCC|GBCC|GDEFOPT|GNL|GOTHER)
        !           182:                                /* Mask of all header lines */
        !           183: #define        GDEL    128             /* Entity removed from list */
        !           184: 
        !           185: /*
        !           186:  * Structure used to pass about the current
        !           187:  * state of the user-typed message header.
        !           188:  */
        !           189: 
        !           190: struct header {
        !           191:        char    *h_to;                  /* Dynamic "To:" string */
        !           192:        char    *h_subject;             /* Subject string */
        !           193:        char    *h_cc;                  /* Carbon copies string */
        !           194:        char    *h_bcc;                 /* Blind carbon copies */
        !           195:        char    *h_defopt;              /* Default options */
        !           196:        char    **h_others;             /* Other header lines */
        !           197:        int     h_seq;                  /* Sequence for optimization */
        !           198: };
        !           199: 
        !           200: /*
        !           201:  * Structure of namelist nodes used in processing
        !           202:  * the recipients of mail and aliases and all that
        !           203:  * kind of stuff.
        !           204:  */
        !           205: 
        !           206: struct name {
        !           207:        struct  name *n_flink;          /* Forward link in list. */
        !           208:        struct  name *n_blink;          /* Backward list link */
        !           209:        short   n_type;                 /* From which list it came */
        !           210:        char    *n_name;                /* This fella's name */
        !           211:        char    *n_full;                /* Full name */
        !           212: };
        !           213: 
        !           214: /*
        !           215:  * Structure of a variable node.  All variables are
        !           216:  * kept on a singly-linked list of these, rooted by
        !           217:  * "variables"
        !           218:  */
        !           219: 
        !           220: struct var {
        !           221:        struct  var *v_link;            /* Forward link to next variable */
        !           222:        char    *v_name;                /* The variable's name */
        !           223:        char    *v_value;               /* And it's current value */
        !           224: };
        !           225: 
        !           226: struct mgroup {
        !           227:        struct  mgroup *ge_link;        /* Next person in this group */
        !           228:        char    *ge_name;               /* This person's user name */
        !           229: };
        !           230: 
        !           231: struct grouphead {
        !           232:        struct  grouphead *g_link;      /* Next grouphead in list */
        !           233:        char    *g_name;                /* Name of this group */
        !           234:        struct  mgroup *g_list;         /* Users in group. */
        !           235: };
        !           236: 
        !           237: #define        NIL     ((struct name *) 0)     /* The nil pointer for namelists */
        !           238: #define        NONE    ((struct cmd *) 0)      /* The nil pointer to command tab */
        !           239: #define        NOVAR   ((struct var *) 0)      /* The nil pointer to variables */
        !           240: #define        NOGRP   ((struct grouphead *) 0)/* The nil grouphead pointer */
        !           241: #define        NOGE    ((struct mgroup *) 0)   /* The nil group pointer */
        !           242: #define        NOFP    ((struct fplst *) 0)    /* The nil file pointer */
        !           243: 
        !           244: #define TRUE   1
        !           245: #define FALSE  0
        !           246: 
        !           247: #define        LSIZE           BUFSIZ          /* maximum size of a line */
        !           248: #define DEADPERM       0600            /* permissions of dead.letter */
        !           249: #define TEMPPERM       0600            /* permissions of temp files */
        !           250: #define MBOXPERM       0600            /* permissions of ~/mbox */
        !           251: 
        !           252: #ifndef        MFMODE
        !           253: # define MFMODE                0660            /* create mode for `/var/mail' files */
        !           254: #endif
        !           255: 
        !           256: /*
        !           257:  * Structure of the hash table of ignored header fields
        !           258:  */
        !           259: struct ignore {
        !           260:        struct ignore   *i_link;        /* Next ignored field in bucket */
        !           261:        char            *i_field;       /* This ignored field */
        !           262: };
        !           263: 
        !           264: /* Default_display indicates whether to display this header line to the TTY */
        !           265: /* when in default mode. Can be overridden via 'P' command at ? prompt */
        !           266: struct hdr {
        !           267:        char    *tag;
        !           268:        int     default_display;
        !           269: };
        !           270: 
        !           271: #ifdef preSVr4
        !           272: struct utimbuf {
        !           273:        time_t  actime;
        !           274:        time_t  modtime;
        !           275: };
        !           276: #else
        !           277: #  include     <utime.h>
        !           278: #endif
        !           279: 
        !           280: /*
        !           281:  * Token values returned by the scanner used for argument lists.
        !           282:  * Also, sizes of scanner-related things.
        !           283:  */
        !           284: 
        !           285: #define        TEOL            0               /* End of the command line */
        !           286: #define        TNUMBER         1               /* A message number */
        !           287: #define        TDASH           2               /* A simple dash */
        !           288: #define        TSTRING         3               /* A string (possibly containing -) */
        !           289: #define        TDOT            4               /* A "." */
        !           290: #define        TUP             5               /* An "^" */
        !           291: #define        TDOLLAR         6               /* A "$" */
        !           292: #define        TSTAR           7               /* A "*" */
        !           293: #define        TOPEN           8               /* An '(' */
        !           294: #define        TCLOSE          9               /* A ')' */
        !           295: #define TPLUS          10              /* A '+' */
        !           296: #define TERROR         11              /* abandon ship                 adb */
        !           297: 
        !           298: #define        REGDEP          2               /* Maximum regret depth. */
        !           299: #define        STRINGLEN       64              /* Maximum length of string token */
        !           300: 
        !           301: /*
        !           302:  * Constants for conditional commands.  These describe whether
        !           303:  * we should be executing stuff or not.
        !           304:  */
        !           305: 
        !           306: #define        CANY            0               /* Execute in send or receive mode */
        !           307: #define        CRCV            1               /* Execute in receive mode only */
        !           308: #define        CSEND           2               /* Execute in send mode only */
        !           309: 
        !           310: /*
        !           311:  * The pointers for the string allocation routines,
        !           312:  * there are NSPACE independent areas.
        !           313:  * The first holds STRINGSIZE bytes, the next
        !           314:  * twice as much, and so on.
        !           315:  */
        !           316: 
        !           317: #define        NSPACE  25                      /* Total number of string spaces */
        !           318: struct strings {
        !           319:        char    *s_topFree;             /* Beginning of this area */
        !           320:        char    *s_nextFree;            /* Next alloctable place here */
        !           321:        unsigned s_nleft;               /* Number of bytes left here */
        !           322: };
        !           323: 
        !           324: /* The following typedefs must be used in SVR4 */
        !           325: #ifdef preSVr4
        !           326: typedef int gid_t;
        !           327: typedef int uid_t;
        !           328: typedef int pid_t;
        !           329: typedef int mode_t;
        !           330: #endif
        !           331: 
        !           332: /*
        !           333:  * Forward declarations of routine types to keep lint and cc happy.
        !           334:  */
        !           335: 
        !           336: extern int             Copy();
        !           337: extern FILE            *Fdopen();
        !           338: extern int             Followup();
        !           339: extern char            *Getf();
        !           340: extern int             Respond();
        !           341: extern int             Save();
        !           342: extern int             Sendm();
        !           343: extern int             Type();
        !           344: extern void            Verhogen();
        !           345: extern char            *addone();
        !           346: extern char            *addto();
        !           347: extern void            alter();
        !           348: extern int             alternates();
        !           349: extern void            announce();
        !           350: extern int             any();
        !           351: extern int             anyof();
        !           352: extern int             argcount();
        !           353: extern void            assign();
        !           354: extern int             blankline();
        !           355: extern int             blockof();
        !           356: extern struct name     *cat();
        !           357: extern void            clrbuf();
        !           358: extern FILE            *collect();
        !           359: extern void            commands();
        !           360: extern char            *copy();
        !           361: extern int             copycmd();
        !           362: extern int             deassign();
        !           363: extern int             delete();
        !           364: extern struct name     *delname();
        !           365: extern int             deltype();
        !           366: extern char            *detract();
        !           367: extern int             docomma();
        !           368: extern int             dopipe();
        !           369: extern int             dosh();
        !           370: extern int             echo();
        !           371: extern int             editor();
        !           372: extern int             edstop();
        !           373: extern struct name     *elide();
        !           374: extern int             elsecmd();
        !           375: extern int             endifcmd();
        !           376: extern int             execute();
        !           377: extern char            *expand();
        !           378: extern struct name     *extract();
        !           379: extern int             file();
        !           380: extern struct grouphead        *findgroup();
        !           381: extern void            findmail();
        !           382: extern int             first();
        !           383: extern void            flush();
        !           384: extern int             folders();
        !           385: extern int             followup();
        !           386: extern int             from();
        !           387: extern off_t           fsize();
        !           388: extern int             getfold();
        !           389: extern int             gethfield();
        !           390: extern int             getline();
        !           391: extern int             getmsglist();
        !           392: extern int             getname();
        !           393: extern int             getrawlist();
        !           394: extern void            getrecf();
        !           395: extern uid_t           getuserid();
        !           396: extern int             grabh();
        !           397: extern int             group();
        !           398: extern void            hangup();
        !           399: extern int             hash();
        !           400: extern char            *hcontents();
        !           401: extern int             headerp();
        !           402: extern int             headers();
        !           403: extern int             help();
        !           404: extern char            *hfield();
        !           405: extern void            holdsigs();
        !           406: extern int             icequal();
        !           407: extern int             ifcmd();
        !           408: extern int             igfield();
        !           409: extern void            inithost();
        !           410: extern int             isdir();
        !           411: extern int             isheader();
        !           412: extern int             ishfield();
        !           413: extern int             ishost();
        !           414: extern int             isign();
        !           415: extern int             istext();
        !           416: extern void            istrcpy();
        !           417: extern void            lcwrite();
        !           418: extern int             linecount();
        !           419: extern void            load();
        !           420: extern int             lock();
        !           421: extern void            lockmail();
        !           422: extern int             mail();
        !           423: extern void            mail1();
        !           424: extern char            *maildomain();
        !           425: extern void            mapf();
        !           426: extern int             mboxit();
        !           427: extern void            mechk();
        !           428: extern int             messize();
        !           429: extern void            minit();
        !           430: extern int             my_fclose();
        !           431: extern FILE            *my_fopen();
        !           432: extern int             name();
        !           433: extern char            *nameof();
        !           434: extern char            *netmap();
        !           435: extern int             newfileinfo();
        !           436: extern int             next();
        !           437: extern int             npclose();
        !           438: extern FILE            *npopen();
        !           439: extern int             null();
        !           440: extern int             offsetofaddr();
        !           441: extern int             outof();
        !           442: extern struct name     *outpre();
        !           443: extern int             panic();
        !           444: extern void            parse();
        !           445: extern int             pcmdlist();
        !           446: extern int             pdot();
        !           447: extern int             preserve();
        !           448: extern void            printgroup();
        !           449: extern void            printhead();
        !           450: extern int             puthead();
        !           451: extern int             putline();
        !           452: extern int             pversion();
        !           453: extern void            quit();
        !           454: extern int             readline();
        !           455: extern void            receipt();
        !           456: extern void            relsesigs();
        !           457: extern int             removefile();
        !           458: extern int             respond();
        !           459: extern int             rexit();
        !           460: extern VOID            *salloc();
        !           461: extern VOID            *srealloc();
        !           462: extern int             samebody();
        !           463: extern int             save();
        !           464: extern void            savedead();
        !           465: extern char            *savestr();
        !           466: extern int             schdir();
        !           467: extern int             scroll();
        !           468: extern long            send();
        !           469: extern int             sendm();
        !           470: extern int             set();
        !           471: extern int             setfile();
        !           472: extern FILE            *setinput();
        !           473: extern void            setptr();
        !           474: extern int             shell();
        !           475: extern void            sigchild();
        !           476: extern void            (*sigset())();
        !           477: extern char            *skin();
        !           478: extern char            *snarf();
        !           479: extern int             source();
        !           480: extern char            *splice();
        !           481: extern void            sreset();
        !           482: extern void            stop();
        !           483: extern int             stouch();
        !           484: extern void            stradd();
        !           485: extern int             substr();
        !           486: extern int             swrite();
        !           487: extern struct name     *tailof();
        !           488: extern void            tinit();
        !           489: extern int             top();
        !           490: extern void            touch();
        !           491: extern struct name     *translate();
        !           492: extern int             type();
        !           493: extern int             undelete();
        !           494: extern int             unigfield();
        !           495: extern void            unlockmail();
        !           496: extern char            **unpack();
        !           497: extern int             unset();
        !           498: extern int             unstack();
        !           499: extern char            *unuucp();
        !           500: extern struct name     *usermap();
        !           501: extern int             username();
        !           502: extern char            *value();
        !           503: extern char            *vcopy();
        !           504: extern int             visual();
        !           505: extern char            *yankword();
        !           506: 
        !           507: /*
        !           508:  * Standard functions from the C library.
        !           509:  * These are all defined in <stdlib.h> in SVr4.
        !           510:  */
        !           511: #ifdef preSVr4
        !           512: extern long            atol();
        !           513: extern char            *getcwd();
        !           514: extern char            *calloc();
        !           515: extern char            *getenv();
        !           516: extern void            exit();
        !           517: extern void            free();
        !           518: extern char            *malloc();
        !           519: extern time_t          time();
        !           520: extern long            ulimit();
        !           521: extern int             utime();
        !           522: #endif

unix.superglobalmegacorp.com

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