Annotation of 43BSDReno/contrib/mh/uip/rcvpack.c, revision 1.1

1.1     ! root        1: /* rcvpack.c - a rcvmail program to keep a copy */
        !             2: 
        !             3: #include "../h/mh.h"
        !             4: #include "../h/dropsbr.h"
        !             5: #include "../h/rcvmail.h"
        !             6: #include "../zotnet/tws.h"
        !             7: #include "../zotnet/mts.h"
        !             8: 
        !             9: /*  */
        !            10: 
        !            11: static struct swit switches[] = {
        !            12: #define        HELPSW  0
        !            13:     "help", 4,
        !            14: 
        !            15:     NULL, NULL
        !            16: };
        !            17: 
        !            18: /*  */
        !            19: 
        !            20: long   lseek ();
        !            21: 
        !            22: /*  */
        !            23: 
        !            24: /* ARGSUSED */
        !            25: 
        !            26: main(argc, argv)
        !            27:        int argc;
        !            28:        char **argv;
        !            29: {
        !            30:     int     md;
        !            31:     char   *cp,
        !            32:            *file = NULL,
        !            33:             buf[100],
        !            34:            ddate[BUFSIZ],
        !            35:           **ap,
        !            36:           **argp,
        !            37:            *arguments[MAXARGS];
        !            38: 
        !            39:     invo_name = r1bindex (argv[0], '/');
        !            40:     mts_init (invo_name);
        !            41:     if ((cp = m_find (invo_name)) != NULL) {
        !            42:        ap = brkstring (cp = getcpy (cp), " ", "\n");
        !            43:        ap = copyip (ap, arguments);
        !            44:     }
        !            45:     else
        !            46:        ap = arguments;
        !            47:     (void) copyip (argv + 1, ap);
        !            48:     argp = arguments;
        !            49: 
        !            50: /*  */
        !            51: 
        !            52:     while (cp = *argp++) {
        !            53:        if (*cp == '-')
        !            54:            switch (smatch (++cp, switches)) {
        !            55:                case AMBIGSW:
        !            56:                    ambigsw (cp, switches);
        !            57:                    done (1);
        !            58:                case UNKWNSW:
        !            59:                    adios (NULLCP, "-%s unknown", cp);
        !            60:                case HELPSW:
        !            61:                    (void) sprintf (buf, "%s [switches] file", invo_name);
        !            62:                    help (buf, switches);
        !            63:                    done (1);
        !            64:            }
        !            65:        if (file)
        !            66:            adios (NULLCP, "only one file at a time!");
        !            67:        else
        !            68:            file = cp;
        !            69:     }
        !            70: 
        !            71: /*  */
        !            72: 
        !            73:     if (!file)
        !            74:        adios (NULLCP, "%s [switches] file", invo_name);
        !            75: 
        !            76:     (void) sprintf (ddate, "Delivery-Date: %s\n", dtimenow ());
        !            77:     rewind (stdin);
        !            78:     if ((md = mbx_open (file, getuid (), getgid (), m_gmprot ())) == NOTOK
        !            79:            || mbx_copy (file, md, fileno (stdin), 1, ddate, 0) == NOTOK
        !            80:            || mbx_close (file, md) == NOTOK) {
        !            81:        if (md != NOTOK)
        !            82:            (void) mbx_close (file, md);
        !            83:        done (RCV_MBX);
        !            84:     }
        !            85: 
        !            86:     done (RCV_MOK);
        !            87: }
        !            88: 
        !            89: /*
        !            90:  * XXX We need to force config.o to be linked in to get around
        !            91:  * library order problems
        !            92:  */
        !            93: /* XXX don't bother if linking with the shared library */
        !            94: #ifndef SHARED
        !            95: static void
        !            96: kludge()
        !            97: {
        !            98:        (void)libpath((char *)0);
        !            99: }
        !           100: #endif

unix.superglobalmegacorp.com

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