Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > ae54eb07ce52cb7be10d751458e27bce > files > 3

aumix-2.8-21.fc13.src.rpm

diff -NarU5 aumix-2.8.orig/src/common.c aumix-2.8/src/common.c
--- aumix-2.8.orig/src/common.c	2002-10-29 16:27:51.000000000 -0500
+++ aumix-2.8/src/common.c	2008-09-26 13:39:07.000000000 -0400
@@ -114,10 +114,11 @@
 int             usage_ok = 1;
 
 int             main(int argc, char *argv[])
 {
 	int             optn, ii;
+	int		save = 0, load = 0;
 #ifdef HAVE_CURSES
 	int             setcolors = FALSE;
 #endif				/* HAVE_CURSES */
 	/* Internationalization */
 #ifdef HAVE_NLS
@@ -166,18 +167,14 @@
 				setcolors = TRUE;
 				interactive = IN_CURSES;
 				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. */
 				if (!interactive)
 					interactive = IN_ANY;
@@ -189,10 +186,21 @@
 			default:	/* Show help. */
 				Usage(EXIT_FAILURE);
 			}
 		}
 	}
+	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)
 		interactive = IN_ANY;
 /* By now we've decided whether to go interactive.