[svn] GnuPG - r4770 - in trunk: doc tools

svn author marcus cvs at cvs.gnupg.org
Mon May 26 15:43:21 CEST 2008


Author: marcus
Date: 2008-05-26 15:43:20 +0200 (Mon, 26 May 2008)
New Revision: 4770

Modified:
   trunk/doc/ChangeLog
   trunk/doc/tools.texi
   trunk/tools/ChangeLog
   trunk/tools/gpgconf-comp.c
   trunk/tools/gpgconf.c
   trunk/tools/gpgconf.h
Log:
doc/
2008-05-26  Marcus Brinkmann  <marcus at ulysses.g10code.com>

	* tools.texi (Invoking gpgconf): Document --list-dirs.

tools/
2008-05-26  Marcus Brinkmann  <marcus at ulysses.g10code.com>

	* gpgconf.c (enum cmd_and_opt_values): Add aListDirs.
	(opts): Add aListDirs option.
	(main): Handle aListDirs.
	* gpgconf.h (gc_percent_escape): New declaration.
	* gpgconf-comp.c (my_percent_escape): Make non-static and rename
	to ...
	(gc_percent_escape): ... this.  Change all callers.


Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/doc/ChangeLog	2008-05-26 13:43:20 UTC (rev 4770)
@@ -1,3 +1,7 @@
+2008-05-26  Marcus Brinkmann  <marcus at ulysses.g10code.com>
+
+	* tools.texi (Invoking gpgconf): Document --list-dirs.
+
 2008-05-20  Marcus Brinkmann  <marcus at g10code.de>
 
 	* tools.texi (Invoking gpgconf): Add --dry-run and --check-options.

Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/tools/ChangeLog	2008-05-26 13:43:20 UTC (rev 4770)
@@ -1,3 +1,13 @@
+2008-05-26  Marcus Brinkmann  <marcus at ulysses.g10code.com>
+
+	* gpgconf.c (enum cmd_and_opt_values): Add aListDirs.
+	(opts): Add aListDirs option.
+	(main): Handle aListDirs.
+	* gpgconf.h (gc_percent_escape): New declaration.
+	* gpgconf-comp.c (my_percent_escape): Make non-static and rename
+	to ...
+	(gc_percent_escape): ... this.  Change all callers.
+
 2008-05-26  Werner Koch  <wk at g10code.com>
 
 	* gpgconf-comp.c (gpg_agent_runtime_change) [W32]: Issue

Modified: trunk/doc/tools.texi
===================================================================
--- trunk/doc/tools.texi	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/doc/tools.texi	2008-05-26 13:43:20 UTC (rev 4770)
@@ -237,6 +237,13 @@
 Update all configuration files with values taken from the global
 configuration file (usually @file{/etc/gnupg/gpgconf.conf}).
 
+ at item --list-dirs
+Lists the directories used by @command{gpgconf}.  One directory is
+listed per line, and each line consists of a colon-separated list
+where the first field names the directory type (for example
+ at code{sysconfdir}) and the second field contains the percent-escaped
+directory.
+
 @item --list-config [@var{filename}]
 List the global configuration file in a colon separated format.  If
 @var{filename} is given, check that file instead.

Modified: trunk/tools/gpgconf-comp.c
===================================================================
--- trunk/tools/gpgconf-comp.c	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/tools/gpgconf-comp.c	2008-05-26 13:43:20 UTC (rev 4770)
@@ -1097,8 +1097,8 @@
 
 /* Percent-Escape special characters.  The string is valid until the
    next invocation of the function.  */
-static char *
-my_percent_escape (const char *src)
+char *
+gc_percent_escape (const char *src)
 {
   static char *esc_str;
   static int esc_str_len;
@@ -1226,8 +1226,8 @@
           desc = gc_component[component].desc;
           desc = my_dgettext (gc_component[component].desc_domain, desc);
           fprintf (out, "%s:%s:",
-                   gc_component[component].name,  my_percent_escape (desc));
-          fprintf (out, "%s\n",  my_percent_escape (pgmname));
+                   gc_component[component].name,  gc_percent_escape (desc));
+          fprintf (out, "%s\n",  gc_percent_escape (pgmname));
         }
     }
 }
@@ -1430,20 +1430,20 @@
       desc = gc_component[component].desc;
       desc = my_dgettext (gc_component[component].desc_domain, desc);
       fprintf (out, "%s:%s:",
-	       gc_component[component].name, my_percent_escape (desc));
-      fputs (my_percent_escape (pgmname), out);
+	       gc_component[component].name, gc_percent_escape (desc));
+      fputs (gc_percent_escape (pgmname), out);
       fprintf (out, ":%d:%d:", !(result & 1), !(result & 2));
       for (errptr = errlines; errptr; errptr = errptr->next)
 	{
 	  if (errptr != errlines)
 	    fputs ("\n:::::", out); /* Continuation line.  */
 	  if (errptr->fname)
-	    fputs (my_percent_escape (errptr->fname), out);
+	    fputs (gc_percent_escape (errptr->fname), out);
 	  putc (':', out);
 	  if (errptr->fname)
 	    fprintf (out, "%u", errptr->lineno);
 	  putc (':', out);
-	  fputs (my_percent_escape (errptr->errtext), out);
+	  fputs (gc_percent_escape (errptr->errtext), out);
 	  putc (':', out);
 	}
       putc ('\n', out);
@@ -1559,7 +1559,7 @@
     fprintf (out, " %s", gc_level[option->level].name);
 
   /* The description field.  */
-  fprintf (out, ":%s", desc ? my_percent_escape (desc) : "");
+  fprintf (out, ":%s", desc ? gc_percent_escape (desc) : "");
   
   /* The type field.  */
   fprintf (out, ":%u", option->arg_type);
@@ -1573,7 +1573,7 @@
 	     gc_arg_type[gc_arg_type[option->arg_type].fallback].name);
 
   /* The argument name field.  */
-  fprintf (out, ":%s", arg_name ? my_percent_escape (arg_name) : "");
+  fprintf (out, ":%s", arg_name ? gc_percent_escape (arg_name) : "");
   if (arg_name)
     xfree (arg_name);
 
@@ -1892,7 +1892,7 @@
 		}
 	      else if (gc_arg_type[option->arg_type].fallback
 		       == GC_ARG_TYPE_STRING)
-		opt_value = xasprintf ("\"%s", my_percent_escape (value));
+		opt_value = xasprintf ("\"%s", gc_percent_escape (value));
 	      else
 		{
 		  /* FIXME: Verify that the number is sane.  */
@@ -1983,12 +1983,12 @@
 	     really append.  */
 	  if (list)
 	    {
-	      new_list = xasprintf ("%s,\"%s", list, my_percent_escape (start));
+	      new_list = xasprintf ("%s,\"%s", list, gc_percent_escape (start));
 	      xfree (list);
 	      list = new_list;
 	    }
 	  else
-	    list = xasprintf ("\"%s", my_percent_escape (start));
+	    list = xasprintf ("\"%s", gc_percent_escape (start));
 	}
       if (length < 0 || ferror (list_file))
 	gc_error (1, errno, "can not read list file %s", list_pathname);
@@ -3448,8 +3448,8 @@
                     *p = 0; /* We better strip any extra stuff. */
                 }                    
               
-              fprintf (listfp, "k:%s:", my_percent_escape (key));
-              fprintf (listfp, "%s\n", group? my_percent_escape (group):"");
+              fprintf (listfp, "k:%s:", gc_percent_escape (key));
+              fprintf (listfp, "%s\n", group? gc_percent_escape (group):"");
             }
 
           /* All other lines are rule records.  */
@@ -3458,7 +3458,7 @@
                    option_info->name? option_info->name : "",
                    flags? flags : "");
           if (value != empty)
-            fprintf (listfp, "\"%s", my_percent_escape (value));
+            fprintf (listfp, "\"%s", gc_percent_escape (value));
           
           putc ('\n', listfp);
         }

Modified: trunk/tools/gpgconf.c
===================================================================
--- trunk/tools/gpgconf.c	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/tools/gpgconf.c	2008-05-26 13:43:20 UTC (rev 4770)
@@ -46,7 +46,8 @@
     aCheckOptions,
     aApplyDefaults,
     aListConfig,
-    aCheckConfig
+    aCheckConfig,
+    aListDirs
 
   };
 
@@ -63,6 +64,8 @@
     { aCheckOptions, "check-options", 256, N_("|COMPONENT|check options") },
     { aApplyDefaults, "apply-defaults", 256,
       N_("apply global default values") },
+    { aListDirs, "list-dirs", 256,
+      N_("get the configuration directories for gpgconf") },
     { aListConfig,   "list-config", 256,
       N_("list global configuration file") },
     { aCheckConfig,   "check-config", 256,
@@ -165,6 +168,7 @@
         case oVerbose:   opt.verbose++; break;
         case oNoVerbose: opt.verbose = 0; break;
 
+	case aListDirs:
         case aListComponents:
         case aCheckPrograms:
         case aListOptions:
@@ -253,6 +257,13 @@
       if (gc_process_gpgconf_conf (NULL, 1, 1, NULL))
         exit (1);
       break;
+      
+    case aListDirs:
+      /* Show the system configuration directory for gpgconf.  */
+      get_outfp (&outfp);
+      fprintf (outfp, "sysconfdir:%s\n",
+	       gc_percent_escape (gnupg_sysconfdir ()));
+      break;
     }
 
   if (outfp && outfp != stdout)

Modified: trunk/tools/gpgconf.h
===================================================================
--- trunk/tools/gpgconf.h	2008-05-26 12:00:55 UTC (rev 4769)
+++ trunk/tools/gpgconf.h	2008-05-26 13:43:20 UTC (rev 4770)
@@ -37,6 +37,11 @@
 
 
 /*-- gpgconf-comp.c --*/
+/* Percent-Escape special characters.  The string is valid until the
+   next invocation of the function.  */
+char *gc_percent_escape (const char *src);
+
+
 void gc_error (int status, int errnum, const char *fmt, ...);
 
 /* List all components that are available.  */




More information about the Gnupg-commits mailing list