1 /*-
2 * Copyright (c) 1980 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.proprietary.c%
6 */
7
8 #ifndef lint
9 static char sccsid[] = "@(#)stat_.c 5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11
12 /*
13 * get file status
14 *
15 * calling sequence:
16 * integer stat, statb(12)
17 * call stat (name, statb)
18 * where:
19 * 'statb' will receive the stat structure for file 'name'.
20 */
21
22 #include <sys/param.h>
23 #ifndef MAXPATHLEN
24 #define MAXPATHLEN 128
25 #endif
26 #include <sys/stat.h>
27 #include "../libI77/f_errno.h"
28
stat_(name,stbuf,namlen)29 long stat_(name, stbuf, namlen)
30 char *name; long *stbuf, namlen;
31 {
32 char buf[MAXPATHLEN];
33 struct stat statb;
34
35 if (namlen >= sizeof buf)
36 return((long)(errno=F_ERARG));
37 g_char(name, namlen, buf);
38 if (stat(buf, &statb) == 0)
39 {
40 *stbuf++ = statb.st_dev;
41 *stbuf++ = statb.st_ino;
42 *stbuf++ = statb.st_mode;
43 *stbuf++ = statb.st_nlink;
44 *stbuf++ = statb.st_uid;
45 *stbuf++ = statb.st_gid;
46 *stbuf++ = statb.st_rdev;
47 *stbuf++ = statb.st_size;
48 *stbuf++ = statb.st_atime;
49 *stbuf++ = statb.st_mtime;
50 *stbuf++ = statb.st_ctime;
51 *stbuf++ = statb.st_blksize;
52 return(0L);
53 }
54 return ((long)errno);
55 }
56