fix strtoul() odd interface

This commit is contained in:
Pierangelo Masarati 2006-04-25 15:46:44 +00:00
parent 94c3bc332d
commit 716d1770a2

View File

@ -362,6 +362,11 @@ lutil_atoux( unsigned *v, const char *s, int x )
assert( s != NULL );
assert( v != NULL );
/* strtoul() has an odd interface */
if ( s[ 0 ] == '-' ) {
return -1;
}
u = strtoul( s, &next, x );
if ( next == s || next[ 0 ] != '\0' ) {
return -1;
@ -404,6 +409,11 @@ lutil_atoulx( unsigned long *v, const char *s, int x )
assert( s != NULL );
assert( v != NULL );
/* strtoul() has an odd interface */
if ( s[ 0 ] == '-' ) {
return -1;
}
ul = strtoul( s, &next, x );
if ( next == s || next[ 0 ] != '\0' ) {
return -1;
@ -433,6 +443,11 @@ lutil_parse_time(
unsigned long u;
char *what;
/* strtoul() has an odd interface */
if ( s[ 0 ] == '-' ) {
return -1;
}
u = strtoul( s, &next, 10 );
if ( next == s ) {
return -1;