Changeset 7785


Ignore:
Timestamp:
Jan 23, 2009, 7:36:34 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #1723: View version with / from transmission-remote

Location:
trunk/daemon
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r7690 r7785  
    6767    { 'u', "username", "Set username for authentication", "u", 1, "<username>" },
    6868    { 'v', "password", "Set password for authentication", "v", 1, "<password>" },
     69    { 'V', "version", "Show version number and exit", "V", 0, NULL },
    6970    { 'w', "download-dir", "Where to save downloaded data", "w", 1, "<path>" },
    7071    { 'P', "peerport", "Port for incoming peers (Default: " TR_DEFAULT_PEER_PORT_STR ")", "P", 1, "<port>" },
     
    216217            case 'g': /* handled above */
    217218                      break;
     219            case 'V': /* version */
     220                      fprintf(stderr, "Transmission %s\n", LONG_VERSION_STRING);
     221                      exit( 0 );
    218222            case 'p': tr_bencDictAddInt( &settings, TR_PREFS_KEY_RPC_PORT, atoi( optarg ) );
    219223                      break;
  • trunk/daemon/remote.c

    r7766 r7785  
    3737#define DEFAULT_PORT atoi(TR_DEFAULT_RPC_PORT_STR)
    3838
    39 enum { TAG_LIST, TAG_DETAILS, TAG_FILES, TAG_PEERS };
     39enum { TAG_SESSION, TAG_LIST, TAG_DETAILS, TAG_FILES, TAG_PEERS };
    4040
    4141static const char*
     
    8080    { 'r', "remove",               "Remove the current torrent(s)", "r",  0, NULL },
    8181    { 'R', "remove-and-delete",    "Remove the current torrent(s) and delete local data", NULL, 0, NULL },
     82    { 920, "session",              "Print session information", NULL,  0, NULL },
    8283    { 's', "start",                "Start the current torrent(s)", "s",  0, NULL },
    8384    { 'S', "stop",                 "Stop the current torrent(s)", "S",  0, NULL },
     
    8687    { 'U', "no-uplimit",           "Don't limit the global upload speed", "U",  0, NULL },
    8788    { 'v', "verify",               "Verify the current torrent(s)", "v",  0, NULL },
     89    { 'V', "version",              "Show version number and exit", "V", 0, NULL },
    8890    { 'w', "download-dir",         "Set the default download folder", "w",  1, "<path>" },
    8991    { 'x', "pex",                  "Enable peer exchange (PEX)", "x",  0, NULL },
     
    436438                break;
    437439
     440            case 'V':
     441                fprintf(stderr, "Transmission %s\n", LONG_VERSION_STRING);
     442                exit(0);
     443                break;
     444
    438445            case 'w': {
    439446                char * path = absolutify( optarg );
     
    493500                tr_bencDictAddStr( &top, "method", "session-set" );
    494501                tr_bencDictAddStr( args, "encryption", "tolerated" );
     502                break;
     503
     504            case 920:
     505                tr_bencDictAddStr( &top, "method", "session-get" );
     506                tr_bencDictAddInt( &top, "tag", TAG_SESSION );
    495507                break;
    496508
     
    712724    }
    713725    return str;
     726}
     727
     728static void
     729printSession( tr_benc * top )
     730{
     731    tr_benc *args;
     732    if( ( tr_bencDictFindDict( top, "arguments", &args ) ) )
     733    {
     734        const char * str;
     735        int64_t      i;
     736
     737        printf( "VERSION\n" );
     738        if( tr_bencDictFindStr( args,  "version", &str ) )
     739            printf( "  Daemon version: %s\n", str );
     740        if( tr_bencDictFindInt( args, "rpc-version", &i ) )
     741            printf( "  RPC version: %" PRId64 "\n", i );
     742        if( tr_bencDictFindInt( args, "rpc-version-minimum", &i ) )
     743            printf( "  RPC minimum version: %" PRId64 "\n", i );
     744        printf( "\n" );
     745
     746        printf( "TRANSFER\n" );
     747        if( tr_bencDictFindStr( args,  "download-dir", &str ) )
     748            printf( "  Download directory: %s\n", str );
     749        if( tr_bencDictFindInt( args, "port", &i ) )
     750            printf( "  Listenport: %" PRId64 "\n", i );
     751        if( tr_bencDictFindInt( args, "port-forwarding-enabled", &i ) )
     752            printf( "  Portforwarding enabled: %s\n", ( i ? "Yes" : "No" ) );
     753        if( tr_bencDictFindInt( args, "pex-allowed", &i ) )
     754            printf( "  Peer exchange allowed: %s\n", ( i ? "Yes" : "No" ) );
     755        if( tr_bencDictFindStr( args,  "encryption", &str ) )
     756            printf( "  Encryption: %s\n", str );
     757        printf( "\n" );
     758
     759        printf( "LIMITS\n" );
     760        if( tr_bencDictFindInt( args, "peer-limit", &i ) )
     761            printf( "  Peer limit: %" PRId64 "\n", i );
     762        if( tr_bencDictFindInt( args, "speed-limit-down-enabled", &i ) )
     763            printf( "  Downloadlimit enabled: %s\n", ( i ? "Yes" : "No" ) );
     764        if( tr_bencDictFindInt( args, "speed-limit-down", &i ) )
     765            printf( "  Downloadlimit: %6" PRId64 " KB/sec\n", i );
     766        if( tr_bencDictFindInt( args, "speed-limit-up-enabled", &i ) )
     767            printf( "  Uploadlimit enabled:   %s\n", ( i ? "Yes" : "No" ) );
     768        if( tr_bencDictFindInt( args, "speed-limit-up", &i ) )
     769            printf( "  Uploadlimit:   %6" PRId64 " KB/sec\n", i );
     770               
     771    }
    714772}
    715773
     
    10871145        switch( tag )
    10881146        {
     1147            case TAG_SESSION:
     1148                printSession( &top ); break;
     1149
    10891150            case TAG_FILES:
    10901151                printFileList( &top ); break;
  • trunk/daemon/transmission-daemon.1

    r7547 r7785  
    2424.Op Fl L Ar limit
    2525.Op Fl er | ep | et
     26.Op Fl V
    2627.Op Fl w Ar download-dir
    2728.Ek
     
    9899Used for client authentication.
    99100
     101.It Fl V Fl -version
     102Show version number and exit
     103
    100104.It Fl w Fl -download-dir
    101105Where to store downloaded data.
  • trunk/daemon/transmission-remote.1

    r7745 r7785  
    3434.Op Fl u Ar number | Fl U
    3535.Op Fl v
     36.Op Fl V
    3637.Op Fl w Ar download-dir
    3738.Op Fl x | X
     
    162163.It Fl v Fl -verify
    163164Verify the current torrent(s)
     165
     166.It Fl V Fl -version
     167Show version number and exit
    164168
    165169.It Fl w Fl -download-dir Ar directory
Note: See TracChangeset for help on using the changeset viewer.