mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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.
This commit is contained in:
parent
cf748e8736
commit
2871422d9a
@ -1407,11 +1407,11 @@ input lines which makes scripts easier to read.
|
|||||||
|
|
||||||
@item /while @var{condition}
|
@item /while @var{condition}
|
||||||
@itemx /end
|
@itemx /end
|
||||||
These commands provide a way for executing loops. All lines between the
|
These commands provide a way for executing loops. All lines between
|
||||||
@code{while} and the corresponding @code{end} are executed as long as
|
the @code{while} and the corresponding @code{end} are executed as long
|
||||||
the evaluation of @var{condition} yields a non-zero value. The
|
as the evaluation of @var{condition} yields a non-zero value or is the
|
||||||
evaluation is done by passing @var{condition} to the @code{strtol}
|
string @code{true} or @code{yes}. The evaluation is done by passing
|
||||||
function. Example:
|
@var{condition} to the @code{strtol} function. Example:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
/subst
|
/subst
|
||||||
@ -1422,6 +1422,13 @@ function. Example:
|
|||||||
/end
|
/end
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
@item /if @var{condition}
|
||||||
|
@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
|
||||||
|
@var{condition} to the @code{strtol} function.
|
||||||
|
|
||||||
@item /run @var{file}
|
@item /run @var{file}
|
||||||
Run commands from @var{file}.
|
Run commands from @var{file}.
|
||||||
|
@ -1747,6 +1747,13 @@ main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
tmpline = substitute_line (tmpcond);
|
tmpline = substitute_line (tmpcond);
|
||||||
value = tmpline? tmpline : tmpcond;
|
value = tmpline? tmpline : tmpcond;
|
||||||
|
/* "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);
|
condition = strtol (value, NULL, 0);
|
||||||
xfree (tmpline);
|
xfree (tmpline);
|
||||||
xfree (tmpcond);
|
xfree (tmpcond);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user