mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 15:03:44 +02:00
util/spkmodem_recv: Add -u flag (no line buffer)
printf outputs to stdout, which is line buffered by default. Adding a -u option to disable buffering. Exit when a non-support flag is given, but adhere to current behaviour when no flag is given. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* Compilation: gcc -o spkmodem-recv spkmodem-recv */
|
/* Compilation: gcc -o spkmodem-recv spkmodem-recv */
|
||||||
/* Usage: parec --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */
|
/* Usage: parec --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */
|
||||||
@@ -33,7 +34,17 @@ void fetch_sample(void);
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
(void)argc; (void)argv;
|
int c;
|
||||||
|
|
||||||
|
while ((c = getopt(argc, argv, "u")) != -1) {
|
||||||
|
switch (c) {
|
||||||
|
case 'u':
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
err(errno = EINVAL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (!feof(stdin))
|
while (!feof(stdin))
|
||||||
handle_audio();
|
handle_audio();
|
||||||
|
|||||||
Reference in New Issue
Block a user