Annotation of researchv10no/lbin/mailx/temp.c, revision 1.1

1.1     ! root        1: #ident "@(#)temp.c     1.4 'attmail mail(1) command'"
        !             2: #ident "@(#)mailx:temp.c       1.5.1.1"
        !             3: /*     Copyright (c) 1984 AT&T */
        !             4: /*       All Rights Reserved   */
        !             5: 
        !             6: /*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
        !             7: /*     The copyright notice above does not evidence any        */
        !             8: /*     actual or intended publication of such source code.     */
        !             9: 
        !            10: #ident "@(#)mailx:temp.c       1.5"
        !            11: 
        !            12: #include "rcv.h"
        !            13: #include <pwd.h>
        !            14: #ifdef preSVr4
        !            15: extern struct passwd *getpwnam();
        !            16: extern struct passwd *getpwuid();
        !            17: #endif
        !            18: 
        !            19: /*
        !            20:  * mailx -- a modified version of a University of California at Berkeley
        !            21:  *     mail program
        !            22:  *
        !            23:  * Give names to all the temporary files that we will need.
        !            24:  */
        !            25: 
        !            26: void
        !            27: tinit()
        !            28: {
        !            29: /*     char usrname[PATHSIZE];                 why is this here??  adb */
        !            30:        register int err = 0;
        !            31:        register pid_t pid = mypid;
        !            32: 
        !            33:        sprintf(tempMail, "/tmp/Rs%-ld", pid);
        !            34:        sprintf(tempResid, "/tmp/Rq%-ld", pid);                 /* adb */
        !            35:        sprintf(tempQuit, "/tmp/Rm%-ld", pid);
        !            36:        sprintf(tempEdit, "/tmp/Re%-ld", pid);
        !            37:        sprintf(tempSet, "/tmp/Rx%-ld", pid);
        !            38:        sprintf(tempMesg, "/tmp/Rx%-ld", pid);
        !            39:        sprintf(tempZedit, "/tmp/Rz%-ld", pid);
        !            40: 
        !            41:        /* check the uid if myname was set by -u */
        !            42:        if (strlen(myname) != 0) {
        !            43:                struct passwd *pwd = getpwnam(myname);
        !            44:                if (!pwd) {
        !            45:                        printf("\"%s\" is not a user of this system\n",
        !            46:                            myname);
        !            47:                        exit(1);
        !            48:                }
        !            49:                else
        !            50:                        uid = pwd->pw_uid;
        !            51:                endpwent();
        !            52:        }
        !            53:        /* get the name associated with this uid */
        !            54:        else {
        !            55:                struct passwd *pwd = getpwuid(uid = myruid);
        !            56:                if (!pwd) {
        !            57:                        copy("ubluit", myname);
        !            58:                        err++;
        !            59:                        if (rcvmode) {
        !            60:                                printf("Who are you!?\n");
        !            61:                                exit(1);
        !            62:                        }
        !            63:                }
        !            64:                else
        !            65:                        copy(pwd->pw_name, myname);
        !            66:                endpwent();
        !            67:        }
        !            68:        strcpy(homedir, Getf("HOME"));
        !            69:        findmail();
        !            70:        assign("MBOX", Getf("MBOX"));
        !            71:        assign("MAILRC", Getf("MAILRC"));
        !            72:        assign("DEAD", Getf("DEAD"));
        !            73:        assign("save", "");
        !            74:        assign("asksub", "");
        !            75:        assign("header", "");
        !            76: }

unix.superglobalmegacorp.com

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