| 1 | # |
| 2 | |
| 3 | /* |
| 4 | * Mail -- a mail program |
| 5 | * |
| 6 | * 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 | static char *SccsId = "@(#)v6.local.c 2.1 %G%"; |
| 15 | |
| 16 | #include "rcv.h" |
| 17 | |
| 18 | /* |
| 19 | * Locate the user's mailbox file (ie, the place where new, unread |
| 20 | * mail is queued). In Version 6, it is in ~/.mail |
| 21 | */ |
| 22 | |
| 23 | findmail() |
| 24 | { |
| 25 | register char *cp; |
| 26 | |
| 27 | cp = copy(homedir, mailname); |
| 28 | copy("/.mail", cp); |
| 29 | } |
| 30 | |
| 31 | /* |
| 32 | * Get rid of the queued mail. |
| 33 | */ |
| 34 | |
| 35 | demail() |
| 36 | { |
| 37 | close(creat(mailname, 0666)); |
| 38 | alter(mailname); |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * Get an environment variable. At present, we only support |
| 43 | * "SHELL" and "HOME". This routine makes use of the getpw |
| 44 | * routine in the neighboring getname.c stuff. |
| 45 | */ |
| 46 | |
| 47 | char * |
| 48 | getenv(name) |
| 49 | char name[]; |
| 50 | { |
| 51 | char pwline[LINESIZE]; |
| 52 | static char val[30]; |
| 53 | register char *cp, *dp; |
| 54 | register int cc; |
| 55 | |
| 56 | if (equal(name, "SHELL")) |
| 57 | cc = 6; |
| 58 | else if (equal(name, "HOME")) |
| 59 | cc = 5; |
| 60 | else |
| 61 | return(NOSTR); |
| 62 | if (getpw(uid, pwline) < 0) |
| 63 | return(NOSTR); |
| 64 | for (cp = pwline; *cp && cc > 0;) |
| 65 | if (*cp++ == ':') |
| 66 | cc--; |
| 67 | dp = cp; |
| 68 | while (*cp != ':' && *cp != '\0') |
| 69 | cp++; |
| 70 | *cp = '\0'; |
| 71 | if (*dp == '\0') |
| 72 | return(NOSTR); |
| 73 | copy(dp, val); |
| 74 | return(val); |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | * Lock and unlock retrofits which are only |
| 79 | * significant in version 7. |
| 80 | */ |
| 81 | |
| 82 | lock(name) |
| 83 | char *name; |
| 84 | { |
| 85 | |
| 86 | return(0); |
| 87 | } |
| 88 | |
| 89 | unlock() |
| 90 | { |
| 91 | |
| 92 | return(0); |
| 93 | } |
| 94 | |
| 95 | /* |
| 96 | * Discover user login name. |
| 97 | */ |
| 98 | |
| 99 | username(uid, namebuf) |
| 100 | char namebuf[]; |
| 101 | { |
| 102 | |
| 103 | return(getname(uid, namebuf)); |
| 104 | } |