summaryrefslogtreecommitdiff
path: root/stdlib/strtol.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-05-22 02:11:55 +0000
committerRoland McGrath <roland@gnu.org>1996-05-22 02:11:55 +0000
commitb8fe19fa809ac786b7d3dbb464cb1b3f887dc69d (patch)
tree0758f3dea04af210777ee864f4fa99e7f107b29e /stdlib/strtol.c
parent1b82a4a8cacdca3d02e98c1799b206da043d940c (diff)
Wed May 22 01:48:54 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/strtol.c [!QUAD] (ULONG_MAX, LONG_MAX): Define these macros if they are not available. (WEAKNAME): New macro to declare argument as weak. Define function with __ prefix and add normal name as weak alias. * sysdeps/posix/euidaccess.c (S_IROTH, S_IWOTH, S_IXOTH): Defines these macros if not already available based on R_OK, W_OK, and X_OK. Tue May 21 18:48:46 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * misc/sys/syslog.h (__need___va_list): Define this instead of __need_va_list before including <stdarg.h>. * Makerules (o-iterator): Use $(object-suffixes-left) instead of $(object-suffixes) to produce repetitions; this is used for other lists than just that one. [versioned]: Use $(o-iterator) properly. * sysdeps/unix/sysv/linux/Implies: Include `gnu'. * sysdeps/mach/hurd/Implies: Likewise. Sat May 18 02:57:46 1996 Ulrich Drepper <drepper@cygnus.com> * login/Makefile: New file. This directory contains functions for user administration. * Makefile (subdirs): Add login. * misc/Makefile (headers): Remove utmp.h. Now in login/utmp.h. (extra-libs, libutil-routines): Ditto. * misc/login.c, misc/login_tty.c, misc/logout.c, misc/logwtmp.c, misc/utmp.h: Moved to misc/. * login/login.c, login/login_tty.c, login/logout.c, login/logwtmp.c, login/utmp.h: Moved to here from misc/. * login/utmp.h: Split file. Definitions of data structures and constants are now in the system dependent utmpbits.h file. * login/setutent_r.c, login/setutent.c, login/endutent_r.c, login/endutent.c, login/getutent_r.c, login/getutent.c, login/getutid_r.c, login/getutid.c, login/getutline_r.c, login/getutline.c, login/pututline_r.c, login/pututline.c: New files. Routines to handle utmp-style files. * sysdeps/gnu/utmpbits.h: New file. Contains GNU/Linux specific definitions of utmp data structures and constants. * sysdeps/unix/sysv/utmpbits.h: Renamed from sysdeps/unix/sysv/utmp.h. * sysdeps/generic/utmpbits.h: New file. Generic (BSDish) version of definitions of utmp data structures and constants. Fri May 17 00:01:31 1996 Ulrich Drepper <drepper@cygnus.com> * locale/C-monetary.c: Default value for mon_decimal_point should be '.'. * stdio-common/printf.h: Remove Linux libc compatibility stuff. Add `extra' flag. Currently used in __printf_fp. * stdio-common/printf_fp.c (__guess_grouping): Renamed from `guess_grouping' and extend visibility to extern. This function is now used in `strfmon'. (__printf_fp): Recognize new bit flag in info struct. This triggers to use the grouping information and decimal point from the LC_MONETARY category instead of the LC_NUMERIC category. * stdio-common/vfprintf.c (process_arg): Correct major bug. In `complicated' loop we must not use the varargs because the args are already available in the ARGS_VALUE array. * stdlib/Makefile (headers): Add monetary.h. (routines): Add strfmon. * stdlib/monetary.h: New file. Header for strfmon function. * stdlib/strfmon.c: New file. Implement strfmon function to print monetary amounts according to current locale's rules. * sysdeps/unix/sysv/linux/i386/sys/vm86.h: The kernel header is now (>= Linux-1.3.100) called <asm/vm86.h>.
Diffstat (limited to 'stdlib/strtol.c')
-rw-r--r--stdlib/strtol.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index 2a2a8ea5e7..3b073ce333 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -105,6 +105,13 @@ extern int errno;
# endif
#else
# define LONG long
+
+#ifndef ULONG_MAX
+# define ULONG_MAX ((unsigned long) ~(unsigned long) 0)
+#endif
+#ifndef LONG_MAX
+# define LONG_MAX ((long int) (ULONG_MAX >> 1))
+#endif
#endif
#ifdef USE_WIDE_CHAR
@@ -128,8 +135,11 @@ extern int errno;
#ifdef __STDC__
# define INTERNAL(x) INTERNAL1(x)
# define INTERNAL1(x) __##x##_internal
+# define WEAKNAME(x) WEAKNAME1(x)
+# define WEAKNAME1(x) __##x
#else
# define INTERNAL(x) __/**/x/**/_internal
+# define WEAKNAME(x) __/**/x
#endif
#ifdef USE_NUMBER_GROUPING
@@ -290,8 +300,10 @@ INTERNAL (strtol) (nptr, endptr, base, group)
#if !UNSIGNED
/* 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))
+ if (overflow == 0
+ && i > (negative
+ ? -((unsigned LONG int) (LONG_MIN + 1)) + 1
+ : (unsigned LONG int) LONG_MAX))
overflow = 1;
#endif
@@ -326,8 +338,13 @@ noconv:
/* External user entry point. */
+/* Prototype. */
+INT WEAKNAME (strtol) __P ((const STRING_TYPE *nptr, STRING_TYPE **endptr,
+ int base));
+
+
INT
-strtol (nptr, endptr, base)
+WEAKNAME (strtol) (nptr, endptr, base)
const STRING_TYPE *nptr;
STRING_TYPE **endptr;
int base;
@@ -335,9 +352,9 @@ strtol (nptr, endptr, base)
return INTERNAL (strtol) (nptr, endptr, base, 0);
}
-#ifdef weak_symbol
+#ifdef weak_alias
/* We need this indirection when `strtol' is defined as a macro
for one of the other names. */
-#define weak1(x) weak_symbol(x)
-weak1 (strtol)
+#define weak1(x, y) weak_alias (x, y)
+weak1 (WEAKNAME (strtol), strtol)
#endif