Add '-V' for version

-h should exit with success
Update manpages
This commit is contained in:
Matt Johnston 2014-07-27 22:06:26 +08:00
parent 5cf83a7212
commit ed0552f214
6 changed files with 29 additions and 7 deletions

View File

@ -90,6 +90,7 @@ static void printhelp() {
"-c <cipher list> Specify preferred ciphers ('-c help' to list options)\n" "-c <cipher list> Specify preferred ciphers ('-c help' to list options)\n"
"-m <MAC list> Specify preferred MACs for packet verification (or '-m help')\n" "-m <MAC list> Specify preferred MACs for packet verification (or '-m help')\n"
#endif #endif
"-V Version\n"
#ifdef DEBUG_TRACE #ifdef DEBUG_TRACE
"-v verbose (compiled with DEBUG_TRACE)\n" "-v verbose (compiled with DEBUG_TRACE)\n"
#endif #endif
@ -324,6 +325,10 @@ void cli_getopts(int argc, char ** argv) {
#ifndef ENABLE_CLI_LOCALTCPFWD #ifndef ENABLE_CLI_LOCALTCPFWD
case 'L': case 'L':
#endif #endif
case 'V':
print_version();
exit(EXIT_SUCCESS);
break;
case 'o': case 'o':
case 'b': case 'b':
next = &dummy; next = &dummy;

View File

@ -106,3 +106,8 @@ parse_ciphers_macs()
} }
#endif #endif
void print_version(const char* name) {
fprintf(stderr, "Dropbear %s v%s\n", name, DROPBEAR_VERSION);
}

View File

@ -19,8 +19,7 @@ dbclient \- lightweight SSH client
.SH DESCRIPTION .SH DESCRIPTION
.B dbclient .B dbclient
is a SSH client designed to be small enough to be used in small memory is a small SSH client
environments, while still being functional and secure enough for general use.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-p \fIport .B \-p \fIport
@ -98,7 +97,7 @@ Ensure that traffic is transmitted at a certain interval in seconds. This is
useful for working around firewalls or routers that drop connections after useful for working around firewalls or routers that drop connections after
a certain period of inactivity. The trade-off is that a session may be a certain period of inactivity. The trade-off is that a session may be
closed if there is a temporary lapse of network connectivity. A setting closed if there is a temporary lapse of network connectivity. A setting
if 0 disables keepalives. if 0 disables keepalives. If no response is received for 3 consecutive keepalives the connection will be closed.
.TP .TP
.B \-I \fIidle_timeout .B \-I \fIidle_timeout
Disconnect the session if no traffic is transmitted or received for \fIidle_timeout\fR seconds. Disconnect the session if no traffic is transmitted or received for \fIidle_timeout\fR seconds.
@ -121,6 +120,9 @@ Specify a comma separated list of authentication MACs to enable. Use \fI-m help\
.TP .TP
.B \-s .B \-s
The specified command will be requested as a subsystem, used for sftp. Dropbear doesn't implement sftp itself but the OpenSSH sftp client can be used eg \fIsftp -S dbclient user@host\fR The specified command will be requested as a subsystem, used for sftp. Dropbear doesn't implement sftp itself but the OpenSSH sftp client can be used eg \fIsftp -S dbclient user@host\fR
.TP
.B \-V
Print the version
.SH MULTI-HOP .SH MULTI-HOP
Dropbear will also allow multiple "hops" to be specified, separated by commas. In Dropbear will also allow multiple "hops" to be specified, separated by commas. In

View File

@ -10,8 +10,7 @@ dropbear \- lightweight SSH server
.IR [address:]port ] .IR [address:]port ]
.SH DESCRIPTION .SH DESCRIPTION
.B dropbear .B dropbear
is a SSH server designed to be small enough to be used in small memory is a small SSH server
environments, while still being functional and secure enough for general use.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-b \fIbanner .B \-b \fIbanner
@ -88,10 +87,14 @@ Ensure that traffic is transmitted at a certain interval in seconds. This is
useful for working around firewalls or routers that drop connections after useful for working around firewalls or routers that drop connections after
a certain period of inactivity. The trade-off is that a session may be a certain period of inactivity. The trade-off is that a session may be
closed if there is a temporary lapse of network connectivity. A setting closed if there is a temporary lapse of network connectivity. A setting
if 0 disables keepalives. if 0 disables keepalives. If no response is received for 3 consecutive keepalives the connection will be closed.
.TP .TP
.B \-I \fIidle_timeout .B \-I \fIidle_timeout
Disconnect the session if no traffic is transmitted or received for \fIidle_timeout\fR seconds. Disconnect the session if no traffic is transmitted or received for \fIidle_timeout\fR seconds.
.TP
.B \-V
Print the version
.SH FILES .SH FILES
.TP .TP

View File

@ -164,4 +164,6 @@ void cli_getopts(int argc, char ** argv);
void parse_ciphers_macs(); void parse_ciphers_macs();
#endif #endif
void print_version(const char* name);
#endif /* _RUNOPTS_H_ */ #endif /* _RUNOPTS_H_ */

View File

@ -92,6 +92,7 @@ static void printhelp(const char * progname) {
"-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n" "-W <receive_window_buffer> (default %d, larger may be faster, max 1MB)\n"
"-K <keepalive> (0 is never, default %d, in seconds)\n" "-K <keepalive> (0 is never, default %d, in seconds)\n"
"-I <idle_timeout> (0 is never, default %d, in seconds)\n" "-I <idle_timeout> (0 is never, default %d, in seconds)\n"
"-V Version\n"
#ifdef DEBUG_TRACE #ifdef DEBUG_TRACE
"-v verbose (compiled with DEBUG_TRACE)\n" "-v verbose (compiled with DEBUG_TRACE)\n"
#endif #endif
@ -256,7 +257,7 @@ void svr_getopts(int argc, char ** argv) {
#endif #endif
case 'h': case 'h':
printhelp(argv[0]); printhelp(argv[0]);
exit(EXIT_FAILURE); exit(EXIT_SUCCESS);
break; break;
case 'u': case 'u':
/* backwards compatibility with old urandom option */ /* backwards compatibility with old urandom option */
@ -266,6 +267,10 @@ void svr_getopts(int argc, char ** argv) {
debug_trace = 1; debug_trace = 1;
break; break;
#endif #endif
case 'V':
print_version("server");
exit(EXIT_SUCCESS);
break;
default: default:
fprintf(stderr, "Unknown argument %s\n", argv[i]); fprintf(stderr, "Unknown argument %s\n", argv[i]);
printhelp(argv[0]); printhelp(argv[0]);