Merge remote-tracking branch 'nsz/master'
authorRich Felker <dalias@aerifal.cx>
Sun, 6 May 2012 13:42:23 +0000 (09:42 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 6 May 2012 13:42:23 +0000 (09:42 -0400)
include/stropts.h
src/misc/isastream.c [new file with mode: 0644]

index 36d84bb..c99c922 100644 (file)
@@ -129,7 +129,8 @@ struct str_list {
        struct str_mlist *sl_modlist;
 };
 
-int ioctl (int, int, ...);
+int isastream(int);
+int ioctl(int, int, ...);
 
 #ifdef __cplusplus
 }
diff --git a/src/misc/isastream.c b/src/misc/isastream.c
new file mode 100644 (file)
index 0000000..4dafdb0
--- /dev/null
@@ -0,0 +1,7 @@
+#include <stropts.h>
+#include <fcntl.h>
+
+int isastream(int fd)
+{
+       return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
+}