1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

cgtest: stop also behaving like cmdgen.

The self-test mode of command-line PuTTYgen used to be compiled by
manually setting a #define, so that it would _replace_ the puttygen
binary. Therefore, it was useful to still have it behave like puttygen
if invoked with arguments, so that you didn't have to annoyingly
recompile back and forth to switch between manual and automated
testing.

But now that cgtest is built _alongside_ puttygen, there's no need for
that. If someone needs the non-test version of puttygen, it's right
there next to cgtest. So I've removed that weird special case, and
replaced it with a new command-line syntax for cgtest which supports a
-v option (which itself replaces configuration via an awkward
environment variable CGTEST_VERBOSE).
This commit is contained in:
Simon Tatham 2020-01-13 22:04:32 +00:00
parent 43a63019f5
commit 93f7b324a5

View File

@ -1291,16 +1291,17 @@ int main(int argc, char **argv)
int i;
static char *const keytypes[] = { "rsa1", "dsa", "rsa" };
if (getenv("CGTEST_VERBOSE"))
cgtest_verbose = true;
/*
* Even when this thing is compiled for automatic test mode,
* it's helpful to be able to invoke it with command-line
* options for _manual_ tests.
*/
if (argc > 1)
return cmdgen_main(argc, argv);
while (--argc > 0) {
ptrlen arg = ptrlen_from_asciz(*++argv);
if (ptrlen_eq_string(arg, "-v") ||
ptrlen_eq_string(arg, "--verbose")) {
cgtest_verbose = true;
} else {
fprintf(stderr, "cgtest: unrecognised option '%.*s'\n",
PTRLEN_PRINTF(arg));
return 1;
}
}
passes = fails = 0;