blob: 8ed3d98ee7e2d99ffe3376018fd4d4c3b5ead8d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
|