[svn-commits] seanbright: trunk r729 - /trunk/menuselect.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 24 16:32:54 CDT 2010


Author: seanbright
Date: Wed Mar 24 16:32:51 2010
New Revision: 729

URL: http://svnview.digium.com/svn/menuselect?view=rev&rev=729
Log:
Don't duplicate work that getopt could do for us.

Modified:
    trunk/menuselect.c

Modified: trunk/menuselect.c
URL: http://svnview.digium.com/svn/menuselect/trunk/menuselect.c?view=diff&rev=729&r1=728&r2=729
==============================================================================
--- trunk/menuselect.c (original)
+++ trunk/menuselect.c Wed Mar 24 16:32:51 2010
@@ -72,6 +72,12 @@
 /*! This is set when the --check-deps argument is provided. */
 static int check_deps = 0;
 
+/*! This is set when the --enable-all argument is provided. */
+static int enable_all = 0;
+
+/*! This is set when the --disable-all argument is provided. */
+static int disable_all = 0;
+
 /*! This variable is non-zero when any changes are made */
 int changes_made = 0;
 
@@ -1537,13 +1543,13 @@
 		 * is not the case, an informative message will be printed to the
 		 * user and the build will fail.
 		 */
-		{ "check-deps",       no_argument,       &check_deps, 1 },
+		{ "check-deps",       no_argument,       &check_deps,  1  },
 		{ "enable",           required_argument, 0,           'e' },
 		{ "enable-category",  required_argument, 0,           'E' },
-		{ "enable-all",       no_argument,       0,           'A' },
+		{ "enable-all",       no_argument,       &enable_all,  1  },
 		{ "disable",          required_argument, 0,           'd' },
 		{ "disable-category", required_argument, 0,           'D' },
-		{ "disable-all",      no_argument,       0,           'a' },
+		{ "disable-all",      no_argument,       &disable_all, 1  },
 
 		{ 0, 0, 0, 0 },
 	};
@@ -1553,7 +1559,6 @@
 	const char *enable_cat = NULL;
 	const char *disable = NULL;
 	const char *disable_cat = NULL;
-	int enable_all = 0, disable_all = 0;
 
 	if (open_debug()) {
 		exit(1);
@@ -1587,20 +1592,12 @@
 			disable_cat = optarg;
 			do_menu = 0;
 			break;
-		case 'A':
-			enable_all = 1;
-			do_menu = 0;
-			break;
-		case 'a':
-			disable_all = 1;
-			do_menu = 0;
-			break;
 		default:
 			break;
 		}
 	}
 
-	if (check_deps) {
+	if (check_deps || enable_all || disable_all) {
 		do_menu = 0;
 	}
 




More information about the svn-commits mailing list