gallium: Implement debug_get_num_option.
For numeric options.
This commit is contained in:
@@ -230,8 +230,34 @@ debug_get_bool_option(const char *name, boolean dfault)
|
|||||||
long
|
long
|
||||||
debug_get_num_option(const char *name, long dfault)
|
debug_get_num_option(const char *name, long dfault)
|
||||||
{
|
{
|
||||||
/* FIXME */
|
long result;
|
||||||
return dfault;
|
const char *str;
|
||||||
|
|
||||||
|
str = debug_get_option(name, NULL);
|
||||||
|
if(!str)
|
||||||
|
result = dfault;
|
||||||
|
else {
|
||||||
|
long sign;
|
||||||
|
char c;
|
||||||
|
c = *str++;
|
||||||
|
if(c == '-') {
|
||||||
|
sign = -1;
|
||||||
|
c = *str++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sign = 1;
|
||||||
|
}
|
||||||
|
result = 0;
|
||||||
|
while('0' <= c && c <= '9') {
|
||||||
|
result = result*10 + (c - '0');
|
||||||
|
c = *str++;
|
||||||
|
}
|
||||||
|
result *= sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
debug_printf("%s: %s = %li\n", __FUNCTION__, name, result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -289,7 +289,7 @@ boolean
|
|||||||
debug_get_bool_option(const char *name, boolean dfault);
|
debug_get_bool_option(const char *name, boolean dfault);
|
||||||
|
|
||||||
long
|
long
|
||||||
debug_get_unsigned_option(const char *name, long dfault);
|
debug_get_num_option(const char *name, long dfault);
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
debug_get_flags_option(const char *name,
|
debug_get_flags_option(const char *name,
|
||||||
|
Reference in New Issue
Block a user