BSD 4_2 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 11 Aug 1983 15:22:36 +0000 (07:22 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 11 Aug 1983 15:22:36 +0000 (07:22 -0800)
Work on file usr/src/ucb/Mail/configdefs.h
Work on file usr/src/ucb/Mail/glob.h
Work on file usr/src/ucb/Mail/def.h
Work on file usr/src/ucb/Mail/local.h
Work on file usr/src/ucb/Mail/rcv.h
Work on file usr/src/ucb/Mail/sigretro.h
Work on file usr/src/ucb/Mail/v7.local.h

Synthesized-from: CSRG/cd1/4.2

usr/src/ucb/Mail/configdefs.h [new file with mode: 0644]
usr/src/ucb/Mail/def.h [new file with mode: 0644]
usr/src/ucb/Mail/glob.h [new file with mode: 0644]
usr/src/ucb/Mail/local.h [new file with mode: 0644]
usr/src/ucb/Mail/rcv.h [new file with mode: 0644]
usr/src/ucb/Mail/sigretro.h [new file with mode: 0644]
usr/src/ucb/Mail/v7.local.h [new file with mode: 0644]

diff --git a/usr/src/ucb/Mail/configdefs.h b/usr/src/ucb/Mail/configdefs.h
new file mode 100644 (file)
index 0000000..6c7cf34
--- /dev/null
@@ -0,0 +1,101 @@
+/*     configdefs.h    1.4     83/08/11        */
+
+/*
+ * This file contains the definitions of data structures used in
+ * configuring the network behavior of Mail when replying.
+ */
+
+/*
+ * The following constants are used when you are running 4.1a bsd or
+ * later on a local network.  Under control of the #define flag
+ * GETHOST, the host name is determined dynamically using the
+ * gethostname() system call.  The name thus found is inserted
+ * into the host table slot whose name was originally EMPTY.
+ */
+#define        EMPTY           "** empty **"
+#define        EMPTYID         'E'
+
+/*
+ * The following data structure is the host table.  You must have
+ * an entry here for your own machine, plus any special stuff you
+ * expect the mailer to know about.  If you have #define'd GETHOST
+ * in v7.local.h, you needn't add your machine to the host table.
+ * Not all hosts need be here, however:
+ * Mail can dope out stuff about hosts on the fly by looking
+ * at addresses.  The machines needed here are:
+ *     1) The local machine
+ *     2) Any machines on the path to a network gateway
+ *     3) Any machines with nicknames that you want to have considered
+ *        the same.
+ * The machine id letters can be anything you like and are not seen
+ * externally.  Be sure not to use characters with the 0200 bit set --
+ * these have special meanings.
+ */
+struct netmach {
+       char    *nt_machine;
+       char    nt_mid;
+       short   nt_type;
+};
+
+/*
+ * Network type codes.  Basically, there is one for each different
+ * network, if the network can be discerned by the separator character,
+ * such as @ for the arpa net.  The purpose of these codes is to
+ * coalesce cases where more than one character means the same thing,
+ * such as % and @ for the arpanet.  Also, the host table uses a
+ * bit map of these codes to show what it is connected to.
+ * BN -- connected to Bell Net.
+ * AN -- connected to ARPA net, SN -- connected to Schmidt net.
+ */
+#define        AN      1                       /* Connected to ARPA net */
+#define        BN      2                       /* Connected to BTL net */
+#define        SN      4                       /* Connected to Schmidt net */
+
+/*
+ * Data structure for table mapping network characters to network types.
+ */
+struct ntypetab {
+       char    nt_char;                /* Actual character separator */
+       int     nt_bcode;               /* Type bit code */
+};
+
+/*
+ * Codes for the "kind" of a network.  IMPLICIT means that if there are
+ * physically several machines on the path, one does not list them in the
+ * address.  The arpa net is like this.  EXPLICIT means you list them,
+ * as in UUCP.
+ * By the way, this distinction means we lose if anyone actually uses the
+ * arpa net subhost convention: name@subhost@arpahost
+ */
+#define        IMPLICIT        1
+#define        EXPLICIT        2
+
+/*
+ * Table for mapping a network code to its type -- IMPLICIT routing or
+ * IMPLICIT routing.
+ */
+struct nkindtab {
+       int     nk_type;                /* Its bit code */
+       int     nk_kind;                /* Whether explicit or implicit */
+};
+
+/*
+ * The following table gives the order of preference of the various
+ * networks.  Thus, if we have a choice of how to get somewhere, we
+ * take the preferred route.
+ */
+struct netorder {
+       short   no_stat;
+       char    no_char;
+};
+
+/*
+ * External declarations for above defined tables.
+ */
+#ifndef CONFIGFILE
+extern struct netmach netmach[1];
+extern struct ntypetab ntypetab[1];
+extern struct nkindtab nkindtab[1];
+extern struct netorder netorder[1];
+extern char *metanet;
+#endif
diff --git a/usr/src/ucb/Mail/def.h b/usr/src/ucb/Mail/def.h
new file mode 100644 (file)
index 0000000..d3b1e04
--- /dev/null
@@ -0,0 +1,326 @@
+/*     def.h   2.13    83/08/11        */
+
+#include <sys/types.h>
+#include <signal.h>
+#include <stdio.h>
+#include <sgtty.h>
+#include "local.h"
+
+#undef isalpha
+#undef isdigit
+
+/*
+ * Mail -- a mail program
+ *
+ * Commands are:
+ *     t <message list>                print out these messages
+ *     r <message list>                reply to messages
+ *     m <user list>                   mail to users (analogous to send)
+ *     e <message list>                edit messages
+ *     c [directory]                   chdir to dir or home if none
+ *     x                               exit quickly
+ *     w <message list> file           save messages in file
+ *     q                               quit, save remaining stuff in mbox
+ *     d <message list>                delete messages
+ *     u <message list>                undelete messages
+ *     h                               print message headers
+ *
+ * Author: Kurt Shoens (UCB) March 25, 1978
+ */
+
+
+#define        ESCAPE          '~'             /* Default escape for sending */
+#define        NMLSIZE         20              /* max names in a message list */
+#define        PATHSIZE        100             /* Size of pathnames throughout */
+#define        NAMESIZE        20              /* Max size of user name */
+#define        HSHSIZE         19              /* Hash size for aliases and vars */
+#define        HDRFIELDS       3               /* Number of header fields */
+#define        LINESIZE        BUFSIZ          /* max readable line width */
+#define        STRINGSIZE      ((unsigned) 128)/* Dynamic allocation units */
+#define        MAXARGC         20              /* Maximum list of raw strings */
+#define        NOSTR           ((char *) 0)    /* Null string pointer */
+#define        MAXEXP          25              /* Maximum expansion of aliases */
+#define        equal(a, b)     (strcmp(a,b)==0)/* A nice function to string compare */
+
+struct message {
+       short   m_flag;                 /* flags, see below */
+       short   m_block;                /* block number of this message */
+       short   m_offset;               /* offset in block of message */
+       long    m_size;                 /* Bytes in the message */
+       short   m_lines;                /* Lines in the message */
+};
+
+/*
+ * flag bits.
+ */
+
+#define        MUSED           (1<<0)          /* entry is used, but this bit isn't */
+#define        MDELETED        (1<<1)          /* entry has been deleted */
+#define        MSAVED          (1<<2)          /* entry has been saved */
+#define        MTOUCH          (1<<3)          /* entry has been noticed */
+#define        MPRESERVE       (1<<4)          /* keep entry in sys mailbox */
+#define        MMARK           (1<<5)          /* message is marked! */
+#define        MODIFY          (1<<6)          /* message has been modified */
+#define        MNEW            (1<<7)          /* message has never been seen */
+#define        MREAD           (1<<8)          /* message has been read sometime. */
+#define        MSTATUS         (1<<9)          /* message status has changed */
+#define        MBOX            (1<<10)         /* Send this to mbox, regardless */
+
+/*
+ * Format of the command description table.
+ * The actual table is declared and initialized
+ * in lex.c
+ */
+
+struct cmd {
+       char    *c_name;                /* Name of command */
+       int     (*c_func)();            /* Implementor of the command */
+       short   c_argtype;              /* Type of arglist (see below) */
+       short   c_msgflag;              /* Required flags of messages */
+       short   c_msgmask;              /* Relevant flags of messages */
+};
+
+/* Yechh, can't initialize unions */
+
+#define        c_minargs c_msgflag             /* Minimum argcount for RAWLIST */
+#define        c_maxargs c_msgmask             /* Max argcount for RAWLIST */
+
+/*
+ * Argument types.
+ */
+
+#define        MSGLIST  0              /* Message list type */
+#define        STRLIST  1              /* A pure string */
+#define        RAWLIST  2              /* Shell string list */
+#define        NOLIST   3              /* Just plain 0 */
+#define        NDMLIST  4              /* Message list, no defaults */
+
+#define        P       040             /* Autoprint dot after command */
+#define        I       0100            /* Interactive command bit */
+#define        M       0200            /* Legal from send mode bit */
+#define        W       0400            /* Illegal when read only bit */
+#define        F       01000           /* Is a conditional command */
+#define        T       02000           /* Is a transparent command */
+#define        R       04000           /* Cannot be called from collect */
+
+/*
+ * Oft-used mask values
+ */
+
+#define        MMNORM          (MDELETED|MSAVED)/* Look at both save and delete bits */
+#define        MMNDEL          MDELETED        /* Look only at deleted bit */
+
+/*
+ * Structure used to return a break down of a head
+ * line (hats off to Bill Joy!)
+ */
+
+struct headline {
+       char    *l_from;        /* The name of the sender */
+       char    *l_tty;         /* His tty string (if any) */
+       char    *l_date;        /* The entire date string */
+};
+
+#define        GTO     1               /* Grab To: line */
+#define        GSUBJECT 2              /* Likewise, Subject: line */
+#define        GCC     4               /* And the Cc: line */
+#define        GBCC    8               /* And also the Bcc: line */
+#define        GMASK   (GTO|GSUBJECT|GCC|GBCC)
+                               /* Mask of places from whence */
+
+#define        GNL     16              /* Print blank line after */
+#define        GDEL    32              /* Entity removed from list */
+#define        GCOMMA  64              /* detract puts in commas */
+
+/*
+ * Structure used to pass about the current
+ * state of the user-typed message header.
+ */
+
+struct header {
+       char    *h_to;                  /* Dynamic "To:" string */
+       char    *h_subject;             /* Subject string */
+       char    *h_cc;                  /* Carbon copies string */
+       char    *h_bcc;                 /* Blind carbon copies */
+       int     h_seq;                  /* Sequence for optimization */
+};
+
+/*
+ * Structure of namelist nodes used in processing
+ * the recipients of mail and aliases and all that
+ * kind of stuff.
+ */
+
+struct name {
+       struct  name *n_flink;          /* Forward link in list. */
+       struct  name *n_blink;          /* Backward list link */
+       short   n_type;                 /* From which list it came */
+       char    *n_name;                /* This fella's name */
+};
+
+/*
+ * Structure of a variable node.  All variables are
+ * kept on a singly-linked list of these, rooted by
+ * "variables"
+ */
+
+struct var {
+       struct  var *v_link;            /* Forward link to next variable */
+       char    *v_name;                /* The variable's name */
+       char    *v_value;               /* And it's current value */
+};
+
+struct group {
+       struct  group *ge_link;         /* Next person in this group */
+       char    *ge_name;               /* This person's user name */
+};
+
+struct grouphead {
+       struct  grouphead *g_link;      /* Next grouphead in list */
+       char    *g_name;                /* Name of this group */
+       struct  group *g_list;          /* Users in group. */
+};
+
+#define        NIL     ((struct name *) 0)     /* The nil pointer for namelists */
+#define        NONE    ((struct cmd *) 0)      /* The nil pointer to command tab */
+#define        NOVAR   ((struct var *) 0)      /* The nil pointer to variables */
+#define        NOGRP   ((struct grouphead *) 0)/* The nil grouphead pointer */
+#define        NOGE    ((struct group *) 0)    /* The nil group pointer */
+
+/*
+ * Structure of the hash table of ignored header fields
+ */
+struct ignore {
+       struct ignore   *i_link;        /* Next ignored field in bucket */
+       char            *i_field;       /* This ignored field */
+};
+
+/*
+ * Token values returned by the scanner used for argument lists.
+ * Also, sizes of scanner-related things.
+ */
+
+#define        TEOL    0                       /* End of the command line */
+#define        TNUMBER 1                       /* A message number */
+#define        TDASH   2                       /* A simple dash */
+#define        TSTRING 3                       /* A string (possibly containing -) */
+#define        TDOT    4                       /* A "." */
+#define        TUP     5                       /* An "^" */
+#define        TDOLLAR 6                       /* A "$" */
+#define        TSTAR   7                       /* A "*" */
+#define        TOPEN   8                       /* An '(' */
+#define        TCLOSE  9                       /* A ')' */
+#define TPLUS  10                      /* A '+' */
+
+#define        REGDEP  2                       /* Maximum regret depth. */
+#define        STRINGLEN       64              /* Maximum length of string token */
+
+/*
+ * Constants for conditional commands.  These describe whether
+ * we should be executing stuff or not.
+ */
+
+#define        CANY            0               /* Execute in send or receive mode */
+#define        CRCV            1               /* Execute in receive mode only */
+#define        CSEND           2               /* Execute in send mode only */
+
+/*
+ * Kludges to handle the change from setexit / reset to setjmp / longjmp
+ */
+
+#define        setexit()       setjmp(srbuf)
+#define        reset(x)        longjmp(srbuf, x)
+
+/*
+ * VM/UNIX has a vfork system call which is faster than forking.  If we
+ * don't have it, fork(2) will do . . .
+ */
+
+#ifndef VMUNIX
+#define        vfork() fork()
+#endif
+#ifndef        SIGRETRO
+#define        sigchild()
+#endif
+
+/*
+ * 4.2bsd signal interface help...
+ */
+#ifdef VMUNIX
+#define        sigset(s, a)    signal(s, a)
+#define        mask(s)         (1 << ((s) - 1))
+#define        sigsys(s, a)    signal(s, a)
+#endif
+
+/*
+ * Truncate a file to the last character written. This is
+ * useful just before closing an old file that was opened
+ * for read/write.
+ */
+#define trunc(stream)  ftruncate(fileno(stream), (long) ftell(stream))
+
+/*
+ * Forward declarations of routine types to keep lint and cc happy.
+ */
+
+FILE   *Fdopen();
+FILE   *collect();
+FILE   *infix();
+FILE   *mesedit();
+FILE   *mespipe();
+FILE   *popen();
+FILE   *setinput();
+char   **unpack();
+char   *addto();
+char   *arpafix();
+char   *calloc();
+char   *copy();
+char   *copyin();
+char   *detract();
+char   *expand();
+char   *gets();
+char   *hfield();
+char   *index();
+char   *name1();
+char   *nameof();
+char   *nextword();
+char   *getenv();
+char   *getfilename();
+char   *hcontents();
+char   *netmap();
+char   *netname();
+char   *readtty();
+char   *reedit();
+char   *rename();
+char   *revarpa();
+char   *rindex();
+char   *rpair();
+char   *salloc();
+char   *savestr();
+char   *skin();
+char   *snarf();
+char   *strcat();
+char   *strcpy();
+char   *value();
+char   *vcopy();
+char   *yankword();
+off_t  fsize();
+#ifndef VMUNIX
+int    (*sigset())();
+#endif
+struct cmd     *lex();
+struct grouphead       *findgroup();
+struct name    *cat();
+struct name    *delname();
+struct name    *elide();
+struct name    *extract();
+struct name    *gexpand();
+struct name    *map();
+struct name    *outof();
+struct name    *put();
+struct name    *usermap();
+struct name    *verify();
+struct var     *lookup();
+long   transmit();
+int    icequal();
+int    cmpdomain();
diff --git a/usr/src/ucb/Mail/glob.h b/usr/src/ucb/Mail/glob.h
new file mode 100644 (file)
index 0000000..5c1a135
--- /dev/null
@@ -0,0 +1,77 @@
+/*     glob.h  2.10    83/08/11        */
+
+/*
+ * A bunch of global variable declarations lie herein.
+ * def.h must be included first.
+ */
+
+int    msgCount;                       /* Count of messages read in */
+int    mypid;                          /* Current process id */
+int    rcvmode;                        /* True if receiving mail */
+int    sawcom;                         /* Set after first command */
+int    hflag;                          /* Sequence number for network -h */
+char   *rflag;                         /* -r address for network */
+char   *Tflag;                         /* -T temp file for netnews */
+char   nosrc;                          /* Don't source /usr/lib/Mail.rc */
+char   noheader;                       /* Suprress initial header listing */
+int    selfsent;                       /* User sent self something */
+int    senderr;                        /* An error while checking */
+int    edit;                           /* Indicates editing a file */
+int    readonly;                       /* Will be unable to rewrite file */
+int    noreset;                        /* String resets suspended */
+int    sourcing;                       /* Currently reading variant file */
+int    loading;                        /* Loading user definitions */
+int    shudann;                        /* Print headers when possible */
+int    cond;                           /* Current state of conditional exc. */
+FILE   *itf;                           /* Input temp file buffer */
+FILE   *otf;                           /* Output temp file buffer */
+FILE   *pipef;                         /* Pipe file we have opened */
+int    image;                          /* File descriptor for image of msg */
+FILE   *input;                         /* Current command input file */
+char   *editfile;                      /* Name of file being edited */
+char   *sflag;                         /* Subject given from non tty */
+int    outtty;                         /* True if standard output a tty */
+int    intty;                          /* True if standard input a tty */
+int    baud;                           /* Output baud rate */
+char   mbox[PATHSIZE];                 /* Name of mailbox file */
+char   mailname[PATHSIZE];             /* Name of system mailbox */
+int    uid;                            /* The invoker's user id */
+char   mailrc[PATHSIZE];               /* Name of startup file */
+char   deadletter[PATHSIZE];           /* Name of #/dead.letter */
+char   homedir[PATHSIZE];              /* Path name of home directory */
+char   myname[PATHSIZE];               /* My login id */
+off_t  mailsize;                       /* Size of system mailbox */
+int    lexnumber;                      /* Number of TNUMBER from scan() */
+char   lexstring[STRINGLEN];           /* String from TSTRING, scan() */
+int    regretp;                        /* Pointer to TOS of regret tokens */
+int    regretstack[REGDEP];            /* Stack of regretted tokens */
+char   *stringstack[REGDEP];           /* Stack of regretted strings */
+int    numberstack[REGDEP];            /* Stack of regretted numbers */
+struct message *dot;                   /* Pointer to current message */
+struct message *message;               /* The actual message structure */
+struct var     *variables[HSHSIZE];    /* Pointer to active var list */
+struct grouphead       *groups[HSHSIZE];/* Pointer to active groups */
+struct ignore          *ignore[HSHSIZE];/* Pointer to ignored fields */
+char   **altnames;                     /* List of alternate names for user */
+char   **localnames;                   /* List of aliases for our local host */
+int    debug;                          /* Debug flag set */
+int    rmail;                          /* Being called as rmail */
+
+#include <setjmp.h>
+
+jmp_buf        srbuf;
+
+
+/*
+ * The pointers for the string allocation routines,
+ * there are NSPACE independent areas.
+ * The first holds STRINGSIZE bytes, the next
+ * twice as much, and so on.
+ */
+
+#define        NSPACE  25                      /* Total number of string spaces */
+struct strings {
+       char    *s_topFree;             /* Beginning of this area */
+       char    *s_nextFree;            /* Next alloctable place here */
+       unsigned s_nleft;               /* Number of bytes left here */
+} stringdope[NSPACE];
diff --git a/usr/src/ucb/Mail/local.h b/usr/src/ucb/Mail/local.h
new file mode 100644 (file)
index 0000000..b08c811
--- /dev/null
@@ -0,0 +1,25 @@
+/*     local.h 2.2     83/08/11        */
+
+#ifdef V7
+#include "v7.local.h"
+#endif
+
+#ifdef CORY
+#include "c.local.h"
+#endif
+
+#ifdef INGRES
+#include "ing.local.h"
+#endif
+
+#ifdef V6
+#include "v6.local.h"
+#endif
+
+#ifdef CC
+#include "cc.local.h"
+#endif
+
+#ifdef V40
+#include "40.local.h"
+#endif
diff --git a/usr/src/ucb/Mail/rcv.h b/usr/src/ucb/Mail/rcv.h
new file mode 100644 (file)
index 0000000..eeb3b66
--- /dev/null
@@ -0,0 +1,14 @@
+/*     rcv.h   2.3     83/08/11        */
+
+/*
+ * Mail -- a mail program
+ *
+ * This file is included by normal files which want both
+ * globals and declarations.
+ */
+
+#ifdef pdp11
+#include <whoami.h>
+#endif
+#include "def.h"
+#include "glob.h"
diff --git a/usr/src/ucb/Mail/sigretro.h b/usr/src/ucb/Mail/sigretro.h
new file mode 100644 (file)
index 0000000..2cfc079
--- /dev/null
@@ -0,0 +1,18 @@
+/*     sigretro.h      4.1     83/08/11        */
+
+/*
+ * Define extra stuff not found in signal.h
+ */
+
+#ifndef SIGRETRO
+
+#define        SIGRETRO                                /* Can use this for cond code */
+
+#ifndef SIG_HOLD
+
+#define        SIG_HOLD        (int (*)()) 3           /* Phony action to hold sig */
+#define        BADSIG          (int (*)()) -1          /* Return value on error */
+
+#endif SIG_HOLD
+
+#endif SIGRETRO
diff --git a/usr/src/ucb/Mail/v7.local.h b/usr/src/ucb/Mail/v7.local.h
new file mode 100644 (file)
index 0000000..6249649
--- /dev/null
@@ -0,0 +1,37 @@
+/*     v7.local.h      2.6     83/08/11        */
+
+/*
+ * Declarations and constants specific to an installation.
+ *
+ * Vax/Unix version 7.
+ */
+
+#define        GETHOST                         /* System has gethostname syscall */
+#ifdef GETHOST
+#define        LOCAL           EMPTYID         /* Dynamically determined local host */
+#else
+#define        LOCAL           'j'             /* Local host id */
+#endif GETHOST
+
+#define        MAIL            "/bin/mail"     /* Name of mail sender */
+#define SENDMAIL       "/usr/lib/sendmail"
+                                       /* Name of classy mail deliverer */
+#define        EDITOR          "/usr/ucb/ex"   /* Name of text editor */
+#define        VISUAL          "/usr/ucb/vi"   /* Name of display editor */
+#define        SHELL           "/bin/csh"      /* Standard shell */
+#define        MORE            "/usr/ucb/more" /* Standard output pager */
+#define        HELPFILE        "/usr/lib/Mail.help"
+                                       /* Name of casual help file */
+#define        THELPFILE       "/usr/lib/Mail.help.~"
+#define        POSTAGE         "/usr/adm/maillog"
+                                       /* Where to audit mail sending */
+                                       /* Name of casual tilde help */
+#define        UIDMASK         0177777         /* Significant uid bits */
+#define        MASTER          "/usr/lib/Mail.rc"
+#define        APPEND                          /* New mail goes to end of mailbox */
+#define CANLOCK                                /* Locking protocol actually works */
+#define        UTIME                           /* System implements utime(2) */
+
+#ifndef VMUNIX
+#include "sigretro.h"                  /* Retrofit signal defs */
+#endif VMUNIX