[svn] GnuPG - r4646 - trunk/tools

svn author marcus cvs at cvs.gnupg.org
Mon Dec 10 17:44:39 CET 2007


Author: marcus
Date: 2007-12-10 17:44:38 +0100 (Mon, 10 Dec 2007)
New Revision: 4646

Modified:
   trunk/tools/ChangeLog
   trunk/tools/gpgconf-comp.c
Log:
2007-12-10  Marcus Brinkmann  <marcus at g10code.de>

	* gpgconf-comp.c (gc_component_list_options): Fix up expert level
	of group.


Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2007-12-10 15:34:20 UTC (rev 4645)
+++ trunk/tools/ChangeLog	2007-12-10 16:44:38 UTC (rev 4646)
@@ -1,3 +1,8 @@
+2007-12-10  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gpgconf-comp.c (gc_component_list_options): Fix up expert level
+	of group.
+
 2007-12-04  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpgconf-comp.c (gc_component_list_components): Do not print a

Modified: trunk/tools/gpgconf-comp.c
===================================================================
--- trunk/tools/gpgconf-comp.c	2007-12-10 15:34:20 UTC (rev 4645)
+++ trunk/tools/gpgconf-comp.c	2007-12-10 16:44:38 UTC (rev 4646)
@@ -1531,7 +1531,6 @@
 gc_component_list_options (int component, FILE *out)
 {  
   const gc_option_t *option = gc_component[component].options;
-  const gc_option_t *group_option = NULL;
 
   while (option && option->name)
     {
@@ -1544,17 +1543,38 @@
 	}
 
       if (option->flags & GC_OPT_FLAG_GROUP)
-	group_option = option;
-      else
 	{
-	  if (group_option)
+	  const gc_option_t *group_option = option + 1;
+	  gc_expert_level_t level = GC_LEVEL_NR;
+
+	  /* The manual states that the group level is always the
+	     minimum of the levels of all contained options.  Due to
+	     different active options, and because it is hard to
+	     maintain manually, we calculate it here.  The value in
+	     the global static table is ignored.  */
+	  
+	  while (group_option->name)
 	    {
-	      list_one_option (group_option, out);
-	      group_option = NULL;
+	      if (group_option->flags & GC_OPT_FLAG_GROUP)
+		break;
+	      if (group_option->level < level)
+		level = group_option->level;
+	      group_option++;
 	    }
 
-	  list_one_option (option, out);
+	  /* Check if group is empty.  */
+	  if (level != GC_LEVEL_NR)
+	    {
+	      gc_option_t opt_copy;
+
+	      /* Fix up the group level.  */
+	      memcpy (&opt_copy, option, sizeof (opt));
+	      opt_copy.level = level;
+	      list_one_option (&opt_copy, out);
+	    }
 	}
+      else
+	list_one_option (option, out);
 
       option++;
     }




More information about the Gnupg-commits mailing list