From 5ebc44a9bee58f67eab6cf1328867a72e9e28837 Mon Sep 17 00:00:00 2001 From: tTh Date: Thu, 30 Nov 2023 02:47:56 +0100 Subject: [PATCH] add a chdir from cli opt --- Ecoute/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Ecoute/main.c b/Ecoute/main.c index efce443..f728fbf 100644 --- a/Ecoute/main.c +++ b/Ecoute/main.c @@ -116,14 +116,18 @@ int main(int argc, char * argv[]) int opt = 0; int foo; char *audiodevice = "none"; +char *newdir = NULL; -while ((opt = getopt(argc, argv, "d:hx")) != -1) { +while ((opt = getopt(argc, argv, "d:hs:x")) != -1) { switch (opt) { case 'd': audiodevice = optarg; break; case 'h': help_cli(argv[0]); break; + case 's': + newdir = optarg; + break; case 'x': fprintf(stderr, "no crash available\n"); exit(0); @@ -133,7 +137,16 @@ while ((opt = getopt(argc, argv, "d:hx")) != -1) { } } +#if DEBUG_LEVEL fprintf(stderr, "audio device = %s\n", audiodevice); +#endif + +if (NULL != newdir) { +#if DEBUG_LEVEL + fprintf(stderr, "newdir = '%s'\n", newdir); +#endif + foo = chdir(newdir); + } foo = init_sound_output(audiodevice, 0); if (foo) {