12513Sdlw /* 2*12029Sdlw char id_stat[] = "@(#)stat_.c 1.2"; 32513Sdlw * 42513Sdlw * get file status 52513Sdlw * 62513Sdlw * calling sequence: 7*12029Sdlw * integer stat, statb(12) 82513Sdlw * call stat (name, statb) 92513Sdlw * where: 102513Sdlw * 'statb' will receive the stat structure for file 'name'. 112513Sdlw */ 122513Sdlw 132513Sdlw #include <sys/types.h> 142513Sdlw #include <sys/stat.h> 152513Sdlw #include "../libI77/f_errno.h" 162513Sdlw 172513Sdlw long stat_(name, stbuf, namlen) 182513Sdlw char *name; long *stbuf, namlen; 192513Sdlw { 20*12029Sdlw char buf[256]; 212513Sdlw struct stat statb; 222513Sdlw 232513Sdlw if (namlen >= sizeof buf) 242513Sdlw return((long)(errno=F_ERARG)); 252513Sdlw g_char(name, namlen, buf); 262513Sdlw if (stat(buf, &statb) == 0) 272513Sdlw { 282513Sdlw *stbuf++ = statb.st_dev; 292513Sdlw *stbuf++ = statb.st_ino; 302513Sdlw *stbuf++ = statb.st_mode; 312513Sdlw *stbuf++ = statb.st_nlink; 322513Sdlw *stbuf++ = statb.st_uid; 332513Sdlw *stbuf++ = statb.st_gid; 342513Sdlw *stbuf++ = statb.st_rdev; 352513Sdlw *stbuf++ = statb.st_size; 362513Sdlw *stbuf++ = statb.st_atime; 372513Sdlw *stbuf++ = statb.st_mtime; 382513Sdlw *stbuf++ = statb.st_ctime; 39*12029Sdlw *stbuf++ = statb.st_blksize; 402513Sdlw return(0L); 412513Sdlw } 422513Sdlw return ((long)errno); 432513Sdlw } 44