From: Prashant P. Shah <pshah.mumbai@xxxxxxxxx> This is a patch to the wl_profile.c file that fixes whitespace issues found by the checkpatch.pl tool. Signed-off-by: Prashant P. Shah <pshah.mumbai@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/wlags49_h2/wl_profile.c | 759 ++++++++++++++---------------- 1 files changed, 354 insertions(+), 405 deletions(-) diff --git a/drivers/staging/wlags49_h2/wl_profile.c b/drivers/staging/wlags49_h2/wl_profile.c index 1e0c75f..e4e78a4 100644 --- a/drivers/staging/wlags49_h2/wl_profile.c +++ b/drivers/staging/wlags49_h2/wl_profile.c @@ -113,17 +113,19 @@ extern p_u32 DebugFlag; extern dbg_info_t *DbgInfo; #endif -int parse_yes_no( char* value ); +int parse_yes_no(char *value); -int parse_yes_no( char* value ) { +int parse_yes_no(char *value) +{ int rc = 0; //default to NO for invalid parameters - if ( strlen( value ) == 1 ) { - if ( ( value[0] | ('Y'^'y') ) == 'y' ) rc = 1; + if (strlen(value) == 1) { + if ((value[0] | ('Y'^'y')) == 'y') + rc = 1; // } else { // this should not be debug time info, it is an enduser data entry error ;? -// DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MICROWAVE_ROBUSTNESS ); +// DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MICROWAVE_ROBUSTNESS); } return rc; } // parse_yes_no @@ -149,11 +151,11 @@ int rc = 0; //default to NO for invalid parameters * N/A * ******************************************************************************/ -void parse_config( struct net_device *dev ) +void parse_config(struct net_device *dev) { int file_desc; #if 0 // BIN_DL - int rc; + int rc; char *cp = NULL; #endif // BIN_DL char buffer[MAX_LINE_SIZE]; @@ -163,48 +165,48 @@ void parse_config( struct net_device *dev ) ENCSTRCT sEncryption; /*------------------------------------------------------------------------*/ - DBG_FUNC( "parse_config" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("parse_config"); + DBG_ENTER(DbgInfo); /* Get the wavelan specific info for this device */ wvlan_config = (struct wl_private *)dev->priv; - if ( wvlan_config == NULL ) { - DBG_ERROR( DbgInfo, "Wavelan specific info struct not present?\n" ); + if (wvlan_config == NULL) { + DBG_ERROR(DbgInfo, "Wavelan specific info struct not present?\n"); return; } /* setup the default encryption string */ - strcpy( wvlan_config->szEncryption, DEF_CRYPT_STR ); + strcpy(wvlan_config->szEncryption, DEF_CRYPT_STR); /* Obtain a user-space process context, storing the original context */ - fs = get_fs( ); - set_fs( get_ds( )); + fs = get_fs(); + set_fs(get_ds()); /* Determine the filename for this device and attempt to open it */ - sprintf( filename, "%s%s", ROOT_CONFIG_FILENAME, dev->name ); - file_desc = open( filename, O_RDONLY, 0 ); - if ( file_desc != -1 ) { - DBG_TRACE( DbgInfo, "Wireless config file found. Parsing options...\n" ); + sprintf(filename, "%s%s", ROOT_CONFIG_FILENAME, dev->name); + file_desc = open(filename, O_RDONLY, 0); + if (file_desc != -1) { + DBG_TRACE(DbgInfo, "Wireless config file found. Parsing options...\n"); /* Read out the options */ - while( readline( file_desc, buffer )) { - translate_option( buffer, wvlan_config ); + while (readline(file_desc, buffer)) { + translate_option(buffer, wvlan_config); } /* Close the file */ - close( file_desc ); //;?even if file_desc == -1 ??? + close(file_desc); //;?even if file_desc == -1 ??? } else { - DBG_TRACE( DbgInfo, "No iwconfig file found for this device; " - "config.opts or wireless.opts will be used\n" ); + DBG_TRACE(DbgInfo, "No iwconfig file found for this device; " + "config.opts or wireless.opts will be used\n"); } /* Return to the original context */ - set_fs( fs ); + set_fs(fs); /* convert the WEP keys, if read in as key1, key2, type of data */ - if ( wvlan_config->EnableEncryption ) { - memset( &sEncryption, 0, sizeof( sEncryption )); + if (wvlan_config->EnableEncryption) { + memset(&sEncryption, 0, sizeof(sEncryption)); - wl_wep_decode( CRYPT_CODE, &sEncryption, - wvlan_config->szEncryption ); + wl_wep_decode(CRYPT_CODE, &sEncryption, + wvlan_config->szEncryption); /* the Linux driver likes to use 1-4 for the key IDs, and then convert to 0-3 when sending to the card. The Windows code @@ -216,63 +218,63 @@ void parse_config( struct net_device *dev ) sEncryption.wEnabled = wvlan_config->EnableEncryption; sEncryption.wTxKeyID = wvlan_config->TransmitKeyID - 1; - memcpy( &sEncryption.EncStr, &wvlan_config->DefaultKeys, - sizeof( CFG_DEFAULT_KEYS_STRCT )); + memcpy(&sEncryption.EncStr, &wvlan_config->DefaultKeys, + sizeof(CFG_DEFAULT_KEYS_STRCT)); - memset( wvlan_config->szEncryption, 0, sizeof( wvlan_config->szEncryption )); + memset(wvlan_config->szEncryption, 0, sizeof(wvlan_config->szEncryption)); - wl_wep_code( CRYPT_CODE, wvlan_config->szEncryption, &sEncryption, - sizeof( sEncryption )); + wl_wep_code(CRYPT_CODE, wvlan_config->szEncryption, &sEncryption, + sizeof(sEncryption)); } /* decode the encryption string for the call to wl_commit() */ - wl_wep_decode( CRYPT_CODE, &sEncryption, wvlan_config->szEncryption ); + wl_wep_decode(CRYPT_CODE, &sEncryption, wvlan_config->szEncryption); wvlan_config->TransmitKeyID = sEncryption.wTxKeyID + 1; wvlan_config->EnableEncryption = sEncryption.wEnabled; - memcpy( &wvlan_config->DefaultKeys, &sEncryption.EncStr, - sizeof( CFG_DEFAULT_KEYS_STRCT )); + memcpy(&wvlan_config->DefaultKeys, &sEncryption.EncStr, + sizeof(CFG_DEFAULT_KEYS_STRCT)); #if 0 //BIN_DL /* Obtain a user-space process context, storing the original context */ - fs = get_fs( ); - set_fs( get_ds( )); + fs = get_fs(); + set_fs(get_ds()); //;?just to fake something - strcpy(/*wvlan_config->fw_image_*/filename, "/etc/agere/fw.bin" ); - file_desc = open( /*wvlan_config->fw_image_*/filename, 0, 0 ); - if ( file_desc == -1 ) { - DBG_ERROR( DbgInfo, "No image file found\n" ); + strcpy(/*wvlan_config->fw_image_*/filename, "/etc/agere/fw.bin"); + file_desc = open(/*wvlan_config->fw_image_*/filename, 0, 0); + if (file_desc == -1) { + DBG_ERROR(DbgInfo, "No image file found\n"); } else { - DBG_TRACE( DbgInfo, "F/W image file found\n" ); + DBG_TRACE(DbgInfo, "F/W image file found\n"); #define DHF_ALLOC_SIZE 96000 //just below 96K, let's hope it suffices for now and for the future - cp = (char*)vmalloc( DHF_ALLOC_SIZE ); - if ( cp == NULL ) { - DBG_ERROR( DbgInfo, "error in vmalloc\n" ); + cp = (char *)vmalloc(DHF_ALLOC_SIZE); + if (cp == NULL) { + DBG_ERROR(DbgInfo, "error in vmalloc\n"); } else { - rc = read( file_desc, cp, DHF_ALLOC_SIZE ); - if ( rc == DHF_ALLOC_SIZE ) { - DBG_ERROR( DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE ); - } else if ( rc > 0 ) { - DBG_TRACE( DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp ); - rc = read( file_desc, &cp[rc], 1 ); - if ( rc == 0 ) { - DBG_TRACE( DbgInfo, "no more to read\n" ); + rc = read(file_desc, cp, DHF_ALLOC_SIZE); + if (rc == DHF_ALLOC_SIZE) { + DBG_ERROR(DbgInfo, "buffer too small, %d\n", DHF_ALLOC_SIZE); + } else if (rc > 0) { + DBG_TRACE(DbgInfo, "read O.K.: %d bytes %.12s\n", rc, cp); + rc = read(file_desc, &cp[rc], 1); + if (rc == 0) { + DBG_TRACE(DbgInfo, "no more to read\n"); } } - if ( rc != 0 ) { - DBG_ERROR( DbgInfo, "file not read in one swoop or other error"\ - ", give up, too complicated, rc = %0X\n", rc ); + if (rc != 0) { + DBG_ERROR(DbgInfo, "file not read in one swoop or other error"\ + ", give up, too complicated, rc = %0X\n", rc); } - vfree( cp ); + vfree(cp); } - close( file_desc ); + close(file_desc); } - set_fs( fs ); /* Return to the original context */ + set_fs(fs); /* Return to the original context */ #endif // BIN_DL - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); return; } // parse_config @@ -298,17 +300,17 @@ void parse_config( struct net_device *dev ) * -1 on error * ******************************************************************************/ -int readline( int filedesc, char *buffer ) +int readline(int filedesc, char *buffer) { int result = -1; int bytes_read = 0; /*------------------------------------------------------------------------*/ /* Make sure the file descriptor is good */ - if ( filedesc != -1 ) { + if (filedesc != -1) { /* Read in from the file byte by byte until a newline is reached */ - while(( result = read( filedesc, &buffer[bytes_read], 1 )) == 1 ) { - if ( buffer[bytes_read] == '\n' ) { + while ((result = read(filedesc, &buffer[bytes_read], 1)) == 1) { + if (buffer[bytes_read] == '\n') { buffer[bytes_read] = '\0'; bytes_read++; break; @@ -318,7 +320,7 @@ int readline( int filedesc, char *buffer ) } /* Return the number of bytes read */ - if ( result == -1 ) { + if (result == -1) { return result; } else { return bytes_read; @@ -346,7 +348,7 @@ int readline( int filedesc, char *buffer ) * N/A * ******************************************************************************/ -void translate_option( char *buffer, struct wl_private *lp ) +void translate_option(char *buffer, struct wl_private *lp) { unsigned int value_convert = 0; int string_length = 0; @@ -355,16 +357,16 @@ void translate_option( char *buffer, struct wl_private *lp ) u_char mac_value[ETH_ALEN]; /*------------------------------------------------------------------------*/ - DBG_FUNC( "translate_option" ); + DBG_FUNC("translate_option"); - if ( buffer == NULL || lp == NULL ) { - DBG_ERROR( DbgInfo, "Config file buffer and/or wavelan buffer ptr NULL\n" ); + if (buffer == NULL || lp == NULL) { + DBG_ERROR(DbgInfo, "Config file buffer and/or wavelan buffer ptr NULL\n"); return; } - ParseConfigLine( buffer, &key, &value ); + ParseConfigLine(buffer, &key, &value); - if ( key == NULL || value == NULL ) { + if (key == NULL || value == NULL) { return; } @@ -375,9 +377,9 @@ void translate_option( char *buffer, struct wl_private *lp ) /* handle DebugFlag as early as possible so it starts its influence as early * as possible */ - if ( strcmp( key, PARM_NAME_DEBUG_FLAG ) == 0 ) { - if ( DebugFlag == ~0 ) { //if DebugFlag is not specified on the command line - if ( DbgInfo->DebugFlag == 0 ) { /* if pc_debug did not set DebugFlag (i.e.pc_debug is + if (strcmp(key, PARM_NAME_DEBUG_FLAG) == 0) { + if (DebugFlag == ~0) { /* if DebugFlag is not specified on the command line */ + if (DbgInfo->DebugFlag == 0) { /* if pc_debug did not set DebugFlag (i.e.pc_debug is * not specified or specified outside the 4-8 range */ DbgInfo->DebugFlag |= DBG_DEFAULTS; @@ -388,250 +390,230 @@ void translate_option( char *buffer, struct wl_private *lp ) DbgInfo->DebugFlag = simple_strtoul(value, NULL, 0); //;?Delete ASAP } #endif /* DBG */ - if ( strcmp( key, PARM_NAME_AUTH_KEY_MGMT_SUITE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_AUTH_KEY_MGMT_SUITE, value ); + if (strcmp(key, PARM_NAME_AUTH_KEY_MGMT_SUITE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_AUTH_KEY_MGMT_SUITE, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_AUTH_KEY_MGMT_SUITE ) || ( value_convert <= PARM_MAX_AUTH_KEY_MGMT_SUITE )) { + if ((value_convert >= PARM_MIN_AUTH_KEY_MGMT_SUITE) || (value_convert <= PARM_MAX_AUTH_KEY_MGMT_SUITE)) { lp->AuthKeyMgmtSuite = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTH_KEY_MGMT_SUITE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTH_KEY_MGMT_SUITE); } - } - else if ( strcmp( key, PARM_NAME_BRSC_2GHZ ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_2GHZ, value ); + } else if (strcmp(key, PARM_NAME_BRSC_2GHZ) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_2GHZ, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_BRSC ) || ( value_convert <= PARM_MAX_BRSC )) { + if ((value_convert >= PARM_MIN_BRSC) || (value_convert <= PARM_MAX_BRSC)) { lp->brsc[0] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_2GHZ ); + DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_2GHZ); } - } - else if ( strcmp( key, PARM_NAME_BRSC_5GHZ ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_5GHZ, value ); + } else if (strcmp(key, PARM_NAME_BRSC_5GHZ) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_BRSC_5GHZ, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_BRSC ) || ( value_convert <= PARM_MAX_BRSC )) { + if ((value_convert >= PARM_MIN_BRSC) || (value_convert <= PARM_MAX_BRSC)) { lp->brsc[1] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_5GHZ ); + DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_BRSC_5GHZ); } - } - else if (( strcmp( key, PARM_NAME_DESIRED_SSID ) == 0 ) || ( strcmp( key, PARM_NAME_OWN_SSID ) == 0 )) { - DBG_TRACE( DbgInfo, "SSID, value: %s\n", value ); + } else if ((strcmp(key, PARM_NAME_DESIRED_SSID) == 0) || (strcmp(key, PARM_NAME_OWN_SSID) == 0)) { + DBG_TRACE(DbgInfo, "SSID, value: %s\n", value); - memset( lp->NetworkName, 0, ( PARM_MAX_NAME_LEN + 1 )); + memset(lp->NetworkName, 0, (PARM_MAX_NAME_LEN + 1)); /* Make sure the value isn't too long */ - string_length = strlen( value ); - if ( string_length > PARM_MAX_NAME_LEN ) { - DBG_WARNING( DbgInfo, "SSID too long; will be truncated\n" ); + string_length = strlen(value); + if (string_length > PARM_MAX_NAME_LEN) { + DBG_WARNING(DbgInfo, "SSID too long; will be truncated\n"); string_length = PARM_MAX_NAME_LEN; } - memcpy( lp->NetworkName, value, string_length ); + memcpy(lp->NetworkName, value, string_length); } #if 0 - else if ( strcmp( key, PARM_NAME_DOWNLOAD_FIRMWARE ) == 0 ) { - DBG_TRACE( DbgInfo, "DOWNLOAD_FIRMWARE, value: %s\n", value ); - memset( lp->fw_image_filename, 0, ( MAX_LINE_SIZE + 1 )); + else if (strcmp(key, PARM_NAME_DOWNLOAD_FIRMWARE) == 0) { + DBG_TRACE(DbgInfo, "DOWNLOAD_FIRMWARE, value: %s\n", value); + memset(lp->fw_image_filename, 0, (MAX_LINE_SIZE + 1)); /* Make sure the value isn't too long */ - string_length = strlen( value ); - if ( string_length > MAX_LINE_SIZE ) { - DBG_WARNING( DbgInfo, "F/W image file name too long; will be ignored\n" ); + string_length = strlen(value); + if (string_length > MAX_LINE_SIZE) { + DBG_WARNING(DbgInfo, "F/W image file name too long; will be ignored\n"); } else { - memcpy( lp->fw_image_filename, value, string_length ); + memcpy(lp->fw_image_filename, value, string_length); } } #endif - else if ( strcmp( key, PARM_NAME_ENABLE_ENCRYPTION ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_ENABLE_ENCRYPTION, value ); + else if (strcmp(key, PARM_NAME_ENABLE_ENCRYPTION) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_ENABLE_ENCRYPTION, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_ENABLE_ENCRYPTION ) && ( value_convert <= PARM_MAX_ENABLE_ENCRYPTION )) { + if ((value_convert >= PARM_MIN_ENABLE_ENCRYPTION) && (value_convert <= PARM_MAX_ENABLE_ENCRYPTION)) { lp->EnableEncryption = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_ENABLE_ENCRYPTION ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_ENABLE_ENCRYPTION); } - } - else if ( strcmp( key, PARM_NAME_ENCRYPTION ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_ENCRYPTION, value ); + } else if (strcmp(key, PARM_NAME_ENCRYPTION) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_ENCRYPTION, value); - memset( lp->szEncryption, 0, sizeof( lp->szEncryption )); + memset(lp->szEncryption, 0, sizeof(lp->szEncryption)); /* Make sure the value isn't too long */ - string_length = strlen( value ); - if ( string_length > sizeof( lp->szEncryption ) ) { - DBG_WARNING( DbgInfo, "%s too long; will be truncated\n", PARM_NAME_ENCRYPTION ); - string_length = sizeof( lp->szEncryption ); + string_length = strlen(value); + if (string_length > sizeof(lp->szEncryption)) { + DBG_WARNING(DbgInfo, "%s too long; will be truncated\n", PARM_NAME_ENCRYPTION); + string_length = sizeof(lp->szEncryption); } - memcpy( lp->szEncryption, value, string_length ); - } - else if ( strcmp( key, PARM_NAME_KEY1 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY1, value ); + memcpy(lp->szEncryption, value, string_length); + } else if (strcmp(key, PARM_NAME_KEY1) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY1, value); - if ( is_valid_key_string( value )) { - memset( lp->DefaultKeys.key[0].key, 0, MAX_KEY_SIZE ); + if (is_valid_key_string(value)) { + memset(lp->DefaultKeys.key[0].key, 0, MAX_KEY_SIZE); - key_string2key( value, &lp->DefaultKeys.key[0] ); + key_string2key(value, &lp->DefaultKeys.key[0]); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY1 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY1); } - } - else if ( strcmp( key, PARM_NAME_KEY2 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY2, value ); + } else if (strcmp(key, PARM_NAME_KEY2) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY2, value); - if ( is_valid_key_string( value )) { - memset( lp->DefaultKeys.key[1].key, 0, MAX_KEY_SIZE ); + if (is_valid_key_string(value)) { + memset(lp->DefaultKeys.key[1].key, 0, MAX_KEY_SIZE); - key_string2key( value, &lp->DefaultKeys.key[1] ); + key_string2key(value, &lp->DefaultKeys.key[1]); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY2 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY2); } - } - else if ( strcmp( key, PARM_NAME_KEY3 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY3, value ); + } else if (strcmp(key, PARM_NAME_KEY3) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY3, value); - if ( is_valid_key_string( value )) { - memset( lp->DefaultKeys.key[2].key, 0, MAX_KEY_SIZE ); + if (is_valid_key_string(value)) { + memset(lp->DefaultKeys.key[2].key, 0, MAX_KEY_SIZE); - key_string2key( value, &lp->DefaultKeys.key[2] ); + key_string2key(value, &lp->DefaultKeys.key[2]); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY3 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY3); } - } - else if ( strcmp( key, PARM_NAME_KEY4 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_KEY4, value ); + } else if (strcmp(key, PARM_NAME_KEY4) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_KEY4, value); - if ( is_valid_key_string( value )) { - memset( lp->DefaultKeys.key[3].key, 0, MAX_KEY_SIZE ); + if (is_valid_key_string(value)) { + memset(lp->DefaultKeys.key[3].key, 0, MAX_KEY_SIZE); - key_string2key( value, &lp->DefaultKeys.key[3] ); + key_string2key(value, &lp->DefaultKeys.key[3]); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY4 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_KEY4); } } /* New Parameters for WARP */ - else if ( strcmp( key, PARM_NAME_LOAD_BALANCING ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_LOAD_BALANCING, value ); + else if (strcmp(key, PARM_NAME_LOAD_BALANCING) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_LOAD_BALANCING, value); lp->loadBalancing = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MEDIUM_DISTRIBUTION ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MEDIUM_DISTRIBUTION, value ); + } else if (strcmp(key, PARM_NAME_MEDIUM_DISTRIBUTION) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MEDIUM_DISTRIBUTION, value); lp->mediumDistribution = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MICROWAVE_ROBUSTNESS) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MICROWAVE_ROBUSTNESS, value ); + } else if (strcmp(key, PARM_NAME_MICROWAVE_ROBUSTNESS) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MICROWAVE_ROBUSTNESS, value); lp->MicrowaveRobustness = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MULTICAST_RATE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RATE, value ); + } else if (strcmp(key, PARM_NAME_MULTICAST_RATE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RATE, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_MULTICAST_RATE ) && ( value_convert <= PARM_MAX_MULTICAST_RATE )) { + if ((value_convert >= PARM_MIN_MULTICAST_RATE) && (value_convert <= PARM_MAX_MULTICAST_RATE)) { lp->MulticastRate[0] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MULTICAST_RATE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MULTICAST_RATE); } - } - else if ( strcmp( key, PARM_NAME_OWN_CHANNEL ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_CHANNEL, value ); + } else if (strcmp(key, PARM_NAME_OWN_CHANNEL) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_CHANNEL, value); value_convert = simple_strtoul(value, NULL, 0); - if ( wl_is_a_valid_chan( value_convert )) { - if ( value_convert > 14 ) { + if (wl_is_a_valid_chan(value_convert)) { + if (value_convert > 14) { value_convert = value_convert | 0x100; } lp->Channel = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_CHANNEL ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_CHANNEL); } - } - else if ( strcmp( key, PARM_NAME_OWN_NAME ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_NAME, value ); + } else if (strcmp(key, PARM_NAME_OWN_NAME) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_NAME, value); - memset( lp->StationName, 0, ( PARM_MAX_NAME_LEN + 1 )); + memset(lp->StationName, 0, (PARM_MAX_NAME_LEN + 1)); /* Make sure the value isn't too long */ - string_length = strlen( value ); - if ( string_length > PARM_MAX_NAME_LEN ) { - DBG_WARNING( DbgInfo, "%s too long; will be truncated\n", PARM_NAME_OWN_NAME ); + string_length = strlen(value); + if (string_length > PARM_MAX_NAME_LEN) { + DBG_WARNING(DbgInfo, "%s too long; will be truncated\n", PARM_NAME_OWN_NAME); string_length = PARM_MAX_NAME_LEN; } - memcpy( lp->StationName, value, string_length ); - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD, value ); + memcpy(lp->StationName, value, string_length); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->RTSThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD); } - } - else if ( strcmp( key, PARM_NAME_SRSC_2GHZ ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_2GHZ, value ); + } else if (strcmp(key, PARM_NAME_SRSC_2GHZ) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_2GHZ, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_SRSC ) || ( value_convert <= PARM_MAX_SRSC )) { + if ((value_convert >= PARM_MIN_SRSC) || (value_convert <= PARM_MAX_SRSC)) { lp->srsc[0] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_2GHZ ); + DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_2GHZ); } - } - else if ( strcmp( key, PARM_NAME_SRSC_5GHZ ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_5GHZ, value ); + } else if (strcmp(key, PARM_NAME_SRSC_5GHZ) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SRSC_5GHZ, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_SRSC ) || ( value_convert <= PARM_MAX_SRSC )) { + if ((value_convert >= PARM_MIN_SRSC) || (value_convert <= PARM_MAX_SRSC)) { lp->srsc[1] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_5GHZ ); + DBG_WARNING(DbgInfo, "%s invaid; will be ignored\n", PARM_NAME_SRSC_5GHZ); } - } - else if ( strcmp( key, PARM_NAME_SYSTEM_SCALE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_SYSTEM_SCALE, value ); + } else if (strcmp(key, PARM_NAME_SYSTEM_SCALE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_SYSTEM_SCALE, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_SYSTEM_SCALE ) && ( value_convert <= PARM_MAX_SYSTEM_SCALE )) { + if ((value_convert >= PARM_MIN_SYSTEM_SCALE) && (value_convert <= PARM_MAX_SYSTEM_SCALE)) { lp->DistanceBetweenAPs = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_SYSTEM_SCALE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_SYSTEM_SCALE); } - } - else if ( strcmp( key, PARM_NAME_TX_KEY ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_KEY, value ); + } else if (strcmp(key, PARM_NAME_TX_KEY) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_KEY, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_KEY ) && ( value_convert <= PARM_MAX_TX_KEY )) { + if ((value_convert >= PARM_MIN_TX_KEY) && (value_convert <= PARM_MAX_TX_KEY)) { lp->TransmitKeyID = simple_strtoul(value, NULL, 0); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_KEY ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_KEY); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->TxRateControl[0] = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE); } - } - else if ( strcmp( key, PARM_NAME_TX_POW_LEVEL ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_POW_LEVEL, value ); + } else if (strcmp(key, PARM_NAME_TX_POW_LEVEL) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_POW_LEVEL, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_POW_LEVEL ) || ( value_convert <= PARM_MAX_TX_POW_LEVEL )) { + if ((value_convert >= PARM_MIN_TX_POW_LEVEL) || (value_convert <= PARM_MAX_TX_POW_LEVEL)) { lp->txPowLevel = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_POW_LEVEL ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_POW_LEVEL); } } @@ -640,101 +622,91 @@ void translate_option( char *buffer, struct wl_private *lp ) /* Configuration parameters specific to STA mode */ #if 1 //;? (HCF_TYPE) & HCF_TYPE_STA //;?seems reasonable that even an AP-only driver could afford this small additional footprint - if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_STA ) { + if (CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_STA) { //;?should we return an error status in AP mode - if ( strcmp( key, PARM_NAME_PORT_TYPE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PORT_TYPE, value ); + if (strcmp(key, PARM_NAME_PORT_TYPE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PORT_TYPE, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert == PARM_MIN_PORT_TYPE ) || ( value_convert == PARM_MAX_PORT_TYPE )) { + if ((value_convert == PARM_MIN_PORT_TYPE) || (value_convert == PARM_MAX_PORT_TYPE)) { lp->PortType = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PORT_TYPE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PORT_TYPE); } - } - else if ( strcmp( key, PARM_NAME_PM_ENABLED ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PM_ENABLED, value ); + } else if (strcmp(key, PARM_NAME_PM_ENABLED) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PM_ENABLED, value); value_convert = simple_strtoul(value, NULL, 0); /* ;? how about wl_main.c containing - * VALID_PARAM( PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD || - * ( PARM_PM_ENABLED & 0x7FFF ) <= WVLAN_PM_STATE_STANDARD ); + * VALID_PARAM(PARM_PM_ENABLED <= WVLAN_PM_STATE_STANDARD || + * (PARM_PM_ENABLED & 0x7FFF) <= WVLAN_PM_STATE_STANDARD); */ - if ( ( value_convert & 0x7FFF ) <= PARM_MAX_PM_ENABLED) { + if ((value_convert & 0x7FFF) <= PARM_MAX_PM_ENABLED) { lp->PMEnabled = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_ENABLED ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_ENABLED); //;?this is a data entry error, hence not a DBG_WARNING } - } - else if ( strcmp( key, PARM_NAME_CREATE_IBSS ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_CREATE_IBSS, value ); + } else if (strcmp(key, PARM_NAME_CREATE_IBSS) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_CREATE_IBSS, value); lp->CreateIBSS = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MULTICAST_RX ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RX, value ); + } else if (strcmp(key, PARM_NAME_MULTICAST_RX) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_RX, value); lp->MulticastReceive = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MAX_SLEEP ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MAX_SLEEP, value ); + } else if (strcmp(key, PARM_NAME_MAX_SLEEP) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MAX_SLEEP, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= 0 ) && ( value_convert <= 65535 )) { + if ((value_convert >= 0) && (value_convert <= 65535)) { lp->MaxSleepDuration = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MAX_SLEEP ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_MAX_SLEEP); } - } - else if ( strcmp( key, PARM_NAME_NETWORK_ADDR ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_NETWORK_ADDR, value ); + } else if (strcmp(key, PARM_NAME_NETWORK_ADDR) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_NETWORK_ADDR, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->MACAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->MACAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_NETWORK_ADDR ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_NETWORK_ADDR); } - } - else if ( strcmp( key, PARM_NAME_AUTHENTICATION ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_AUTHENTICATION, value ); + } else if (strcmp(key, PARM_NAME_AUTHENTICATION) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_AUTHENTICATION, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_AUTHENTICATION ) && ( value_convert <= PARM_MAX_AUTHENTICATION )) { + if ((value_convert >= PARM_MIN_AUTHENTICATION) && (value_convert <= PARM_MAX_AUTHENTICATION)) { lp->authentication = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTHENTICATION ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_AUTHENTICATION); } - } - else if ( strcmp( key, PARM_NAME_OWN_ATIM_WINDOW ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_ATIM_WINDOW, value ); + } else if (strcmp(key, PARM_NAME_OWN_ATIM_WINDOW) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_ATIM_WINDOW, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_OWN_ATIM_WINDOW ) && ( value_convert <= PARM_MAX_OWN_ATIM_WINDOW )) { + if ((value_convert >= PARM_MIN_OWN_ATIM_WINDOW) && (value_convert <= PARM_MAX_OWN_ATIM_WINDOW)) { lp->atimWindow = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_ATIM_WINDOW ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_ATIM_WINDOW); } - } - else if ( strcmp( key, PARM_NAME_PM_HOLDOVER_DURATION ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PM_HOLDOVER_DURATION, value ); + } else if (strcmp(key, PARM_NAME_PM_HOLDOVER_DURATION) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PM_HOLDOVER_DURATION, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_PM_HOLDOVER_DURATION ) && ( value_convert <= PARM_MAX_PM_HOLDOVER_DURATION )) { + if ((value_convert >= PARM_MIN_PM_HOLDOVER_DURATION) && (value_convert <= PARM_MAX_PM_HOLDOVER_DURATION)) { lp->holdoverDuration = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_HOLDOVER_DURATION ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_PM_HOLDOVER_DURATION); } - } - else if ( strcmp( key, PARM_NAME_PROMISCUOUS_MODE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_PROMISCUOUS_MODE, value ); + } else if (strcmp(key, PARM_NAME_PROMISCUOUS_MODE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_PROMISCUOUS_MODE, value); lp->promiscuousMode = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_CONNECTION_CONTROL ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_CONNECTION_CONTROL, value ); + } else if (strcmp(key, PARM_NAME_CONNECTION_CONTROL) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_CONNECTION_CONTROL, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_CONNECTION_CONTROL ) && ( value_convert <= PARM_MAX_CONNECTION_CONTROL )) { + if ((value_convert >= PARM_MIN_CONNECTION_CONTROL) && (value_convert <= PARM_MAX_CONNECTION_CONTROL)) { lp->connectionControl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_CONNECTION_CONTROL ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_CONNECTION_CONTROL); } } @@ -745,227 +717,204 @@ void translate_option( char *buffer, struct wl_private *lp ) /* Configuration parameters specific to AP mode */ #if 1 //;? (HCF_TYPE) & HCF_TYPE_AP //;?should we restore this to allow smaller memory footprint - if ( CNV_INT_TO_LITTLE( lp->hcfCtx.IFB_FWIdentity.comp_id ) == COMP_ID_FW_AP ) { - if ( strcmp( key, PARM_NAME_OWN_DTIM_PERIOD ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_DTIM_PERIOD, value ); + if (CNV_INT_TO_LITTLE(lp->hcfCtx.IFB_FWIdentity.comp_id) == COMP_ID_FW_AP) { + if (strcmp(key, PARM_NAME_OWN_DTIM_PERIOD) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_DTIM_PERIOD, value); value_convert = simple_strtoul(value, NULL, 0); - if ( value_convert >= PARM_MIN_OWN_DTIM_PERIOD ) { + if (value_convert >= PARM_MIN_OWN_DTIM_PERIOD) { lp->DTIMPeriod = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_DTIM_PERIOD ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_DTIM_PERIOD); } - } - else if ( strcmp( key, PARM_NAME_REJECT_ANY ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_REJECT_ANY, value ); + } else if (strcmp(key, PARM_NAME_REJECT_ANY) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_REJECT_ANY, value); lp->RejectAny = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_EXCLUDE_UNENCRYPTED ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_EXCLUDE_UNENCRYPTED, value ); + } else if (strcmp(key, PARM_NAME_EXCLUDE_UNENCRYPTED) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_EXCLUDE_UNENCRYPTED, value); lp->ExcludeUnencrypted = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_MULTICAST_PM_BUFFERING ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_PM_BUFFERING, value ); + } else if (strcmp(key, PARM_NAME_MULTICAST_PM_BUFFERING) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_MULTICAST_PM_BUFFERING, value); lp->ExcludeUnencrypted = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_INTRA_BSS_RELAY ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_INTRA_BSS_RELAY, value ); + } else if (strcmp(key, PARM_NAME_INTRA_BSS_RELAY) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_INTRA_BSS_RELAY, value); lp->ExcludeUnencrypted = parse_yes_no(value); - } - else if ( strcmp( key, PARM_NAME_OWN_BEACON_INTERVAL ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_BEACON_INTERVAL, value ); + } else if (strcmp(key, PARM_NAME_OWN_BEACON_INTERVAL) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_OWN_BEACON_INTERVAL, value); value_convert = simple_strtoul(value, NULL, 0); - if ( value_convert >= PARM_MIN_OWN_BEACON_INTERVAL ) { + if (value_convert >= PARM_MIN_OWN_BEACON_INTERVAL) { lp->ownBeaconInterval = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_BEACON_INTERVAL ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_OWN_BEACON_INTERVAL); } - } - else if ( strcmp( key, PARM_NAME_COEXISTENCE ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_COEXISTENCE, value ); + } else if (strcmp(key, PARM_NAME_COEXISTENCE) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_COEXISTENCE, value); value_convert = simple_strtoul(value, NULL, 0); - if ( value_convert >= PARM_MIN_COEXISTENCE ) { + if (value_convert >= PARM_MIN_COEXISTENCE) { lp->coexistence = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_COEXISTENCE ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_COEXISTENCE); } } #ifdef USE_WDS - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD1 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD1, value ); + else if (strcmp(key, PARM_NAME_RTS_THRESHOLD1) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD1, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[0].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD1 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD1); } - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD2 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD2, value ); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD2) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD2, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[1].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD2 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD2); } - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD3 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD3, value ); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD3) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD3, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[2].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD3 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD3); } - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD4 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD4, value ); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD4) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD4, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[3].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD4 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD4); } - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD5 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD5, value ); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD5) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD5, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[4].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD5 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD5); } - } - else if ( strcmp( key, PARM_NAME_RTS_THRESHOLD6 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD6, value ); + } else if (strcmp(key, PARM_NAME_RTS_THRESHOLD6) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_RTS_THRESHOLD6, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_RTS_THRESHOLD ) && ( value_convert <= PARM_MAX_RTS_THRESHOLD )) { + if ((value_convert >= PARM_MIN_RTS_THRESHOLD) && (value_convert <= PARM_MAX_RTS_THRESHOLD)) { lp->wds_port[5].rtsThreshold = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD6 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_RTS_THRESHOLD6); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE1 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE1, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE1) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE1, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[0].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE1 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE1); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE2 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE2, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE2) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE2, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[1].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE2 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE2); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE3 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE3, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE3) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE3, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[2].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE3 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE3); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE4 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE4, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE4) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE4, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[3].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE4 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE4); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE5 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE5, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE5) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE5, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[4].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE5 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE5); } - } - else if ( strcmp( key, PARM_NAME_TX_RATE6 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE6, value ); + } else if (strcmp(key, PARM_NAME_TX_RATE6) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_TX_RATE6, value); value_convert = simple_strtoul(value, NULL, 0); - if (( value_convert >= PARM_MIN_TX_RATE ) && ( value_convert <= PARM_MAX_TX_RATE )) { + if ((value_convert >= PARM_MIN_TX_RATE) && (value_convert <= PARM_MAX_TX_RATE)) { lp->wds_port[5].txRateCntl = value_convert; } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE6 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_TX_RATE6); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS1 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS1, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS1) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS1, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[0].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[0].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS1 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS1); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS2 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS2, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS2) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS2, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[1].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[1].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS2 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS2); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS3 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS3, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS3) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS3, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[2].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[2].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS3 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS3); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS4 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS4, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS4) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS4, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[3].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[3].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS4 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS4); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS5 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS5, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS5) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS5, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[4].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[4].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS5 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS5); } - } - else if ( strcmp( key, PARM_NAME_WDS_ADDRESS6 ) == 0 ) { - DBG_TRACE( DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS6, value ); + } else if (strcmp(key, PARM_NAME_WDS_ADDRESS6) == 0) { + DBG_TRACE(DbgInfo, "%s, value: %s\n", PARM_NAME_WDS_ADDRESS6, value); - if ( parse_mac_address( value, mac_value ) == ETH_ALEN ) { - memcpy( lp->wds_port[5].wdsAddress, mac_value, ETH_ALEN ); + if (parse_mac_address(value, mac_value) == ETH_ALEN) { + memcpy(lp->wds_port[5].wdsAddress, mac_value, ETH_ALEN); } else { - DBG_WARNING( DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS6 ); + DBG_WARNING(DbgInfo, "%s invalid; will be ignored\n", PARM_NAME_WDS_ADDRESS6); } } #endif /* USE_WDS */ @@ -996,7 +945,7 @@ void translate_option( char *buffer, struct wl_private *lp ) * The number of bytes in the final MAC address, should equal to ETH_ALEN. * ******************************************************************************/ -int parse_mac_address( char *value, u_char *byte_array ) +int parse_mac_address(char *value, u_char *byte_array) { int value_offset = 0; int array_offset = 0; @@ -1004,11 +953,11 @@ int parse_mac_address( char *value, u_char *byte_array ) char byte_field[3]; /*------------------------------------------------------------------------*/ - memset( byte_field, '\0', 3 ); + memset(byte_field, '\0', 3); - while( value[value_offset] != '\0' ) { + while (value[value_offset] != '\0') { /* Skip over the colon chars seperating the bytes, if they exist */ - if ( value[value_offset] == ':' ) { + if (value[value_offset] == ':') { value_offset++; continue; } @@ -1018,9 +967,9 @@ int parse_mac_address( char *value, u_char *byte_array ) value_offset++; /* Once the byte_field is filled, convert it and store it */ - if ( field_offset == 2 ) { + if (field_offset == 2) { byte_field[field_offset] = '\0'; - byte_array[array_offset] = simple_strtoul( byte_field, NULL, 16 ); + byte_array[array_offset] = simple_strtoul(byte_field, NULL, 16); field_offset = 0; array_offset++; } @@ -1052,42 +1001,42 @@ int parse_mac_address( char *value, u_char *byte_array ) * N/A * ******************************************************************************/ -void ParseConfigLine( char *pszLine, char **ppszLVal, char **ppszRVal ) +void ParseConfigLine(char *pszLine, char **ppszLVal, char **ppszRVal) { int i; int size; /*------------------------------------------------------------------------*/ - DBG_FUNC( "ParseConfigLine" ); - DBG_ENTER( DbgInfo ); + DBG_FUNC("ParseConfigLine"); + DBG_ENTER(DbgInfo); /* get a snapshot of our string size */ - size = strlen( pszLine ); + size = strlen(pszLine); *ppszLVal = NULL; *ppszRVal = NULL; - if ( pszLine[0] != '#' && /* skip the line if it is a comment */ - pszLine[0] != '\n'&& /* if it's an empty UNIX line, do nothing */ - !( pszLine[0] == '\r' && pszLine[1] == '\n' ) /* if it's an empty MS-DOS line, do nothing */ - ) { + if (pszLine[0] != '#' && /* skip the line if it is a comment */ + pszLine[0] != '\n' && /* if it's an empty UNIX line, do nothing */ + !(pszLine[0] == '\r' && pszLine[1] == '\n') /* if it's an empty MS-DOS line, do nothing */ + ) { /* advance past any whitespace, and assign the L-value */ - for( i = 0; i < size; i++ ) { - if ( pszLine[i] != ' ' ) { + for (i = 0; i < size; i++) { + if (pszLine[i] != ' ') { *ppszLVal = &pszLine[i]; break; } } /* advance to the end of the l-value*/ - for( i++; i < size; i++ ) { - if ( pszLine[i] == ' ' || pszLine[i] == '=' ) { + for (i++; i < size; i++) { + if (pszLine[i] == ' ' || pszLine[i] == '=') { pszLine[i] = '\0'; break; } } /* make any whitespace and the equal sign a NULL character, and advance to the R-Value */ - for( i++; i < size; i++ ) { - if ( pszLine[i] == ' ' || pszLine[i] == '=' ) { + for (i++; i < size; i++) { + if (pszLine[i] == ' ' || pszLine[i] == '=') { pszLine[i] = '\0'; continue; } @@ -1095,16 +1044,16 @@ void ParseConfigLine( char *pszLine, char **ppszLVal, char **ppszRVal ) break; } /* make the line ending character(s) a NULL */ - for( i++; i < size; i++ ) { - if ( pszLine[i] == '\n' ) { + for (i++; i < size; i++) { + if (pszLine[i] == '\n') { pszLine[i] = '\0'; } - if (( pszLine[i] == '\r' ) && ( pszLine[i+1] == '\n' )) { + if ((pszLine[i] == '\r') && (pszLine[i+1] == '\n')) { pszLine[i] = '\0'; } } } - DBG_LEAVE( DbgInfo ); + DBG_LEAVE(DbgInfo); } // ParseConfigLine /*============================================================================*/ -- 1.7.0.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel