"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/include/isc/parseint.h" (7 Sep 2020, 1541 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


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 
   13 #ifndef ISC_PARSEINT_H
   14 #define ISC_PARSEINT_H 1
   15 
   16 #include <inttypes.h>
   17 
   18 #include <isc/lang.h>
   19 #include <isc/types.h>
   20 
   21 /*! \file isc/parseint.h
   22  * \brief Parse integers, in a saner way than atoi() or strtoul() do.
   23  */
   24 
   25 /***
   26  ***    Functions
   27  ***/
   28 
   29 ISC_LANG_BEGINDECLS
   30 
   31 isc_result_t
   32 isc_parse_uint32(uint32_t *uip, const char *string, int base);
   33 
   34 isc_result_t
   35 isc_parse_uint16(uint16_t *uip, const char *string, int base);
   36 
   37 isc_result_t
   38 isc_parse_uint8(uint8_t *uip, const char *string, int base);
   39 /*%<
   40  * Parse the null-terminated string 'string' containing a base 'base'
   41  * integer, storing the result in '*uip'.
   42  * The base is interpreted
   43  * as in strtoul().  Unlike strtoul(), leading whitespace, minus or
   44  * plus signs are not accepted, and all errors (including overflow)
   45  * are reported uniformly through the return value.
   46  *
   47  * Requires:
   48  *\li   'string' points to a null-terminated string
   49  *\li   0 <= 'base' <= 36
   50  *
   51  * Returns:
   52  *\li   #ISC_R_SUCCESS
   53  *\li   #ISC_R_BADNUMBER   The string is not numeric (in the given base)
   54  *\li   #ISC_R_RANGE      The number is not representable as the requested type.
   55  */
   56 
   57 ISC_LANG_ENDDECLS
   58 
   59 #endif /* ISC_PARSEINT_H */