Back to index

nagios-plugins  1.4.16
Go to the documentation of this file.
00001 /* Convert string to double, using the C locale.
00003    Copyright (C) 2003-2004, 2009-2010 Free Software Foundation, Inc.
00005    This program is free software: you can redistribute it and/or modify
00006    it under the terms of the GNU General Public License as published by
00007    the Free Software Foundation; either version 3 of the License, or
00008    (at your option) any later version.
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    GNU General Public License for more details.
00015    You should have received a copy of the GNU General Public License
00016    along with this program.  If not, see <>.  */
00018 /* Parse the initial portion of the string pointed to by NPTR as a floating-
00019    point number (in decimal or hexadecimal notation), like in the C locale:
00020    accepting only the ASCII digits '0'..'9', and only '.' as decimal point
00021    character.
00022    If ENDPTR is not NULL, set *ENDPTR to point to the first byte beyond the
00023    parsed number or to NPTR if the string does not start with a parseable
00024    number.
00025    Return value:
00026    - If successful, return the value as a double or 'long double',
00027      respectively, and don't modify errno.
00028    - In case of overflow, return ┬▒HUGE_VAL or ┬▒HUGE_VALL, respectively, and
00029      set errno to ERANGE.
00030    - In case of underflow, return a value very near to 0 and set errno to
00031      ERANGE.
00032    - If the string does not start with a number at all, return 0 (and recall
00033      that if ENDPTR != NULL, *ENDPTR is set to NPTR), and maybe set errno to
00034      EINVAL.
00035    - In case of other error, return 0 and set errno, for example to ENOMEM.  */
00036 extern double      c_strtod  (char const *nptr, char **endptr);
00037 extern long double c_strtold (char const *nptr, char **endptr);