summaryrefslogtreecommitdiff
path: root/lib/strtol.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-01-27 14:41:51 +0000
committerJim Meyering <jim@meyering.net>1995-01-27 14:41:51 +0000
commit428920f8fc5c93f018cf914fc6a8fd0ae6e223d9 (patch)
tree9bcec0b1673ab5f664e16b5bb6877f7d5f333977 /lib/strtol.c
parent4e2a9fa5f2f78ce00482f0d896f14f9b6a3fbf8c (diff)
downloadcoreutils-428920f8fc5c93f018cf914fc6a8fd0ae6e223d9.tar.xz
.
Diffstat (limited to 'lib/strtol.c')
-rw-r--r--lib/strtol.c51
1 files 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 <config.h>
+#endif
#include <ctype.h>
#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
#if HAVE_LIMITS_H
#include <limits.h>
#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 <stddef.h>
#include <stdlib.h>
#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. */