Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2020-01-14 01:04:32 +0300
committerSimon Tatham <anakin@pobox.com>2020-01-14 09:50:55 +0300
commit93f7b324a51d0d73e5c8cfecfc0077939bafc7ba (patch)
tree54c8b93c7114e21ba1c4ab1a05bcacde4eaaa70d /cmdgen.c
parent43a63019f5bdc627170212ec5ed8c1333ad4727b (diff)
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).
Diffstat (limited to 'cmdgen.c')
-rw-r--r--cmdgen.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/cmdgen.c b/cmdgen.c
index 4946aa5c..0ba70f19 100644
--- a/cmdgen.c
+++ b/cmdgen.c
@@ -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;