diff --git a/daemon/daemon.c b/daemon/daemon.c index 7b5f81912..0ef3b4278 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -68,7 +68,7 @@ static const struct tr_option options[] = { 'a', "allowed", "Allowed IP addresses. (Default: " TR_DEFAULT_RPC_WHITELIST ")", "a", 1, "" }, { 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL }, { 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL }, - { 'c', "watch-dir", "Directory to watch for new .torrent files", "c", 1, "" }, + { 'c', "watch-dir", "Where to watch for new .torrent files", "c", 1, "" }, { 'C', "no-watch-dir", "Disable the watch-dir", "C", 0, NULL }, { 941, "incomplete-dir", "Where to store new torrents until they're complete", NULL, 1, "" }, { 942, "no-incomplete-dir", "Don't store incomplete torrents in a different location", NULL, 0, NULL }, @@ -96,9 +96,9 @@ static const struct tr_option options[] = { 910, "encryption-required", "Encrypt all peer connections", "er", 0, NULL }, { 911, "encryption-preferred", "Prefer encrypted peer connections", "ep", 0, NULL }, { 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL }, - { 'i', "bind-address-ipv4", "Where to listen for peer connections", "i", 1, "" }, - { 'I', "bind-address-ipv6", "Where to listen for peer connections", "I", 1, "" }, - { 'r', "rpc-bind-address", "Where to listen for RPC connections", "r", 1, "" }, + { 'i', "bind-address-ipv4", "Where to listen for peer connections", "i", 1, "" }, + { 'I', "bind-address-ipv6", "Where to listen for peer connections", "I", 1, "" }, + { 'r', "rpc-bind-address", "Where to listen for RPC connections", "r", 1, "" }, { 953, "global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" }, { 954, "no-global-seedratio", "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL }, { 'x', "pid-file", "Enable PID file", "x", 1, "" }, diff --git a/daemon/remote.c b/daemon/remote.c index b6dfbd3cd..7cf40fdc0 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -221,24 +221,24 @@ static tr_option opts[] = { 961, "find", "Tell Transmission where to find a torrent's data", NULL, 1, "" }, { 'm', "portmap", "Enable portmapping via NAT-PMP or UPnP", "m", 0, NULL }, { 'M', "no-portmap", "Disable portmapping", "M", 0, NULL }, - { 'n', "auth", "Set authentication info", "n", 1, "" }, - { 'N', "netrc", "Set authentication info from a .netrc file", "N", 1, "" }, + { 'n', "auth", "Set username and password", "n", 1, "" }, + { 'N', "netrc", "Set authentication info from a .netrc file", "N", 1, "" }, { 'o', "dht", "Enable distributed hash tables (DHT)", "o", 0, NULL }, { 'O', "no-dht", "Disable distributed hash tables (DHT)", "O", 0, NULL }, { 'p', "port", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "" }, { 962, "port-test", "Port testing", "pt", 0, NULL }, { 'P', "random-port", "Random port for incomping peers", "P", 0, NULL }, - { 900, "priority-high", "Try to download the specified file(s) first", "ph", 1, "" }, - { 901, "priority-normal", "Try to download the specified file(s) normally", "pn", 1, "" }, - { 902, "priority-low", "Try to download the specified file(s) last", "pl", 1, "" }, + { 900, "priority-high", "Try to download these file(s) first", "ph", 1, "" }, + { 901, "priority-normal", "Try to download these file(s) normally", "pn", 1, "" }, + { 902, "priority-low", "Try to download these file(s) last", "pl", 1, "" }, { 700, "bandwidth-high", "Give this torrent first chance at available bandwidth", "Bh", 0, NULL }, - { 701, "bandwidth-normal", "Give this torrent the bandwidth left over by high priority torrents", "Bn", 0, NULL }, - { 702, "bandwidth-low", "Give this torrent the bandwidth left over by high and normal priority torrents", "Bl", 0, NULL }, + { 701, "bandwidth-normal", "Give this torrent bandwidth left over by high priority torrents", "Bn", 0, NULL }, + { 702, "bandwidth-low", "Give this torrent bandwidth left over by high and normal priority torrents", "Bl", 0, NULL }, { 'r', "remove", "Remove the current torrent(s)", "r", 0, NULL }, { 930, "peers", "Set the maximum number of peers for the current torrent(s) or globally", "pr", 1, "" }, { 'R', "remove-and-delete", "Remove the current torrent(s) and delete local data", NULL, 0, NULL }, - { 800, "torrent-done-script", "Specify a script to run when a torrent finishes", NULL, 1, "" }, - { 801, "no-torrent-done-script", "Don't run a script when torrnets finish", NULL, 0, NULL }, + { 800, "torrent-done-script", "Specify a script to run when a torrent finishes", NULL, 1, "" }, + { 801, "no-torrent-done-script", "Don't run a script when torrents finish", NULL, 0, NULL }, { 950, "seedratio", "Let the current torrent(s) seed until a specific ratio", "sr", 1, "ratio" }, { 951, "seedratio-default", "Let the current torrent(s) use the global seedratio settings", "srd", 0, NULL }, { 952, "no-seedratio", "Let the current torrent(s) seed regardless of ratio", "SR", 0, NULL }, diff --git a/libtransmission/tr-getopt.c b/libtransmission/tr-getopt.c index 10b5f36f0..3522e1f9c 100644 --- a/libtransmission/tr-getopt.c +++ b/libtransmission/tr-getopt.c @@ -10,6 +10,7 @@ * $Id$ */ +#include /* isspace() */ #include #include /* exit() */ #include @@ -37,21 +38,52 @@ getArgName( const tr_option * opt ) return arg; } +static int +get_next_line_len( const char * description, int maxlen ) +{ + int end; + int len = strlen( description ); + + if( len < maxlen ) + return len; + + end = maxlen < len ? maxlen : len; + while( ( end > 0 ) && !isspace( description[end] ) ) + --end; + + return end ? end : len; +} + static void getopts_usage_line( const tr_option * opt, int longWidth, int shortWidth, int argWidth ) { + int len; const char * longName = opt->longName ? opt->longName : ""; const char * shortName = opt->shortName ? opt->shortName : ""; const char * arg = getArgName( opt ); - printf( " %s%-*s %s%-*s %-*s %s\n", + const int d_indent = shortWidth + longWidth + argWidth + 7; + const int d_width = 80 - d_indent; + const char * d = opt->description; + + printf( " %s%-*s %s%-*s %-*s ", (shortName && *shortName ? "-" : " "), shortWidth, shortName, (longName && *longName ? "--" : " "), longWidth, longName, - argWidth, arg, - opt->description ); + argWidth, arg ); + len = get_next_line_len( d, d_width ); + printf( "%*.*s\n", len, len, d ); + + d += len; + while( isspace( *d ) ) ++d; + + while(( len = get_next_line_len( d, d_width ))) { + printf( "%*.*s%*.*s\n", d_indent, d_indent, "", len, len, d ); + d += len; + while( isspace( *d ) ) ++d; + } } static void