Annotation of 3BSD/cmd/ucbmail/def.h, revision 1.1

1.1     ! root        1: #
        !             2: 
        !             3: #include "local.h"
        !             4: #include <sys/types.h>
        !             5: #include <signal.h>
        !             6: #include <stdio.h>
        !             7: 
        !             8: #undef isalpha
        !             9: #undef isdigit
        !            10: 
        !            11: /*
        !            12:  * Mail -- a mail program
        !            13:  *
        !            14:  * Commands are:
        !            15:  *     t <message list>                print out these messages
        !            16:  *     r <message list>                reply to messages
        !            17:  *     m <user list>                   mail to users (analogous to send)
        !            18:  *     e <message list>                edit messages
        !            19:  *     c [directory]                   chdir to dir or home if none
        !            20:  *     x                               exit quickly
        !            21:  *     w <message list> file           save messages in file
        !            22:  *     q                               quit, save remaining stuff in mbox
        !            23:  *     d <message list>                delete messages
        !            24:  *     u <message list>                undelete messages
        !            25:  *     h                               print message headers
        !            26:  *
        !            27:  * Author: Kurt Shoens (UCB) March 25, 1978
        !            28:  */
        !            29: 
        !            30: 
        !            31: #define        ESCAPE          '~'             /* Default escape for sending */
        !            32: #define        NMLSIZE         20              /* max names in a message list */
        !            33: #define        PATHSIZE        35              /* Size of pathnames throughout */
        !            34: #define        NAMESIZE        20              /* Max size of user name */
        !            35: #define        HSHSIZE         19              /* Hash size for aliases and vars */
        !            36: #define        HDRFIELDS       3               /* Number of header fields */
        !            37: #define        LINESIZE        512             /* max readable line width */
        !            38: #define        SCREEN          18              /* screen size in lines (effective) */
        !            39: #define        STRINGSIZE      ((unsigned) 128)/* Dynamic allocation units */
        !            40: #define        MAXARGC         20              /* Maximum list of raw strings */
        !            41: #define        NOSTR           ((char *) 0)    /* Null string pointer */
        !            42: #define        equal(a, b)     (strcmp(a,b)==0)/* A nice function to string compare */
        !            43: 
        !            44: struct message {
        !            45:        short   m_flag;                 /* flags, see below */
        !            46:        short   m_block;                /* block number of this message */
        !            47:        short   m_offset;               /* offset in block of message */
        !            48:        unsigned        m_size;         /* Bytes in the message */
        !            49:        short   m_lines;                /* Lines in the message */
        !            50: };
        !            51: 
        !            52: /*
        !            53:  * flag bits.
        !            54:  */
        !            55: 
        !            56: #define        MUSED           1               /* entry is used, but this bit isn't */
        !            57: #define        MDELETED        2               /* entry has been deleted */
        !            58: #define        MSAVED          4               /* entry has been saved */
        !            59: #define        MTOUCH          8               /* entry has been noticed */
        !            60: #define        MPRESERVE       16              /* keep entry in sys mailbox */
        !            61: #define        MMARK           32              /* message is marked! */
        !            62: #define        MODIFY          64              /* message has been modified */
        !            63: 
        !            64: /*
        !            65:  * Format of the command description table.
        !            66:  * The actual table is declared and initialized
        !            67:  * in lex.c
        !            68:  */
        !            69: 
        !            70: struct cmd {
        !            71:        char    *c_name;                /* Name of command */
        !            72:        int     (*c_func)();            /* Implementor of the command */
        !            73:        short   c_argtype;              /* Type of arglist (see below) */
        !            74:        short   c_msgflag;              /* Required flags of messages */
        !            75:        short   c_msgmask;              /* Relevant flags of messages */
        !            76: };
        !            77: 
        !            78: /* Yechh, can't initialize unions */
        !            79: 
        !            80: #define        c_minargs c_msgflag             /* Minimum argcount for RAWLIST */
        !            81: #define        c_maxargs c_msgmask             /* Max argcount for RAWLIST */
        !            82: 
        !            83: /*
        !            84:  * Argument types.
        !            85:  */
        !            86: 
        !            87: #define        MSGLIST  0              /* Message list type */
        !            88: #define        STRLIST  1              /* A pure string */
        !            89: #define        RAWLIST  2              /* Shell string list */
        !            90: #define        NOLIST   3              /* Just plain 0 */
        !            91: #define        NDMLIST  4              /* Message list, no defaults */
        !            92: 
        !            93: #define        P       040             /* Autoprint dot after command */
        !            94: #define        I       0100            /* Interactive command bit */
        !            95: #define        M       0200            /* Illegal from send mode bit */
        !            96: 
        !            97: /*
        !            98:  * Oft-used mask values
        !            99:  */
        !           100: 
        !           101: #define        MMNORM          (MDELETED|MSAVED)/* Look at both save and delete bits */
        !           102: #define        MMNDEL          MDELETED        /* Look only at deleted bit */
        !           103: 
        !           104: /*
        !           105:  * Structure used to return a break down of a head
        !           106:  * line (hats off to Bill Joy!)
        !           107:  */
        !           108: 
        !           109: struct headline {
        !           110:        char    *l_from;        /* The name of the sender */
        !           111:        char    *l_tty;         /* His tty string (if any) */
        !           112:        char    *l_date;        /* The entire date string */
        !           113: };
        !           114: 
        !           115: #define        GTO     1               /* Grab To: line */
        !           116: #define        GSUBJECT 2              /* Likewise, Subject: line */
        !           117: #define        GCC     4               /* And the Cc: line */
        !           118: #define        GBCC    8               /* And also the Bcc: line */
        !           119: 
        !           120: /*
        !           121:  * Structure used to pass about the current
        !           122:  * state of the user-typed message header.
        !           123:  */
        !           124: 
        !           125: struct header {
        !           126:        char    *h_to;                  /* Dynamic "To:" string */
        !           127:        char    *h_subject;             /* Subject string */
        !           128:        char    *h_cc;                  /* Carbon copies string */
        !           129:        char    *h_bcc;                 /* Blind carbon copies */
        !           130:        int     h_seq;                  /* Sequence for optimization */
        !           131: };
        !           132: 
        !           133: /*
        !           134:  * Structure of namelist nodes used in processing
        !           135:  * the recipients of mail and aliases and all that
        !           136:  * kind of stuff.
        !           137:  */
        !           138: 
        !           139: struct name {
        !           140:        struct  name *n_flink;          /* Forward link in list. */
        !           141:        struct  name *n_blink;          /* Backward list link */
        !           142:        char    *n_name;                /* This fella's name */
        !           143: };
        !           144: 
        !           145: /*
        !           146:  * Structure of a variable node.  All variables are
        !           147:  * kept on a singly-linked list of these, rooted by
        !           148:  * "variables"
        !           149:  */
        !           150: 
        !           151: struct var {
        !           152:        struct  var *v_link;            /* Forward link to next variable */
        !           153:        char    *v_name;                /* The variable's name */
        !           154:        char    *v_value;               /* And it's current value */
        !           155: };
        !           156: 
        !           157: struct group {
        !           158:        struct  group *ge_link;         /* Next person in this group */
        !           159:        char    *ge_name;               /* This person's user name */
        !           160: };
        !           161: 
        !           162: struct grouphead {
        !           163:        struct  grouphead *g_link;      /* Next grouphead in list */
        !           164:        char    *g_name;                /* Name of this group */
        !           165:        struct  group *g_list;          /* Users in group. */
        !           166: };
        !           167: 
        !           168: #define        NIL     ((struct name *) 0)     /* The nil pointer for namelists */
        !           169: #define        NONE    ((struct cmd *) 0)      /* The nil pointer to command tab */
        !           170: #define        NOVAR   ((struct var *) 0)      /* The nil pointer to variables */
        !           171: #define        NOGRP   ((struct grouphead *) 0)/* The nil grouphead pointer */
        !           172: #define        NOGE    ((struct group *) 0)    /* The nil group pointer */
        !           173: 
        !           174: /*
        !           175:  * Token values returned by the scanner used for argument lists.
        !           176:  * Also, sizes of scanner-related things.
        !           177:  */
        !           178: 
        !           179: #define        TEOL    0                       /* End of the command line */
        !           180: #define        TNUMBER 1                       /* A message number */
        !           181: #define        TDASH   2                       /* A simple dash */
        !           182: #define        TSTRING 3                       /* A string (possibly containing -) */
        !           183: #define        TDOT    4                       /* A "." */
        !           184: #define        TUP     5                       /* An "^" */
        !           185: #define        TDOLLAR 6                       /* A "$" */
        !           186: #define        TSTAR   7                       /* A "*" */
        !           187: #define        TOPEN   8                       /* An '(' */
        !           188: #define        TCLOSE  9                       /* A ')' */
        !           189: 
        !           190: #define        REGDEP  2                       /* Maximum regret depth. */
        !           191: #define        STRINGLEN       16              /* Maximum length of string token */
        !           192: 
        !           193: /*
        !           194:  * Kludges to handle the change from setexit / reset to setjmp / longjmp
        !           195:  */
        !           196: 
        !           197: #define        setexit()       setjmp(srbuf)
        !           198: #define        reset(x)        longjmp(srbuf, x)
        !           199: 
        !           200: /*
        !           201:  * If we have a system with the vfork() system call, define VFORK
        !           202:  * otherwise . . .
        !           203:  */
        !           204: 
        !           205: #ifndef VFORK
        !           206: #define        vfork() fork()
        !           207: #endif
        !           208: 
        !           209: /*
        !           210:  * Forward declarations of routine types to keep lint and cc happy.
        !           211:  */
        !           212: 
        !           213: FILE   *Fdopen();
        !           214: FILE   *collect();
        !           215: FILE   *infix();
        !           216: FILE   *mesedit();
        !           217: FILE   *mespipe();
        !           218: FILE   *setinput();
        !           219: char   **unpack();
        !           220: char   *addto();
        !           221: char   *calloc();
        !           222: char   *copy();
        !           223: char   *copyin();
        !           224: char   *detract();
        !           225: char   *expand();
        !           226: char   *gets();
        !           227: char   *hfield();
        !           228: char   *index();
        !           229: char   *nameof();
        !           230: char   *nextword();
        !           231: char   *getenv();
        !           232: char   *hcontents();
        !           233: char   *netmap();
        !           234: char   *netname();
        !           235: char   *readtty();
        !           236: char   *rindex();
        !           237: char   *rpair();
        !           238: char   *salloc();
        !           239: char   *savestr();
        !           240: char   *savestr();
        !           241: char   *snarf();
        !           242: char   *value();
        !           243: char   *vcopy();
        !           244: char   *yankword();
        !           245: off_t  fsize();
        !           246: struct cmd     *lex();
        !           247: struct grouphead       *findgroup();
        !           248: struct name    *cat();
        !           249: struct name    *delname();
        !           250: struct name    *elide();
        !           251: struct name    *extract();
        !           252: struct name    *map();
        !           253: struct name    *outof();
        !           254: struct name    *put();
        !           255: struct name    *usermap();
        !           256: struct name    *verify();
        !           257: struct var     *lookup();
        !           258: unsigned       int     msize();

unix.superglobalmegacorp.com

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