X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fxstrtol.c;h=ed5bcdd0b2d0965f3dc4028754243804b8b8eff5;hb=024eeefda59f214eeaac745db9f3e982b9a726c3;hp=d01db3ca9ef2efba845590999e00735bc863f4d2;hpb=222b0486b7db1b09293e05512873d633440efcb3;p=gnulib.git diff --git a/lib/xstrtol.c b/lib/xstrtol.c index d01db3ca9..ed5bcdd0b 100644 --- a/lib/xstrtol.c +++ b/lib/xstrtol.c @@ -1,7 +1,7 @@ /* A more useful interface to strtol. - Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2003, 2004, 2005, + 2006, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,12 +19,6 @@ /* Written by Jim Meyering. */ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "xstrtol.h" - #ifndef __strtol # define __strtol strtol # define __strtol_t long int @@ -33,6 +27,10 @@ # define STRTOL_T_MAXIMUM LONG_MAX #endif +#include + +#include "xstrtol.h" + /* Some pre-ANSI implementations (e.g. SunOS 4) need stderr defined if assertion checking is enabled. */ #include @@ -46,27 +44,6 @@ #include "intprops.h" -#ifndef STRTOL_T_MINIMUM -# define STRTOL_T_MINIMUM TYPE_MINIMUM (__strtol_t) -# define STRTOL_T_MAXIMUM TYPE_MAXIMUM (__strtol_t) -#endif - -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -# define IN_CTYPE_DOMAIN(c) 1 -#else -# define IN_CTYPE_DOMAIN(c) isascii(c) -#endif - -#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c)) - -#if !HAVE_DECL_STRTOIMAX && !defined strtoimax -intmax_t strtoimax (); -#endif - -#if !HAVE_DECL_STRTOUMAX && !defined strtoumax -uintmax_t strtoumax (); -#endif - static strtol_error bkm_scale (__strtol_t *x, int scale_factor) { @@ -112,7 +89,7 @@ __xstrtol (const char *s, char **ptr, int strtol_base, { const char *q = s; unsigned char ch = *q; - while (ISSPACE (ch)) + while (isspace (ch)) ch = *++q; if (ch == '-') return LONGINT_INVALID; @@ -250,37 +227,3 @@ __xstrtol (const char *s, char **ptr, int strtol_base, *val = tmp; return err; } - -#ifdef TESTING_XSTRTO - -# include -# include "error.h" - -char *program_name; - -int -main (int argc, char **argv) -{ - strtol_error s_err; - int i; - - program_name = argv[0]; - for (i=1; i%lu (%s)\n", argv[i], val, p); - } - else - { - STRTOL_FATAL_ERROR (argv[i], "arg", s_err); - } - } - exit (0); -} - -#endif /* TESTING_XSTRTO */