1 /* Convert string representation of a number into an uintmax_t value.
2 Copyright 1999 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Written by Paul Eggert. */
25 # include <inttypes.h>
33 # if defined PROTOTYPES || defined __STDC__
34 # define PARAMS(Args) Args
36 # define PARAMS(Args) ()
40 #if HAVE_UNSIGNED_LONG_LONG && ! HAVE_STRTOULL
41 unsigned long long strtoull
PARAMS ((char const *, char **, int));
45 strtoumax (char const *ptr
, char **endptr
, int base
)
47 #define USE_IF_EQUIVALENT(function) \
48 if (sizeof (uintmax_t) == sizeof function (ptr, endptr, base)) \
49 return function (ptr, endptr, base);
51 #if HAVE_UNSIGNED_LONG_LONG
52 USE_IF_EQUIVALENT (strtoull
)
55 USE_IF_EQUIVALENT (strtoul
)