Annotation of 43BSD/usr.bin/uucp/getwd.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)getwd.c    5.4 (Berkeley) 6/19/85";
        !             3: #endif
        !             4: 
        !             5: #include "uucp.h"
        !             6: 
        !             7: /*
        !             8:  *     get working directory
        !             9:  *
        !            10:  *     return codes  0 = FAIL
        !            11:  *                   wkdir = SUCCES
        !            12:  */
        !            13: 
        !            14: char *
        !            15: getwd(wkdir)
        !            16: register char *wkdir;
        !            17: {
        !            18:        register FILE *fp;
        !            19:        extern FILE *rpopen();
        !            20:        extern int rpclose();
        !            21:        register char *c;
        !            22: 
        !            23:        *wkdir = '\0';
        !            24:        if ((fp = rpopen("PATH=/bin:/usr/bin:/usr/ucb;pwd 2>&-", "r")) == NULL)
        !            25:                return 0;
        !            26:        if (fgets(wkdir, 100, fp) == NULL) {
        !            27:                rpclose(fp);
        !            28:                return 0;
        !            29:        }
        !            30:        if (*(c = wkdir + strlen(wkdir) - 1) == '\n')
        !            31:                *c = '\0';
        !            32:        rpclose(fp);
        !            33:        return wkdir;
        !            34: }

unix.superglobalmegacorp.com

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