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)
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;
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;
}
}
+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)
{
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);
} 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);
} 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);