#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;
}
#endif // _di_f_pipe_exists_
+#ifndef _di_f_pipe_warning_exists_
+ f_return_status f_pipe_warning_exists() {
+ struct stat st_info;
+
+ if (fstat(fileno(f_pipe_warning), &st_info) != 0) {
+ return f_status_set_error(f_file_stat_error);
+ }
+
+ if (S_ISFIFO(st_info.st_mode)) {
+ return f_true;
+ }
+
+ return f_false;
+ }
+#endif // _di_f_pipe_warning_exists_
+
+#ifndef _di_f_pipe_error_exists_
+ f_return_status f_pipe_error_exists() {
+ struct stat st_info;
+
+ if (fstat(fileno(f_pipe_error), &st_info) != 0) {
+ return f_status_set_error(f_file_stat_error);
+ }
+
+ if (S_ISFIFO(st_info.st_mode)) {
+ return f_true;
+ }
+
+ return f_false;
+ }
+#endif // _di_f_pipe_error_exists_
+
+#ifndef _di_f_pipe_debug_exists_
+ f_return_status f_pipe_debug_exists() {
+ struct stat st_info;
+
+ if (fstat(fileno(f_pipe_debug), &st_info) != 0) {
+ return f_status_set_error(f_file_stat_error);
+ }
+
+ if (S_ISFIFO(st_info.st_mode)) {
+ return f_true;
+ }
+
+ return f_false;
+ }
+#endif // _di_f_pipe_debug_exists_
+
#ifdef __cplusplus
} // extern "C"
#endif
extern "C" {
#endif
+/**
+ * Default pipe sources.
+ */
#ifndef _di_f_pipe_
- #define f_pipe f_standard_input
+ #define f_pipe f_standard_input
+ #define f_pipe_warning f_standard_warning
+ #define f_pipe_error f_standard_error
+ #define f_pipe_debug f_standard_debug
#endif // _di_f_pipe_
+/**
+ * Identify whether or not the default f_pipe source (generally standard input) contains piped data.
+ *
+ * @return
+ * f_true if there is piped data.
+ * f_false if there is no piped data.
+ * f_file_stat_error (with error bit) on stat() error.
+ *
+ * @see stat()
+ */
#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_
+/**
+ * Identify whether or not the default f_pipe_warning source (generally standard warning) contains piped data.
+ *
+ * For most systems, standard warning does not exist and instead maps to standard output.
+ *
+ * @return
+ * f_true if there is piped data.
+ * f_false if there is no piped data.
+ * f_file_stat_error (with error bit) on stat() error.
+ *
+ * @see stat()
+ */
+#ifndef _di_f_pipe_warning_exists_
+ extern f_return_status f_pipe_warning_exists();
+#endif // _di_f_pipe_warning_exists_
+
+/**
+ * Identify whether or not the default f_pipe_error source (generally standard error) contains piped data.
+ *
+ * @return
+ * f_true if there is piped data.
+ * f_false if there is no piped data.
+ * f_file_stat_error (with error bit) on stat() error.
+ *
+ * @see stat()
+ */
+#ifndef _di_f_pipe_error_exists_
+ extern f_return_status f_pipe_error_exists();
+#endif // _di_f_pipe_error_exists_
+
+/**
+ * Identify whether or not the default f_pipe_debug source (generally standard warning) contains piped data.
+ *
+ * For most systems, standard debug does not exist and instead maps to standard output.
+ *
+ * @return
+ * f_true if there is piped data.
+ * f_false if there is no piped data.
+ * f_file_stat_error (with error bit) on stat() error.
+ *
+ * @see stat()
+ */
+#ifndef _di_f_pipe_debug_exists_
+ extern f_return_status f_pipe_debug_exists();
+#endif // _di_f_pipe_debug_exists_
+
#ifdef __cplusplus
} // extern "C"
#endif