From b6e3f6cb5d1051777c35988f201e6730525e3389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Wed, 19 Jun 2024 23:52:56 +0900 Subject: =?UTF-8?q?=E6=8E=83=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recording.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'src/recording.c') 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 -#include -#include - -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 -- cgit v1.2.3