Annotation of 40BSD/cmd/ucbmail/40.local.c, revision 1.1

1.1     ! root        1: #
        !             2: 
        !             3: /*
        !             4:  * Mail -- a mail program
        !             5:  *
        !             6:  * Ingres 11/70.  Unix version 6.0
        !             7:  *
        !             8:  * Local routines that are installation dependent.
        !             9:  * All fiddlers please note:  if you make careful note of
        !            10:  * what you change here, I will incorporate your changes and
        !            11:  * you won't have to remake them each release.
        !            12:  */
        !            13: 
        !            14: #include "rcv.h"
        !            15: 
        !            16: /*
        !            17:  * Locate the user's mailbox file (ie, the place where new, unread
        !            18:  * mail is queued).  On the 11/40, it is in /usr/mail/name
        !            19:  */
        !            20: 
        !            21: findmail()
        !            22: {
        !            23:        register char *cp;
        !            24: 
        !            25:        cp = copy("/usr/mail/", mailname);
        !            26:        copy(myname, cp);
        !            27: }
        !            28: 
        !            29: /*
        !            30:  * Get rid of the queued mail.
        !            31:  */
        !            32: 
        !            33: demail()
        !            34: {
        !            35: 
        !            36:        close(creat(mailname, 0644));
        !            37:        alter(mailname);
        !            38: }
        !            39: 
        !            40: /*
        !            41:  * Get an environment variable.  At present, we only support
        !            42:  * "SHELL" and "HOME".  This routine makes use of the getpw
        !            43:  * routine in the neighboring getname.c stuff.
        !            44:  */
        !            45: 
        !            46: char *
        !            47: getenv(name)
        !            48:        char name[];
        !            49: {
        !            50:        char pwline[LINESIZE];
        !            51:        static char val[30];
        !            52:        register char *cp, *dp;
        !            53:        register int cc;
        !            54: 
        !            55:        if (equal(name, "SHELL"))
        !            56:                cc = 6;
        !            57:        else if (equal(name, "HOME"))
        !            58:                cc = 5;
        !            59:        else
        !            60:                return(NOSTR);
        !            61:        if (getpw(uid, pwline) < 0)
        !            62:                return(NOSTR);
        !            63:        for (cp = pwline; *cp && cc > 0;)
        !            64:                if (*cp++ == ':')
        !            65:                        cc--;
        !            66:        dp = cp;
        !            67:        while (*cp != ':' && *cp != '\0')
        !            68:                cp++;
        !            69:        *cp = '\0';
        !            70:        if (*dp == '\0')
        !            71:                return(NOSTR);
        !            72:        copy(dp, val);
        !            73:        return(val);
        !            74: }
        !            75: 
        !            76: /*
        !            77:  * Lock and unlock retrofits which are only
        !            78:  * significant in version 7.
        !            79:  */
        !            80: 
        !            81: lock(name)
        !            82:        char *name;
        !            83: {
        !            84: 
        !            85:        return(0);
        !            86: }
        !            87: 
        !            88: unlock()
        !            89: {
        !            90: 
        !            91:        return(0);
        !            92: }
        !            93: 
        !            94: /*
        !            95:  * discover user's login name.
        !            96:  */
        !            97: 
        !            98: username(uid, namebuf)
        !            99:        char namebuf[];
        !           100: {
        !           101: 
        !           102:        return(getname(uid, namebuf));
        !           103: }

unix.superglobalmegacorp.com

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