"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/isc/include/isc/parseint.h" (4 Sep 2020, 1540 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "parseint.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 #ifndef ISC_PARSEINT_H
   13 #define ISC_PARSEINT_H 1
   14 
   15 #include <inttypes.h>
   16 
   17 #include <isc/lang.h>
   18 #include <isc/types.h>
   19 
   20 /*! \file isc/parseint.h
   21  * \brief Parse integers, in a saner way than atoi() or strtoul() do.
   22  */
   23 
   24 /***
   25  ***    Functions
   26  ***/
   27 
   28 ISC_LANG_BEGINDECLS
   29 
   30 isc_result_t
   31 isc_parse_uint32(uint32_t *uip, const char *string, int base);
   32 
   33 isc_result_t
   34 isc_parse_uint16(uint16_t *uip, const char *string, int base);
   35 
   36 isc_result_t
   37 isc_parse_uint8(uint8_t *uip, const char *string, int base);
   38 /*%<
   39  * Parse the null-terminated string 'string' containing a base 'base'
   40  * integer, storing the result in '*uip'.
   41  * The base is interpreted
   42  * as in strtoul().  Unlike strtoul(), leading whitespace, minus or
   43  * plus signs are not accepted, and all errors (including overflow)
   44  * are reported uniformly through the return value.
   45  *
   46  * Requires:
   47  *\li   'string' points to a null-terminated string
   48  *\li   0 <= 'base' <= 36
   49  *
   50  * Returns:
   51  *\li   #ISC_R_SUCCESS
   52  *\li   #ISC_R_BADNUMBER   The string is not numeric (in the given base)
   53  *\li   #ISC_R_RANGE      The number is not representable as the requested type.
   54  */
   55 
   56 ISC_LANG_ENDDECLS
   57 
   58 #endif /* ISC_PARSEINT_H */