Annotation of 42BSD/usr.lib/libU77/chmod_.c, revision 1.1

1.1     ! root        1: /*
        !             2: char   id_chmod[]      = "@(#)chmod_.c 1.2";
        !             3:  *
        !             4:  * chmod - change file mode bits
        !             5:  *
        !             6:  * synopsis:
        !             7:  *     integer function chmod (fname, mode)
        !             8:  *     character*(*) fname, mode
        !             9:  */
        !            10: 
        !            11: #include "../libI77/f_errno.h"
        !            12: #include <sys/param.h>
        !            13: #ifndef        MAXPATHLEN
        !            14: #define MAXPATHLEN     128
        !            15: #endif
        !            16: 
        !            17: long chmod_(name, mode, namlen, modlen)
        !            18: char   *name, *mode;
        !            19: long   namlen, modlen;
        !            20: {
        !            21:        char    nambuf[MAXPATHLEN];
        !            22:        char    modbuf[32];
        !            23:        int     retcode;
        !            24: 
        !            25:        if (namlen >= sizeof nambuf || modlen >= sizeof modbuf)
        !            26:                return((long)(errno=F_ERARG));
        !            27:        g_char(name, namlen, nambuf);
        !            28:        g_char(mode, modlen, modbuf);
        !            29:        if (nambuf[0] == '\0')
        !            30:                return((long)(errno=ENOENT));
        !            31:        if (modbuf[0] == '\0')
        !            32:                return((long)(errno=F_ERARG));
        !            33:        if (fork())
        !            34:        {
        !            35:                if (wait(&retcode) == -1)
        !            36:                        return((long)errno);
        !            37:                return((long)retcode);
        !            38:        }
        !            39:        else
        !            40:                execl("/bin/chmod", "chmod", modbuf, nambuf, (char *)0);
        !            41: }

unix.superglobalmegacorp.com

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