summaryrefslogtreecommitdiff
path: root/lib/libc/sys/stat.2
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-10-05 05:05:58 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-10-05 05:05:58 +0000
commita825e5fd5217942ac3f1b65992c09efeeee460b4 (patch)
treea6cffc9d1ec1fbe3c0b2aed20b737c9b46c55389 /lib/libc/sys/stat.2
parent7f46dc2fbebee4c3600c1ecf0def96390b5a1197 (diff)
Add S_ISBLK(), S_ISCHR(), S_ISDIR(), S_ISFIFO(), S_ISLNK(), S_ISREG(),
and S_ISSOCK() macros. OK deraadt@, OK and help from jmc@.
Diffstat (limited to 'lib/libc/sys/stat.2')
-rw-r--r--lib/libc/sys/stat.215
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
index 887109a4744..dfab0110498 100644
--- a/lib/libc/sys/stat.2
+++ b/lib/libc/sys/stat.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: stat.2,v 1.19 2005/06/15 17:48:52 millert Exp $
+.\" $OpenBSD: stat.2,v 1.20 2006/10/05 05:05:57 ray Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@@ -175,6 +175,19 @@ has the following bits:
#define S_IXUSR 0000100 /* execute/search permission, owner */
.Ed
.Pp
+The following macros test a file's type.
+If the file is of that type, a non-zero value is returned;
+otherwise, 0 is returned.
+.Bd -literal -offset indent
+S_ISBLK(st_mode m) /* block special */
+S_ISCHR(st_mode m) /* char special */
+S_ISDIR(st_mode m) /* directory */
+S_ISFIFO(st_mode m) /* fifo */
+S_ISLNK(st_mode m) /* symbolic link */
+S_ISREG(st_mode m) /* regular file */
+S_ISSOCK(st_mode m) /* socket */
+.Ed
+.Pp
For a list of access modes, see
.Aq Pa sys/stat.h ,
.Xr access 2 ,