X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Futil%2Fvolparse.c;h=33cbb69c5c4f93b882178dd90232065b7a553a96;hp=1efbcd14f27570af2a1423964c2bdebf5194f52a;hb=d80d0eeaabbd139471ee4c9520eb7c77973870bc;hpb=fb5bcd00fc6f1560d7d02115a0b5beaa3014a0e7 diff --git a/src/util/volparse.c b/src/util/volparse.c index 1efbcd1..33cbb69 100644 --- a/src/util/volparse.c +++ b/src/util/volparse.c @@ -179,3 +179,43 @@ afs_int32 *aval; else *aval = total; return 0; } + +afs_uint32 +GetUInt32 (as, aval) +register char *as; +afs_uint32 *aval; +{ + register afs_uint32 total; + register int tc; + int base; + + total = 0; /* initialize things */ + + /* skip over leading spaces */ + while (tc = *as) { + if (tc != ' ' && tc != '\t') break; + } + + /* compute the base */ + if (*as == '0') { + as++; + if (*as == 'x' || *as == 'X') { + base = 16; + as++; + } + else base = 8; + } + else base = 10; + + /* compute the # itself */ + while(tc = *as) { + if (!ismeta(tc, base)) return -1; + total *= base; + total += getmeta(tc); + as++; + } + + *aval = total; + return 0; +} +