1*47944Sbostic /*-
2*47944Sbostic * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic * All rights reserved.
42513Sdlw *
5*47944Sbostic * %sccs.include.proprietary.c%
623047Skre */
723047Skre
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)stat_.c 5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic
1223047Skre /*
132513Sdlw * get file status
142513Sdlw *
152513Sdlw * calling sequence:
1612029Sdlw * integer stat, statb(12)
172513Sdlw * call stat (name, statb)
182513Sdlw * where:
192513Sdlw * 'statb' will receive the stat structure for file 'name'.
202513Sdlw */
212513Sdlw
2212146Sdlw #include <sys/param.h>
2312146Sdlw #ifndef MAXPATHLEN
2412146Sdlw #define MAXPATHLEN 128
2512146Sdlw #endif
262513Sdlw #include <sys/stat.h>
272513Sdlw #include "../libI77/f_errno.h"
282513Sdlw
stat_(name,stbuf,namlen)292513Sdlw long stat_(name, stbuf, namlen)
302513Sdlw char *name; long *stbuf, namlen;
312513Sdlw {
3212146Sdlw char buf[MAXPATHLEN];
332513Sdlw struct stat statb;
342513Sdlw
352513Sdlw if (namlen >= sizeof buf)
362513Sdlw return((long)(errno=F_ERARG));
372513Sdlw g_char(name, namlen, buf);
382513Sdlw if (stat(buf, &statb) == 0)
392513Sdlw {
402513Sdlw *stbuf++ = statb.st_dev;
412513Sdlw *stbuf++ = statb.st_ino;
422513Sdlw *stbuf++ = statb.st_mode;
432513Sdlw *stbuf++ = statb.st_nlink;
442513Sdlw *stbuf++ = statb.st_uid;
452513Sdlw *stbuf++ = statb.st_gid;
462513Sdlw *stbuf++ = statb.st_rdev;
472513Sdlw *stbuf++ = statb.st_size;
482513Sdlw *stbuf++ = statb.st_atime;
492513Sdlw *stbuf++ = statb.st_mtime;
502513Sdlw *stbuf++ = statb.st_ctime;
5112029Sdlw *stbuf++ = statb.st_blksize;
522513Sdlw return(0L);
532513Sdlw }
542513Sdlw return ((long)errno);
552513Sdlw }
56