|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: static char *sccsid = "@(#)v7.local.c 5.2 (Berkeley) 6/21/85"; ! 9: #endif not lint ! 10: ! 11: /* ! 12: * Mail -- a mail program ! 13: * ! 14: * Version 7 ! 15: * ! 16: * Local routines that are installation dependent. ! 17: */ ! 18: ! 19: #include "rcv.h" ! 20: ! 21: /* ! 22: * Locate the user's mailbox file (ie, the place where new, unread ! 23: * mail is queued). In Version 7, it is in /usr/spool/mail/name. ! 24: */ ! 25: ! 26: findmail() ! 27: { ! 28: register char *cp; ! 29: ! 30: cp = copy("/usr/spool/mail/", mailname); ! 31: copy(myname, cp); ! 32: if (isdir(mailname)) { ! 33: stradd(mailname, '/'); ! 34: strcat(mailname, myname); ! 35: } ! 36: } ! 37: ! 38: /* ! 39: * Get rid of the queued mail. ! 40: */ ! 41: ! 42: demail() ! 43: { ! 44: ! 45: if (value("keep") != NOSTR) ! 46: close(creat(mailname, 0666)); ! 47: else { ! 48: if (remove(mailname) < 0) ! 49: close(creat(mailname, 0666)); ! 50: } ! 51: } ! 52: ! 53: /* ! 54: * Discover user login name. ! 55: */ ! 56: ! 57: username(uid, namebuf) ! 58: char namebuf[]; ! 59: { ! 60: register char *np; ! 61: ! 62: if (uid == getuid() && (np = getenv("USER")) != NOSTR) { ! 63: strncpy(namebuf, np, PATHSIZE); ! 64: return(0); ! 65: } ! 66: return(getname(uid, namebuf)); ! 67: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.