12513Sdlw /* 2*12146Sdlw char id_stat[] = "@(#)stat_.c 1.3"; 32513Sdlw * 42513Sdlw * get file status 52513Sdlw * 62513Sdlw * calling sequence: 712029Sdlw * integer stat, statb(12) 82513Sdlw * call stat (name, statb) 92513Sdlw * where: 102513Sdlw * 'statb' will receive the stat structure for file 'name'. 112513Sdlw */ 122513Sdlw 13*12146Sdlw #include <sys/param.h> 14*12146Sdlw #ifndef MAXPATHLEN 15*12146Sdlw #define MAXPATHLEN 128 16*12146Sdlw #endif 172513Sdlw #include <sys/stat.h> 182513Sdlw #include "../libI77/f_errno.h" 192513Sdlw 202513Sdlw long stat_(name, stbuf, namlen) 212513Sdlw char *name; long *stbuf, namlen; 222513Sdlw { 23*12146Sdlw char buf[MAXPATHLEN]; 242513Sdlw struct stat statb; 252513Sdlw 262513Sdlw if (namlen >= sizeof buf) 272513Sdlw return((long)(errno=F_ERARG)); 282513Sdlw g_char(name, namlen, buf); 292513Sdlw if (stat(buf, &statb) == 0) 302513Sdlw { 312513Sdlw *stbuf++ = statb.st_dev; 322513Sdlw *stbuf++ = statb.st_ino; 332513Sdlw *stbuf++ = statb.st_mode; 342513Sdlw *stbuf++ = statb.st_nlink; 352513Sdlw *stbuf++ = statb.st_uid; 362513Sdlw *stbuf++ = statb.st_gid; 372513Sdlw *stbuf++ = statb.st_rdev; 382513Sdlw *stbuf++ = statb.st_size; 392513Sdlw *stbuf++ = statb.st_atime; 402513Sdlw *stbuf++ = statb.st_mtime; 412513Sdlw *stbuf++ = statb.st_ctime; 4212029Sdlw *stbuf++ = statb.st_blksize; 432513Sdlw return(0L); 442513Sdlw } 452513Sdlw return ((long)errno); 462513Sdlw } 47