]> Kevux Git Server - fll/commitdiff
Add Project: pipe
authorKevin Day <kevin@kevux.org>
Sat, 10 Mar 2012 20:59:38 +0000 (14:59 -0600)
committerKevin Day <kevin@kevux.org>
Sat, 10 Mar 2012 22:04:50 +0000 (16:04 -0600)
This adds the level 0 implementation of project pipe.
At this time, all it does is provide a way to tell if the current instance of some program has piped data being passed to it.

level_0/f_pipe/c/pipe.c [new file with mode: 0644]
level_0/f_pipe/c/pipe.h [new file with mode: 0644]
level_0/f_pipe/data/build/settings [new file with mode: 0644]

diff --git a/level_0/f_pipe/c/pipe.c b/level_0/f_pipe/c/pipe.c
new file mode 100644 (file)
index 0000000..771a0af
--- /dev/null
@@ -0,0 +1,35 @@
+/* FLL - Level 0
+ * Project:       Pipe
+ * Version:       0.3.x
+ * Licenses:      lgplv2.1
+ * Programmers:   Kevin Day
+ * Documentation:
+ *
+ * Provides pipe functionality.
+ */
+#include <level_0/pipe.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_f_pipe_exists_
+  // returns f_true if the standard input contains piped data.
+  f_return_status f_pipe_exists(){
+    struct stat st_info;
+
+    if (fstat(fileno(f_pipe), &st_info) != 0) {
+      return f_file_stat_error;
+    }
+
+    if (S_ISFIFO(st_info.st_mode)) {
+      return f_true;
+    }
+
+    return f_false;
+  }
+#endif // _di_f_pipe_exists_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_pipe/c/pipe.h b/level_0/f_pipe/c/pipe.h
new file mode 100644 (file)
index 0000000..3d481cc
--- /dev/null
@@ -0,0 +1,39 @@
+/* FLL - Level 0
+ * Project:       Pipe
+ * Version:       0.3.x
+ * Licenses:      lgplv2.1
+ * Programmers:   Kevin Day
+ * Documentation:
+ *
+ * Provides pipe functionality.
+ *
+ */
+#ifndef _F_pipe_h
+#define _F_pipe_h
+
+// libc includes
+#include <stdio.h>
+#include <sys/stat.h>
+
+// fll includes
+#include <level_0/errors.h>
+#include <level_0/types.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_f_pipe_
+  #define f_pipe f_standard_input
+#endif // _di_f_pipe_
+
+#ifndef _di_f_pipe_exists_
+  // returns f_true if the standard input contains piped data.
+  extern f_return_status f_pipe_exists();
+#endif // _di_f_pipe_exists_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _F_pipe_h
diff --git a/level_0/f_pipe/data/build/settings b/level_0/f_pipe/data/build/settings
new file mode 100644 (file)
index 0000000..25af48d
--- /dev/null
@@ -0,0 +1,21 @@
+# fss-0000
+
+project_name f_pipe
+project_level 0
+
+version_major 0
+version_minor 3
+version_micro 0
+
+build_compiler gcc
+build_libraries -lc 
+build_sources_library pipe.c
+build_sources_program 
+build_sources_headers pipe.h
+build_shared yes
+
+flags_all -z now
+flags_shared
+flags_static
+flags_library -fPIC
+flags_program -fPIE