- Timestamp:
- 2006-07-01T15:52:05Z (18 years ago)
- Branches:
- master
- Children:
- fef6116
- Parents:
- 0a3c243
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/misc.c
r0a3c243 r5100caa 486 486 } 487 487 } 488 489 int is_bool( char *value ) 490 { 491 if( *value == 0 ) 492 return 0; 493 494 if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) ) 495 return 1; 496 if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) ) 497 return 1; 498 499 while( *value ) 500 if( !isdigit( *value ) ) 501 return 0; 502 else 503 value ++; 504 505 return 1; 506 } 507 508 int bool2int( char *value ) 509 { 510 int i; 511 512 if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) ) 513 return 1; 514 if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) ) 515 return 0; 516 517 if( sscanf( value, "%d", &i ) == 1 ) 518 return i; 519 520 return 0; 521 } -
lib/misc.h
r0a3c243 r5100caa 51 51 G_MODULE_EXPORT void random_bytes( unsigned char *buf, int count ); 52 52 53 G_MODULE_EXPORT int is_bool( char *value ); 54 G_MODULE_EXPORT int bool2int( char *value ); 55 53 56 #endif -
lib/rc4.c
r0a3c243 r5100caa 165 165 if( clear_len < 0 ) 166 166 { 167 *clear = g_strdup( "" );167 *clear = (unsigned char*) g_strdup( "" ); 168 168 return 0; 169 169 }
Note: See TracChangeset
for help on using the changeset viewer.