Changeset 10545


Ignore:
Timestamp:
Apr 29, 2010, 1:35:57 PM (11 years ago)
Author:
charles
Message:

(trunk daemon) #3178 "transmission-remote --torrent-uplimit no longer works after r10543" -- updated --help and manpage to reflect that -u can be used per-torrent or per-session now because it now knows whether a torrent has been specified

Location:
trunk/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r10543 r10545  
    182182                "\n"
    183183                "See the man page for detailed explanations and many examples.";
     184}
     185
     186/***
     187****
     188****  Command-Line Arguments
     189****
     190***/
     191
     192static tr_option opts[] =
     193{
     194    { 'a', "add",                   "Add torrent files by filename or URL", "a",  0, NULL },
     195    { 970, "alt-speed",             "Use the alternate Limits", "as",  0, NULL },
     196    { 971, "no-alt-speed",          "Don't use the alternate Limits", "AS",  0, NULL },
     197    { 972, "alt-speed-downlimit",   "max alternate download speed (in KiB/s)", "asd",  1, "<speed>" },
     198    { 973, "alt-speed-uplimit",     "max alternate upload speed (in KiB/s)", "asu",  1, "<speed>" },
     199    { 974, "alt-speed-scheduler",   "Use the scheduled on/off times", "asc",  0, NULL },
     200    { 975, "no-alt-speed-scheduler","Don't use the scheduled on/off times", "ASC",  0, NULL },
     201    { 976, "alt-speed-time-begin",  "Time to start using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
     202    { 977, "alt-speed-time-end",    "Time to stop using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
     203    { 978, "alt-speed-days",        "Numbers for any/all days of the week - eg. \"1-7\"", NULL,  1, "<days>" },
     204    { 963, "blocklist-update",      "Blocklist update", NULL, 0, NULL },
     205    { 'c', "incomplete-dir",        "Where to store new torrents until they're complete", "c", 1, "<dir>" },
     206    { 'C', "no-incomplete-dir",     "Don't store incomplete torrents in a different location", "C", 0, NULL },
     207    { 'b', "debug",                 "Print debugging information", "b",  0, NULL },
     208    { 'd', "downlimit",             "Set the max download speed in KiB/s for the current torrent(s) or globally", "u", 1, "<speed>" },
     209    { 'D', "no-downlimit",          "Disable max download speed for the current torrent(s) or globally", "U", 0, NULL },
     210    { 910, "encryption-required",   "Encrypt all peer connections", "er", 0, NULL },
     211    { 911, "encryption-preferred",  "Prefer encrypted peer connections", "ep", 0, NULL },
     212    { 912, "encryption-tolerated",  "Prefer unencrypted peer connections", "et", 0, NULL },
     213    { 'f', "files",                 "List the current torrent(s)' files", "f",  0, NULL },
     214    { 'g', "get",                   "Mark files for download", "g",  1, "<files>" },
     215    { 'G', "no-get",                "Mark files for not downloading", "G",  1, "<files>" },
     216    { 'i', "info",                  "Show the current torrent(s)' details", "i",  0, NULL },
     217    { 920, "session-info",          "Show the session's details", "si", 0, NULL },
     218    { 921, "session-stats",         "Show the session's statistics", "st", 0, NULL },
     219    { 'l', "list",                  "List all torrents", "l",  0, NULL },
     220    { 960, "move",                  "Move current torrent's data to a new folder", NULL, 1, "<path>" },
     221    { 961, "find",                  "Tell Transmission where to find a torrent's data", NULL, 1, "<path>" },
     222    { 'm', "portmap",               "Enable portmapping via NAT-PMP or UPnP", "m",  0, NULL },
     223    { 'M', "no-portmap",            "Disable portmapping", "M",  0, NULL },
     224    { 'n', "auth",                  "Set authentication info", "n",  1, "<user:pass>" },
     225    { 'N', "netrc",                 "Set authentication info from a .netrc file", "N",  1, "<filename>" },
     226    { 'o', "dht",                   "Enable distributed hash tables (DHT)", "o", 0, NULL },
     227    { 'O', "no-dht",                "Disable distributed hash tables (DHT)", "O", 0, NULL },
     228    { 'p', "port",                  "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
     229    { 962, "port-test",             "Port testing", "pt", 0, NULL },
     230    { 'P', "random-port",           "Random port for incomping peers", "P", 0, NULL },
     231    { 900, "priority-high",         "Set the files' priorities as high", "ph", 1, "<files>" },
     232    { 901, "priority-normal",       "Set the files' priorities as normal", "pn", 1, "<files>" },
     233    { 902, "priority-low",          "Set the files' priorities as low", "pl", 1, "<files>" },
     234    { 'r', "remove",                "Remove the current torrent(s)", "r",  0, NULL },
     235    { 930, "peers",                 "Set the maximum number of peers for the current torrent(s) or globally", "pr", 1, "<max>" },
     236    { 'R', "remove-and-delete",     "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
     237    { 950, "seedratio",             "Let the current torrent(s) seed until a specific ratio", "sr", 1, "ratio" },
     238    { 951, "seedratio-default",     "Let the current torrent(s) use the global seedratio settings", "srd", 0, NULL },
     239    { 952, "no-seedratio",          "Let the current torrent(s) seed regardless of ratio", "SR", 0, NULL },
     240    { 953, "global-seedratio",      "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" },
     241    { 954, "no-global-seedratio",   "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL },
     242    { 's', "start",                 "Start the current torrent(s)", "s",  0, NULL },
     243    { 'S', "stop",                  "Stop the current torrent(s)", "S",  0, NULL },
     244    { 't', "torrent",               "Set the current torrent(s)", "t",  1, "<torrent>" },
     245    { 990, "start-paused",          "Start added torrents paused", NULL, 0, NULL },
     246    { 991, "no-start-paused",       "Start added torrents unpaused", NULL, 0, NULL },
     247    { 992, "trash-torrent",         "Delete torrents after adding", NULL, 0, NULL },
     248    { 993, "no-trash-torrent",      "Do not delete torrents after adding", NULL, 0, NULL },
     249    { 982, "torrent-uplimit",       "Set the maximum upload speed for the current torrent(s) in KiB/s", "tu",  1, "<speed>" },
     250    { 983, "no-torrent-uplimit",    "Don't limit the upload speed for the current torrent(s)", "TU",  0, NULL },
     251    { 984, "honor-session",         "Make the current torrent(s) honor the session limits", "hl",  0, NULL },
     252    { 985, "no-honor-session",      "Make the current torrent(s) not honor the session limits", "HL",  0, NULL },
     253    { 'u', "uplimit",               "Set the max upload speed in KiB/s for the current torrent(s) or globally", "u", 1, "<speed>" },
     254    { 'U', "no-uplimit",            "Disable max upload speed for the current torrent(s) or globally", "U", 0, NULL },
     255    { 'v', "verify",                "Verify the current torrent(s)", "v",  0, NULL },
     256    { 'V', "version",               "Show version number and exit", "V", 0, NULL },
     257    { 'w', "download-dir",          "When adding a new torrent, set its download folder.  Otherwise, set the default download folder", "w",  1, "<path>" },
     258    { 'x', "pex",                   "Enable peer exchange (PEX)", "x",  0, NULL },
     259    { 'X', "no-pex",                "Disable peer exchange (PEX)", "X",  0, NULL },
     260    { 940, "peer-info",             "List the current torrent(s)' peers", "pi",  0, NULL },
     261    {   0, NULL,                    NULL, NULL, 0, NULL }
     262};
     263
     264static void
     265showUsage( void )
     266{
     267    tr_getopt_usage( MY_NAME, getUsage( ), opts );
     268}
     269
     270static int
     271numarg( const char * arg )
     272{
     273    char *     end = NULL;
     274    const long num = strtol( arg, &end, 10 );
     275
     276    if( *end )
     277    {
     278        fprintf( stderr, "Not a number: \"%s\"\n", arg );
     279        showUsage( );
     280        exit( EXIT_FAILURE );
     281    }
     282    return num;
    184283}
    185284
     
    239338        case 911: /* encryption-preferred */
    240339        case 912: /* encryption-tolerated */
    241         case 931: /* global-peers */
    242340        case 953: /* global-seedratio */
    243341        case 954: /* no-global-seedratio */
     
    248346            return MODE_SESSION_SET;
    249347
    250         case 930: /* peers */
    251348        case 950: /* seedratio */
    252349        case 951: /* seedratio-default */
     
    279376        case 'u': /* upload speed limit */
    280377        case 'U': /* no upload speed limit */
     378        case 930: /* peers */
    281379            return MODE_SESSION_SET | MODE_TORRENT_SET;
    282380
     
    314412            return 0;
    315413    }
    316 }
    317 
    318 static tr_option opts[] =
    319 {
    320     { 'a', "add",                   "Add torrent files by filename or URL", "a",  0, NULL },
    321     { 970, "alt-speed",             "Use the alternate Limits", "as",  0, NULL },
    322     { 971, "no-alt-speed",          "Don't use the alternate Limits", "AS",  0, NULL },
    323     { 972, "alt-speed-downlimit",   "max alternate download speed (in KiB/s)", "asd",  1, "<speed>" },
    324     { 973, "alt-speed-uplimit",     "max alternate upload speed (in KiB/s)", "asu",  1, "<speed>" },
    325     { 974, "alt-speed-scheduler",   "Use the scheduled on/off times", "asc",  0, NULL },
    326     { 975, "no-alt-speed-scheduler","Don't use the scheduled on/off times", "ASC",  0, NULL },
    327     { 976, "alt-speed-time-begin",  "Time to start using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
    328     { 977, "alt-speed-time-end",    "Time to stop using the alt speed limits (in hhmm)", NULL,  1, "<time>" },
    329     { 978, "alt-speed-days",        "Numbers for any/all days of the week - eg. \"1-7\"", NULL,  1, "<days>" },
    330     { 963, "blocklist-update",      "Blocklist update", NULL, 0, NULL },
    331     { 'c', "incomplete-dir",        "Where to store new torrents until they're complete", "c", 1, "<dir>" },
    332     { 'C', "no-incomplete-dir",     "Don't store incomplete torrents in a different location", "C", 0, NULL },
    333     { 'b', "debug",                 "Print debugging information", "b",  0, NULL },
    334     { 'd', "downlimit",             "Set the maximum global download speed in KiB/s", "d",  1, "<speed>" },
    335     { 'D', "no-downlimit",          "Don't limit the global download speed", "D",  0, NULL },
    336     { 910, "encryption-required",   "Encrypt all peer connections", "er", 0, NULL },
    337     { 911, "encryption-preferred",  "Prefer encrypted peer connections", "ep", 0, NULL },
    338     { 912, "encryption-tolerated",  "Prefer unencrypted peer connections", "et", 0, NULL },
    339     { 'f', "files",                 "List the current torrent(s)' files", "f",  0, NULL },
    340     { 'g', "get",                   "Mark files for download", "g",  1, "<files>" },
    341     { 'G', "no-get",                "Mark files for not downloading", "G",  1, "<files>" },
    342     { 'i', "info",                  "Show the current torrent(s)' details", "i",  0, NULL },
    343     { 920, "session-info",          "Show the session's details", "si", 0, NULL },
    344     { 921, "session-stats",         "Show the session's statistics", "st", 0, NULL },
    345     { 'l', "list",                  "List all torrents", "l",  0, NULL },
    346     { 960, "move",                  "Move current torrent's data to a new folder", NULL, 1, "<path>" },
    347     { 961, "find",                  "Tell Transmission where to find a torrent's data", NULL, 1, "<path>" },
    348     { 'm', "portmap",               "Enable portmapping via NAT-PMP or UPnP", "m",  0, NULL },
    349     { 'M', "no-portmap",            "Disable portmapping", "M",  0, NULL },
    350     { 'n', "auth",                  "Set authentication info", "n",  1, "<username:password>" },
    351     { 'N', "netrc",                 "Set authentication info from a .netrc file", "N",  1, "<filename>" },
    352     { 'o', "dht",                   "Enable distributed hash tables (DHT)", "o", 0, NULL },
    353     { 'O', "no-dht",                "Disable distributed hash tables (DHT)", "O", 0, NULL },
    354     { 'p', "port",                  "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "p", 1, "<port>" },
    355     { 962, "port-test",             "Port testing", "pt", 0, NULL },
    356     { 'P', "random-port",           "Random port for incomping peers", "P", 0, NULL },
    357     { 900, "priority-high",         "Set the files' priorities as high", "ph", 1, "<files>" },
    358     { 901, "priority-normal",       "Set the files' priorities as normal", "pn", 1, "<files>" },
    359     { 902, "priority-low",          "Set the files' priorities as low", "pl", 1, "<files>" },
    360     { 'r', "remove",                "Remove the current torrent(s)", "r",  0, NULL },
    361     { 930, "peers",                 "Set the current torrent(s)' maximum number of peers each", "pr", 1, "<max>" },
    362     { 931, "global-peers",          "Set the global maximum number of peers", "gpr", 1, "<max>" },
    363     { 'R', "remove-and-delete",     "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
    364     { 950, "seedratio",             "Let the current torrent(s) seed until a specific ratio", "sr", 1, "ratio" },
    365     { 951, "seedratio-default",     "Let the current torrent(s) use the global seedratio settings", "srd", 0, NULL },
    366     { 952, "no-seedratio",          "Let the current torrent(s) seed regardless of ratio", "SR", 0, NULL },
    367     { 953, "global-seedratio",      "All torrents, unless overridden by a per-torrent setting, should seed until a specific ratio", "gsr", 1, "ratio" },
    368     { 954, "no-global-seedratio",   "All torrents, unless overridden by a per-torrent setting, should seed regardless of ratio", "GSR", 0, NULL },
    369     { 's', "start",                 "Start the current torrent(s)", "s",  0, NULL },
    370     { 'S', "stop",                  "Stop the current torrent(s)", "S",  0, NULL },
    371     { 't', "torrent",               "Set the current torrent(s)", "t",  1, "<torrent>" },
    372     { 990, "start-paused",          "Start added torrents paused", NULL, 0, NULL },
    373     { 991, "no-start-paused",       "Start added torrents unpaused", NULL, 0, NULL },
    374     { 992, "trash-torrent",         "Delete torrents after adding", NULL, 0, NULL },
    375     { 993, "no-trash-torrent",      "Do not delete torrents after adding", NULL, 0, NULL },
    376     { 982, "torrent-uplimit",       "Set the maximum upload speed for the current torrent(s) in KiB/s", "tu",  1, "<speed>" },
    377     { 983, "no-torrent-uplimit",    "Don't limit the upload speed for the current torrent(s)", "TU",  0, NULL },
    378     { 984, "honor-session",         "Make the current torrent(s) honor the session limits", "hl",  0, NULL },
    379     { 985, "no-honor-session",      "Make the current torrent(s) not honor the session limits", "HL",  0, NULL },
    380     { 'u', "uplimit",               "Set the maximum global upload speed in KiB/s", "u",  1, "<speed>" },
    381     { 'U', "no-uplimit",            "Don't limit the global upload speed", "U",  0, NULL },
    382     { 'v', "verify",                "Verify the current torrent(s)", "v",  0, NULL },
    383     { 'V', "version",               "Show version number and exit", "V", 0, NULL },
    384     { 'w', "download-dir",          "Set the default download folder", "w",  1, "<path>" },
    385     { 'x', "pex",                   "Enable peer exchange (PEX)", "x",  0, NULL },
    386     { 'X', "no-pex",                "Disable peer exchange (PEX)", "X",  0, NULL },
    387     { 940, "peer-info",             "List the current torrent(s)' peers", "pi",  0, NULL },
    388     {   0, NULL,                    NULL, NULL, 0, NULL }
    389 };
    390 
    391 static void
    392 showUsage( void )
    393 {
    394     tr_getopt_usage( MY_NAME, getUsage( ), opts );
    395 }
    396 
    397 static int
    398 numarg( const char * arg )
    399 {
    400     char *     end = NULL;
    401     const long num = strtol( arg, &end, 10 );
    402 
    403     if( *end )
    404     {
    405         fprintf( stderr, "Not a number: \"%s\"\n", arg );
    406         showUsage( );
    407         exit( EXIT_FAILURE );
    408     }
    409     return num;
    410414}
    411415
     
    18141818                case 'X': tr_bencDictAddBool( args, TR_PREFS_KEY_PEX_ENABLED, FALSE );
    18151819                          break;
    1816                 case 931: tr_bencDictAddInt( args, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, atoi(optarg) );
    1817                           break;
    18181820                case 953: tr_bencDictAddReal( args, "seedRatioLimit", atof(optarg) );
    18191821                          tr_bencDictAddBool( args, "seedRatioLimited", TRUE );
     
    18711873                              tr_bencDictAddBool( sargs, TR_PREFS_KEY_USPEED_ENABLED, TRUE );
    18721874                          break;
     1875                case 930: if( targs )
     1876                              tr_bencDictAddInt( targs, "peer-limit", atoi(optarg) );
     1877                          else
     1878                              tr_bencDictAddInt( sargs, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, atoi(optarg) );
     1879                          break;
    18731880                default:  assert( "unhandled value" && 0 );
    18741881                          break;
     
    18811888            switch( c )
    18821889            {
    1883                 case 930: tr_bencDictAddInt( args, "peer-limit", atoi(optarg) );
    1884                           break;
    18851890                case 950: tr_bencDictAddReal( args, "seedRatioLimit", atof(optarg) );
    18861891                          tr_bencDictAddInt( args, "seedRatioMode", TR_RATIOLIMIT_SINGLE );
  • trunk/daemon/transmission-remote.1

    r10391 r10545  
    2525.Op Fl f
    2626.Op Fl g Ar files
    27 .Op Fl gpr Ar peers
    2827.Op Fl G Ar files
    2928.Op Fl gsr Ar ratio
     
    5049.Op Fl st
    5150.Op Fl t Ar all | Ar id | Ar hash
    52 .Op Fl td Ar number
    53 .Op Fl TD
    54 .Op Fl tu Ar number
    55 .Op Fl TU
    5651.Op Fl hl
    5752.Op Fl HL
     
    113108Don't store incomplete torrents in a different directory.
    114109.It Fl d Fl -downlimit Ar limit
    115 Limit the global download speed to
     110Limit the maximum download speed to
    116111.Ar limit
    117 kilobytes per second.
     112KiB/s.
     113If current torrent(s) are selected this operates on them.  Otherwise, it changes the global setting.
    118114.It Fl D Fl -no-downlimit
    119 Remove the global download limit.
     115Disable download speed limits.
     116If current torrent(s) are selected this operates on them.  Otherwise, it changes the global setting.
    120117.It Fl er Fl -encryption-required
    121118Encrypt all peer connections.
     
    188185Mark file(s) as low priority.
    189186.It Fl pr Fl -peers Ar number
    190 Set the current torrent(s)' maximum number of peers
    191 .It Fl gpr Fl -global-peers Ar number
    192 Set the maximum number of peers allowed globally
     187Set the maximum number of peers.
     188If current torrent(s) are selected this operates on them.  Otherwise, it changes the global setting.
    193189.It Fl r Fl -remove
    194190Remove the current torrent(s).  This does not delete the downloaded data.
     
    223219To set more than one current torrent, join their ids together in a list, such as
    224220"\-t2,4,6-8" to operate on the torrents whose IDs are 2, 4, 6, 7, and 8.
    225 .It Fl td Fl -torrent-downlimit Ar limit
    226 Limit the current torrent(s) download speed to
    227 .Ar limit
    228 kilobytes per second.
    229 .It Fl TD Fl -no-torrent-downlimit
    230 Don't use the current torrent(s) download limit.
    231 .It Fl tu Fl -torrent-uplimit Ar limit
    232 Limit the current torrent(s) upload speed to
    233 .Ar limit
    234 kilobytes per second.
    235 .It Fl TU Fl -no-torrent-uplimit
    236 Don't use the current torrent(s) upload limit.
    237221.It Fl -trash-torrent
    238222Delete torrents after adding
     
    244228Make the current torrent(s) not honor the session limits.
    245229.It Fl u Fl -uplimit Ar limit
    246 Limit the global upload speed to
     230Limit the maximum upload speed to
    247231.Ar limit
    248 kilobytes per second.
     232KiB/s.
     233If current torrent(s) are selected this operates on them.  Otherwise, it changes the global setting.
    249234.It Fl U Fl -no-uplimit
    250 Remove the global upload limit.
     235Disable upload speed limits.
     236If current torrent(s) are selected this operates on them.  Otherwise, it changes the global setting.
    251237.It Fl v Fl -verify
    252238Verify the current torrent(s)
Note: See TracChangeset for help on using the changeset viewer.