[svn] GnuPG - r4260 - in trunk: doc keyserver

svn author wk cvs at cvs.gnupg.org
Fri Sep 22 16:38:39 CEST 2006


Author: wk
Date: 2006-09-22 16:38:38 +0200 (Fri, 22 Sep 2006)
New Revision: 4260

Modified:
   trunk/doc/ChangeLog
   trunk/doc/gnupg7.texi
   trunk/doc/gpg.texi
   trunk/doc/yat2m.c
   trunk/keyserver/ChangeLog
   trunk/keyserver/no-libgcrypt.c
Log:
Improved yat2m.
Tweaked gpg.texti to be used for gpg1 and gpg2.


Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/doc/ChangeLog	2006-09-22 14:38:38 UTC (rev 4260)
@@ -1,3 +1,15 @@
+2006-09-22  Werner Koch  <wk at g10code.com>
+
+	* gpg.texi: Make some parts depend on the "gpgone" set
+	command. This allows us to use the same source for gpg1 and gpg2.
+
+	* yat2m.c (parse_file): Better parsing of @ifset and ifclear.
+	(main): Allow definition of "-D gpgone".
+	(parse_file): Allow macro definitions.
+	(proc_texi_cmd): Expand macros.
+	(proc_texi_buffer): Process commands terminated by the closing
+	brace of the enclosing command.
+
 2006-09-20  Werner Koch  <wk at g10code.com>
 
 	* texi.css: New.  Note that the current vesion of makeinfo has a

Modified: trunk/doc/gnupg7.texi
===================================================================
--- trunk/doc/gnupg7.texi	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/doc/gnupg7.texi	2006-09-22 14:38:38 UTC (rev 4260)
@@ -18,6 +18,7 @@
 @command{gpg2}. @command{gpg-agent} is a passphrase and private key
 daemon which may also emulate the @command{ssh-agent}.
 @mansect see also
+ at command{gpg}(1), 
 @command{gpg2}(1), 
 @command{gpgv}(1), 
 @command{gpgsm}(1), 

Modified: trunk/doc/gpg.texi
===================================================================
--- trunk/doc/gpg.texi	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/doc/gpg.texi	2006-09-22 14:38:38 UTC (rev 4260)
@@ -9,7 +9,36 @@
 @cindex command options
 @cindex options, GPG command
 
+ at c Begin GnuPG 1.x specific stuff
+ at ifset gpgone
+ at macro gpgname
+gpg
+ at end macro
+ at manpage gpg.1
+ at ifset manverb
+.B gpg
+\- OpenPGP encryption and signing tool
+ at end ifset
 
+ at mansect synopsis
+ at ifset manverb
+.B  gpg
+.RB [ \-\-homedir
+.IR dir ]
+.RB [ \-\-options
+.IR file ]
+.RI [ options ]  
+.I command
+.RI [ args ]
+ at end ifset
+ at end ifset
+ at c End GnuPG 1.x specific stuff
+
+ at c Begin GnuPG 2 specific stuff
+ at ifclear gpgone
+ at macro gpgname
+gpg2
+ at end macro
 @manpage gpg2.1
 @ifset manverb
 .B gpg2
@@ -27,14 +56,22 @@
 .I command
 .RI [ args ]
 @end ifset
+ at end ifclear
+ at c Begin GnuPG 2 specific stuff
 
 @mansect description
- at command{gpg2} is the OpenPGP part of the GNU Privacy Guard (GnuPG). It
+ at command{@gpgname} is the OpenPGP part of the GNU Privacy Guard (GnuPG). It
 is a tool to provide digital encryption and signing services using the
-OpenPGP standard. @command{gpg2} features complete key management and
+OpenPGP standard. @command{@gpgname} features complete key management and
 all bells and whistles you can expect from a decent OpenPGP
 implementation.
 
+ at ifset gpgone
+This is the standa alone version of @command{gpg}.  For desktop use you
+shoul consider using @command{gpg2}.
+ at end ifset
+
+ at ifclear gpgone
 In contrast to the standalone version @command{gpg}, which is more
 suited for server and embedded platforms, this version is installed
 under the name @command{gpg2} and more targeted to the desktop as it
@@ -43,12 +80,15 @@
 the same system.  If you need to use different configuration files, you
 should make use of something like @file{gpg.conf-2} instead of just
 @file{gpg.conf}.
+ at end ifclear
 
 @manpause
-Documentation for the old standard @command{gpg} is available as man page
-man page and at @inforef{Top,GnuPG 1,gpg}.
+ at ifclear gpgone
+Documentation for the old standard @command{gpg} is available as a man
+page and at @inforef{Top,GnuPG 1,gpg}.
+ at end ifclear
 
- at xref{Option Index}, for an index to @command{GPG}'s commands and options.
+ at xref{Option Index}, for an index to @command{@gpgname}'s commands and options.
 @mancont
 
 @menu
@@ -76,7 +116,7 @@
 Commands are not distinguished from options execpt for the fact that
 only one command is allowed.
 
- at code{gpg2} may be run with no commands, in which case it will
+ at command{@gpgname} may be run with no commands, in which case it will
 perform a reasonable action depending on the type of file it is given
 as input (an encrypted message is decrypted, a signature is verified,
 a file containing keys is listed).
@@ -778,7 +818,7 @@
 @node GPG Options
 @section Option Summary
 
- at command{GPG} comes features a bunch of options to control the exact
+ at command{@gpgname} comes features a bunch of options to control the exact
 behaviour and to change the default configuration.
 
 @menu
@@ -1380,10 +1420,15 @@
 
 @item --use-agent
 @itemx --no-use-agent
-Try to use the GnuPG-Agent. Please note that this agent is still under
-development. With this option, GnuPG first tries to connect to the
+ at ifclear gpgone
+This is dummy option. @command{@gpgname} always requires the agent.
+ at end ifclear
+ at ifset gpgone
+Try to use the GnuPG-Agent. 
+With this option, GnuPG first tries to connect to the
 agent before it asks for a passphrase. --no-use-agent disables this
 option.
+ at end ifset
 
 @item --gpg-agent-info
 Override the value of the environment variable
@@ -1462,7 +1507,7 @@
 When verifying a signature made from a subkey, ensure that the cross
 certification "back signature" on the subkey is present and valid.
 This protects against a subtle attack against subkeys that can sign.
-Defaults to --require-cross-certification for @command{gpg2}.
+Defaults to --require-cross-certification for @command{@gpgname}.
 
 @item --expert
 @itemx --no-expert
@@ -2361,14 +2406,14 @@
 @section Configuration files
 
 There are a few configuration files to control certain aspects of
- at command{gpg2}'s operation. Unless noted, they are expected in the
+ at command{@gpgname}'s operation. Unless noted, they are expected in the
 current home directory (@pxref{option --homedir}).
 
 @table @file
 
 @item gpg.conf
 @cindex gpgsm.conf
-This is the standard configuration file read by @command{gpg2} on
+This is the standard configuration file read by @command{@gpgname} on
 startup.  It may contain any valid long option; the leading two dashes
 may not be entered and the option may not be abbreviated.  This default
 name may be changed on the command line (@pxref{option
@@ -2382,9 +2427,9 @@
 start up with a working configuration.  For existing users the a small
 helper script is provided to create these files (@pxref{addgnupghome}).
 
-For internal purposes @command{gpg2} creates and maintaines a few other
+For internal purposes @command{@gpgname} creates and maintaines a few other
 files; They all live in in the current home directory (@pxref{option
---homedir}).  Only the @command{gpg2} may modify these files.
+--homedir}).  Only the @command{@gpgname} may modify these files.
 
 
 @table @file

Modified: trunk/doc/yat2m.c
===================================================================
--- trunk/doc/yat2m.c	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/doc/yat2m.c	2006-09-22 14:38:38 UTC (rev 4260)
@@ -105,11 +105,27 @@
 static const char *opt_include;
 static int opt_store;
 
+/* The only define we understand is -D gpgone.  Thus we need a simple
+   boolean tro track it. */
+static int gpgone_defined;
 
 /* Flag to keep track whether any error occurred.  */
 static int any_error;
 
 
+/* Object to keep macro definitions.  */
+struct macro_s
+{
+  struct macro_s *next;
+  char *value;  /* Malloced value. */
+  char name[1];
+};
+typedef struct macro_s *macro_t;
+
+/* List of all defined macros. */
+static macro_t macrolist;
+
+
 /* Object to store one line of content.  */
 struct line_buffer_s
 {
@@ -468,8 +484,6 @@
     { "bullet",  0, "* " },
     { "end",     4 },
     { "quotation",1, ".RS\n\\fB" },
-    { "ifset",   1 },
-    { "ifclear",   1 },
     { NULL }
   };
   size_t n;
@@ -551,8 +565,20 @@
     }
   else
     {
-      inf ("texinfo command `%s' not supported (%.*s)", command,
-           ((s = memchr (rest, '\n', len)), (s? (s-rest) : len)), rest);
+      macro_t m;
+
+      for (m = macrolist; m ; m = m->next)
+        if (!strcmp (m->name, command))
+            break;
+      if (m)
+        {
+          proc_texi_buffer (fp, m->value, strlen (m->value),
+                            table_level, eol_action);
+          ignore_args = 1; /* Parameterized macros are not yet supported. */
+        }
+      else
+        inf ("texinfo command `%s' not supported (%.*s)", command,
+             ((s = memchr (rest, '\n', len)), (s? (s-rest) : len)), rest);
     }
 
   if (*rest == '{')
@@ -654,6 +680,16 @@
       else
         putc (*s, fp);
     }
+
+  if (in_cmd > 1)
+    {
+      cmdbuf[cmdidx] = 0;
+      n = proc_texi_cmd (fp, cmdbuf, s, len, table_level, eol_action);
+      assert (n <= len);
+      s += n; len -= n;
+      s--; len++;
+      in_cmd = 0;
+    }
 }
 
 
@@ -808,10 +844,23 @@
 {
   char *line;
   int lnr = 0;
+  /* Fixme: The follwing state variables don't carry over to include
+     files. */
   int in_verbatim = 0;
   int skip_to_end = 0;        /* Used to skip over menu entries. */
   int skip_sect_line = 0;     /* Skip after @mansect.  */
+  int ifset_nesting = 0;      /* How often a ifset has been seen. */
+  int ifclear_nesting = 0;    /* How often a ifclear has been seen. */
+  int in_gpgone = 0;          /* Keep track of "@ifset gpgone" parts.  */
+  int not_in_gpgone = 0;      /* Keep track of "@ifclear gpgone" parts.  */
+  int not_in_man = 0;         /* Keep track of "@ifclear isman" parts.  */
 
+  /* Helper to define a macro. */
+  char *macroname = NULL;     
+  char *macrovalue = NULL; 
+  size_t macrovaluesize = 0;
+  size_t macrovalueused = 0;
+
   line = xmalloc (LINESIZE);
   while (fgets (line, LINESIZE, fp))
     {
@@ -828,6 +877,63 @@
         }
       line[--n] = 0;
 
+      if (*line == '@')
+        {
+          for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++)
+            n++;
+          while (*p == ' ' || *p == '\t')
+            p++;
+        }
+      else
+        p = line;
+
+      /* Take action on macro.  */
+      if (macroname)
+        {
+          if (n == 4 && !memcmp (line, "@end", 4)
+              && (line[4]==' '||line[4]=='\t'||!line[4])
+              && !strncmp (p, "macro", 5)
+              && (p[5]==' '||p[5]=='\t'||!p[5]))
+            {
+              macro_t m;
+
+              if (macrovalueused)
+                macrovalue[--macrovalueused] = 0; /* Kill the last LF. */
+              macrovalue[macrovalueused] = 0;     /* Terminate macro. */
+              macrovalue = xrealloc (macrovalue, macrovalueused+1);
+              
+              for (m= macrolist; m; m = m->next)
+                if (!strcmp (m->name, macroname))
+                  break;
+              if (m)
+                free (m->value);
+              else
+                {
+                  m = xcalloc (1, sizeof *m + strlen (macroname));
+                  strcpy (m->name, macroname);
+                  m->next = macrolist;
+                  macrolist = m;
+                }
+              m->value = macrovalue;
+              macrovalue = NULL;
+              free (macroname);
+              macroname = NULL;
+            }
+          else
+            {
+              if (macrovalueused + strlen (line) + 2 >= macrovaluesize)
+                {
+                  macrovaluesize += strlen (line) + 256;
+                  macrovalue = xrealloc (macrovalue,  macrovaluesize);
+                }
+              strcpy (macrovalue+macrovalueused, line);
+              macrovalueused += strlen (line);
+              macrovalue[macrovalueused++] = '\n';
+            }
+          continue;
+        }
+
+
       if (n >= 5 && !memcmp (line, "@node", 5)
           && (line[5]==' '||line[5]=='\t'||!line[5]))
         {
@@ -849,37 +955,116 @@
          few macros used to control this as well as one @ifset
          command.  Parts we know about are saved away into containers
          separate for each section. */
+
+      /* First process ifset/ifclear commands. */
       if (*line == '@')
         {
-          for (p=line+1, n=1; *p && *p != ' ' && *p != '\t'; p++)
-            n++;
-          while (*p == ' ' || *p == '\t')
-            p++;
+          if (n == 6 && !memcmp (line, "@ifset", 6)
+                   && (line[6]==' '||line[6]=='\t'))
+            {
+              ifset_nesting++;
 
+              if (!strncmp (p, "manverb", 7) && (p[7]==' '||p[7]=='\t'||!p[7]))
+                {
+                  if (in_verbatim)
+                    err ("%s:%d: nested \"@ifset manverb\"", fname, lnr);
+                  else
+                    in_verbatim = ifset_nesting;
+                }
+              else if (!strncmp (p, "gpgone", 6)
+                       && (p[6]==' '||p[6]=='\t'||!p[6]))
+                {
+                  if (in_gpgone)
+                    err ("%s:%d: nested \"@ifset gpgone\"", fname, lnr);
+                  else
+                    in_gpgone = ifset_nesting;
+                }
+              continue;
+            }
+          else if (n == 4 && !memcmp (line, "@end", 4)
+                   && (line[4]==' '||line[4]=='\t')
+                   && !strncmp (p, "ifset", 5)
+                   && (p[5]==' '||p[5]=='\t'||!p[5]))
+            {
+              if (in_verbatim && ifset_nesting == in_verbatim)
+                in_verbatim = 0;
+              if (in_gpgone && ifset_nesting == in_gpgone)
+                in_gpgone = 0;
+
+              if (ifset_nesting)
+                ifset_nesting--;
+              else
+                err ("%s:%d: unbalanced \"@end ifset\"", fname, lnr);
+              continue;
+            }
+          else if (n == 8 && !memcmp (line, "@ifclear", 8)
+                   && (line[8]==' '||line[8]=='\t'))
+            {
+              ifclear_nesting++;
+
+              if (!strncmp (p, "gpgone", 6)
+                  && (p[6]==' '||p[6]=='\t'||!p[6]))
+                {
+                  if (not_in_gpgone)
+                    err ("%s:%d: nested \"@ifclear gpgone\"", fname, lnr);
+                  else
+                    not_in_gpgone = ifclear_nesting;
+                }
+
+              else if (!strncmp (p, "isman", 5)
+                       && (p[5]==' '||p[5]=='\t'||!p[5]))
+                {
+                  if (not_in_man)
+                    err ("%s:%d: nested \"@ifclear isman\"", fname, lnr);
+                  else
+                    not_in_man = ifclear_nesting;
+                }
+
+              continue;
+            }
+          else if (n == 4 && !memcmp (line, "@end", 4)
+                   && (line[4]==' '||line[4]=='\t')
+                   && !strncmp (p, "ifclear", 7)
+                   && (p[7]==' '||p[7]=='\t'||!p[7]))
+            {
+              if (not_in_gpgone && ifclear_nesting == not_in_gpgone)
+                not_in_gpgone = 0;
+              if (not_in_man && ifclear_nesting == not_in_man)
+                not_in_man = 0;
+
+              if (ifclear_nesting)
+                ifclear_nesting--;
+              else
+                err ("%s:%d: unbalanced \"@end ifclear\"", fname, lnr);
+              continue;
+            }
+        }
+
+      /* Take action on ifset/ifclear.  */
+      if ( (in_gpgone && !gpgone_defined)
+           || (not_in_gpgone && gpgone_defined)
+           || not_in_man)
+        continue;
+
+      /* Process commands. */
+      if (*line == '@')
+        {
           if (skip_to_end
               && n == 4 && !memcmp (line, "@end", 4)
               && (line[4]==' '||line[4]=='\t'||!line[4]))
             {
               skip_to_end = 0;
             }
-          else if (n == 6 && !memcmp (line, "@ifset", 6)
-              && !strncmp (p, "manverb", 7) && (p[7]==' '||p[7]=='\t'||!p[7]))
+          else if (in_verbatim)
             {
-              if (in_verbatim)
-                err ("%s:%d: nested \"@ifset manverb\"", fname, lnr);
-              else
-                in_verbatim = 1;
+                got_line = 1;
             }
-          else if (in_verbatim && n == 4 && !memcmp (line, "@end", 4)
-                   && !strncmp (p, "ifset", 5)
-                   && (p[5]==' '||p[5]=='\t'||!p[5]))
+          else if (n == 6 && !memcmp (line, "@macro", 6))
             {
-              in_verbatim = 0;
+              macroname = xstrdup (p);
+              macrovalue = xmalloc ((macrovaluesize = 1024));
+              macrovalueused = 0;
             }
-          else if (in_verbatim)
-            {
-              got_line = 1;
-            }
           else if (n == 8 && !memcmp (line, "@manpage", 8))
             {
               free (*section_name);
@@ -923,11 +1108,6 @@
             {
               skip_to_end = 1;
             }
-          else if (n == 8 && !memcmp (line, "@ifclear", 8)
-              && !strncmp (p, "isman", 5) && (p[5]==' '||p[5]=='\t'||!p[5]))
-            {
-              skip_to_end = 1;
-            }
           else if (n == 8 && !memcmp (line, "@include", 8)
                    && (line[8]==' '||line[8]=='\t'||!line[8]))
             {
@@ -956,6 +1136,11 @@
                 }
               free (incname);
             }
+          else if (n == 4 && !memcmp (line, "@bye", 4)
+                   && (line[4]==' '||line[4]=='\t'||!line[4]))
+            {
+              break;
+            }
           else if (!skip_to_end)
             got_line = 1;
         }
@@ -970,6 +1155,8 @@
     }
   if (ferror (fp))
     err ("%s:%d: read error: %s", fname, lnr, strerror (errno));
+  free (macroname);
+  free (macrovalue);
   free (line);
 }
 
@@ -979,6 +1166,14 @@
 {
   char *section_name = NULL;  /* Name of the current section or NULL
                                  if not in a section.  */
+  while (macrolist)
+    {
+      macro_t m = macrolist->next;
+      free (m->value);
+      free (m);
+      macrolist = m;
+    }
+
   parse_file (fname, fp, &section_name, 0);
   free (section_name);
   finish_page ();
@@ -1017,7 +1212,8 @@
                 "  --verbose        enable extra informational output\n"
                 "  --debug          enable additional debug output\n"
                 "  --help           display this help and exit\n"
-                "  -I DIR           also search in include DIR\n\n"
+                "  -I DIR           also search in include DIR\n"
+                "  -D gpgone        the only useable define\n\n"
                 "With no FILE, or when FILE is -, read standard input.\n\n"
                 "Report bugs to <bugs at g10code.com>.");
           exit (0);
@@ -1091,6 +1287,16 @@
               argc--; argv++;
             }
         }
+      else if (!strcmp (*argv, "-D"))
+        {
+          argc--; argv++;
+          if (argc)
+            {
+              if (!strcmp (*argv, "gpgone"))
+                gpgone_defined = 1;
+              argc--; argv++;
+            }
+        }
     }          
  
   if (argc > 1)

Modified: trunk/keyserver/ChangeLog
===================================================================
--- trunk/keyserver/ChangeLog	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/keyserver/ChangeLog	2006-09-22 14:38:38 UTC (rev 4260)
@@ -7,6 +7,8 @@
 	to OpenSSL.  This is considered a bug fix and forgives all
 	possible violations, pertaining to this issue, possibly occured in
 	the past.
+	
+	* no-libgcrypt.c: Changed license to a simple all permissive one.
 
 	* Makefile.am (gpg2keys_ldap_LDADD): For license reasons do not
 	link against common_libs.

Modified: trunk/keyserver/no-libgcrypt.c
===================================================================
--- trunk/keyserver/no-libgcrypt.c	2006-09-22 11:39:45 UTC (rev 4259)
+++ trunk/keyserver/no-libgcrypt.c	2006-09-22 14:38:38 UTC (rev 4260)
@@ -1,22 +1,13 @@
 /* no-libgcrypt.c - Replacement functions for libgcrypt.
  *	Copyright (C) 2003 Free Software Foundation, Inc.
  *
- * This file is part of GnuPG.
- *
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GnuPG is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ * 
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #include <config.h>




More information about the Gnupg-commits mailing list