Changeset 5ebe625 for conf.c


Ignore:
Timestamp:
2006-02-12T07:26:20Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
f665dab
Parents:
a323a22 (diff), 58bc4e6 (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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • conf.c

    ra323a22 r5ebe625  
    3232#include "ini.h"
    3333#include "url.h"
     34#include "ipc.h"
    3435
    3536#include "protocols/proxy.h"
     
    4647        conf = g_new0( conf_t, 1 );
    4748       
     49#ifdef IPV6
     50        conf->iface = "::";
     51#else
    4852        conf->iface = "0.0.0.0";
     53#endif
    4954        conf->port = 6667;
    5055        conf->nofork = 0;
     
    5358        conf->runmode = RUNMODE_INETD;
    5459        conf->authmode = AUTHMODE_OPEN;
    55         conf->password = NULL;
     60        conf->auth_pass = NULL;
     61        conf->oper_pass = NULL;
    5662        conf->configdir = g_strdup( CONFIG );
    5763        conf->plugindir = g_strdup( PLUGINDIR );
     64        conf->pidfile = g_strdup( "/var/run/bitlbee.pid" );
    5865        conf->motdfile = g_strdup( ETCDIR "/motd.txt" );
    5966        conf->ping_interval = 180;
    6067        conf->ping_timeout = 300;
     68        proxytype = 0;
    6169       
    6270        i = conf_loadini( conf, CONF_FILE );
     
    7179        }
    7280       
    73         while( ( opt = getopt( argc, argv, "i:p:nvIDc: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. */
    7483        {
    7584                if( opt == 'i' )
     
    8695                        conf->port = i;
    8796                }
     97                else if( opt == 'p' )
     98                {
     99                        g_free( conf->pidfile );
     100                        conf->pidfile = g_strdup( optarg );
     101                }
    88102                else if( opt == 'n' )
    89                         conf->nofork=1;
     103                        conf->nofork = 1;
    90104                else if( opt == 'v' )
    91                         conf->verbose=1;
     105                        conf->verbose = 1;
    92106                else if( opt == 'I' )
    93                         conf->runmode=RUNMODE_INETD;
     107                        conf->runmode = RUNMODE_INETD;
    94108                else if( opt == 'D' )
    95                         conf->runmode=RUNMODE_DAEMON;
     109                        conf->runmode = RUNMODE_DAEMON;
     110                else if( opt == 'F' )
     111                        conf->runmode = RUNMODE_FORKDAEMON;
    96112                else if( opt == 'c' )
    97113                {
     
    101117                                CONF_FILE = g_strdup( optarg );
    102118                                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;
    103123                                return( conf_load( argc, argv ) );
    104124                        }
     
    118138                                "  -I  Classic/InetD mode. (Default)\n"
    119139                                "  -D  Daemon mode. (Still EXPERIMENTAL!)\n"
     140                                "  -F  Forking daemon. (one process per client)\n"
    120141                                "  -i  Specify the interface (by IP address) to listen on.\n"
    121142                                "      (Default: 0.0.0.0 (any interface))\n"
     
    128149                        return( NULL );
    129150                }
     151                else if( opt == 'R' )
     152                {
     153                        /* We can't load the statefile yet (and should make very sure we do this
     154                           only once), so set the filename here and load the state information
     155                           when initializing ForkDaemon. (This option only makes sense in that
     156                           mode anyway!) */
     157                        ipc_master_set_statefile( optarg );
     158                }
    130159        }
    131160       
     
    157186                                if( g_strcasecmp( ini->value, "daemon" ) == 0 )
    158187                                        conf->runmode = RUNMODE_DAEMON;
     188                                else if( g_strcasecmp( ini->value, "forkdaemon" ) == 0 )
     189                                        conf->runmode = RUNMODE_FORKDAEMON;
    159190                                else
    160191                                        conf->runmode = RUNMODE_INETD;
     192                        }
     193                        else if( g_strcasecmp( ini->key, "pidfile" ) == 0 )
     194                        {
     195                                g_free( conf->pidfile );
     196                                conf->pidfile = g_strdup( ini->value );
    161197                        }
    162198                        else if( g_strcasecmp( ini->key, "daemoninterface" ) == 0 )
     
    184220                        else if( g_strcasecmp( ini->key, "authpassword" ) == 0 )
    185221                        {
    186                                 conf->password = g_strdup( ini->value );
     222                                conf->auth_pass = g_strdup( ini->value );
     223                        }
     224                        else if( g_strcasecmp( ini->key, "operpassword" ) == 0 )
     225                        {
     226                                conf->oper_pass = g_strdup( ini->value );
    187227                        }
    188228                        else if( g_strcasecmp( ini->key, "hostname" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.