From 2871422d9a889cb632f59efda4d9cd170fc9fca7 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 27 Jan 2012 15:40:24 +0100 Subject: 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. --- tools/gpg-connect-agent.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index 117f3380c..7472728c6 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); -- cgit v1.2.3