From 8438e7a949863965cf39adfe9996c4c54d486009 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 27 Jan 1995 14:41:51 +0000 Subject: [PATCH] . --- lib/strtol.c | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/lib/strtol.c b/lib/strtol.c index 09d8f86e9..d7854e63e 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -1,43 +1,50 @@ /* Copyright (C) 1991, 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. + 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 + the Free Software Foundation; either version 2, or (at your option) + any later version. -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif #include #include +#ifndef errno +extern int errno; +#endif #if HAVE_LIMITS_H #include #endif + #ifndef ULONG_MAX -#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1))) -#define LONG_MIN (-LONG_MAX-1) #define ULONG_MAX ((unsigned long) ~(unsigned long) 0) #endif +#ifndef LONG_MAX +#define LONG_MAX (~(1 << (sizeof (long) * 8 - 1))) +#endif + +#ifndef LONG_MIN +#define LONG_MIN (-LONG_MAX - 1) +#endif + #if STDC_HEADERS #include #include #else #define NULL 0 -extern int errno; -#endif - -#if !__STDC__ -#define const #endif #ifndef UNSIGNED @@ -156,7 +163,7 @@ strtol (nptr, endptr, base) /* Check for a value that is within the range of `unsigned long int', but outside the range of `long int'. */ if (i > (negative ? - - (unsigned long int) LONG_MIN : (unsigned long int) LONG_MAX)) + -(unsigned long int) LONG_MIN : (unsigned long int) LONG_MAX)) overflow = 1; #endif @@ -171,7 +178,7 @@ strtol (nptr, endptr, base) } /* Return the result of the appropriate sign. */ - return (negative ? - i : i); + return (negative ? -i : i); noconv:; /* There was no number to convert. */ -- 2.11.0