Annotation of 41BSD/cmd/uucp/gwd.c, revision 1.1

1.1     ! root        1: #include "uucp.h"
        !             2: 
        !             3: /*******
        !             4:  *     gwd(wkdir)      get working directory
        !             5:  *
        !             6:  *     return codes  0 | FAIL
        !             7:  */
        !             8: 
        !             9: gwd(wkdir)
        !            10: char *wkdir;
        !            11: {
        !            12:        FILE *fp;
        !            13:        extern FILE *popen(), *pclose();
        !            14:        char *c;
        !            15: 
        !            16:        if ((fp = popen("pwd", "r")) == NULL)
        !            17:                return(FAIL);
        !            18:        if (fgets(wkdir, 100, fp) == NULL) {
        !            19:                pclose(fp);
        !            20:                return(FAIL);
        !            21:        }
        !            22:        if (*(c = wkdir + strlen(wkdir) - 1) == '\n')
        !            23:                *c = '\0';
        !            24:        pclose(fp);
        !            25:        return(0);
        !            26: }

unix.superglobalmegacorp.com

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