[asterisk-commits] branch russell/make_menuconfig - r7465 in /team/russell/make_menuconfig: ./ b...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 13 00:56:29 CST 2005


Author: russell
Date: Tue Dec 13 00:56:28 2005
New Revision: 7465

URL: http://svn.digium.com/view/asterisk?rev=7465&view=rev
Log:
add displayname for categories to make the main menu more readable

Modified:
    team/russell/make_menuconfig/build_options.xml
    team/russell/make_menuconfig/build_tools/menuconfig.c

Modified: team/russell/make_menuconfig/build_options.xml
URL: http://svn.digium.com/view/asterisk/team/russell/make_menuconfig/build_options.xml?rev=7465&r1=7464&r2=7465&view=diff
==============================================================================
--- team/russell/make_menuconfig/build_options.xml (original)
+++ team/russell/make_menuconfig/build_options.xml Tue Dec 13 00:56:28 2005
@@ -2,6 +2,7 @@
 
 <category>
 	<name>APPS</name>
+	<displayname>Applications</displayname>
 	<member>
 		<name>app_adsiprog.so</name>
 		<description></description>
@@ -242,6 +243,7 @@
 
 <category>
 	<name>CDR_MODULES</name>
+	<displayname>CDR Storage</displayname>
 	<member>
 		<name>cdr_csv.so</name>
 		<description></description>
@@ -258,6 +260,7 @@
 
 <category>
 	<name>CHANNEL_LIBS</name>
+	<displayname>Channel Drivers</displayname>
 	<member>
 		<name>chan_sip.so</name>
 		<description>SIP Channel Driver</description>
@@ -290,6 +293,7 @@
 
 <category>
 	<name>FORMAT_LIBS</name>
+	<displayname>Formats</displayname>
 	<member>
 		<name>format_gsm.so</name>
 		<description></description>
@@ -346,6 +350,7 @@
 
 <category>
 	<name>PBX_LIBS</name>
+	<displayname>PBX Modules</displayname>
 	<member>
 		<name>pbx_config.so</name>
 		<description></description>
@@ -374,6 +379,7 @@
 
 <category>
 	<name>RES_MODULES</name>
+	<displayname>Resources</displayname>
 	<member>
 		<name>res_indications.so</name>
 		<description>Indications</description>
@@ -398,6 +404,7 @@
 
 <category>
 	<name>UTILS</name>
+	<displayname>Utilities</displayname>
 	<member>
 		<name>streamplayer</name>
 		<description>A utility for reading from a raw TCP stream and sending the data to stdout</description>

Modified: team/russell/make_menuconfig/build_tools/menuconfig.c
URL: http://svn.digium.com/view/asterisk/team/russell/make_menuconfig/build_tools/menuconfig.c?rev=7465&r1=7464&r2=7465&view=diff
==============================================================================
--- team/russell/make_menuconfig/build_tools/menuconfig.c (original)
+++ team/russell/make_menuconfig/build_tools/menuconfig.c Tue Dec 13 00:56:28 2005
@@ -64,6 +64,7 @@
 
 static struct category {
 	const char *name;
+	const char *displayname;
 	struct member *members;
 	struct category *next;
 } *categories = NULL;
@@ -76,7 +77,7 @@
 int max_x = 0;
 int max_y = 0;
 
-static inline int ast_strlen_zero(const char *s)
+static inline int strlen_zero(const char *s)
 {
 	return (!s || (*s == '\0'));
 }
@@ -92,7 +93,7 @@
 	return str;
 }
 
-struct category *add_category(const char *category)
+struct category *add_category(const char *category, const char *displayname)
 {
 	struct category *cat;
 	struct category *cat_prev = NULL;
@@ -116,6 +117,7 @@
 	if (cat_prev)
 		cat_prev->next = cat;
 	cat->name = category;
+	cat->displayname = displayname;
 
 	return cat;
 }
@@ -158,6 +160,8 @@
 	struct category *cat;
 	const char *mem_name;
 	const char *mem_desc;
+	const char *cat_name;
+	const char *cat_displayname;
 	mxml_node_t *cur;
 	mxml_node_t *cur2;
 	mxml_node_t *cur3;
@@ -195,14 +199,19 @@
 			fprintf(stderr, "category specified with no name in '%s'!\n", build_options);
 			continue;
 		}
-		
-		cur2 = cur2->child;
-		if (!cur2) {
+		if (!cur2->child) {
 			fprintf(stderr, "category with empty name!\n");
 			continue;
 		}
-	
-		cat = add_category(cur2->value.opaque);
+		cat_name = cur2->child->value.opaque;
+	
+		cur2 = mxmlFindElement(cur, cur, "displayname", NULL, NULL, MXML_DESCEND);
+		if (cur2 && cur2->child)
+			cat_displayname = cur2->child->value.opaque;
+		else
+			cat_displayname = NULL;
+
+		cat = add_category(cat_name, cat_displayname);
 		if (!cat)
 			continue;
 
@@ -295,12 +304,12 @@
 	while (fgets(buf, sizeof(buf), f)) {
 		lineno++;
 
-		if (ast_strlen_zero(buf))
+		if (strlen_zero(buf))
 			continue;
 
 		parse = buf;
 		parse = skip_blanks(parse);
-		if (ast_strlen_zero(parse))
+		if (strlen_zero(parse))
 			continue;
 
 		/* Grab the category name */	
@@ -313,7 +322,7 @@
 		parse = skip_blanks(parse);
 		while ((member = strsep(&parse, " \n"))) {
 			member = skip_blanks(member);
-			if (ast_strlen_zero(member))
+			if (strlen_zero(member))
 				continue;
 
 			mark_as_enabled(member, category);
@@ -414,7 +423,10 @@
 	
 	for (cat = categories; cat; cat = cat->next) {
 		wmove(menu, i, max_x / 2 - 10);
-		snprintf(buf, sizeof(buf), "%d. %s", ++i, cat->name);
+		if (!strlen_zero(cat->displayname))
+			snprintf(buf, sizeof(buf), "%d. %s", ++i, cat->displayname);
+		else
+			snprintf(buf, sizeof(buf), "%d. %s", ++i, cat->name);
 		waddstr(menu, buf);
 	}
 



More information about the asterisk-commits mailing list