1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-14 17:48:05 -05:00

Unix 'puttygen --help' was a mess.

Bring it into line with the other PuTTY tools: --help goes to stdout,
has a one-line purpose and brief version information, --version ends
with a newline.

(Also, tweak text bring the help message under 80 columns.)
This commit is contained in:
Jacob Nevins 2017-02-11 20:12:55 +00:00
parent 9a2730806c
commit 9dc9cca226

View File

@ -130,13 +130,13 @@ void sk_cleanup(void)
void showversion(void) void showversion(void)
{ {
char *buildinfo_text = buildinfo("\n"); char *buildinfo_text = buildinfo("\n");
printf("puttygen: %s\n%s", ver, buildinfo_text); printf("puttygen: %s\n%s\n", ver, buildinfo_text);
sfree(buildinfo_text); sfree(buildinfo_text);
} }
void usage(int standalone) void usage(int standalone)
{ {
fprintf(stderr, fprintf(standalone ? stderr : stdout,
"Usage: puttygen ( keyfile | -t type [ -b bits ] )\n" "Usage: puttygen ( keyfile | -t type [ -b bits ] )\n"
" [ -C comment ] [ -P ] [ -q ]\n" " [ -C comment ] [ -P ] [ -q ]\n"
" [ -o output-keyfile ] [ -O type | -l | -L" " [ -o output-keyfile ] [ -O type | -l | -L"
@ -152,35 +152,35 @@ void help(void)
* Help message is an extended version of the usage message. So * Help message is an extended version of the usage message. So
* start with that, plus a version heading. * start with that, plus a version heading.
*/ */
showversion(); printf("PuTTYgen: key generator and converter for the PuTTY tools\n"
"%s\n", ver);
usage(FALSE); usage(FALSE);
fprintf(stderr, printf(" -t specify key type when generating (ed25519, ecdsa, rsa, "
" -t specify key type when generating (ed25519, ecdsa, rsa, "
"dsa, rsa1)\n" "dsa, rsa1)\n"
" -b specify number of bits when generating key\n" " -b specify number of bits when generating key\n"
" -C change or specify key comment\n" " -C change or specify key comment\n"
" -P change key passphrase\n" " -P change key passphrase\n"
" -q quiet: do not display progress bar\n" " -q quiet: do not display progress bar\n"
" -O specify output type:\n" " -O specify output type:\n"
" private output PuTTY private key format\n" " private output PuTTY private key format\n"
" private-openssh export OpenSSH private key\n" " private-openssh export OpenSSH private key\n"
" private-openssh-new export OpenSSH private key " " private-openssh-new export OpenSSH private key "
"(force new file format)\n" "(force new format)\n"
" private-sshcom export ssh.com private key\n" " private-sshcom export ssh.com private key\n"
" public RFC 4716 / ssh.com public key\n" " public RFC 4716 / ssh.com public key\n"
" public-openssh OpenSSH public key\n" " public-openssh OpenSSH public key\n"
" fingerprint output the key fingerprint\n" " fingerprint output the key fingerprint\n"
" -o specify output file\n" " -o specify output file\n"
" -l equivalent to `-O fingerprint'\n" " -l equivalent to `-O fingerprint'\n"
" -L equivalent to `-O public-openssh'\n" " -L equivalent to `-O public-openssh'\n"
" -p equivalent to `-O public'\n" " -p equivalent to `-O public'\n"
" --old-passphrase file\n" " --old-passphrase file\n"
" specify file containing old key passphrase\n" " specify file containing old key passphrase\n"
" --new-passphrase file\n" " --new-passphrase file\n"
" specify file containing new key passphrase\n" " specify file containing new key passphrase\n"
" --random-device device\n" " --random-device device\n"
" specify device to read entropy from (e.g. /dev/urandom)\n" " specify device to read entropy from (e.g. /dev/urandom)\n"
); );
} }
static int move(char *from, char *to) static int move(char *from, char *to)