[asterisk-commits] branch russell/menuselect_buildoptions r34156 - /team/russell/menuselect_buil...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jun 14 13:55:06 MST 2006


Author: kpfleming
Date: Wed Jun 14 15:55:05 2006
New Revision: 34156

URL: http://svn.digium.com/view/asterisk?rev=34156&view=rev
Log:
tweak output format for buildopts to make it easier to handle in Makefile

Modified:
    team/russell/menuselect_buildoptions/build_tools/menuselect.c

Modified: team/russell/menuselect_buildoptions/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/russell/menuselect_buildoptions/build_tools/menuselect.c?rev=34156&r1=34155&r2=34156&view=diff
==============================================================================
--- team/russell/menuselect_buildoptions/build_tools/menuselect.c (original)
+++ team/russell/menuselect_buildoptions/build_tools/menuselect.c Wed Jun 14 15:55:05 2006
@@ -471,37 +471,36 @@
 		fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name);
 }
 
-static void process_buildopt(char *buf)
-{
-	const char *bop_name, *mem_name;
+static void process_buildopt(const char *mem_name, char *buf)
+{
+	const char *bop_name;
 	struct category *cat;
 	struct member *mem;
 	struct buildopt *bop;
 
-	mem_name = strsep(&buf, "=");
-	bop_name = strsep(&buf, "\n");
-
-	if (!bop_name || !mem_name)
-		return;
-
-	AST_LIST_TRAVERSE(&categories, cat, list) {
-		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			if (strcasecmp(mem->name, mem_name))
-				continue;
-			AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
-				if (strcasecmp(bop->name, bop_name))
+	while ((bop_name = strsep(&buf, " \n"))) {
+		if (!bop_name || strlen_zero(bop_name))
+			return;
+
+		AST_LIST_TRAVERSE(&categories, cat, list) {
+			AST_LIST_TRAVERSE(&cat->members, mem, list) {
+				if (strcasecmp(mem->name, mem_name))
 					continue;
-				bop->enabled = 1;
+				AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
+					if (strcasecmp(bop->name, bop_name))
+						continue;
+					bop->enabled = 1;
+					break;
+				}
 				break;
 			}
-			break;
-		}
-		if (bop)
-			break;
-	}
-
-	if (!bop || !mem)
-		fprintf(stderr, "Unable to find '%s' for member '%s'\n", bop_name, mem_name);
+			if (bop)
+				break;
+		}
+
+		if (!bop || !mem)
+			fprintf(stderr, "Unable to find '%s' for member '%s'\n", bop_name, mem_name);
+	}
 }
 
 /*! \brief Parse an existing output makeopts file and enable members previously selected */
@@ -549,8 +548,8 @@
 			continue;
 		}
 
-		if (!strcasecmp(category, "MENUSELECT_BUILDOPT")) {
-			process_buildopt(parse);
+		if (!strncasecmp(category, "MENUSELECT_BUILDOPT_", 20)) {
+			process_buildopt(category + 20, parse);
 			continue;
 		}
 
@@ -594,12 +593,21 @@
 	/* Output which members were disabled because of failed dependencies or conflicts */
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			char have_bops = 0;
+
 			if (mem->depsfailed || mem->conflictsfailed)
 				fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name);
 			AST_LIST_TRAVERSE(&mem->buildopts, bop, list) {
-				if (bop->enabled)
-					fprintf(f, "MENUSELECT_BUILDOPT=%s=%s\n", mem->name, bop->name);
-			}
+				if (bop->enabled) {
+					if (!have_bops) {
+						fprintf(f, "MENUSELECT_BUILDOPT_%s=", mem->name);
+						have_bops = 1;
+					}
+					fprintf(f, "%s ", bop->name);
+				}
+			}
+			if (have_bops)
+				fprintf(f, "\n");
 		}
 	}
 



More information about the asterisk-commits mailing list