aboutsummaryrefslogtreecommitdiff
path: root/chad/qx.h
diff options
context:
space:
mode:
authoragvxov2026-02-18 08:58:34 +0000
committerGitHub2026-02-18 08:58:34 +0000
commit0d4fc3389b69b70048cd50e614cb9807469cdcd0 (patch)
tree379fef43cc5182b21328eed19ccfdf15c8e96648 /chad/qx.h
parent42541df62871aaf403c0d62de1fdb44c862f2ea5 (diff)
parent8035daa04137c5412050a2f30e6748db256a576b (diff)
downloadlibchad-0d4fc3389b69b70048cd50e614cb9807469cdcd0.tar.xz
libchad-0d4fc3389b69b70048cd50e614cb9807469cdcd0.tar.zst
Merge pull request #1 from BasedProject/8e8m
This is not a pull request, just a hivis text dump
Diffstat (limited to 'chad/qx.h')
-rw-r--r--chad/qx.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/chad/qx.h b/chad/qx.h
new file mode 100644
index 0000000..817eaff
--- /dev/null
+++ b/chad/qx.h
@@ -0,0 +1,36 @@
+#ifndef QX_H
+#define QX_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* # qx
+ *
+ * ## NAME
+ * qx - execute system commands receive back the output
+ *
+ * ## SYNOPSIS
+ */
+extern char * qx(const char * const cmd);
+/* ## DESCRIPTION
+ * `qx()` is a small wrapper function to replicate Perl's `qx` in C.
+ * It is intended for developer convenience.
+ * The command argument is a pointer to a null-terminated
+ * string containing a shell command line.
+ * This command is passed to `/bin/sh` using the `-c` flag; interpretation,
+ * if any, is performed by the shell.
+ *
+ * ## RETURN VALUE
+ * Upon successful return, the captured `stdout` and `stderr` of `cmd` is returned
+ * in a dynamic string. Calling `free()` is the programmer's responsibility.
+ *
+ * If an error is encountered `NULL` is returned.
+ * The shell returning a non-zero exit value is not considered an error.
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif