[git] GnuPG - branch, master, updated. gnupg-2.1.0beta3-37-g2871422

by Werner Koch cvs at cvs.gnupg.org
Fri Jan 27 16:37:30 CET 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  2871422d9a889cb632f59efda4d9cd170fc9fca7 (commit)
      from  cf748e8736b984194345bfd74887b35d3d23fa37 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2871422d9a889cb632f59efda4d9cd170fc9fca7
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Jan 27 15:40:24 2012 +0100

    gpg-connect-tool: Take the string "true" as a true condition.
    
    * tools/gpg-connect-agent.c (main): Handle strings "true" and "yes" in
    conditions as expected.

diff --git a/doc/tools.texi b/doc/tools.texi
index 5e9a024..be1233b 100644
--- a/doc/tools.texi
+++ b/doc/tools.texi
@@ -1407,11 +1407,11 @@ input lines which makes scripts easier to read.
 
 @item /while @var{condition}
 @itemx /end
-These commands provide a way for executing loops.  All lines between the
- at code{while} and the corresponding @code{end} are executed as long as
-the evaluation of @var{condition} yields a non-zero value.  The
-evaluation is done by passing @var{condition} to the @code{strtol}
-function.  Example:
+These commands provide a way for executing loops.  All lines between
+the @code{while} and the corresponding @code{end} are executed as long
+as the evaluation of @var{condition} yields a non-zero value or is the
+string @code{true} or @code{yes}.  The evaluation is done by passing
+ at var{condition} to the @code{strtol} function.  Example:
 
 @smallexample
   /subst
@@ -1422,6 +1422,13 @@ function.  Example:
   /end
 @end smallexample
 
+ at item /if @var{condition}
+ at itemx /end
+These commands provide a way for conditional execution.  All lines between
+the @code{if} and the corresponding @code{end} are executed only if
+the evaluation of @var{condition} yields a non-zero value or is the
+string @code{true} or @code{yes}.  The evaluation is done by passing
+ at var{condition} to the @code{strtol} function.
 
 @item /run @var{file}
 Run commands from @var{file}.
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index 117f338..7472728 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -1747,7 +1747,14 @@ main (int argc, char **argv)
                     }
                   tmpline = substitute_line (tmpcond);
                   value = tmpline? tmpline : tmpcond;
-                  condition = strtol (value, NULL, 0);
+                  /* "true" or "yes" are commonly used to mean TRUE;
+                     all other strings will evaluate to FALSE due to
+                     the strtoul.  */
+                  if (!ascii_strcasecmp (value, "true")
+                      || !ascii_strcasecmp (value, "yes"))
+                    condition = 1;
+                  else
+                    condition = strtol (value, NULL, 0);
                   xfree (tmpline);
                   xfree (tmpcond);
 

-----------------------------------------------------------------------

Summary of changes:
 doc/tools.texi            |   17 ++++++++++++-----
 tools/gpg-connect-agent.c |    9 ++++++++-
 2 files changed, 20 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list