Sun May 26 15:15:08 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* stdlib/ldiv.c: Deansideclized. Sun May 26 19:39:53 1996 Ulrich Drepper <drepper@cygnus.com> * intl/loadmsgcat.c (_nl_load_domain): Test correct variable after malloc. * string/Makefile (tester-ENV): New variable to suppress message translation in test. * string/tester.c: Add tests for strtok_r and strsep. * sysdeps/i386/i486/strcat.S: Correct some more 8bit operation <-> 32 bit operand conflicts. * sysdeps/i386/strsep.S: Wrapper around <sysdeps/i386/strtok.S> to produce strsep function. * sysdeps/i386/strtok.S: Optimized implementation of strtok function. * sysdeps/i386/strtok_r.S: Wrapper around <sysdeps/i386/strtok.S> to produce strtok_r function. * sysdeps/generic/strtok.c: Moved here from string/strtok.c. Corrected example in comment. * string/Makefile (routines): Add strtok_r. * sysdeps/generic/strtok_r.c: New file. Implement reentrant version of strtok_r. * string/string.h: Add prototype for strtok_r. * wcsmbs/wcstok.c: Handle illegal SAVE_PTR argument the same as in strtok_r. Sun May 26 13:28:23 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * time/tzset.c (__tzset): Ignore leading : in $TZ; always try tzfile first and fall back to 1003.1 syntax only if it fails. * time/Makefile (install-others): Also install posix/ZONE and right/ZONE for each ZONE in $(zonenames). (z.% rule): Generate rules for right/ZONE and posix/ZONE targets too, the difference begin leapseconds vs /dev/null as 3rd dep. For original ZONE targets use $(leapseconds), to be set in Makeconfig. (target-zone-flavor): New variable. (tzcompile): Use it to get the right -d for posix/ and right/ flavors. * Makeconfig (leapseconds): New variable. * mach/Machrules (%.udeps rule): Depend on Machrules. Emit deps for .uh and .__h files. (%.uh, %.__h rules): Don't depend on %.defs; use #include <$*.defs> instead. Sun May 26 01:06:47 1996 Ulrich Drepper <drepper@cygnus.com> * stdlib/Makefile (routines): Add llabs, lldiv. * stdlib/llabs.c: New file. Implementation of return absolute value of long long argument. * stdlib/lldiv.c: New file. Implementation of division with remainder of long long argument. * stdlib/stdlib.h [__USE_GNU] (lldiv_t): New type for lldiv function. Define prototypes for lldiv and llabs functions. * locale/C-collate.c: Initialize _NL_COLLATE_NRULES element. * stdlib/strtod.c: Replace wchar_t with wint_t. The later is really the type for a single wide character. * string/strxfrm.c (print_val): Define separate version for use as wcsxfrm. Here we don't need UTF8 encoding. * wcsmbs/wchar.h: gcc-2.7.2-960517 finally introduces wint_t in <stddef.h>. Use this value and only for older gcc version define in place. (uwchar_t): Remove definition. * wcsmbs/wcscmp.c, wcsmbs/wcscoll.c, wcsmbs/wcsncmp.c, wcsmbs/wcsxfrm.c, wcsmbs/wmemcmp.c: : Don't use uwchar_t as unsigned type. wint_t is intended for this. Sat May 25 14:10:19 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * sysdeps/unix/bsd/direntry.h: Use [1] instead of [0] for d_name to quiet -ansi -pedantic. * sysdeps/unix/common/direntry.h: Likewise. * login/Makefile (headers): Add lastlog.h. * login/lastlog.h: New file. * login/Makefile (CFLAGS): Don't append -D_THREAD_SAFE. * login/utmp.h [_REENTRANT || _THREAD_SAFE]: Replace this conditional with #ifdef __USE_REENTRANT. * features.h (__GNU_LIBRARY__): Set to 6. [_GNU_SOURCE] (_POSIX_SOURCE, _POSIX_C_SOURCE, _BSD_SOURCE, _SVID_SOURCE): Make sure they are all defined. * sysdeps/unix/sysv/linux/gnu/types.h: Instead of including <linux/posix_types.h>, define _LINUX_TYPES_DONT_EXPORT and then include <linux/types.h>. * resource/sys/resource.h: Remove trailing commas from enums. * sysdeps/generic/netinet/in.h: Remove trailing commas from enums. * sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
This commit is contained in:
parent
27a110706b
commit
59dd864187
107
ChangeLog
107
ChangeLog
|
@ -1,5 +1,112 @@
|
||||||
|
Sun May 26 15:15:08 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* stdlib/ldiv.c: Deansideclized.
|
||||||
|
|
||||||
|
Sun May 26 19:39:53 1996 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* intl/loadmsgcat.c (_nl_load_domain): Test correct variable
|
||||||
|
after malloc.
|
||||||
|
|
||||||
|
* string/Makefile (tester-ENV): New variable to suppress message
|
||||||
|
translation in test.
|
||||||
|
|
||||||
|
* string/tester.c: Add tests for strtok_r and strsep.
|
||||||
|
|
||||||
|
* sysdeps/i386/i486/strcat.S: Correct some more 8bit operation
|
||||||
|
<-> 32 bit operand conflicts.
|
||||||
|
|
||||||
|
* sysdeps/i386/strsep.S: Wrapper around <sysdeps/i386/strtok.S>
|
||||||
|
to produce strsep function.
|
||||||
|
* sysdeps/i386/strtok.S: Optimized implementation of strtok
|
||||||
|
function.
|
||||||
|
* sysdeps/i386/strtok_r.S: Wrapper around <sysdeps/i386/strtok.S>
|
||||||
|
to produce strtok_r function.
|
||||||
|
|
||||||
|
* sysdeps/generic/strtok.c: Moved here from string/strtok.c.
|
||||||
|
Corrected example in comment.
|
||||||
|
|
||||||
|
* string/Makefile (routines): Add strtok_r.
|
||||||
|
* sysdeps/generic/strtok_r.c: New file. Implement reentrant version
|
||||||
|
of strtok_r.
|
||||||
|
* string/string.h: Add prototype for strtok_r.
|
||||||
|
* wcsmbs/wcstok.c: Handle illegal SAVE_PTR argument the same
|
||||||
|
as in strtok_r.
|
||||||
|
|
||||||
|
Sun May 26 13:28:23 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* time/tzset.c (__tzset): Ignore leading : in $TZ; always try tzfile
|
||||||
|
first and fall back to 1003.1 syntax only if it fails.
|
||||||
|
|
||||||
|
* time/Makefile (install-others): Also install posix/ZONE and
|
||||||
|
right/ZONE for each ZONE in $(zonenames).
|
||||||
|
(z.% rule): Generate rules for right/ZONE and posix/ZONE targets too,
|
||||||
|
the difference begin leapseconds vs /dev/null as 3rd dep. For
|
||||||
|
original ZONE targets use $(leapseconds), to be set in Makeconfig.
|
||||||
|
(target-zone-flavor): New variable.
|
||||||
|
(tzcompile): Use it to get the right -d for posix/ and right/ flavors.
|
||||||
|
* Makeconfig (leapseconds): New variable.
|
||||||
|
|
||||||
|
* mach/Machrules (%.udeps rule): Depend on Machrules.
|
||||||
|
Emit deps for .uh and .__h files.
|
||||||
|
(%.uh, %.__h rules): Don't depend on %.defs; use #include <$*.defs>
|
||||||
|
instead.
|
||||||
|
|
||||||
|
Sun May 26 01:06:47 1996 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* stdlib/Makefile (routines): Add llabs, lldiv.
|
||||||
|
* stdlib/llabs.c: New file. Implementation of return
|
||||||
|
absolute value of long long argument.
|
||||||
|
* stdlib/lldiv.c: New file. Implementation of division with remainder
|
||||||
|
of long long argument.
|
||||||
|
* stdlib/stdlib.h [__USE_GNU] (lldiv_t): New type for lldiv
|
||||||
|
function.
|
||||||
|
Define prototypes for lldiv and llabs functions.
|
||||||
|
|
||||||
|
* locale/C-collate.c: Initialize _NL_COLLATE_NRULES element.
|
||||||
|
|
||||||
|
* stdlib/strtod.c: Replace wchar_t with wint_t. The later is
|
||||||
|
really the type for a single wide character.
|
||||||
|
|
||||||
|
* string/strxfrm.c (print_val): Define separate version for
|
||||||
|
use as wcsxfrm. Here we don't need UTF8 encoding.
|
||||||
|
|
||||||
|
* wcsmbs/wchar.h: gcc-2.7.2-960517 finally introduces wint_t
|
||||||
|
in <stddef.h>. Use this value and only for older gcc version
|
||||||
|
define in place.
|
||||||
|
(uwchar_t): Remove definition.
|
||||||
|
|
||||||
|
* wcsmbs/wcscmp.c, wcsmbs/wcscoll.c, wcsmbs/wcsncmp.c,
|
||||||
|
wcsmbs/wcsxfrm.c, wcsmbs/wmemcmp.c: : Don't use uwchar_t as unsigned
|
||||||
|
type. wint_t is intended for this.
|
||||||
|
|
||||||
|
Sat May 25 14:10:19 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* sysdeps/unix/bsd/direntry.h: Use [1] instead of [0] for d_name to
|
||||||
|
quiet -ansi -pedantic.
|
||||||
|
* sysdeps/unix/common/direntry.h: Likewise.
|
||||||
|
|
||||||
|
* login/Makefile (headers): Add lastlog.h.
|
||||||
|
* login/lastlog.h: New file.
|
||||||
|
|
||||||
|
* login/Makefile (CFLAGS): Don't append -D_THREAD_SAFE.
|
||||||
|
* login/utmp.h [_REENTRANT || _THREAD_SAFE]: Replace this conditional
|
||||||
|
with #ifdef __USE_REENTRANT.
|
||||||
|
|
||||||
|
* features.h (__GNU_LIBRARY__): Set to 6.
|
||||||
|
[_GNU_SOURCE] (_POSIX_SOURCE, _POSIX_C_SOURCE, _BSD_SOURCE,
|
||||||
|
_SVID_SOURCE): Make sure they are all defined.
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/gnu/types.h: Instead of including
|
||||||
|
<linux/posix_types.h>, define _LINUX_TYPES_DONT_EXPORT and then
|
||||||
|
include <linux/types.h>.
|
||||||
|
|
||||||
|
* resource/sys/resource.h: Remove trailing commas from enums.
|
||||||
|
|
||||||
Fri May 24 17:30:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
Fri May 24 17:30:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||||
|
|
||||||
|
* sysdeps/generic/netinet/in.h: Remove trailing commas from enums.
|
||||||
|
* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
|
||||||
|
|
||||||
* login/getutline_r.c: Include string.h.
|
* login/getutline_r.c: Include string.h.
|
||||||
|
|
||||||
* Rules (static-only-routines): Restore the rule to make these .so's
|
* Rules (static-only-routines): Restore the rule to make these .so's
|
||||||
|
|
10
Makeconfig
10
Makeconfig
|
@ -221,6 +221,16 @@ ifndef localtime-file
|
||||||
localtime-file = $(sysconfdir)/localtime
|
localtime-file = $(sysconfdir)/localtime
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# What to use for leap second specifications in compiling the default
|
||||||
|
# timezone files. Set this to `/dev/null' for no leap second handling as
|
||||||
|
# 1003.1 requires, or to `leapseconds' for proper leap second handling.
|
||||||
|
# Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
|
||||||
|
# This variable determines the default: if it's `/dev/null',
|
||||||
|
# ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
|
||||||
|
ifndef leapseconds
|
||||||
|
leapseconds = /dev/null
|
||||||
|
endif
|
||||||
|
|
||||||
# What timezone's DST rules should be used when a POSIX-style TZ
|
# What timezone's DST rules should be used when a POSIX-style TZ
|
||||||
# environment variable doesn't specify any rules. For 1003.1 compliance
|
# environment variable doesn't specify any rules. For 1003.1 compliance
|
||||||
# this timezone must use rules that are as U.S. federal law defines DST.
|
# this timezone must use rules that are as U.S. federal law defines DST.
|
||||||
|
|
4
config.guess
vendored
4
config.guess
vendored
|
@ -137,7 +137,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
AViiON:dgux:*:*)
|
AViiON:dgux:*:*)
|
||||||
# DG/UX returns AViiON for all architectures
|
# DG/UX returns AViiON for all architectures
|
||||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
|
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||||
|
@ -211,7 +211,7 @@ EOF
|
||||||
echo romp-ibm-bsd4.4
|
echo romp-ibm-bsd4.4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||||
*:BOSX:*:*)
|
*:BOSX:*:*)
|
||||||
echo rs6000-bull-bosx
|
echo rs6000-bull-bosx
|
||||||
|
|
31
features.h
31
features.h
|
@ -50,7 +50,6 @@ Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
|
The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
|
||||||
|
|
||||||
All macros defined by this file are defined as 1.
|
|
||||||
All macros listed above as possibly being defined by this file are
|
All macros listed above as possibly being defined by this file are
|
||||||
explicitly undefined if they are not explicitly defined.
|
explicitly undefined if they are not explicitly defined.
|
||||||
Feature-test macros that are not defined by the user or compiler
|
Feature-test macros that are not defined by the user or compiler
|
||||||
|
@ -80,32 +79,42 @@ Cambridge, MA 02139, USA. */
|
||||||
#define __FAVOR_BSD 1
|
#define __FAVOR_BSD 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If _GNU_SOURCE was defined by the user, turn on all the other features. */
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
/* If the user specifies some of the following without _GNU_SOURCE,
|
||||||
|
they are mutually exclusive. But they all default below to on,
|
||||||
|
so undefine them to get all the features turned on for _GNU_SOURCE. */
|
||||||
|
#undef _POSIX_SOURCE
|
||||||
|
#undef _POSIX_C_SOURCE
|
||||||
|
#undef _BSD_SOURCE
|
||||||
|
#undef _SVID_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If nothing (other than _GNU_SOURCE) is defined,
|
/* If nothing (other than _GNU_SOURCE) is defined,
|
||||||
define _BSD_SOURCE and _SVID_SOURCE. */
|
define _BSD_SOURCE and _SVID_SOURCE. */
|
||||||
#if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
|
#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
|
||||||
!defined(_POSIX_C_SOURCE) && !defined(_BSD_SOURCE) && \
|
!defined (_POSIX_C_SOURCE) && !defined (_BSD_SOURCE) && \
|
||||||
!defined(_SVID_SOURCE))
|
!defined (_SVID_SOURCE))
|
||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
#define _SVID_SOURCE 1
|
#define _SVID_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */
|
/* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */
|
||||||
#if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
|
#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
|
||||||
!defined(_POSIX_C_SOURCE))
|
!defined (_POSIX_C_SOURCE))
|
||||||
#define _POSIX_SOURCE 1
|
#define _POSIX_SOURCE 1
|
||||||
#define _POSIX_C_SOURCE 2
|
#define _POSIX_C_SOURCE 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1
|
#if defined (_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1
|
||||||
#define __USE_POSIX 1
|
#define __USE_POSIX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
|
#if defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
|
||||||
#define __USE_POSIX2 1
|
#define __USE_POSIX2 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_BSD_SOURCE) || defined(_SVID_SOURCE)
|
#if defined (_BSD_SOURCE) || defined (_SVID_SOURCE)
|
||||||
#define __USE_MISC 1
|
#define __USE_MISC 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -133,10 +142,10 @@ Cambridge, MA 02139, USA. */
|
||||||
the shared C library corresponding to this set of header files. */
|
the shared C library corresponding to this set of header files. */
|
||||||
|
|
||||||
#undef __GNU_LIBRARY__
|
#undef __GNU_LIBRARY__
|
||||||
#define __GNU_LIBRARY__ 5
|
#define __GNU_LIBRARY__ 6
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__GNUC__) || __GNUC__ < 2
|
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||||
/* In GCC version 2, (__extension__ EXPR) will not complain
|
/* In GCC version 2, (__extension__ EXPR) will not complain
|
||||||
about GCC extensions used in EXPR under -ansi or -pedantic. */
|
about GCC extensions used in EXPR under -ansi or -pedantic. */
|
||||||
#define __extension__
|
#define __extension__
|
||||||
|
|
|
@ -161,7 +161,7 @@ _nl_load_domain (domain_file)
|
||||||
|
|
||||||
domain_file->data
|
domain_file->data
|
||||||
= (struct loaded_domain *) malloc (sizeof (struct loaded_domain *));
|
= (struct loaded_domain *) malloc (sizeof (struct loaded_domain *));
|
||||||
if (domain->data == NULL)
|
if (domain_file->data == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
domain = (struct loaded_domain *) domain_file->data;
|
domain = (struct loaded_domain *) domain_file->data;
|
||||||
|
|
|
@ -23,5 +23,8 @@ const struct locale_data _nl_C_LC_COLLATE =
|
||||||
{
|
{
|
||||||
_nl_C_name,
|
_nl_C_name,
|
||||||
NULL, 0, /* no file mapped */
|
NULL, 0, /* no file mapped */
|
||||||
0,
|
1,
|
||||||
|
{
|
||||||
|
{ word: 0 }
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
subdir := login
|
subdir := login
|
||||||
|
|
||||||
headers := utmp.h utmpbits.h
|
headers := utmp.h utmpbits.h lastlog.h
|
||||||
|
|
||||||
routines := setutent endutent getutent getutid getutline pututline \
|
routines := setutent endutent getutent getutid getutline pututline \
|
||||||
setutent_r endutent_r getutent_r getutid_r getutline_r \
|
setutent_r endutent_r getutent_r getutid_r getutline_r \
|
||||||
|
@ -34,5 +34,3 @@ libutil-routines:= login login_tty logout logwtmp pty
|
||||||
|
|
||||||
|
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
override CFLAGS += -D_THREAD_SAFE
|
|
||||||
|
|
4
login/lastlog.h
Normal file
4
login/lastlog.h
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
/* This header file is used in 4.3BSD to define `struct lastlog',
|
||||||
|
which we define in <utmpbits.h>. */
|
||||||
|
|
||||||
|
#include <utmp.h>
|
|
@ -62,7 +62,7 @@ extern struct utmp *getutline __P ((__const struct utmp *__line));
|
||||||
extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
|
extern struct utmp *pututline __P ((__const struct utmp *__utmp_ptr));
|
||||||
|
|
||||||
|
|
||||||
#if defined(_REENTRANT) || defined(_THREAD_SAFE)
|
#ifdef __USE_REENTRANT
|
||||||
/* Define the data structure needed for the reentrent version. */
|
/* Define the data structure needed for the reentrent version. */
|
||||||
struct utmp_data
|
struct utmp_data
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ extern int getutline_r __P ((__const struct utmp *__line, struct utmp **__utmp,
|
||||||
extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
|
extern int pututline_r __P ((__const struct utmp *__utmp_ptr,
|
||||||
struct utmp_data *__utmp_data));
|
struct utmp_data *__utmp_data));
|
||||||
|
|
||||||
#endif /* _REENTRENT || _THREAD_SAFE */
|
#endif /* Use reentrant. */
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -115,11 +115,12 @@ $(patsubst %,$(objpfx)%.ustamp,$(user-interfaces)): $(objpfx)%.ustamp:
|
||||||
done
|
done
|
||||||
touch $@
|
touch $@
|
||||||
-include $(patsubst %,$(objpfx)%.udeps,$(user-interfaces))
|
-include $(patsubst %,$(objpfx)%.udeps,$(user-interfaces))
|
||||||
$(patsubst %,$(objpfx)%.udeps,$(user-interfaces)): $(objpfx)%.udeps:
|
$(patsubst %,$(objpfx)%.udeps,$(user-interfaces)):
|
||||||
|
$(objpfx)%.udeps: $(..)mach/Machrules
|
||||||
$(make-target-directory)
|
$(make-target-directory)
|
||||||
echo '#include <$*.defs>' | \
|
echo '#include <$*.defs>' | \
|
||||||
$(CC) $(CPPFLAGS) -M -x c - | \
|
$(CC) $(CPPFLAGS) -M -x c - | \
|
||||||
sed -e 's,- *:,$@ $(@:.udeps=.ustamp) \
|
sed -e 's,- *:,$@ $(@:.udeps=.ustamp) $(@:.udeps=.uh) $(@:.udeps=.__h)\
|
||||||
$(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
|
$(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
|
||||||
$(sed-remove-objpfx) > $@.new
|
$(sed-remove-objpfx) > $@.new
|
||||||
mv -f $@.new $@
|
mv -f $@.new $@
|
||||||
|
@ -137,16 +138,18 @@ $(objpfx)%_server.c $(objpfx)%_server.h:
|
||||||
|
|
||||||
# To get header files that declare both the straight and __ functions,
|
# To get header files that declare both the straight and __ functions,
|
||||||
# we generate two files and paste them together.
|
# we generate two files and paste them together.
|
||||||
$(objpfx)%.uh: %.defs; $(mig.uh)
|
$(objpfx)%.uh:; $(mig.uh)
|
||||||
define mig.uh
|
define mig.uh
|
||||||
$(make-target-directory)
|
$(make-target-directory)
|
||||||
$(MIG) $< $(MIGFLAGS) \
|
echo '#include <$*.defs>' | \
|
||||||
|
$(MIG) - /dev/null $(MIGFLAGS) \
|
||||||
-header $@ -server /dev/null -user /dev/null
|
-header $@ -server /dev/null -user /dev/null
|
||||||
endef
|
endef
|
||||||
$(objpfx)%.__h: %.defs; $(mig.__h)
|
$(objpfx)%.__h:; $(mig.__h)
|
||||||
define mig.__h
|
define mig.__h
|
||||||
$(make-target-directory)
|
$(make-target-directory)
|
||||||
$(MIG) $< $(MIGFLAGS) -prefix __ \
|
echo '#include <$*.defs>' | \
|
||||||
|
$(MIG) - /dev/null $(MIGFLAGS) -prefix __ \
|
||||||
-header $@ -server /dev/null -user /dev/null
|
-header $@ -server /dev/null -user /dev/null
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1992, 1994 Free Software Foundation, Inc.
|
/* Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -59,7 +59,7 @@ enum __rusage_who
|
||||||
RUSAGE_SELF = 0,
|
RUSAGE_SELF = 0,
|
||||||
#define RUSAGE_SELF RUSAGE_SELF
|
#define RUSAGE_SELF RUSAGE_SELF
|
||||||
/* All of its terminated child processes. */
|
/* All of its terminated child processes. */
|
||||||
RUSAGE_CHILDREN = -1,
|
RUSAGE_CHILDREN = -1
|
||||||
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
|
#define RUSAGE_CHILDREN RUSAGE_CHILDREN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ enum __priority_which
|
||||||
{
|
{
|
||||||
PRIO_PROCESS = 0, /* WHO is a process ID. */
|
PRIO_PROCESS = 0, /* WHO is a process ID. */
|
||||||
PRIO_PGRP = 1, /* WHO is a process group ID. */
|
PRIO_PGRP = 1, /* WHO is a process group ID. */
|
||||||
PRIO_USER = 2, /* WHO is a user ID. */
|
PRIO_USER = 2 /* WHO is a user ID. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return the highest priority of any process specified by WHICH and WHO
|
/* Return the highest priority of any process specified by WHICH and WHO
|
||||||
|
|
|
@ -29,8 +29,8 @@ routines := \
|
||||||
bsearch qsort msort \
|
bsearch qsort msort \
|
||||||
getenv putenv setenv \
|
getenv putenv setenv \
|
||||||
exit on_exit atexit \
|
exit on_exit atexit \
|
||||||
abs labs \
|
abs labs llabs \
|
||||||
div ldiv \
|
div ldiv lldiv \
|
||||||
mblen mbstowcs mbtowc wcstombs wctomb \
|
mblen mbstowcs mbtowc wcstombs wctomb \
|
||||||
random random_r rand \
|
random random_r rand \
|
||||||
drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
|
drand48 erand48 lrand48 nrand48 mrand48 jrand48 \
|
||||||
|
|
31
stdlib/llabs.c
Normal file
31
stdlib/llabs.c
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/* `long long int' absolute value.
|
||||||
|
Copyright (C) 1991, 1996 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#undef llabs
|
||||||
|
|
||||||
|
|
||||||
|
/* Return the absolute value of I. */
|
||||||
|
long long int
|
||||||
|
llabs (i)
|
||||||
|
long long int i;
|
||||||
|
{
|
||||||
|
return i < 0 ? -i : i;
|
||||||
|
}
|
57
stdlib/lldiv.c
Normal file
57
stdlib/lldiv.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/* `long long int' divison with remainder.
|
||||||
|
Copyright (C) 1992, 1996 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Return the `lldiv_t' representation of NUMER over DENOM. */
|
||||||
|
lldiv_t
|
||||||
|
lldiv (numer, denom)
|
||||||
|
long long int numer;
|
||||||
|
long long int denom;
|
||||||
|
{
|
||||||
|
lldiv_t result;
|
||||||
|
|
||||||
|
result.quot = numer / denom;
|
||||||
|
result.rem = numer % denom;
|
||||||
|
|
||||||
|
/* The ANSI standard says that |QUOT| <= |NUMER / DENOM|, where
|
||||||
|
NUMER / DENOM is to be computed in infinite precision. In
|
||||||
|
other words, we should always truncate the quotient towards
|
||||||
|
zero, never -infinity. Machine division and remainer may
|
||||||
|
work either way when one or both of NUMER or DENOM is
|
||||||
|
negative. If only one is negative and QUOT has been
|
||||||
|
truncated towards -infinity, REM will have the same sign as
|
||||||
|
DENOM and the opposite sign of NUMER; if both are negative
|
||||||
|
and QUOT has been truncated towards -infinity, REM will be
|
||||||
|
positive (will have the opposite sign of NUMER). These are
|
||||||
|
considered `wrong'. If both are NUM and DENOM are positive,
|
||||||
|
RESULT will always be positive. This all boils down to: if
|
||||||
|
NUMER >= 0, but REM < 0, we got the wrong answer. In that
|
||||||
|
case, to get the right answer, add 1 to QUOT and subtract
|
||||||
|
DENOM from REM. */
|
||||||
|
|
||||||
|
if (numer >= 0 && result.rem < 0)
|
||||||
|
{
|
||||||
|
++result.quot;
|
||||||
|
result.rem -= denom;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
|
@ -50,6 +50,15 @@ typedef struct
|
||||||
long int rem; /* Remainder. */
|
long int rem; /* Remainder. */
|
||||||
} ldiv_t;
|
} ldiv_t;
|
||||||
|
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
/* Returned by `lldiv'. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
long long int quot; /* Quotient. */
|
||||||
|
long long int rem; /* Remainder. */
|
||||||
|
} lldiv_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* The largest number rand will return (same as INT_MAX). */
|
/* The largest number rand will return (same as INT_MAX). */
|
||||||
#define RAND_MAX 2147483647
|
#define RAND_MAX 2147483647
|
||||||
|
@ -407,13 +416,19 @@ extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size,
|
||||||
/* Return the absolute value of X. */
|
/* Return the absolute value of X. */
|
||||||
extern int abs __P ((int __x)) __attribute__ ((__const__));
|
extern int abs __P ((int __x)) __attribute__ ((__const__));
|
||||||
extern long int labs __P ((long int __x)) __attribute__ ((__const__));
|
extern long int labs __P ((long int __x)) __attribute__ ((__const__));
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
extern long long int llabs __P ((long long int __x)) __attribute__ ((__const__));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Return the `div_t' or `ldiv_t' representation
|
/* Return the `div_t', `ldiv_t' or `lldiv_t' representation
|
||||||
of the value of NUMER over DENOM. */
|
of the value of NUMER over DENOM. */
|
||||||
/* GCC may have built-ins for these someday. */
|
/* GCC may have built-ins for these someday. */
|
||||||
extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__));
|
extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__));
|
||||||
extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__));
|
extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__));
|
||||||
|
#ifdef __USE_GNU
|
||||||
|
extern lldiv_t lldiv __P ((long long int __numer, long long int __denom)) __attribute__ ((__const__));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __USE_SVID
|
#ifdef __USE_SVID
|
||||||
|
|
|
@ -365,9 +365,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||||
CHAR_TYPE c;
|
CHAR_TYPE c;
|
||||||
|
|
||||||
/* The radix character of the current locale. */
|
/* The radix character of the current locale. */
|
||||||
wchar_t decimal;
|
wint_t decimal;
|
||||||
/* The thousands character of the current locale. */
|
/* The thousands character of the current locale. */
|
||||||
wchar_t thousands;
|
wint_t thousands;
|
||||||
/* The numeric grouping specification of the current locale,
|
/* The numeric grouping specification of the current locale,
|
||||||
in the format described in <locale.h>. */
|
in the format described in <locale.h>. */
|
||||||
const char *grouping;
|
const char *grouping;
|
||||||
|
@ -380,9 +380,10 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Figure out the thousands separator character. */
|
/* Figure out the thousands separator character. */
|
||||||
if (mbtowc (&thousands, _NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
if (mbtowc ((wchar_t *) &thousands,
|
||||||
|
_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP),
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
|
strlen (_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP))) <= 0)
|
||||||
thousands = (wchar_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
thousands = (wint_t) *_NL_CURRENT (LC_NUMERIC, THOUSANDS_SEP);
|
||||||
if (thousands == L'\0')
|
if (thousands == L'\0')
|
||||||
grouping = NULL;
|
grouping = NULL;
|
||||||
}
|
}
|
||||||
|
@ -394,9 +395,9 @@ INTERNAL (STRTOF) (nptr, endptr, group)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the locale's decimal point character. */
|
/* Find the locale's decimal point character. */
|
||||||
if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
if (mbtowc ((wchar_t *) &decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
|
||||||
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
|
strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
|
||||||
decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
decimal = (wint_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
|
||||||
|
|
||||||
|
|
||||||
/* Prepare number representation. */
|
/* Prepare number representation. */
|
||||||
|
|
|
@ -28,7 +28,7 @@ routines := strcat strchr strcmp strcoll strcpy strcspn strdup \
|
||||||
strerror _strerror strlen strnlen \
|
strerror _strerror strlen strnlen \
|
||||||
strncat strncmp strncpy \
|
strncat strncmp strncpy \
|
||||||
strrchr strpbrk strsignal strspn strstr strtok \
|
strrchr strpbrk strsignal strspn strstr strtok \
|
||||||
strxfrm memchr memcmp memmove memset \
|
strtok_r strxfrm memchr memcmp memmove memset \
|
||||||
bcopy bzero ffs stpcpy stpncpy \
|
bcopy bzero ffs stpcpy stpncpy \
|
||||||
strcasecmp strncase \
|
strcasecmp strncase \
|
||||||
memccpy memcpy wordcopy strsep \
|
memccpy memcpy wordcopy strsep \
|
||||||
|
@ -42,3 +42,5 @@ distribute := memcopy.h pagecopy.h
|
||||||
|
|
||||||
|
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
|
tester-ENV = LANGUAGE=C
|
||||||
|
|
|
@ -120,6 +120,11 @@ extern char *strstr __P ((__const char *__haystack, __const char *__needle));
|
||||||
extern char *strtok __P ((char *__s, __const char *__delim));
|
extern char *strtok __P ((char *__s, __const char *__delim));
|
||||||
|
|
||||||
#ifdef __USE_GNU
|
#ifdef __USE_GNU
|
||||||
|
/* Divide S into tokens separated by characters in DELIM. Information
|
||||||
|
passed between calls are stored in SAVE_PTR. */
|
||||||
|
extern char *strtok_r __P ((char *__s, __const char *__delim,
|
||||||
|
char **__save_ptr));
|
||||||
|
|
||||||
/* Find the first occurence of NEEDLE in HAYSTACK.
|
/* Find the first occurence of NEEDLE in HAYSTACK.
|
||||||
NEEDLE is NEEDLELEN bytes long;
|
NEEDLE is NEEDLELEN bytes long;
|
||||||
HAYSTACK is HAYSTACKLEN bytes long. */
|
HAYSTACK is HAYSTACKLEN bytes long. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -13,10 +13,9 @@ Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
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
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -26,15 +25,16 @@ static char *olds = NULL;
|
||||||
/* Parse S into tokens separated by characters in DELIM.
|
/* Parse S into tokens separated by characters in DELIM.
|
||||||
If S is NULL, the last string strtok() was called with is
|
If S is NULL, the last string strtok() was called with is
|
||||||
used. For example:
|
used. For example:
|
||||||
char s[] = "-abc=-def";
|
char s[] = "-abc-=-def";
|
||||||
x = strtok(s, "-"); // x = "abc"
|
x = strtok(s, "-"); // x = "abc"
|
||||||
x = strtok(NULL, "=-"); // x = "def"
|
x = strtok(NULL, "-="); // x = "def"
|
||||||
x = strtok(NULL, "="); // x = NULL
|
x = strtok(NULL, "="); // x = NULL
|
||||||
// s = "abc\0-def\0"
|
// s = "abc\0-def\0"
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
DEFUN(strtok, (s, delim),
|
strtok (s, delim)
|
||||||
register char *s AND register CONST char *delim)
|
char *s;
|
||||||
|
const char *delim;
|
||||||
{
|
{
|
||||||
char *token;
|
char *token;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ DEFUN(strtok, (s, delim),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan leading delimiters. */
|
/* Scan leading delimiters. */
|
||||||
s += strspn(s, delim);
|
s += strspn (s, delim);
|
||||||
if (*s == '\0')
|
if (*s == '\0')
|
||||||
{
|
{
|
||||||
olds = NULL;
|
olds = NULL;
|
||||||
|
@ -59,7 +59,7 @@ DEFUN(strtok, (s, delim),
|
||||||
|
|
||||||
/* Find the end of the token. */
|
/* Find the end of the token. */
|
||||||
token = s;
|
token = s;
|
||||||
s = strpbrk(token, delim);
|
s = strpbrk (token, delim);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
/* This token finishes the string. */
|
/* This token finishes the string. */
|
||||||
olds = NULL;
|
olds = NULL;
|
||||||
|
|
|
@ -21,9 +21,10 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef STRING_TYPE
|
#ifndef WIDE_VERSION
|
||||||
# define STRING_TYPE char
|
# define STRING_TYPE char
|
||||||
# define USTRING_TYPE unsigned char
|
# define USTRING_TYPE unsigned char
|
||||||
|
# define L_(Ch) Ch
|
||||||
# define STRXFRM strxfrm
|
# define STRXFRM strxfrm
|
||||||
# define STRLEN strlen
|
# define STRLEN strlen
|
||||||
# define STPNCPY __stpncpy
|
# define STPNCPY __stpncpy
|
||||||
|
@ -34,9 +35,10 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include "../locale/weight.h"
|
#include "../locale/weight.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef WIDE_VERSION
|
||||||
/* Write 32 bit value UTF-8 encoded but only if enough space is left. */
|
/* Write 32 bit value UTF-8 encoded but only if enough space is left. */
|
||||||
static __inline size_t
|
static __inline size_t
|
||||||
print_val (u_int32_t value, STRING_TYPE *dest, size_t max, size_t act)
|
print_val (u_int32_t value, char *dest, size_t max, size_t act)
|
||||||
{
|
{
|
||||||
char tmp[6];
|
char tmp[6];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
@ -90,6 +92,48 @@ print_val (u_int32_t value, STRING_TYPE *dest, size_t max, size_t act)
|
||||||
|
|
||||||
return act;
|
return act;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static __inline size_t
|
||||||
|
print_val (u_int32_t value, wchar_t *dest, size_t max, size_t act)
|
||||||
|
{
|
||||||
|
/* We cannot really assume wchar_t is 32 bits wide. But it is for
|
||||||
|
GCC and so we don't do much optimization for the other case. */
|
||||||
|
if (sizeof (wchar_t) == 4)
|
||||||
|
{
|
||||||
|
if (act < max)
|
||||||
|
dest[act] = (wchar_t) value;
|
||||||
|
++act;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t tmp[3];
|
||||||
|
size_t idx = 0;
|
||||||
|
|
||||||
|
if (value < 0x8000)
|
||||||
|
tmp[idx++] = (wchar_t) act;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp[idx++] = (wchar_t) (0x8000 + (value & 0x3fff));
|
||||||
|
value >>= 14;
|
||||||
|
if (value < 0x2000)
|
||||||
|
tmp[idx++] = (wchar_t) (0xc000 + value);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp[idx++] = (wchar_t) (0x8000 + (value & 0x3fff));
|
||||||
|
value >>= 14;
|
||||||
|
tmp[idx++] = (wchar_t) (0xe000 + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (idx-- > 0)
|
||||||
|
{
|
||||||
|
if (act < max)
|
||||||
|
dest[act] = tmp[idx];
|
||||||
|
++act;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return act;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Transform SRC into a form such that the result of strcmp
|
/* Transform SRC into a form such that the result of strcmp
|
||||||
|
@ -184,5 +228,9 @@ STRXFRM (STRING_TYPE *dest, const STRING_TYPE *src, size_t n)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Terminate string. */
|
/* Terminate string. */
|
||||||
return print_val (0, dest, n, written);
|
if (written < n)
|
||||||
|
dest[written] = L_('\0');
|
||||||
|
|
||||||
|
/* Return length without counting the terminating '\0'. */
|
||||||
|
return written;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,8 @@ char two[50];
|
||||||
int
|
int
|
||||||
DEFUN(main, (argc, argv), int argc AND char **argv)
|
DEFUN(main, (argc, argv), int argc AND char **argv)
|
||||||
{
|
{
|
||||||
|
char *cp;
|
||||||
|
|
||||||
/* Test strcmp first because we use it to test other things. */
|
/* Test strcmp first because we use it to test other things. */
|
||||||
it = "strcmp";
|
it = "strcmp";
|
||||||
check(strcmp("", "") == 0, 1); /* Trivial case. */
|
check(strcmp("", "") == 0, 1); /* Trivial case. */
|
||||||
|
@ -359,6 +361,100 @@ DEFUN(main, (argc, argv), int argc AND char **argv)
|
||||||
equal(one+2, "b", 32);
|
equal(one+2, "b", 32);
|
||||||
equal(one+4, "c", 33);
|
equal(one+4, "c", 33);
|
||||||
|
|
||||||
|
/* strtok_r. */
|
||||||
|
it = "strtok_r";
|
||||||
|
(void) strcpy(one, "first, second, third");
|
||||||
|
equal(strtok_r(one, ", ", &cp), "first", 1); /* Basic test. */
|
||||||
|
equal(one, "first", 2);
|
||||||
|
equal(strtok_r((char *)NULL, ", ", &cp), "second", 3);
|
||||||
|
equal(strtok_r((char *)NULL, ", ", &cp), "third", 4);
|
||||||
|
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 5);
|
||||||
|
(void) strcpy(one, ", first, ");
|
||||||
|
equal(strtok_r(one, ", ", &cp), "first", 6); /* Extra delims, 1 tok. */
|
||||||
|
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 7);
|
||||||
|
(void) strcpy(one, "1a, 1b; 2a, 2b");
|
||||||
|
equal(strtok_r(one, ", ", &cp), "1a", 8); /* Changing delim lists. */
|
||||||
|
equal(strtok_r((char *)NULL, "; ", &cp), "1b", 9);
|
||||||
|
equal(strtok_r((char *)NULL, ", ", &cp), "2a", 10);
|
||||||
|
(void) strcpy(two, "x-y");
|
||||||
|
equal(strtok_r(two, "-", &cp), "x", 11); /* New string before done. */
|
||||||
|
equal(strtok_r((char *)NULL, "-", &cp), "y", 12);
|
||||||
|
check(strtok_r((char *)NULL, "-", &cp) == NULL, 13);
|
||||||
|
(void) strcpy(one, "a,b, c,, ,d");
|
||||||
|
equal(strtok_r(one, ", ", &cp), "a", 14); /* Different separators. */
|
||||||
|
equal(strtok_r((char *)NULL, ", ", &cp), "b", 15);
|
||||||
|
equal(strtok_r((char *)NULL, " ,", &cp), "c", 16); /* Permute list too. */
|
||||||
|
equal(strtok_r((char *)NULL, " ,", &cp), "d", 17);
|
||||||
|
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 18);
|
||||||
|
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 19); /* Persistence. */
|
||||||
|
(void) strcpy(one, ", ");
|
||||||
|
check(strtok_r(one, ", ", &cp) == NULL, 20); /* No tokens. */
|
||||||
|
(void) strcpy(one, "");
|
||||||
|
check(strtok_r(one, ", ", &cp) == NULL, 21); /* Empty string. */
|
||||||
|
(void) strcpy(one, "abc");
|
||||||
|
equal(strtok_r(one, ", ", &cp), "abc", 22); /* No delimiters. */
|
||||||
|
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 23);
|
||||||
|
(void) strcpy(one, "abc");
|
||||||
|
equal(strtok_r(one, "", &cp), "abc", 24); /* Empty delimiter list. */
|
||||||
|
check(strtok_r((char *)NULL, "", &cp) == NULL, 25);
|
||||||
|
(void) strcpy(one, "abcdefgh");
|
||||||
|
(void) strcpy(one, "a,b,c");
|
||||||
|
equal(strtok_r(one, ",", &cp), "a", 26); /* Basics again... */
|
||||||
|
equal(strtok_r((char *)NULL, ",", &cp), "b", 27);
|
||||||
|
equal(strtok_r((char *)NULL, ",", &cp), "c", 28);
|
||||||
|
check(strtok_r((char *)NULL, ",", &cp) == NULL, 29);
|
||||||
|
equal(one+6, "gh", 30); /* Stomped past end? */
|
||||||
|
equal(one, "a", 31); /* Stomped old tokens? */
|
||||||
|
equal(one+2, "b", 32);
|
||||||
|
equal(one+4, "c", 33);
|
||||||
|
|
||||||
|
/* strsep. */
|
||||||
|
it = "strsep";
|
||||||
|
cp = strcpy(one, "first, second, third");
|
||||||
|
equal(strsep(&cp, ", "), "first", 1); /* Basic test. */
|
||||||
|
equal(one, "first", 2);
|
||||||
|
equal(strsep(&cp, ", "), "second", 3);
|
||||||
|
equal(strsep(&cp, ", "), "third", 4);
|
||||||
|
check(strsep(&cp, ", ") == NULL, 5);
|
||||||
|
cp = strcpy(one, ", first, ");
|
||||||
|
equal(strsep(&cp, ", "), "first", 6); /* Extra delims, 1 tok. */
|
||||||
|
check(strsep(&cp, ", ") == NULL, 7);
|
||||||
|
cp = strcpy(one, "1a, 1b; 2a, 2b");
|
||||||
|
equal(strsep(&cp, ", "), "1a", 8); /* Changing delim lists. */
|
||||||
|
equal(strsep(&cp, "; "), "1b", 9);
|
||||||
|
equal(strsep(&cp, ", "), "2a", 10);
|
||||||
|
cp = strcpy(two, "x-y");
|
||||||
|
equal(strsep(&cp, "-"), "x", 11); /* New string before done. */
|
||||||
|
equal(strsep(&cp, "-"), "y", 12);
|
||||||
|
check(strsep(&cp, "-") == NULL, 13);
|
||||||
|
cp = strcpy(one, "a,b, c,, ,d");
|
||||||
|
equal(strsep(&cp, ", "), "a", 14); /* Different separators. */
|
||||||
|
equal(strsep(&cp, ", "), "b", 15);
|
||||||
|
equal(strsep(&cp, " ,"), "c", 16); /* Permute list too. */
|
||||||
|
equal(strsep(&cp, " ,"), "d", 17);
|
||||||
|
check(strsep(&cp, ", ") == NULL, 18);
|
||||||
|
check(strsep(&cp, ", ") == NULL, 19); /* Persistence. */
|
||||||
|
cp = strcpy(one, ", ");
|
||||||
|
check(strsep(&cp, ", ") == NULL, 20); /* No tokens. */
|
||||||
|
cp = strcpy(one, "");
|
||||||
|
check(strsep(&cp, ", ") == NULL, 21); /* Empty string. */
|
||||||
|
cp = strcpy(one, "abc");
|
||||||
|
equal(strsep(&cp, ", "), "abc", 22); /* No delimiters. */
|
||||||
|
check(strsep(&cp, ", ") == NULL, 23);
|
||||||
|
cp = strcpy(one, "abc");
|
||||||
|
equal(strsep(&cp, ""), "abc", 24); /* Empty delimiter list. */
|
||||||
|
check(strsep(&cp, "") == NULL, 25);
|
||||||
|
(void) strcpy(one, "abcdefgh");
|
||||||
|
cp = strcpy(one, "a,b,c");
|
||||||
|
equal(strsep(&cp, ","), "a", 26); /* Basics again... */
|
||||||
|
equal(strsep(&cp, ","), "b", 27);
|
||||||
|
equal(strsep(&cp, ","), "c", 28);
|
||||||
|
check(strsep(&cp, ",") == NULL, 29);
|
||||||
|
equal(one+6, "gh", 30); /* Stomped past end? */
|
||||||
|
equal(one, "a", 31); /* Stomped old tokens? */
|
||||||
|
equal(one+2, "b", 32);
|
||||||
|
equal(one+4, "c", 33);
|
||||||
|
|
||||||
/* memcmp. */
|
/* memcmp. */
|
||||||
it = "memcmp";
|
it = "memcmp";
|
||||||
check(memcmp("a", "a", 1) == 0, 1); /* Identity. */
|
check(memcmp("a", "a", 1) == 0, 1); /* Identity. */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or modify
|
The GNU C Library is free software; you can redistribute it and/or modify
|
||||||
|
@ -36,7 +36,7 @@ enum
|
||||||
IPPROTO_IDP = 22, /* XNS IDP protocol. */
|
IPPROTO_IDP = 22, /* XNS IDP protocol. */
|
||||||
|
|
||||||
IPPROTO_RAW = 255, /* Raw IP packets. */
|
IPPROTO_RAW = 255, /* Raw IP packets. */
|
||||||
IPPROTO_MAX,
|
IPPROTO_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Standard well-known ports. */
|
/* Standard well-known ports. */
|
||||||
|
@ -76,7 +76,7 @@ enum
|
||||||
IPPORT_RESERVED = 1024,
|
IPPORT_RESERVED = 1024,
|
||||||
|
|
||||||
/* Ports greater this value are reserved for (non-privileged) servers. */
|
/* Ports greater this value are reserved for (non-privileged) servers. */
|
||||||
IPPORT_USERRESERVED = 5000,
|
IPPORT_USERRESERVED = 5000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
73
sysdeps/generic/strtok.c
Normal file
73
sysdeps/generic/strtok.c
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
/* Copyright (C) 1991, 1996 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
static char *olds = NULL;
|
||||||
|
|
||||||
|
/* Parse S into tokens separated by characters in DELIM.
|
||||||
|
If S is NULL, the last string strtok() was called with is
|
||||||
|
used. For example:
|
||||||
|
char s[] = "-abc-=-def";
|
||||||
|
x = strtok(s, "-"); // x = "abc"
|
||||||
|
x = strtok(NULL, "-="); // x = "def"
|
||||||
|
x = strtok(NULL, "="); // x = NULL
|
||||||
|
// s = "abc\0-def\0"
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
strtok (s, delim)
|
||||||
|
char *s;
|
||||||
|
const char *delim;
|
||||||
|
{
|
||||||
|
char *token;
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
if (olds == NULL)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s = olds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scan leading delimiters. */
|
||||||
|
s += strspn (s, delim);
|
||||||
|
if (*s == '\0')
|
||||||
|
{
|
||||||
|
olds = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the end of the token. */
|
||||||
|
token = s;
|
||||||
|
s = strpbrk (token, delim);
|
||||||
|
if (s == NULL)
|
||||||
|
/* This token finishes the string. */
|
||||||
|
olds = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Terminate the token and make OLDS point past it. */
|
||||||
|
*s = '\0';
|
||||||
|
olds = s + 1;
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
74
sysdeps/generic/strtok_r.c
Normal file
74
sysdeps/generic/strtok_r.c
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
/* Reentrant string tokenizer. Generic version.
|
||||||
|
Copyright (C) 1991, 1996 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Parse S into tokens separated by characters in DELIM.
|
||||||
|
If S is NULL, the saved pointer in SAVE_PTR is used as
|
||||||
|
the next starting point. For example:
|
||||||
|
char s[] = "-abc-=-def";
|
||||||
|
char *sp;
|
||||||
|
x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
|
||||||
|
x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
|
||||||
|
x = strtok_r(NULL, "=", &sp); // x = NULL
|
||||||
|
// s = "abc\0-def\0"
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
strtok_r (s, delim, save_ptr)
|
||||||
|
char *s;
|
||||||
|
const char *delim;
|
||||||
|
char **save_ptr;
|
||||||
|
{
|
||||||
|
char *token;
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
if (*save_ptr == NULL)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
s = *save_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scan leading delimiters. */
|
||||||
|
s += strspn (s, delim);
|
||||||
|
if (*s == '\0')
|
||||||
|
{
|
||||||
|
*save_ptr = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the end of the token. */
|
||||||
|
token = s;
|
||||||
|
s = strpbrk (token, delim);
|
||||||
|
if (s == NULL)
|
||||||
|
/* This token finishes the string. */
|
||||||
|
*save_ptr = NULL;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Terminate the token and make *SAVE_PTR point past it. */
|
||||||
|
*s = '\0';
|
||||||
|
*save_ptr = s + 1;
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/* strcat(dest, src) -- Append SRC on the end of DEST.
|
/* strcat(dest, src) -- Append SRC on the end of DEST.
|
||||||
For Intel 80x86, x>=4.
|
For Intel 80x86, x>=4.
|
||||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||||
Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
|
Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
|
||||||
Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
|
Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
@ -40,19 +40,19 @@ ENTRY (strcat)
|
||||||
jz L8 /* yes => return */
|
jz L8 /* yes => return */
|
||||||
|
|
||||||
/* Test the first bytes separately until destination is aligned. */
|
/* Test the first bytes separately until destination is aligned. */
|
||||||
testb $3, %edx /* destination pointer aligned? */
|
testl $3, %edx /* destination pointer aligned? */
|
||||||
jz L1 /* yes => begin scan loop */
|
jz L1 /* yes => begin scan loop */
|
||||||
testb $0xff, (%edx) /* is end of string? */
|
testb $0xff, (%edx) /* is end of string? */
|
||||||
jz L2 /* yes => start appending */
|
jz L2 /* yes => start appending */
|
||||||
incl %edx /* increment source pointer */
|
incl %edx /* increment source pointer */
|
||||||
|
|
||||||
testb $3, %edx /* destination pointer aligned? */
|
testl $3, %edx /* destination pointer aligned? */
|
||||||
jz L1 /* yes => begin scan loop */
|
jz L1 /* yes => begin scan loop */
|
||||||
testb $0xff, (%edx) /* is end of string? */
|
testb $0xff, (%edx) /* is end of string? */
|
||||||
jz L2 /* yes => start appending */
|
jz L2 /* yes => start appending */
|
||||||
incl %edx /* increment source pointer */
|
incl %edx /* increment source pointer */
|
||||||
|
|
||||||
testb $3, %edx /* destination pointer aligned? */
|
testl $3, %edx /* destination pointer aligned? */
|
||||||
jz L1 /* yes => begin scan loop */
|
jz L1 /* yes => begin scan loop */
|
||||||
testb $0xff, (%edx) /* is end of string? */
|
testb $0xff, (%edx) /* is end of string? */
|
||||||
jz L2 /* yes => start appending */
|
jz L2 /* yes => start appending */
|
||||||
|
@ -152,27 +152,27 @@ L3: testb %al, %al /* is first byte NUL? */
|
||||||
L2: subl %ecx, %edx /* reduce number of loop variants */
|
L2: subl %ecx, %edx /* reduce number of loop variants */
|
||||||
|
|
||||||
/* Now we have to align the source pointer. */
|
/* Now we have to align the source pointer. */
|
||||||
testb $3, %ecx /* pointer correctly aligned? */
|
testl $3, %ecx /* pointer correctly aligned? */
|
||||||
jz L29 /* yes => start copy loop */
|
jz L29 /* yes => start copy loop */
|
||||||
movb (%ecx), %al /* get first byte */
|
movb (%ecx), %al /* get first byte */
|
||||||
movb %al, (%ecx,%edx) /* and store it */
|
movb %al, (%ecx,%edx) /* and store it */
|
||||||
andl %al, %al /* is byte NUL? */
|
andb %al, %al /* is byte NUL? */
|
||||||
jz L8 /* yes => return */
|
jz L8 /* yes => return */
|
||||||
incl %ecx /* increment pointer */
|
incl %ecx /* increment pointer */
|
||||||
|
|
||||||
testb $3, %ecx /* pointer correctly aligned? */
|
testl $3, %ecx /* pointer correctly aligned? */
|
||||||
jz L29 /* yes => start copy loop */
|
jz L29 /* yes => start copy loop */
|
||||||
movb (%ecx), %al /* get first byte */
|
movb (%ecx), %al /* get first byte */
|
||||||
movb %al, (%ecx,%edx) /* and store it */
|
movb %al, (%ecx,%edx) /* and store it */
|
||||||
andl %al, %al /* is byte NUL? */
|
andb %al, %al /* is byte NUL? */
|
||||||
jz L8 /* yes => return */
|
jz L8 /* yes => return */
|
||||||
incl %ecx /* increment pointer */
|
incl %ecx /* increment pointer */
|
||||||
|
|
||||||
testb $3, %ecx /* pointer correctly aligned? */
|
testl $3, %ecx /* pointer correctly aligned? */
|
||||||
jz L29 /* yes => start copy loop */
|
jz L29 /* yes => start copy loop */
|
||||||
movb (%ecx), %al /* get first byte */
|
movb (%ecx), %al /* get first byte */
|
||||||
movb %al, (%ecx,%edx) /* and store it */
|
movb %al, (%ecx,%edx) /* and store it */
|
||||||
andl %al, %al /* is byte NUL? */
|
andb %al, %al /* is byte NUL? */
|
||||||
jz L8 /* yes => return */
|
jz L8 /* yes => return */
|
||||||
incl %ecx /* increment pointer */
|
incl %ecx /* increment pointer */
|
||||||
|
|
||||||
|
|
3
sysdeps/i386/strsep.S
Normal file
3
sysdeps/i386/strsep.S
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#define FUNCTION strsep
|
||||||
|
#define USE_AS_STRSEP 1
|
||||||
|
#include <sysdeps/i386/strtok.S>
|
329
sysdeps/i386/strtok.S
Normal file
329
sysdeps/i386/strtok.S
Normal file
|
@ -0,0 +1,329 @@
|
||||||
|
/* strtok (str, delim) -- Return next DELIM separated token from STR.
|
||||||
|
For Intel 80x86, x>=3.
|
||||||
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <errnos.h>
|
||||||
|
#include <sysdep.h>
|
||||||
|
|
||||||
|
/* This file can be used for three variants of the strtok function:
|
||||||
|
|
||||||
|
strtok:
|
||||||
|
INPUT PARAMETER:
|
||||||
|
str (sp + 4)
|
||||||
|
delim (sp + 8)
|
||||||
|
|
||||||
|
strtok_r:
|
||||||
|
INPUT PARAMETER:
|
||||||
|
str (sp + 4)
|
||||||
|
delim (sp + 8)
|
||||||
|
save_ptr (sp + 12)
|
||||||
|
|
||||||
|
strsep:
|
||||||
|
INPUT PARAMETERS
|
||||||
|
str_ptr (sp + 4)
|
||||||
|
delim (sp + 8)
|
||||||
|
|
||||||
|
We do a common implementation here. */
|
||||||
|
|
||||||
|
#if !defined (USE_AS_STRTOK_R) && !defined (USE_AS_STRSEP)
|
||||||
|
.bss
|
||||||
|
.local save_ptr
|
||||||
|
ASM_TYPE_DIRECTIVE (save_ptr, @object)
|
||||||
|
.size save_ptr, 4
|
||||||
|
save_ptr:
|
||||||
|
.space 4
|
||||||
|
|
||||||
|
#define FUNCTION strtok
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We use the possibility to do some more initialization
|
||||||
|
for the strtok implementation. */
|
||||||
|
.text
|
||||||
|
Lillegal_argument:
|
||||||
|
#ifndef PIC
|
||||||
|
movl $EINVAL, C_SYMBOL_NAME(errno)
|
||||||
|
xorl %eax, %eax
|
||||||
|
#else
|
||||||
|
# if defined (USE_AS_STRTOK_R) || defined (USE_AS_STRSEP)
|
||||||
|
pushl %ebx /* Save PIC register. */
|
||||||
|
call Lhere2
|
||||||
|
Lhere2: popl %ebx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere2], %ebx
|
||||||
|
# endif
|
||||||
|
movl errno@GOT(%ebx), %ebx
|
||||||
|
movl $EINVAL, (%ebx)
|
||||||
|
xorl %eax, %eax
|
||||||
|
popl %ebx
|
||||||
|
#endif
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
ENTRY (FUNCTION)
|
||||||
|
|
||||||
|
movl 4(%esp), %edx /* Get start of string. */
|
||||||
|
movl 8(%esp), %eax /* Get start of delimiter set. */
|
||||||
|
|
||||||
|
#ifdef USE_AS_STRSEP
|
||||||
|
/* %EDX does not yet contain the string starting point. Only
|
||||||
|
a pointer to the location where it is stored. */
|
||||||
|
movl (%edx), %edx
|
||||||
|
#else
|
||||||
|
# if !defined (USE_AS_STRTOK_R) && defined (PIC)
|
||||||
|
pushl %ebx /* Save PIC register. */
|
||||||
|
call Lhere
|
||||||
|
Lhere: popl %ebx
|
||||||
|
addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere], %ebx
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* If the pointer is NULL we have to use the stored value of
|
||||||
|
the last run. */
|
||||||
|
cmpl $0, %edx
|
||||||
|
jne L0
|
||||||
|
|
||||||
|
# ifdef USE_AS_STRTOK_R
|
||||||
|
/* The value is stored in the third argument. */
|
||||||
|
movl 12(%esp), %edx
|
||||||
|
movl (%edx), %edx
|
||||||
|
# else
|
||||||
|
/* The value is in the local variable defined above. But
|
||||||
|
we have to take care for PIC code. */
|
||||||
|
# ifndef PIC
|
||||||
|
movl save_ptr, %edx
|
||||||
|
# else
|
||||||
|
movl save_ptr@GOTOFF(%ebx), %edx
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Compare whether pointer is NULL. We are tolerant here
|
||||||
|
because the C function do the same. */
|
||||||
|
cmpl $0, %edx
|
||||||
|
je Lillegal_argument
|
||||||
|
|
||||||
|
#ifndef USE_AS_STRSEP
|
||||||
|
L0:
|
||||||
|
#endif
|
||||||
|
/* First we create a table with flags for all possible characters.
|
||||||
|
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
|
||||||
|
supported by the C string functions we have 256 characters.
|
||||||
|
Before inserting marks for the stop characters we clear the whole
|
||||||
|
table. The unrolled form is much faster than a loop. */
|
||||||
|
xorl %ecx, %ecx /* %ecx = 0 !!! */
|
||||||
|
|
||||||
|
pushl %ecx /* make a 256 bytes long block filled with 0 */
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl %ecx
|
||||||
|
pushl $0 /* These immediate values make the label 2 */
|
||||||
|
pushl $0 /* to be aligned on a 16 byte boundary to */
|
||||||
|
pushl $0 /* get a better performance of the loop. */
|
||||||
|
pushl $0
|
||||||
|
pushl $0
|
||||||
|
pushl $0
|
||||||
|
|
||||||
|
/* For understanding the following code remember that %ecx == 0 now.
|
||||||
|
Although all the following instruction only modify %cl we always
|
||||||
|
have a correct zero-extended 32-bit value in %ecx. */
|
||||||
|
|
||||||
|
L2: movb (%eax), %cl /* get byte from stopset */
|
||||||
|
testb %cl, %cl /* is NUL char? */
|
||||||
|
jz L1 /* yes => start compare loop */
|
||||||
|
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
|
||||||
|
|
||||||
|
movb 1(%eax), %cl /* get byte from stopset */
|
||||||
|
testb $0xff, %cl /* is NUL char? */
|
||||||
|
jz L1 /* yes => start compare loop */
|
||||||
|
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
|
||||||
|
|
||||||
|
movb 2(%eax), %cl /* get byte from stopset */
|
||||||
|
testb $0xff, %cl /* is NUL char? */
|
||||||
|
jz L1 /* yes => start compare loop */
|
||||||
|
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
|
||||||
|
|
||||||
|
movb 3(%eax), %cl /* get byte from stopset */
|
||||||
|
addl $4, %eax /* increment stopset pointer */
|
||||||
|
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
|
||||||
|
testb $0xff, %cl /* is NUL char? */
|
||||||
|
jnz L2 /* no => process next dword from stopset */
|
||||||
|
|
||||||
|
L1: leal -4(%edx), %eax /* prepare loop */
|
||||||
|
|
||||||
|
/* We use a neat trick for the following loop. Normally we would
|
||||||
|
have to test for two termination conditions
|
||||||
|
1. a character in the stopset was found
|
||||||
|
and
|
||||||
|
2. the end of the string was found
|
||||||
|
But as a sign that the chracter is in the stopset we store its
|
||||||
|
value in the table. But the value of NUL is NUL so the loop
|
||||||
|
terminates for NUL in every case. */
|
||||||
|
|
||||||
|
L3: addl $4, %eax /* adjust pointer for full loop round */
|
||||||
|
|
||||||
|
movb (%eax), %cl /* get byte from string */
|
||||||
|
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
|
||||||
|
jz L4 /* no => start of token */
|
||||||
|
|
||||||
|
movb 1(%eax), %cl /* get byte from string */
|
||||||
|
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
|
||||||
|
jz L5 /* no => start of token */
|
||||||
|
|
||||||
|
movb 2(%eax), %cl /* get byte from string */
|
||||||
|
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
|
||||||
|
jz L6 /* no => start of token */
|
||||||
|
|
||||||
|
movb 3(%eax), %cl /* get byte from string */
|
||||||
|
testb %cl, (%esp,%ecx) /* is it contained in stopset? */
|
||||||
|
jnz L3 /* yes => start of loop */
|
||||||
|
|
||||||
|
incl %eax /* adjust pointer */
|
||||||
|
L6: incl %eax
|
||||||
|
L5: incl %eax
|
||||||
|
|
||||||
|
/* Now we have to terminate the string. */
|
||||||
|
|
||||||
|
L4: leal -4(%eax), %edx /* We use %EDX for the next run. */
|
||||||
|
|
||||||
|
L7: addl $4, %edx /* adjust pointer for full loop round */
|
||||||
|
|
||||||
|
movb (%edx), %cl /* get byte from string */
|
||||||
|
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
|
||||||
|
je L8 /* yes => return */
|
||||||
|
|
||||||
|
movb 1(%edx), %cl /* get byte from string */
|
||||||
|
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
|
||||||
|
je L9 /* yes => return */
|
||||||
|
|
||||||
|
movb 2(%edx), %cl /* get byte from string */
|
||||||
|
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
|
||||||
|
je L10 /* yes => return */
|
||||||
|
|
||||||
|
movb 3(%edx), %cl /* get byte from string */
|
||||||
|
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
|
||||||
|
jne L7 /* no => start loop again */
|
||||||
|
|
||||||
|
incl %edx /* adjust pointer */
|
||||||
|
L10: incl %edx
|
||||||
|
L9: incl %edx
|
||||||
|
|
||||||
|
L8: /* Remove the stopset table. */
|
||||||
|
addl $256, %esp
|
||||||
|
|
||||||
|
cmpl %eax, %edx
|
||||||
|
je LreturnNULL /* There was no token anymore. */
|
||||||
|
|
||||||
|
movb $0, (%edx) /* Terminate string. */
|
||||||
|
|
||||||
|
/* Are we at end of string? */
|
||||||
|
cmpb $0, %cl
|
||||||
|
je L11
|
||||||
|
|
||||||
|
incl %edx
|
||||||
|
L11:
|
||||||
|
|
||||||
|
/* Store the pointer to the next character. */
|
||||||
|
#ifdef USE_AS_STRTOK_R
|
||||||
|
movl 12(%esp), %ecx
|
||||||
|
movl %edx, (%ecx)
|
||||||
|
#elif USE_AS_STRSEP
|
||||||
|
movl 4(%esp), %ecx
|
||||||
|
movl %edx, (%ecx)
|
||||||
|
#else
|
||||||
|
# ifndef PIC
|
||||||
|
movl %edx, save_ptr
|
||||||
|
# else
|
||||||
|
movl %edx, save_ptr@GOTOFF(%ebx)
|
||||||
|
popl %ebx
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
ret
|
||||||
|
|
||||||
|
LreturnNULL:
|
||||||
|
xorl %eax, %eax
|
||||||
|
|
||||||
|
/* Store NULL as pointer to the next character. */
|
||||||
|
#ifdef USE_AS_STRTOK_R
|
||||||
|
movl 12(%esp), %ecx
|
||||||
|
movl %eax, (%ecx)
|
||||||
|
#elif USE_AS_STRSEP
|
||||||
|
movl 4(%esp), %ecx
|
||||||
|
movl %eax, (%ecx)
|
||||||
|
#else
|
||||||
|
# ifndef PIC
|
||||||
|
movl %eax, save_ptr
|
||||||
|
# else
|
||||||
|
movl %eax, save_ptr@GOTOFF(%ebx)
|
||||||
|
popl %ebx
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
ret
|
3
sysdeps/i386/strtok_r.S
Normal file
3
sysdeps/i386/strtok_r.S
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#define FUNCTION strtok_r
|
||||||
|
#define USE_AS_STRTOK_R 1
|
||||||
|
#include <sysdeps/i386/strtok.S>
|
|
@ -22,7 +22,7 @@ struct dirent
|
||||||
unsigned int d_fileno; /* 32 bits. */
|
unsigned int d_fileno; /* 32 bits. */
|
||||||
unsigned short int d_reclen; /* 16 bits. */
|
unsigned short int d_reclen; /* 16 bits. */
|
||||||
unsigned short int d_namlen; /* 16 bits. */
|
unsigned short int d_namlen; /* 16 bits. */
|
||||||
char d_name[0]; /* Variable length. */
|
char d_name[1]; /* Variable length. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _DIRENT_HAVE_D_RECLEN 1
|
#define _DIRENT_HAVE_D_RECLEN 1
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct dirent
|
||||||
unsigned int d_fileno;
|
unsigned int d_fileno;
|
||||||
int d_off; /* Position in directory of following entry. */
|
int d_off; /* Position in directory of following entry. */
|
||||||
unsigned short int d_reclen;
|
unsigned short int d_reclen;
|
||||||
char d_name[0]; /* Variable length. */
|
char d_name[1]; /* Variable length. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _DIRENT_HAVE_D_RECLEN 1
|
#define _DIRENT_HAVE_D_RECLEN 1
|
||||||
|
|
|
@ -19,8 +19,10 @@ Cambridge, MA 02139, USA. */
|
||||||
#ifndef _GNU_TYPES_H
|
#ifndef _GNU_TYPES_H
|
||||||
#define _GNU_TYPES_H 1
|
#define _GNU_TYPES_H 1
|
||||||
|
|
||||||
/* Get actual type definitions for architecture from kernel headers. */
|
/* Get actual type definitions for architecture from kernel headers.
|
||||||
#include <linux/posix_types.h>
|
This #define tells <linux/types.h> not to define `dev_t' et al itself. */
|
||||||
|
#define _LINUX_TYPES_DONT_EXPORT
|
||||||
|
#include <linux/types.h>
|
||||||
|
|
||||||
/* Convenience types. */
|
/* Convenience types. */
|
||||||
typedef unsigned char __u_char;
|
typedef unsigned char __u_char;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or modify
|
The GNU C Library is free software; you can redistribute it and/or modify
|
||||||
|
@ -36,7 +36,7 @@ enum
|
||||||
IPPROTO_IDP = 22, /* XNS IDP protocol. */
|
IPPROTO_IDP = 22, /* XNS IDP protocol. */
|
||||||
|
|
||||||
IPPROTO_RAW = 255, /* Raw IP packets. */
|
IPPROTO_RAW = 255, /* Raw IP packets. */
|
||||||
IPPROTO_MAX,
|
IPPROTO_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Standard well-known ports. */
|
/* Standard well-known ports. */
|
||||||
|
@ -76,7 +76,7 @@ enum
|
||||||
IPPORT_RESERVED = 1024,
|
IPPORT_RESERVED = 1024,
|
||||||
|
|
||||||
/* Ports greater this value are reserved for (non-privileged) servers. */
|
/* Ports greater this value are reserved for (non-privileged) servers. */
|
||||||
IPPORT_USERRESERVED = 5000,
|
IPPORT_USERRESERVED = 5000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,9 @@ installed-posixrules-file := $(firstword $(filter /%,$(posixrules-file)) \
|
||||||
|
|
||||||
ifeq ($(cross-compiling),no)
|
ifeq ($(cross-compiling),no)
|
||||||
# Don't try to install the zoneinfo files since we can't run zic.
|
# Don't try to install the zoneinfo files since we can't run zic.
|
||||||
install-others = $(addprefix $(zonedir)/,$(zonenames)) \
|
install-others = $(addprefix $(zonedir)/,$(zonenames) \
|
||||||
|
$(zonenames:%=posix/%) \
|
||||||
|
$(zonenames:%=right/%)) \
|
||||||
$(installed-localtime-file) $(installed-posixrules-file)
|
$(installed-localtime-file) $(installed-posixrules-file)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -81,8 +83,14 @@ $(tzfiles:%=$(objpfx)z.%): $(objpfx)z.%: % Makefile
|
||||||
echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
|
echo '$*-zones := $$(subst $$(nl), ,$$($*-zones))' ;\
|
||||||
echo 'ifdef $*-zones' ;\
|
echo 'ifdef $*-zones' ;\
|
||||||
echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
|
echo '$$(addprefix $$(datadir)/zone%/,$$($*-zones)): \' ;\
|
||||||
|
echo '$< $$(objpfx)zic $$(leapseconds) yearistype' ;\
|
||||||
|
echo ' $$(tzcompile)' ;\
|
||||||
|
echo '$$(addprefix $$(datadir)/zone%/right/,$$($*-zones)): \' ;\
|
||||||
echo '$< $$(objpfx)zic leapseconds yearistype' ;\
|
echo '$< $$(objpfx)zic leapseconds yearistype' ;\
|
||||||
echo ' $$(tzcompile)' ;\
|
echo ' $$(tzcompile)' ;\
|
||||||
|
echo '$$(addprefix $$(datadir)/zone%/posix/,$$($*-zones)): \' ;\
|
||||||
|
echo '$< $$(objpfx)zic /dev/null yearistype' ;\
|
||||||
|
echo ' $$(tzcompile)' ;\
|
||||||
echo 'endif' ;\
|
echo 'endif' ;\
|
||||||
echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
|
echo 'zonenames := $$(zonenames) $$($*-zones)' ;\
|
||||||
) > $@.new
|
) > $@.new
|
||||||
|
@ -98,9 +106,18 @@ echo-zonenames: zonenames
|
||||||
# the command line of `make install' (e.g., "make install prefix=/foo").
|
# the command line of `make install' (e.g., "make install prefix=/foo").
|
||||||
zic-cmd = $(built-program-cmd) -d $(zonedir)
|
zic-cmd = $(built-program-cmd) -d $(zonedir)
|
||||||
define tzcompile
|
define tzcompile
|
||||||
$(zic-cmd) -L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
|
$(zic-cmd)$(target-zone-flavor)
|
||||||
|
-L $(word 3,$^) -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# The source files specify the zone names relative to the -d directory,
|
||||||
|
# so for the posix/ and right/ flavors we need to pass -d $(zonedir)/posix
|
||||||
|
# and the like. This magic extracts /posix or /right if it's the first
|
||||||
|
# component after $(zonedir) in the target name $@.
|
||||||
|
target-zone-flavor = $(filter /posix /right, \
|
||||||
|
/$(firstword $(subst /, , \
|
||||||
|
$(patsubst $(zonedir)/%,%,$@))))
|
||||||
|
|
||||||
ifdef localtime
|
ifdef localtime
|
||||||
$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
|
$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
|
||||||
$(zic-cmd) -l $(localtime)
|
$(zic-cmd) -l $(localtime)
|
||||||
|
|
15
time/tzset.c
15
time/tzset.c
|
@ -90,18 +90,23 @@ DEFUN_VOID(__tzset)
|
||||||
tz_rules[1].name != tz_rules[0].name)
|
tz_rules[1].name != tz_rules[0].name)
|
||||||
free((PTR) tz_rules[1].name);
|
free((PTR) tz_rules[1].name);
|
||||||
|
|
||||||
tz = getenv("TZ");
|
/* Examine the TZ environment variable. */
|
||||||
|
tz = getenv ("TZ");
|
||||||
|
|
||||||
if (tz != NULL && *tz == ':')
|
if (tz != NULL)
|
||||||
{
|
{
|
||||||
__tzfile_read(tz + 1);
|
/* A leading colon means "implementation defined syntax".
|
||||||
|
We ignore the colon and always use the same algorithm:
|
||||||
|
try a data file, and if none exists parse the 1003.1 syntax. */
|
||||||
|
if (*tz == ':')
|
||||||
|
++tz;
|
||||||
|
|
||||||
|
__tzfile_read (tz);
|
||||||
if (__use_tzfile)
|
if (__use_tzfile)
|
||||||
{
|
{
|
||||||
__tzset_run = 1;
|
__tzset_run = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
tz = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tz == NULL || *tz == '\0')
|
if (tz == NULL || *tz == '\0')
|
||||||
|
|
|
@ -27,44 +27,31 @@ Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
/* Get size_t, wchar_t, uwchar_t and NULL from <stddef.h>. */
|
/* Get size_t, wchar_t, wint_t and NULL from <stddef.h>. */
|
||||||
#define __need_size_t
|
#define __need_size_t
|
||||||
#define __need_wchar_t
|
#define __need_wchar_t
|
||||||
/* #define __need_uwchar_t */
|
#define __need_wint_t
|
||||||
#define __need_NULL
|
#define __need_NULL
|
||||||
/* __need_WCHAR_MAX */
|
|
||||||
/* __need_WCHAR_MIN */
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
/* FIXME: Should go with this or another name in stddef.h. */
|
|
||||||
typedef unsigned int uwchar_t;
|
|
||||||
|
|
||||||
/* Conversion state information. */
|
/* Conversion state information. */
|
||||||
typedef int mbstate_t; /* FIXME */
|
typedef int mbstate_t; /* FIXME */
|
||||||
|
|
||||||
/* Should come from <stddef.h> */
|
#define WCHAR_MIN ((wchar_t) 0)
|
||||||
#define WCHAR_MIN ((wchar_t) 0) /* FIXME */
|
#define WCHAR_MAX (~WCHAR_MIN)
|
||||||
#define WCHAR_MAX (~WCHAR_MIN) /* FIXME */
|
|
||||||
|
|
||||||
#ifndef WEOF
|
#ifndef WEOF
|
||||||
# define WEOF (0xffffffffu)
|
# define WEOF (0xffffffffu)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME: should this go into <stddef.h>??? */
|
#ifndef _WINT_T
|
||||||
#if 0
|
|
||||||
#define __need_wint_t
|
|
||||||
#include <stddef.h>
|
|
||||||
#else
|
|
||||||
/* Integral type unchanged by default argument promotions that can
|
/* Integral type unchanged by default argument promotions that can
|
||||||
hold any value corresponding to members of the extended character
|
hold any value corresponding to members of the extended character
|
||||||
set, as well as at least one value that does not correspond to any
|
set, as well as at least one value that does not correspond to any
|
||||||
member of the extended character set. */
|
member of the extended character set. */
|
||||||
#ifndef __have_wint_t_defined
|
#define _WINT_T 1
|
||||||
#define __have_wint_t_defined 1
|
|
||||||
/* This is a hack!!! */
|
|
||||||
typedef unsigned int wint_t;
|
typedef unsigned int wint_t;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Copy SRC to DEST. */
|
/* Copy SRC to DEST. */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
@ -13,9 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
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
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
@ -28,12 +28,12 @@ wcscmp (s1, s2)
|
||||||
const wchar_t *s1;
|
const wchar_t *s1;
|
||||||
const wchar_t *s2;
|
const wchar_t *s2;
|
||||||
{
|
{
|
||||||
uwchar_t c1, c2;
|
wint_t c1, c2;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0')
|
if (c1 == L'\0')
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ Boston, MA 02111-1307, USA. */
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#define STRING_TYPE wchar_t
|
#define STRING_TYPE wchar_t
|
||||||
#define USTRING_TYPE uwchar_t
|
#define USTRING_TYPE wint_t
|
||||||
#define STRCOLL wcscoll
|
#define STRCOLL wcscoll
|
||||||
#define STRCMP wcscmp
|
#define STRCMP wcscmp
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
@ -13,9 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
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
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
@ -30,28 +30,28 @@ wcsncmp (s1, s2, n)
|
||||||
const wchar_t *s2;
|
const wchar_t *s2;
|
||||||
size_t n;
|
size_t n;
|
||||||
{
|
{
|
||||||
uwchar_t c1 = L'\0';
|
wint_t c1 = L'\0';
|
||||||
uwchar_t c2 = L'\0';
|
wint_t c2 = L'\0';
|
||||||
|
|
||||||
if (n >= 4)
|
if (n >= 4)
|
||||||
{
|
{
|
||||||
size_t n4 = n >> 2;
|
size_t n4 = n >> 2;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0' || c1 != c2)
|
if (c1 == L'\0' || c1 != c2)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0' || c1 != c2)
|
if (c1 == L'\0' || c1 != c2)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0' || c1 != c2)
|
if (c1 == L'\0' || c1 != c2)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0' || c1 != c2)
|
if (c1 == L'\0' || c1 != c2)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
} while (--n4 > 0);
|
} while (--n4 > 0);
|
||||||
|
@ -60,8 +60,8 @@ wcsncmp (s1, s2, n)
|
||||||
|
|
||||||
while (n > 0)
|
while (n > 0)
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) *s1++;
|
c1 = (wint_t) *s1++;
|
||||||
c2 = (uwchar_t) *s2++;
|
c2 = (wint_t) *s2++;
|
||||||
if (c1 == L'\0' || c1 != c2)
|
if (c1 == L'\0' || c1 != c2)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
n--;
|
n--;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
@ -13,9 +13,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Library General Public License for more details.
|
Library General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Library General Public
|
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
|
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Cambridge, MA 02139, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -25,20 +25,26 @@ Cambridge, MA 02139, USA. */
|
||||||
NULL, the last string wcstok() was called with is used. */
|
NULL, the last string wcstok() was called with is used. */
|
||||||
wchar_t *
|
wchar_t *
|
||||||
wcstok (wcs, delim, ptr)
|
wcstok (wcs, delim, ptr)
|
||||||
register wchar_t *wcs;
|
wchar_t *wcs;
|
||||||
register const wchar_t *delim;
|
const wchar_t *delim;
|
||||||
register wchar_t **ptr;
|
wchar_t **save_ptr;
|
||||||
{
|
{
|
||||||
wchar_t *result;
|
wchar_t *result;
|
||||||
|
|
||||||
if (wcs == NULL)
|
if (wcs == NULL)
|
||||||
wcs = *ptr;
|
if (*save_ptr == NULL)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wcs = *save_ptr;
|
||||||
|
|
||||||
/* Scan leading delimiters. */
|
/* Scan leading delimiters. */
|
||||||
wcs += wcsspn (wcs, delim);
|
wcs += wcsspn (wcs, delim);
|
||||||
if (*wcs == L'\0')
|
if (*wcs == L'\0')
|
||||||
{
|
{
|
||||||
*ptr = NULL;
|
*save_ptr = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,12 +53,12 @@ wcstok (wcs, delim, ptr)
|
||||||
wcs = wcspbrk (result, delim);
|
wcs = wcspbrk (result, delim);
|
||||||
if (wcs == NULL)
|
if (wcs == NULL)
|
||||||
/* This token finishes the string. */
|
/* This token finishes the string. */
|
||||||
*ptr = NULL;
|
*save_ptr = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Terminate the token and make OLDS point past it. */
|
/* Terminate the token and make *SAVE_PTR point past it. */
|
||||||
*wcs = L'\0';
|
*wcs = L'\0';
|
||||||
*ptr = wcs + 1;
|
*save_ptr = wcs + 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,10 @@ Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#define WIDE_VERSION 1
|
||||||
#define STRING_TYPE wchar_t
|
#define STRING_TYPE wchar_t
|
||||||
#define USTRING_TYPE uwchar_t
|
#define USTRING_TYPE wint_t
|
||||||
|
#define L_(Ch) L##Ch
|
||||||
#define STRXFRM wcsxfrm
|
#define STRXFRM wcsxfrm
|
||||||
#define STRLEN wcslen
|
#define STRLEN wcslen
|
||||||
#define STPNCPY __wcpncpy
|
#define STPNCPY __wcpncpy
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
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
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
@ -26,25 +26,25 @@ wmemcmp (s1, s2, n)
|
||||||
const wchar_t *s2;
|
const wchar_t *s2;
|
||||||
size_t n;
|
size_t n;
|
||||||
{
|
{
|
||||||
register uwchar_t c1;
|
register wint_t c1;
|
||||||
register uwchar_t c2;
|
register wint_t c2;
|
||||||
|
|
||||||
while (n >= 4)
|
while (n >= 4)
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) s1[0];
|
c1 = (wint_t) s1[0];
|
||||||
c2 = (uwchar_t) s2[0];
|
c2 = (wint_t) s2[0];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) s1[1];
|
c1 = (wint_t) s1[1];
|
||||||
c2 = (uwchar_t) s2[1];
|
c2 = (wint_t) s2[1];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) s1[2];
|
c1 = (wint_t) s1[2];
|
||||||
c2 = (uwchar_t) s2[2];
|
c2 = (wint_t) s2[2];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
c1 = (uwchar_t) s1[3];
|
c1 = (wint_t) s1[3];
|
||||||
c2 = (uwchar_t) s2[3];
|
c2 = (wint_t) s2[3];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
s1 += 4;
|
s1 += 4;
|
||||||
|
@ -54,8 +54,8 @@ wmemcmp (s1, s2, n)
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) s1[0];
|
c1 = (wint_t) s1[0];
|
||||||
c2 = (uwchar_t) s2[0];
|
c2 = (wint_t) s2[0];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
++s1;
|
++s1;
|
||||||
|
@ -64,8 +64,8 @@ wmemcmp (s1, s2, n)
|
||||||
}
|
}
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) s1[0];
|
c1 = (wint_t) s1[0];
|
||||||
c2 = (uwchar_t) s2[0];
|
c2 = (wint_t) s2[0];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
++s1;
|
++s1;
|
||||||
|
@ -74,8 +74,8 @@ wmemcmp (s1, s2, n)
|
||||||
}
|
}
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
c1 = (uwchar_t) s1[0];
|
c1 = (wint_t) s1[0];
|
||||||
c2 = (uwchar_t) s2[0];
|
c2 = (wint_t) s2[0];
|
||||||
if (c1 - c2 != 0)
|
if (c1 - c2 != 0)
|
||||||
return c1 - c2;
|
return c1 - c2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue