Annotation of 43BSDReno/lib/libU77/chmod_.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1980 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  *
                      6:  *     @(#)chmod_.c    5.1     6/7/85
                      7:  */
                      8: 
                      9: /*
                     10:  * chmod - change file mode bits
                     11:  *
                     12:  * synopsis:
                     13:  *     integer function chmod (fname, mode)
                     14:  *     character*(*) fname, mode
                     15:  */
                     16: 
                     17: #include "../libI77/f_errno.h"
                     18: #include <sys/param.h>
                     19: #ifndef        MAXPATHLEN
                     20: #define MAXPATHLEN     128
                     21: #endif
                     22: 
                     23: long chmod_(name, mode, namlen, modlen)
                     24: char   *name, *mode;
                     25: long   namlen, modlen;
                     26: {
                     27:        char    nambuf[MAXPATHLEN];
                     28:        char    modbuf[32];
                     29:        int     retcode;
                     30: 
                     31:        if (namlen >= sizeof nambuf || modlen >= sizeof modbuf)
                     32:                return((long)(errno=F_ERARG));
                     33:        g_char(name, namlen, nambuf);
                     34:        g_char(mode, modlen, modbuf);
                     35:        if (nambuf[0] == '\0')
                     36:                return((long)(errno=ENOENT));
                     37:        if (modbuf[0] == '\0')
                     38:                return((long)(errno=F_ERARG));
                     39:        if (fork())
                     40:        {
                     41:                if (wait(&retcode) == -1)
                     42:                        return((long)errno);
                     43:                return((long)retcode);
                     44:        }
                     45:        else
                     46:                execl("/bin/chmod", "chmod", modbuf, nambuf, (char *)0);
                     47: }

unix.superglobalmegacorp.com

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