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[] = "@(#)lstat_.c 5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11
12 /*
13 * get file status
14 *
15 * calling sequence:
16 * integer lstat, statb(12)
17 * external lstat
18 * ierr = lstat (name, statb)
19 * where:
20 * 'statb' will receive the stat structure for file 'name'.
21 */
22
23 #include <sys/param.h>
24 #ifndef MAXPATHLEN
25 #define MAXPATHLEN 128
26 #endif
27 #include <sys/stat.h>
28 #include "../libI77/f_errno.h"
29
lstat_(name,stbuf,namlen)30 long lstat_(name, stbuf, namlen)
31 char *name; long *stbuf, namlen;
32 {
33 char buf[MAXPATHLEN];
34 struct stat statb;
35
36 if (namlen >= sizeof buf)
37 return((long)(errno=F_ERARG));
38 g_char(name, namlen, buf);
39 if (lstat(buf, &statb) == 0)
40 {
41 *stbuf++ = statb.st_dev;
42 *stbuf++ = statb.st_ino;
43 *stbuf++ = statb.st_mode;
44 *stbuf++ = statb.st_nlink;
45 *stbuf++ = statb.st_uid;
46 *stbuf++ = statb.st_gid;
47 *stbuf++ = statb.st_rdev;
48 *stbuf++ = statb.st_size;
49 *stbuf++ = statb.st_atime;
50 *stbuf++ = statb.st_mtime;
51 *stbuf++ = statb.st_ctime;
52 *stbuf++ = statb.st_blksize;
53 return(0L);
54 }
55 return ((long)errno);
56 }
57