--- a/src/common.c 2002-11-28 14:22:00.000000000 +0100 +++ b/src/common.c 2002-11-28 14:23:11.000000000 +0100 @@ -116,6 +116,7 @@ int main(int argc, char *argv[]) { int optn, ii; + int save = 0, load = 0; #ifdef HAVE_CURSES int setcolors = FALSE; #endif /* HAVE_CURSES */ @@ -171,14 +172,10 @@ break; #endif /* HAVE_CURSES */ case 'S': /* Save to file. */ - if (mixer_fd == -1) - ErrorExitWarn(InitializeMixer(device_filename), 'e'); - ErrorExitWarn(SaveSettings(), 'e'); + save = 1; break; case 'L': /* Load from file. */ - if (mixer_fd == -1) - ErrorExitWarn(InitializeMixer(device_filename), 'e'); - ErrorExitWarn(LoadSettings(), 'e'); + load = 1; break; #if defined (HAVE_CURSES) || defined (HAVE_GTK) || defined (HAVE_GTK1) case 'I': /* User asked for interactive mode. */ @@ -194,6 +191,17 @@ } } } + if (save | load) { + if (mixer_fd == -1) + ErrorExitWarn(InitializeMixer(device_filename), 'e'); + if (save) + ErrorExitWarn(SaveSettings(), 'e'); + else + ErrorExitWarn(LoadSettings(), 'e'); + close(mixer_fd); + exit(EXIT_SUCCESS); + } + #if defined (HAVE_CURSES) || defined (HAVE_GTK) || defined (HAVE_GTK1) /* Be interactive if no options were given. */ if (!interactive && argc <= 1)