X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Futil%2Fvolparse.c;h=33cbb69c5c4f93b882178dd90232065b7a553a96;hp=15f536297f67e40ed50f183cd938f92ea9023ae2;hb=d80d0eeaabbd139471ee4c9520eb7c77973870bc;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/util/volparse.c b/src/util/volparse.c index 15f5362..33cbb69 100644 --- a/src/util/volparse.c +++ b/src/util/volparse.c @@ -1,6 +1,13 @@ /* - * (C) COPYRIGHT TRANSARC CORPORATION 1989 - * LICENSED MATERIALS - PROPERTY OF TRANSARC + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +/* * ALL RIGHTS RESERVED */ @@ -172,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; +} +