12513Sdlw /* 2*23047Skre * Copyright (c) 1980 Regents of the University of California. 3*23047Skre * All rights reserved. The Berkeley software License Agreement 4*23047Skre * specifies the terms and conditions for redistribution. 52513Sdlw * 6*23047Skre * @(#)stat_.c 5.1 06/07/85 7*23047Skre */ 8*23047Skre 9*23047Skre /* 102513Sdlw * get file status 112513Sdlw * 122513Sdlw * calling sequence: 1312029Sdlw * integer stat, statb(12) 142513Sdlw * call stat (name, statb) 152513Sdlw * where: 162513Sdlw * 'statb' will receive the stat structure for file 'name'. 172513Sdlw */ 182513Sdlw 1912146Sdlw #include <sys/param.h> 2012146Sdlw #ifndef MAXPATHLEN 2112146Sdlw #define MAXPATHLEN 128 2212146Sdlw #endif 232513Sdlw #include <sys/stat.h> 242513Sdlw #include "../libI77/f_errno.h" 252513Sdlw 262513Sdlw long stat_(name, stbuf, namlen) 272513Sdlw char *name; long *stbuf, namlen; 282513Sdlw { 2912146Sdlw char buf[MAXPATHLEN]; 302513Sdlw struct stat statb; 312513Sdlw 322513Sdlw if (namlen >= sizeof buf) 332513Sdlw return((long)(errno=F_ERARG)); 342513Sdlw g_char(name, namlen, buf); 352513Sdlw if (stat(buf, &statb) == 0) 362513Sdlw { 372513Sdlw *stbuf++ = statb.st_dev; 382513Sdlw *stbuf++ = statb.st_ino; 392513Sdlw *stbuf++ = statb.st_mode; 402513Sdlw *stbuf++ = statb.st_nlink; 412513Sdlw *stbuf++ = statb.st_uid; 422513Sdlw *stbuf++ = statb.st_gid; 432513Sdlw *stbuf++ = statb.st_rdev; 442513Sdlw *stbuf++ = statb.st_size; 452513Sdlw *stbuf++ = statb.st_atime; 462513Sdlw *stbuf++ = statb.st_mtime; 472513Sdlw *stbuf++ = statb.st_ctime; 4812029Sdlw *stbuf++ = statb.st_blksize; 492513Sdlw return(0L); 502513Sdlw } 512513Sdlw return ((long)errno); 522513Sdlw } 53