mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Make --help and --version work consistently across all tools.
Well, at least across all command-line tools on both Windows and Unix, and the GTK apps on Unix too. The Windows GUI apps fundamentally can't write to standard output and it doesn't seem sensible to use message boxes for these purposes :-) [originally from svn r9673]
This commit is contained in:
parent
65290ced76
commit
5db48dcddb
5
cmdgen.c
5
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)
|
||||
|
7
pscp.c
7
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;
|
||||
|
6
psftp.c
6
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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user