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

1.1       root        1: #
                      2: 
                      3: /*
                      4:  * Mail -- a mail program
                      5:  *
                      6:  * EECS Cory 11/70 Version 7.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: #include <pwd.h>
                     16: 
                     17: /*
                     18:  * Locate the user's mailbox file (ie, the place where new, unread
                     19:  * mail is queued).  At Cory, it is in /usr/spool/mail/name.
                     20:  */
                     21: 
                     22: findmail()
                     23: {
                     24:        register char *cp;
                     25: 
                     26:        cp = copy("/usr/spool/mail/", mailname);
                     27:        copy(myname, cp);
                     28: }
                     29: 
                     30: /*
                     31:  * Get rid of the queued mail.
                     32:  */
                     33: 
                     34: demail()
                     35: {
                     36:        register int p;
                     37:        
                     38:        close(creat(mailname, 0666));
                     39:        alter(mailname);
                     40: }
                     41: 
                     42: /*
                     43:  * Mail file lock / unlock.
                     44:  * Insignificant on Cory version 7, since /usr/spool/mail not
                     45:  * generally writable.
                     46:  */
                     47: 
                     48: lock(name)
                     49:        char *name;
                     50: {
                     51: 
                     52:        return(0);
                     53: }
                     54: 
                     55: unlock()
                     56: {
                     57: 
                     58:        return(0);
                     59: }
                     60: 
                     61: /*
                     62:  * Discover user login name.
                     63:  */
                     64: 
                     65: username(uid, namebuf)
                     66:        char namebuf[];
                     67: {
                     68:        register char *np;
                     69: 
                     70:        if (uid == getuid() && (np = getenv("USER")) != NOSTR) {
                     71:                strncpy(namebuf, np, 9);
                     72:                return(0);
                     73:        }
                     74:        return(getname(uid, namebuf));
                     75: }
                     76: 
                     77: /*
                     78:  * Discover user name from uid.  Uses the fancy hashed passwd
                     79:  * data base available only on Cory Unix.
                     80:  */
                     81: 
                     82: getname(uid, namebuf)
                     83:        char namebuf[];
                     84: {
                     85:        struct passwd *gp;
                     86:        struct passwd *getpwuid();
                     87: 
                     88:        gp = getpwuid(uid);
                     89:        if (gp == (struct passwd *) 0)
                     90:                return(-1);
                     91:        strcpy(namebuf, gp->pw_name);
                     92:        return(0);
                     93: }
                     94: 
                     95: /*
                     96:  * Cory hall getuserid
                     97:  */
                     98: 
                     99: getuserid(name)
                    100:        char name[];
                    101: {
                    102:        struct passwd *gp;
                    103:        struct passwd *getpwnam();
                    104: 
                    105:        if ((gp = getpwnam(name)) == (struct passwd *) 0)
                    106:                return(-1);
                    107:        return(gp->pw_uid);
                    108: }

unix.superglobalmegacorp.com

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