diff --git a/cmdgen.c b/cmdgen.c index 5b0e54d9..86a548e3 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -118,10 +118,7 @@ void sk_cleanup(void) void showversion(void) { - char *verstr = dupstr(ver); - verstr[0] = tolower((unsigned char)verstr[0]); - printf("PuTTYgen %s\n", verstr); - sfree(verstr); + printf("puttygen: %s\n", ver); } void usage(int standalone) diff --git a/pscp.c b/pscp.c index 833e46cd..054e437b 100644 --- a/pscp.c +++ b/pscp.c @@ -2283,9 +2283,12 @@ int psftp_main(int argc, char *argv[]) preserve = 1; } else if (strcmp(argv[i], "-q") == 0) { statistics = 0; - } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-?") == 0) { + } else if (strcmp(argv[i], "-h") == 0 || + strcmp(argv[i], "-?") == 0 || + strcmp(argv[i], "--help") == 0) { usage(); - } else if (strcmp(argv[i], "-V") == 0) { + } else if (strcmp(argv[i], "-V") == 0 || + strcmp(argv[i], "--version") == 0) { version(); } else if (strcmp(argv[i], "-ls") == 0) { list = 1; diff --git a/psftp.c b/psftp.c index ef930bdd..ab287dfd 100644 --- a/psftp.c +++ b/psftp.c @@ -2923,12 +2923,14 @@ int psftp_main(int argc, char *argv[]) if (flags & FLAG_VERBOSE) verbose = 1; } else if (strcmp(argv[i], "-h") == 0 || - strcmp(argv[i], "-?") == 0) { + strcmp(argv[i], "-?") == 0 || + strcmp(argv[i], "--help") == 0) { usage(); } else if (strcmp(argv[i], "-pgpfp") == 0) { pgp_fingerprints(); return 1; - } else if (strcmp(argv[i], "-V") == 0) { + } else if (strcmp(argv[i], "-V") == 0 || + strcmp(argv[i], "--version") == 0) { version(); } else if (strcmp(argv[i], "-batch") == 0) { console_batch_mode = 1; diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 2c0df9cb..bd69fb69 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -2592,6 +2592,13 @@ static void help(FILE *fp) { } } +static void version(FILE *fp) { + if(fprintf(fp, "%s: %s\n", appname, ver) < 0 || fflush(fp) < 0) { + perror("output error"); + exit(1); + } +} + int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch, struct gui_data *inst, Conf *conf) { @@ -2801,6 +2808,10 @@ int do_cmdline(int argc, char **argv, int do_everything, int *allow_launch, help(stdout); exit(0); + } else if(!strcmp(p, "-version") || !strcmp(p, "--version")) { + version(stdout); + exit(0); + } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); exit(1); diff --git a/unix/uxplink.c b/unix/uxplink.c index 0d896225..560ec386 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -654,8 +654,11 @@ int main(int argc, char **argv) } else if (!strcmp(p, "-s")) { /* Save status to write to conf later. */ use_subsystem = 1; - } else if (!strcmp(p, "-V")) { + } else if (!strcmp(p, "-V") || !strcmp(p, "--version")) { version(); + } else if (!strcmp(p, "--help")) { + usage(); + exit(0); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); exit(1); diff --git a/windows/winplink.c b/windows/winplink.c index 7ec98e7f..0abed7ce 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -343,8 +343,10 @@ int main(int argc, char **argv) } else if (!strcmp(p, "-s")) { /* Save status to write to conf later. */ use_subsystem = 1; - } else if (!strcmp(p, "-V")) { + } else if (!strcmp(p, "-V") || !strcmp(p, "--version")) { version(); + } else if (!strcmp(p, "--help")) { + usage(); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); exit(1);