aboutsummaryrefslogtreecommitdiffstats
path: root/extra/aumix/aumix-2.8-save_load.patch
blob: 498716b517a94c1e15eef5aca81659a3ab29bd5e (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
33
34
35
36
37
38
39
40
41
42
43
44
45
--- 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)