|
|
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: * @(#)stat_.c 5.1 6/7/85 ! 7: */ ! 8: ! 9: /* ! 10: * get file status ! 11: * ! 12: * calling sequence: ! 13: * integer stat, statb(12) ! 14: * call stat (name, statb) ! 15: * where: ! 16: * 'statb' will receive the stat structure for file 'name'. ! 17: */ ! 18: ! 19: #include <sys/param.h> ! 20: #ifndef MAXPATHLEN ! 21: #define MAXPATHLEN 128 ! 22: #endif ! 23: #include <sys/stat.h> ! 24: #include "../libI77/f_errno.h" ! 25: ! 26: long stat_(name, stbuf, namlen) ! 27: char *name; long *stbuf, namlen; ! 28: { ! 29: char buf[MAXPATHLEN]; ! 30: struct stat statb; ! 31: ! 32: if (namlen >= sizeof buf) ! 33: return((long)(errno=F_ERARG)); ! 34: g_char(name, namlen, buf); ! 35: if (stat(buf, &statb) == 0) ! 36: { ! 37: *stbuf++ = statb.st_dev; ! 38: *stbuf++ = statb.st_ino; ! 39: *stbuf++ = statb.st_mode; ! 40: *stbuf++ = statb.st_nlink; ! 41: *stbuf++ = statb.st_uid; ! 42: *stbuf++ = statb.st_gid; ! 43: *stbuf++ = statb.st_rdev; ! 44: *stbuf++ = statb.st_size; ! 45: *stbuf++ = statb.st_atime; ! 46: *stbuf++ = statb.st_mtime; ! 47: *stbuf++ = statb.st_ctime; ! 48: *stbuf++ = statb.st_blksize; ! 49: return(0L); ! 50: } ! 51: return ((long)errno); ! 52: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.