summaryrefslogtreecommitdiff
path: root/src/recording.c
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-19 23:52:56 +0900
committer諏訪子 <suwako@076.moe>2024-06-19 23:52:56 +0900
commitb6e3f6cb5d1051777c35988f201e6730525e3389 (patch)
tree98679f1995f7b103f3314ce54fdf0d1c76df6dbd /src/recording.c
parent8f378429801162d690dc68c0f15b483c1d291838 (diff)
掃除
Diffstat (limited to 'src/recording.c')
-rw-r--r--src/recording.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/recording.c b/src/recording.c
index 8ed3d98..459b1f7 100644
--- a/src/recording.c
+++ b/src/recording.c
@@ -1,32 +1,12 @@
#if defined(__OpenBSD__)
#include "recording.h"
+#include "common.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");
+const char *display_recording_audio() {
+ return run_command_s("sysctl -n kern.audio.record");
}
-void display_recording_video() {
- run_rec_command("sysctl -n kern.video.record");
+const char *display_recording_video() {
+ return run_command_s("sysctl -n kern.video.record");
}
#endif