add a chdir from cli opt

This commit is contained in:
tTh 2023-11-30 02:47:56 +01:00
parent eb74809d59
commit 5ebc44a9be
1 changed files with 14 additions and 1 deletions

View File

@ -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) {