Changeset 7374


Ignore:
Timestamp:
Dec 14, 2008, 1:22:06 AM (10 years ago)
Author:
charles
Message:

(trunk daemon) added --dump option to dump the settings to stderr and exit.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/daemon.c

    r7367 r7374  
    5454    { 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL },
    5555    { 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL },
     56    { 'd', "dump-settings", "Dump the settings and exit", "d", 0, NULL },
    5657    { 'f', "foreground", "Run in the foreground instead of daemonizing", "f", 0, NULL },
    5758    { 'g', "config-dir", "Where to look for configuration files", "g", 1, "<path>" },
     
    181182{
    182183    int c;
     184    int64_t i;
    183185    const char * optarg;
    184186    tr_benc settings;
    185187    tr_bool foreground = FALSE;
     188    tr_bool dumpSettings = FALSE;
    186189    const char * configDir = NULL;
    187190
     
    210213            case 'B': tr_bencDictAddInt( &settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, 0 );
    211214                      break;
     215            case 'd': dumpSettings = TRUE;
     216                      break;
    212217            case 'f': foreground = TRUE;
    213218                      break;
     
    229234                      break;
    230235        }
     236    }
     237
     238    if( dumpSettings )
     239    {
     240        char * str = tr_bencSaveAsJSON( &settings, NULL );
     241        fprintf( stderr, "%s", str );
     242        tr_free( str );
     243        return 0;
    231244    }
    232245
     
    245258    mySession = tr_sessionInit( "daemon", configDir, FALSE, &settings );
    246259
    247     if( tr_bencDictFindInt( &settings, TR_PREFS_KEY_RPC_AUTH_REQUIRED, NULL ) )
     260    if( tr_bencDictFindInt( &settings, TR_PREFS_KEY_RPC_AUTH_REQUIRED, &i ) && i!=0 )
    248261        tr_ninf( MY_NAME, "requiring authentication" );
    249262
  • trunk/libtransmission/session.c

    r7368 r7374  
    340340    }
    341341
    342     tr_inf( "saved \"%s\"", filename );
     342    tr_inf( "Saved \"%s\"", filename );
    343343    tr_free( filename );
    344344}
Note: See TracChangeset for help on using the changeset viewer.