summaryrefslogtreecommitdiff
path: root/src/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/recording.c')
-rw-r--r--src/recording.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/recording.c b/src/recording.c
new file mode 100644
index 0000000..8ed3d98
--- /dev/null
+++ b/src/recording.c
@@ -0,0 +1,32 @@
+#if defined(__OpenBSD__)
+#include "recording.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+void run_rec_command(const char *command) {
+ char buf[128];
+
+ FILE *p = popen(command, "r");
+ if (!p) {
+ fprintf(stderr, "録画コマンドを実効に失敗: %s", command);
+ return;
+ }
+
+ while (fgets(buf, sizeof(buf), p) != NULL) {
+ buf[strcspn(buf, "\n")] = '\0';
+ printf("%s", strncmp(buf, "0", strlen(buf)) ? "off" : "on");
+ }
+
+ pclose(p);
+}
+
+void display_recording_audio() {
+ run_rec_command("sysctl -n kern.audio.record");
+}
+
+void display_recording_video() {
+ run_rec_command("sysctl -n kern.video.record");
+}
+#endif