Changeset e9b755e for conf.c


Ignore:
Timestamp:
2007-10-18T16:44:25Z (17 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
7435ccf
Parents:
c511365
Message:

Use standard functions for dealing with both IPv6 and IPv4.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • conf.c

    rc511365 re9b755e  
    4747        conf = g_new0( conf_t, 1 );
    4848       
    49 #ifdef IPV6
    50         conf->iface = "::";
    51 #else
    52         conf->iface = "0.0.0.0";
    53 #endif
    54         conf->port = 6667;
     49        conf->iface = NULL;
     50        conf->port = "6667";
    5551        conf->nofork = 0;
    5652        conf->verbose = 0;
     
    8985                else if( opt == 'p' )
    9086                {
    91                         if( ( sscanf( optarg, "%d", &i ) != 1 ) || ( i <= 0 ) || ( i > 65535 ) )
    92                         {
    93                                 fprintf( stderr, "Invalid port number: %s\n", optarg );
    94                                 return( NULL );
    95                         }
    96                         conf->port = i;
     87                        g_free( conf->port );
     88                        conf->port = g_strdup( optarg );
    9789                }
    9890                else if( opt == 'P' )
     
    204196                        else if( g_strcasecmp( ini->key, "daemonport" ) == 0 )
    205197                        {
    206                                 if( ( sscanf( ini->value, "%d", &i ) != 1 ) || ( i <= 0 ) || ( i > 65535 ) )
    207                                 {
    208                                         fprintf( stderr, "Invalid port number: %s\n", ini->value );
    209                                         return( 0 );
    210                                 }
    211                                 conf->port = i;
     198                                conf->port = g_strdup( ini->value );
    212199                        }
    213200                        else if( g_strcasecmp( ini->key, "authmode" ) == 0 )
Note: See TracChangeset for help on using the changeset viewer.