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

1.1     ! root        1: /*
        !             2: char id_stat[] = "@(#)stat_.c  1.3";
        !             3:  *
        !             4:  * get file status
        !             5:  *
        !             6:  * calling sequence:
        !             7:  *     integer stat, statb(12)
        !             8:  *     call stat (name, statb)
        !             9:  * where:
        !            10:  *     'statb' will receive the stat structure for file 'name'.
        !            11:  */
        !            12: 
        !            13: #include <sys/param.h>
        !            14: #ifndef        MAXPATHLEN
        !            15: #define MAXPATHLEN     128
        !            16: #endif
        !            17: #include <sys/stat.h>
        !            18: #include "../libI77/f_errno.h"
        !            19: 
        !            20: long stat_(name, stbuf, namlen)
        !            21: char *name; long *stbuf, namlen;
        !            22: {
        !            23:        char buf[MAXPATHLEN];
        !            24:        struct stat statb;
        !            25: 
        !            26:        if (namlen >= sizeof buf)
        !            27:                return((long)(errno=F_ERARG));
        !            28:        g_char(name, namlen, buf);
        !            29:        if (stat(buf, &statb) == 0)
        !            30:        {
        !            31:                *stbuf++ = statb.st_dev;
        !            32:                *stbuf++ = statb.st_ino;
        !            33:                *stbuf++ = statb.st_mode;
        !            34:                *stbuf++ = statb.st_nlink;
        !            35:                *stbuf++ = statb.st_uid;
        !            36:                *stbuf++ = statb.st_gid;
        !            37:                *stbuf++ = statb.st_rdev;
        !            38:                *stbuf++ = statb.st_size;
        !            39:                *stbuf++ = statb.st_atime;
        !            40:                *stbuf++ = statb.st_mtime;
        !            41:                *stbuf++ = statb.st_ctime;
        !            42:                *stbuf++ = statb.st_blksize;
        !            43:                return(0L);
        !            44:        }
        !            45:        return ((long)errno);
        !            46: }

unix.superglobalmegacorp.com

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