Annotation of 43BSDReno/contrib/mh/conf/config/config.c, revision 1.1.1.1

1.1       root        1: /* config.c - master MH configuration file */
                      2: 
                      3: /* @(MHWARNING) */
                      4: 
                      5: /* LINTLIBRARY */
                      6: 
                      7: #include "../h/mh.h"
                      8: #ifdef MHRC
                      9: #include <pwd.h>
                     10: #endif MHRC
                     11: #include <stdio.h>
                     12: 
                     13: 
                     14: @(MHCONFIG)
                     15: 
                     16: 
                     17: #ifdef MHRC
                     18: #ifdef SYS5
                     19: struct passwd *getpwnam ();
                     20: #endif SYS5
                     21: #endif MHRC
                     22: 
                     23: /*  */
                     24: 
                     25: static    char lpath[BUFSIZ];
                     26: 
                     27: char   *libpath (file)
                     28: char   *file;
                     29: {
                     30:     char   *cp;
                     31: #ifdef MHRC
                     32:     char   *pp;
                     33:     struct passwd  *pw;
                     34: #endif MHRC
                     35: 
                     36: #ifdef MHRC
                     37:     m_getdefs ();
                     38: #endif MHRC
                     39: 
                     40:     switch (*file) {
                     41:        case '/': 
                     42:            return file;
                     43: 
                     44: #ifdef MHRC
                     45:        case '~': 
                     46:            if (cp = index (pp = file + 1, '/'))
                     47:                *cp++ = NULL;
                     48:            if (*pp == NULL)
                     49:                pp = mypath;
                     50:            else
                     51:                if (pw = getpwnam (pp))
                     52:                    pp = pw -> pw_dir;
                     53:                else {
                     54:                    if (cp)
                     55:                        *--cp = '/';
                     56:                    goto try_it;
                     57:                }
                     58: 
                     59:            (void) sprintf (lpath, "%s/%s", pp, cp ? cp : "");
                     60:            if (cp)
                     61:                *--cp = '/';
                     62: 
                     63:            if (access (lpath, 04) != NOTOK)
                     64:                return lpath;   /* else fall */
                     65:     try_it: ;
                     66: #endif MHRC
                     67: 
                     68:        default: 
                     69:            if (access ((cp = m_maildir (file)), 04) != NOTOK)
                     70:                return cp;
                     71:     }
                     72: 
                     73:     (void) sprintf (lpath, "@(MHETCPATH)/%s", file);
                     74:     return (access (lpath, 04) != NOTOK ? lpath : file);
                     75: }
                     76: 
                     77: /*  */
                     78: 
                     79: /* 
                     80:  * Standard yes/no switches structure
                     81:  */
                     82: 
                     83: struct swit anoyes[] = {
                     84:     "no", 0,
                     85:     "yes", 0,
                     86:     NULL, NULL
                     87: };
                     88: 
                     89: /*  */
                     90: 
                     91: /* 
                     92:  * MH constants
                     93:  */
                     94: 
                     95: char   *components = "components";
                     96: char   *current = "cur";
                     97: char   *defalt = "inbox";
                     98: char   *digestcomps = "digestcomps";
                     99: char   *distcomps = "distcomps";
                    100: char   *draft = "draft";
                    101: char   *forwcomps = "forwcomps";
                    102: char   *mh_defaults = "@(MHETCPATH)/mh.profile";
                    103: char   *mh_profile = ".mh_profile";
                    104: char   *mhlformat = "mhl.format";
                    105: char   *mhlforward = "mhl.forward";
                    106: char   *nsequence = "Sequence-Negation";
                    107: char   *pfolder = "Current-Folder";
                    108: char   *psequence = "Previous-Sequence";
                    109: char   *rcvdistcomps = "rcvdistcomps";
                    110: char   *replcomps = "replcomps";
                    111: char   *usequence = "Unseen-Sequence";
                    112: 
                    113: 
                    114: /* 
                    115:  * MH not-so constants
                    116:  */
                    117: 
                    118: char   *context = "context";
                    119: #ifndef        NOMHSEQ
                    120: char   *mh_seq = ".mh_sequences";
                    121: #else  NOMHSEQ
                    122: char   *mh_seq = NULL;
                    123: #endif NOMHSEQ
                    124: 
                    125: 
                    126: /* 
                    127:  * MH globals
                    128:  */
                    129: 
                    130: char    ctxflags;              /* status of user's context */
                    131: 
                    132: char   *invo_name;             /* pgm invocation name */
                    133: char   *mypath;                        /* user's $HOME */
                    134: char   *defpath;               /* pathname of user's profile */
                    135: char   *ctxpath;               /* pathname of user's context */
                    136: 
                    137: struct node *m_defs;           /* profile/context structure */
                    138: 
                    139: /*  */
                    140: 
                    141: /* 
                    142:  * MH processes
                    143:  */
                    144: 
                    145: 
                    146: /*
                    147:  * This program is usually called directly by users, but it is
                    148:  * also invoked by the post program to process an "fcc".
                    149:  */
                    150: 
                    151: char   *fileproc = "@(MHBINPATH)/refile";
                    152: 
                    153: 
                    154: /* 
                    155:  * This program is called to incorporate messages into a folder.
                    156:  */
                    157: 
                    158: char   *incproc = "@(MHBINPATH)/inc";
                    159: 
                    160: 
                    161: /*
                    162:  * When a user runs an MH program for the first time, this program
                    163:  * is called to create his MH profile, and mail directory.
                    164:  */
                    165: 
                    166: char   *installproc = "@(MHETCPATH)/install-mh";
                    167: 
                    168: 
                    169: /*
                    170:  * This is the program invoked by a "list" response to "What now?"
                    171:  *  whereas, showproc is the program invoked by show, next, prev.
                    172:  */
                    173: 
                    174: #ifndef        MORE
                    175: char   *lproc = "/usr/ucb/more";
                    176: #else  MORE
                    177: char   *lproc = MORE;
                    178: #endif MORE
                    179: 
                    180: 
                    181: /*
                    182:  * This is the path for the Bell equivalent mail program.
                    183:  */
                    184: 
                    185: char   *mailproc = "@(MHBINPATH)/mhmail";
                    186: 
                    187: 
                    188: /*
                    189:  * mhl runs this program as a front-end.
                    190:  */
                    191: 
                    192: #ifndef        MORE
                    193: char   *moreproc = "/usr/ucb/more";
                    194: #else  MORE
                    195: char   *moreproc = MORE;
                    196: #endif MORE
                    197: 
                    198: 
                    199: /* 
                    200:  * This program is mhl - the nifty message lister
                    201:  */
                    202: 
                    203: char   *mhlproc = "@(MHETCPATH)/mhl";
                    204: 
                    205: 
                    206: /* 
                    207:  * This is the super handy BBoard reading program, which is really just the MH
                    208:  * shell program
                    209:  */
                    210: 
                    211: char   *mshproc = "@(MHBINPATH)/msh";
                    212: 
                    213: 
                    214: /* 
                    215:  * This program is called to pack a folder.  
                    216:  */
                    217: 
                    218: char   *packproc = "@(MHBINPATH)/packf";
                    219: 
                    220: 
                    221: /*
                    222:  * This is the delivery program called through send to
                    223:  * actually deliver mail to users.  This is the interface to
                    224:  * the MTS.
                    225:  */
                    226: 
                    227: #if BERK && SENDMTS
                    228: char   *postproc = "@(MHETCPATH)/spost";
                    229: #else
                    230: char   *postproc = "@(MHETCPATH)/post";
                    231: #endif BERK
                    232: 
                    233: 
                    234: /* 
                    235:  * This program is called to remove a folder.  
                    236:  */
                    237: 
                    238: char   *rmfproc = "@(MHBINPATH)/rmf";
                    239: 
                    240: 
                    241: /* 
                    242:  * This program is called to remove a message by rmm or refile -nolink.
                    243:  * It's usually empty, which means to rename the file to a backup name.
                    244:  */
                    245: 
                    246: char   *rmmproc = NULL;
                    247: 
                    248: 
                    249: /*
                    250:  * This program is usually called by the user's whatnowproc, but it
                    251:  * may also be called directly to send a message previously composed.
                    252:  */
                    253: 
                    254: char   *sendproc = "@(MHBINPATH)/send";
                    255: 
                    256: 
                    257: /*
                    258:  * This program is called to list messages by the show program.
                    259:  * By setting showproc to mhl, the user can run mhl instead.
                    260:  */
                    261: 
                    262: #ifndef        MORE
                    263: char   *showproc = "/usr/ucb/more";
                    264: #else  MORE
                    265: char   *showproc = MORE;
                    266: #endif MORE
                    267: 
                    268: 
                    269: /* 
                    270:  * This program is called under stand-alone MH to deliver a message to
                    271:  * a local user.  Under other MTS's it can be used to emulate a
                    272:  * MMDF-II .maildelivery mechanism.
                    273:  */
                    274: 
                    275: char   *slocalproc = "@(MHETCPATH)/slocal";
                    276: 
                    277: 
                    278: /* 
                    279:  * This program is called by vmh as the back-end to the window management
                    280:  * protocol
                    281:  */
                    282: 
                    283: char   *vmhproc = "@(MHBINPATH)/msh";
                    284: 
                    285: 
                    286: /* 
                    287:  * This program is called after comp, et. al., have built a draft
                    288:  */
                    289: 
                    290: char   *whatnowproc = "@(MHBINPATH)/whatnow";
                    291: 
                    292: 
                    293: /* 
                    294:  * This program is called to list/validate the addresses in a message.
                    295:  */
                    296: 
                    297: char   *whomproc = "@(MHBINPATH)/whom";
                    298: 
                    299: /*  */
                    300: 
                    301: /*
                    302:  * This is the editor invoked by the various message composition
                    303:  * programs.  It SHOULD be a 2-D scope editor, such as Rand's ned
                    304:  * or Berkeley's ex, but any editor will work.  We use prompter as
                    305:  * the default, since with -prepend it works just fine with forw.
                    306:  */
                    307: 
                    308: char   *sysed = "@(MHEDITOR)";
                    309: 
                    310: 
                    311: /* 
                    312:  * This is the MH alias file.
                    313:  */
                    314: 
                    315: char   *AliasFile = "@(MHETCPATH)/MailAliases";
                    316: 
                    317: /*  */
                    318: 
                    319: /* 
                    320:  * File protections
                    321:  */
                    322: 
                    323: 
                    324: /*
                    325:  * Folders (directories) are created with this protection (mode)
                    326:  */
                    327: 
                    328: #ifndef        FOLDPROT
                    329: #define        FOLDPROT        "0711"
                    330: #endif not FOLDPROT
                    331: 
                    332: char   *foldprot = FOLDPROT;
                    333: 
                    334: 
                    335: /*
                    336:  * Every NEW message will be created with this protection.  When a
                    337:  * message is filed it retains its protection, so this only applies
                    338:  * to messages coming in through inc.
                    339:  */
                    340: 
                    341: #ifndef        MSGPROT
                    342: #define        MSGPROT         "0644"
                    343: #endif not MSGPROT
                    344: 
                    345: char   *msgprot = MSGPROT;

unix.superglobalmegacorp.com

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