Changeset a4dc9f7 for conf.c


Ignore:
Timestamp:
2006-03-01T22:48:37Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
46ad029
Parents:
8e419cb (diff), 9a1555d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

[merge] Wilmer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • conf.c

    r8e419cb ra4dc9f7  
    3232#include "ini.h"
    3333#include "url.h"
     34#include "ipc.h"
    3435
    3536#include "protocols/proxy.h"
     
    6162        conf->configdir = g_strdup( CONFIG );
    6263        conf->plugindir = g_strdup( PLUGINDIR );
     64        conf->pidfile = g_strdup( "/var/run/bitlbee.pid" );
    6365        conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
    6466        conf->ping_interval = 180;
    6567        conf->ping_timeout = 300;
     68        proxytype = 0;
    6669       
    6770        i = conf_loadini( conf, CONF_FILE );
     
    7679        }
    7780       
    78         while( ( opt = getopt( argc, argv, "i:p:nvIDFc:d:h" ) ) >= 0 )
     81        while( argc > 0 && ( opt = getopt( argc, argv, "i:p:P:nvIDFc:d:hR:" ) ) >= 0 )
     82        /*     ^^^^ Just to make sure we skip this step from the REHASH handler. */
    7983        {
    8084                if( opt == 'i' )
     
    9195                        conf->port = i;
    9296                }
     97                else if( opt == 'p' )
     98                {
     99                        g_free( conf->pidfile );
     100                        conf->pidfile = g_strdup( optarg );
     101                }
    93102                else if( opt == 'n' )
    94                         conf->nofork=1;
     103                        conf->nofork = 1;
    95104                else if( opt == 'v' )
    96                         conf->verbose=1;
     105                        conf->verbose = 1;
    97106                else if( opt == 'I' )
    98                         conf->runmode=RUNMODE_INETD;
     107                        conf->runmode = RUNMODE_INETD;
    99108                else if( opt == 'D' )
    100                         conf->runmode=RUNMODE_DAEMON;
     109                        conf->runmode = RUNMODE_DAEMON;
    101110                else if( opt == 'F' )
    102                         conf->runmode=RUNMODE_FORKDAEMON;
     111                        conf->runmode = RUNMODE_FORKDAEMON;
    103112                else if( opt == 'c' )
    104113                {
     
    108117                                CONF_FILE = g_strdup( optarg );
    109118                                g_free( conf );
     119                                /* Re-evaluate arguments. Don't use this option twice,
     120                                   you'll end up in an infinite loop! Hope this trick
     121                                   works with all libcs BTW.. */
     122                                optind = 1;
    110123                                return( conf_load( argc, argv ) );
    111124                        }
     
    126139                                "  -D  Daemon mode. (Still EXPERIMENTAL!)\n"
    127140                                "  -F  Forking daemon. (one process per client)\n"
     141                                "  -P  Specify PID-file (not for inetd mode)\n"
    128142                                "  -i  Specify the interface (by IP address) to listen on.\n"
    129143                                "      (Default: 0.0.0.0 (any interface))\n"
     
    136150                        return( NULL );
    137151                }
     152                else if( opt == 'R' )
     153                {
     154                        /* We can't load the statefile yet (and should make very sure we do this
     155                           only once), so set the filename here and load the state information
     156                           when initializing ForkDaemon. (This option only makes sense in that
     157                           mode anyway!) */
     158                        ipc_master_set_statefile( optarg );
     159                }
    138160        }
    139161       
     
    169191                                else
    170192                                        conf->runmode = RUNMODE_INETD;
     193                        }
     194                        else if( g_strcasecmp( ini->key, "pidfile" ) == 0 )
     195                        {
     196                                g_free( conf->pidfile );
     197                                conf->pidfile = g_strdup( ini->value );
    171198                        }
    172199                        else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.