1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
1998-03-08 14:58  Ulrich Drepper  <drepper@cygnus.com>

	* Makeconfig (nisobjdir): Set to path to nis directory.
	(rpath-link): Add nisobjdir.
	Patch by Sven Verdoolaege <skimo@kotnet.org>.

	* elf/Makefile: Pretty print.
	* elf/dl-lookup.c: Include unistd.h.
	* elf/dl-runtime.c: Likewise.

	* localedata/Makefile (test-srcs): Add tst-rpmatch.
	(distribute): Add tst-rpmatch.sh.
	(tests): Add tst-rpmatch to dependency list and run tst-rpmatch.sh.

	New tests for rpmatch function by
	Jochen Hein <jochen.hein@delphi.central.de>.
	* localedata/tst-rpmatch.c: New file.
	* localedata/tst-rpmatch.sh: New file.

	* localedata/locales/de_DE: Correct yesexpr and noexpr.
	* localedata/locales/de_AT: Likewise.

	* posix/getopt.c: Update contact address.
	* posix/getopt1.c: Pretty print.

	* sysdeps/generic/libc-start.c: Do most of the initialization now
	here instead of in start.S.
	* sysdeps/unix/sysv/linux/libc-start.c: Likewise.
	* sysdeps/i386/elf/start.S: Remove most of the initialization code.

	* sysdeps/unix/sysv/linux/i386/profil-counter.h: No need for
	profil_counter to be public.

1998-03-08 13:06  Tim Waugh  <tim@cyberelk.demon.co.uk>

	* posix/wordexp.c (parse_arith): Now works for negative numbers too.
	(parse_param): Coded parameter length expansion (${#var}).
	(parse_param): Handling for "=", "+", "-", and the ":" versions added.
	(parse_param): Cleaned up (fixed) error handling.

	* posix/wordexp-test.c: IFS now includes non-whitespace character
	(comma).  Added more tests.
This commit is contained in:
Ulrich Drepper
1998-03-08 15:26:29 +00:00
parent a78de796b7
commit 3db52d94e2
20 changed files with 523 additions and 165 deletions

View File

@ -1,3 +1,46 @@
1998-03-08 14:58 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (nisobjdir): Set to path to nis directory.
(rpath-link): Add nisobjdir.
Patch by Sven Verdoolaege <skimo@kotnet.org>.
* elf/Makefile: Pretty print.
* elf/dl-lookup.c: Include unistd.h.
* elf/dl-runtime.c: Likewise.
* localedata/Makefile (test-srcs): Add tst-rpmatch.
(distribute): Add tst-rpmatch.sh.
(tests): Add tst-rpmatch to dependency list and run tst-rpmatch.sh.
New tests for rpmatch function by
Jochen Hein <jochen.hein@delphi.central.de>.
* localedata/tst-rpmatch.c: New file.
* localedata/tst-rpmatch.sh: New file.
* localedata/locales/de_DE: Correct yesexpr and noexpr.
* localedata/locales/de_AT: Likewise.
* posix/getopt.c: Update contact address.
* posix/getopt1.c: Pretty print.
* sysdeps/generic/libc-start.c: Do most of the initialization now
here instead of in start.S.
* sysdeps/unix/sysv/linux/libc-start.c: Likewise.
* sysdeps/i386/elf/start.S: Remove most of the initialization code.
* sysdeps/unix/sysv/linux/i386/profil-counter.h: No need for
profil_counter to be public.
1998-03-08 13:06 Tim Waugh <tim@cyberelk.demon.co.uk>
* posix/wordexp.c (parse_arith): Now works for negative numbers too.
(parse_param): Coded parameter length expansion (${#var}).
(parse_param): Handling for "=", "+", "-", and the ":" versions added.
(parse_param): Cleaned up (fixed) error handling.
* posix/wordexp-test.c: IFS now includes non-whitespace character
(comma). Added more tests.
1998-03-07 Ulrich Drepper <drepper@cygnus.com> 1998-03-07 Ulrich Drepper <drepper@cygnus.com>
* elf/link.h: Fix typos. * elf/link.h: Fix typos.

View File

@ -414,10 +414,11 @@ else
default-rpath = $(libdir) default-rpath = $(libdir)
endif endif
# This is how to find at build-time things that will be installed there. # This is how to find at build-time things that will be installed there.
rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(dbobjdir) rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir)
mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math) mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
nisobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nis)
dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2) dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
else else
link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a

View File

@ -1,5 +1,3 @@
# Makefile for elf subdirectory of GNU C Library.
# Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
@ -18,6 +16,8 @@
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
# Makefile for elf subdirectory of GNU C Library.
subdir := elf subdir := elf
headers = elf.h bits/elfclass.h bits/dlfcn.h link.h dlfcn.h headers = elf.h bits/elfclass.h bits/dlfcn.h link.h dlfcn.h

View File

@ -18,10 +18,10 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <alloca.h> #include <alloca.h>
#include <stddef.h>
#include <link.h> #include <link.h>
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "dl-hash.h" #include "dl-hash.h"
#include <dl-machine.h> #include <dl-machine.h>

View File

@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <link.h> #include <link.h>
#include <stddef.h> #include <unistd.h>
/* The global scope we will use for symbol lookups. /* The global scope we will use for symbol lookups.

View File

@ -1,3 +1,8 @@
1998-03-08 Ulrich Drepper <drepper@cygnus.com>
* locales/ru_RU: Correct inconsistencies in mon data.
Patch by Alexander V. Lukyanov <lav@alpha.netis.ru>.
1997-10-09 04:56 Ulrich Drepper <drepper@cygnus.com> 1997-10-09 04:56 Ulrich Drepper <drepper@cygnus.com>
* locales/is_IS: Update from Debian version. * locales/is_IS: Update from Debian version.

View File

@ -30,7 +30,7 @@ charmaps := $(filter-out $(addprefix charmaps/, CVS RCS %~), \
locales := $(filter-out $(addprefix locales/, CVS RCS %~), \ locales := $(filter-out $(addprefix locales/, CVS RCS %~), \
$(wildcard locales/*)) $(wildcard locales/*))
test-srcs := collate-test xfrm-test tst-fmon test-srcs := collate-test xfrm-test tst-fmon tst-rpmatch
test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1 test-input := de_DE.ISO-8859-1 da_DK.ISO-8859-1 fr_CA,2.13.ISO-8859-1
test-output := $(foreach s, .out .xout, \ test-output := $(foreach s, .out .xout, \
$(addsuffix $s, $(basename $(test-input)))) $(addsuffix $s, $(basename $(test-input))))
@ -43,7 +43,7 @@ ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \ distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \
README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \ README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \
$(charmaps) $(locales) $(ld-test-srcs) $(charmaps) $(locales) $(ld-test-srcs) tst-rpmatch.sh
# Get $(inst_i18ndir) defined. # Get $(inst_i18ndir) defined.
include ../Makeconfig include ../Makeconfig
@ -59,8 +59,10 @@ $(inst_i18ndir)/locales/%: locales/%; $(do-install)
ifeq (no,$(cross-compiling)) ifeq (no,$(cross-compiling))
tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon \
$(objpfx)tst-rpmatch
$(SHELL) -e sort-test.sh $(common-objpfx) $(test-input) $(SHELL) -e sort-test.sh $(common-objpfx) $(test-input)
$(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data $(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data
$(SHELL) -e tst-locale.sh $(common-objpfx) $(SHELL) -e tst-locale.sh $(common-objpfx)
$(SHELL) -e tst-rpmatch.sh $(common-objpfx)
endif endif

View File

@ -27,8 +27,8 @@ copy "en_DK"
END LC_COLLATE END LC_COLLATE
LC_MESSAGES LC_MESSAGES
yesexpr "<<(><j><J><y><Y><)/>><.><*>" yesexpr "<'/>><<(><j><J><y><Y><)/>><.><*>"
noexpr "<<(><n><N><)/>><.><*>" noexpr "<'/>><<(><n><N><)/>><.><*>"
END LC_MESSAGES END LC_MESSAGES
LC_MONETARY LC_MONETARY

View File

@ -2138,8 +2138,8 @@ copy "en_DK"
END LC_CTYPE END LC_CTYPE
LC_MESSAGES LC_MESSAGES
yesexpr "<<(><j><J><y><Y><)/>><.><*>" yesexpr "<'/>><<(><j><J><y><Y><)/>><.><*>"
noexpr "<<(><n><N><)/>><.><*>" noexpr "<'/>><<(><n><N><)/>><.><*>"
END LC_MESSAGES END LC_MESSAGES
LC_MONETARY LC_MONETARY

View File

@ -38,7 +38,7 @@ LC_COLLATE
% members of equivalence classes % members of equivalence classes
% 3. A distinction is made with regards % 3. A distinction is made with regards
% to case as noted below. % to case as noted below.
% 4. Special characters are ignored % 4. Special characters are ignored
% when comparing letters, but then % when comparing letters, but then
% they are considered % they are considered
% 5. The alphabets are sorted in order % 5. The alphabets are sorted in order
@ -66,10 +66,10 @@ collating-symbol <SMALL>
% and Spanish <C><h> being treated % and Spanish <C><h> being treated
% as one letter. % as one letter.
% The <a8> ...... <z8> collating % The <a8> ...... <z8> collating
% symbols have defined weights as % symbols have defined weights as
% the last character in a group of % the last character in a group of
% Latin letters. They are used % Latin letters. They are used
% to specify deltas by locales using % to specify deltas by locales using
% a locale as the default ordering % a locale as the default ordering
% and by "replace-after" statements % and by "replace-after" statements
@ -992,7 +992,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<a-> <A>;<MACRON>;<SMALL>;IGNORE <a-> <A>;<MACRON>;<SMALL>;IGNORE
<A7> <A>;<MACRON+DOT>;<CAPITAL>;IGNORE <A7> <A>;<MACRON+DOT>;<CAPITAL>;IGNORE
<a7> <A>;<MACRON+DOT>;<SMALL>;IGNORE <a7> <A>;<MACRON+DOT>;<SMALL>;IGNORE
<a8> <a8>
<AE> "<A><E>";"<AE><AE>";"<CAPITAL><CAPITAL>";IGNORE <AE> "<A><E>";"<AE><AE>";"<CAPITAL><CAPITAL>";IGNORE
<ae> "<A><E>";"<AE><AE>";"<SMALL><SMALL>";IGNORE <ae> "<A><E>";"<AE><AE>";"<SMALL><SMALL>";IGNORE
<AE'> "<A><E>";"<AE'><AE'>";"<CAPITAL><CAPITAL>";IGNORE <AE'> "<A><E>";"<AE'><AE'>";"<CAPITAL><CAPITAL>";IGNORE
@ -1007,7 +1007,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<b-.> <B>;<DOT-BELOW>;<SMALL>;IGNORE <b-.> <B>;<DOT-BELOW>;<SMALL>;IGNORE
<B_> <B>;<LINE-BELOW>;<CAPITAL>;IGNORE <B_> <B>;<LINE-BELOW>;<CAPITAL>;IGNORE
<b_> <B>;<LINE-BELOW>;<SMALL>;IGNORE <b_> <B>;<LINE-BELOW>;<SMALL>;IGNORE
<b8> <b8>
<C> <C>;<NONE>;<CAPITAL>;IGNORE <C> <C>;<NONE>;<CAPITAL>;IGNORE
<c> <C>;<NONE>;<SMALL>;IGNORE <c> <C>;<NONE>;<SMALL>;IGNORE
<C'> <C>;<ACUTE>;<CAPITAL>;IGNORE <C'> <C>;<ACUTE>;<CAPITAL>;IGNORE
@ -1024,7 +1024,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<c,> <C>;<CEDILLA>;<SMALL>;IGNORE <c,> <C>;<CEDILLA>;<SMALL>;IGNORE
<C,'> <C>;<CEDILLA+ACUTE>;<CAPITAL>;IGNORE <C,'> <C>;<CEDILLA+ACUTE>;<CAPITAL>;IGNORE
<c,'> <C>;<CEDILLA+ACUTE>;<SMALL>;IGNORE <c,'> <C>;<CEDILLA+ACUTE>;<SMALL>;IGNORE
<c8> <c8>
<D> <D>;<NONE>;<CAPITAL>;IGNORE <D> <D>;<NONE>;<CAPITAL>;IGNORE
<d> <D>;<NONE>;<SMALL>;IGNORE <d> <D>;<NONE>;<SMALL>;IGNORE
<D<> <D>;<CARON>;<CAPITAL>;IGNORE <D<> <D>;<CARON>;<CAPITAL>;IGNORE
@ -1041,7 +1041,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<d-/>> <D>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE <d-/>> <D>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
<D_> <D>;<LINE-BELOW>;<CAPITAL>;IGNORE <D_> <D>;<LINE-BELOW>;<CAPITAL>;IGNORE
<d_> <D>;<LINE-BELOW>;<SMALL>;IGNORE <d_> <D>;<LINE-BELOW>;<SMALL>;IGNORE
<d8> <d8>
<E> <E>;<NONE>;<CAPITAL>;IGNORE <E> <E>;<NONE>;<CAPITAL>;IGNORE
<e> <E>;<NONE>;<SMALL>;IGNORE <e> <E>;<NONE>;<SMALL>;IGNORE
<E'> <E>;<ACUTE>;<CAPITAL>;IGNORE <E'> <E>;<ACUTE>;<CAPITAL>;IGNORE
@ -1092,14 +1092,14 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<e-!> <E>;<MACRON+GRAVE>;<SMALL>;IGNORE <e-!> <E>;<MACRON+GRAVE>;<SMALL>;IGNORE
<E-/>> <E>;<MACRON+CIRCUMFLEX>;<CAPITAL>;IGNORE <E-/>> <E>;<MACRON+CIRCUMFLEX>;<CAPITAL>;IGNORE
<e-/>> <E>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE <e-/>> <E>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
<e8> <e8>
<F> <F>;<NONE>;<CAPITAL>;IGNORE <F> <F>;<NONE>;<CAPITAL>;IGNORE
<f> <F>;<NONE>;<SMALL>;IGNORE <f> <F>;<NONE>;<SMALL>;IGNORE
<F2> <F>;<HOOK>;<CAPITAL>;IGNORE <F2> <F>;<HOOK>;<CAPITAL>;IGNORE
<f2> <F>;<HOOK>;<SMALL>;IGNORE <f2> <F>;<HOOK>;<SMALL>;IGNORE
<F.> <F>;<DOT>;<CAPITAL>;IGNORE <F.> <F>;<DOT>;<CAPITAL>;IGNORE
<f.> <F>;<DOT>;<SMALL>;IGNORE <f.> <F>;<DOT>;<SMALL>;IGNORE
<f8> <f8>
<ff> "<F><F>";"<NONE><NONE>";"<ff><ff>";IGNORE <ff> "<F><F>";"<NONE><NONE>";"<ff><ff>";IGNORE
<fi> "<F><I>";"<NONE><NONE>";"<fi><fi>";IGNORE <fi> "<F><I>";"<NONE><NONE>";"<fi><fi>";IGNORE
<fl> "<F><L>";"<NONE><NONE>";"<fl><fl>";IGNORE <fl> "<F><L>";"<NONE><NONE>";"<fl><fl>";IGNORE
@ -1124,7 +1124,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<g,> <G>;<CEDILLA>;<SMALL>;IGNORE <g,> <G>;<CEDILLA>;<SMALL>;IGNORE
<G-> <G>;<MACRON>;<CAPITAL>;IGNORE <G-> <G>;<MACRON>;<CAPITAL>;IGNORE
<g-> <G>;<MACRON>;<SMALL>;IGNORE <g-> <G>;<MACRON>;<SMALL>;IGNORE
<g8> <g8>
<H> <H>;<NONE>;<CAPITAL>;IGNORE <H> <H>;<NONE>;<CAPITAL>;IGNORE
<h> <H>;<NONE>;<SMALL>;IGNORE <h> <H>;<NONE>;<SMALL>;IGNORE
<H-(> <H>;<BREVE-BELOW>;<CAPITAL>;IGNORE <H-(> <H>;<BREVE-BELOW>;<CAPITAL>;IGNORE
@ -1141,7 +1141,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<h//> <H>;<STROKE>;<SMALL>;IGNORE <h//> <H>;<STROKE>;<SMALL>;IGNORE
<H,> <H>;<CEDILLA>;<CAPITAL>;IGNORE <H,> <H>;<CEDILLA>;<CAPITAL>;IGNORE
<h,> <H>;<CEDILLA>;<SMALL>;IGNORE <h,> <H>;<CEDILLA>;<SMALL>;IGNORE
<h8> <h8>
<I> <I>;<NONE>;<CAPITAL>;IGNORE <I> <I>;<NONE>;<CAPITAL>;IGNORE
<i> <I>;<NONE>;<SMALL>;IGNORE <i> <I>;<NONE>;<SMALL>;IGNORE
<I'> <I>;<ACUTE>;<CAPITAL>;IGNORE <I'> <I>;<ACUTE>;<CAPITAL>;IGNORE
@ -1176,14 +1176,14 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<i;> <I>;<OGONEK>;<SMALL>;IGNORE <i;> <I>;<OGONEK>;<SMALL>;IGNORE
<I-> <I>;<MACRON>;<CAPITAL>;IGNORE <I-> <I>;<MACRON>;<CAPITAL>;IGNORE
<i-> <I>;<MACRON>;<SMALL>;IGNORE <i-> <I>;<MACRON>;<SMALL>;IGNORE
<i8> <i8>
<IJ> "<I><J>";"<IJ><IJ>";"<CAPITAL><CAPITAL>";IGNORE <IJ> "<I><J>";"<IJ><IJ>";"<CAPITAL><CAPITAL>";IGNORE
<ij> "<I><J>";"<IJ><IJ>";"<SMALL><SMALL>";IGNORE <ij> "<I><J>";"<IJ><IJ>";"<SMALL><SMALL>";IGNORE
<J> <J>;<NONE>;<CAPITAL>;IGNORE <J> <J>;<NONE>;<CAPITAL>;IGNORE
<j> <J>;<NONE>;<SMALL>;IGNORE <j> <J>;<NONE>;<SMALL>;IGNORE
<J/>> <J>;<CIRCUMFLEX>;<CAPITAL>;IGNORE <J/>> <J>;<CIRCUMFLEX>;<CAPITAL>;IGNORE
<j/>> <J>;<CIRCUMFLEX>;<SMALL>;IGNORE <j/>> <J>;<CIRCUMFLEX>;<SMALL>;IGNORE
<j8> <j8>
<K> <K>;<NONE>;<CAPITAL>;IGNORE <K> <K>;<NONE>;<CAPITAL>;IGNORE
<k> <K>;<NONE>;<SMALL>;IGNORE <k> <K>;<NONE>;<SMALL>;IGNORE
<K'> <K>;<ACUTE>;<CAPITAL>;IGNORE <K'> <K>;<ACUTE>;<CAPITAL>;IGNORE
@ -1198,7 +1198,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<k,> <K>;<CEDILLA>;<SMALL>;IGNORE <k,> <K>;<CEDILLA>;<SMALL>;IGNORE
<K_> <K>;<LINE-BELOW>;<CAPITAL>;IGNORE <K_> <K>;<LINE-BELOW>;<CAPITAL>;IGNORE
<k_> <K>;<LINE-BELOW>;<SMALL>;IGNORE <k_> <K>;<LINE-BELOW>;<SMALL>;IGNORE
<k8> <k8>
<kk> <K>;<kk>;<SMALL>;IGNORE <kk> <K>;<kk>;<SMALL>;IGNORE
<L> <L>;<NONE>;<CAPITAL>;IGNORE <L> <L>;<NONE>;<CAPITAL>;IGNORE
<l> <L>;<NONE>;<SMALL>;IGNORE <l> <L>;<NONE>;<SMALL>;IGNORE
@ -1220,7 +1220,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<l-/>> <L>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE <l-/>> <L>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
<L_> <L>;<LINE-BELOW>;<CAPITAL>;IGNORE <L_> <L>;<LINE-BELOW>;<CAPITAL>;IGNORE
<l_> <L>;<LINE-BELOW>;<SMALL>;IGNORE <l_> <L>;<LINE-BELOW>;<SMALL>;IGNORE
<l8> <l8>
<M> <M>;<NONE>;<CAPITAL>;IGNORE <M> <M>;<NONE>;<CAPITAL>;IGNORE
<m> <M>;<NONE>;<SMALL>;IGNORE <m> <M>;<NONE>;<SMALL>;IGNORE
<M'> <M>;<ACUTE>;<CAPITAL>;IGNORE <M'> <M>;<ACUTE>;<CAPITAL>;IGNORE
@ -1229,7 +1229,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<m.> <M>;<DOT>;<SMALL>;IGNORE <m.> <M>;<DOT>;<SMALL>;IGNORE
<M-.> <M>;<DOT-BELOW>;<CAPITAL>;IGNORE <M-.> <M>;<DOT-BELOW>;<CAPITAL>;IGNORE
<m-.> <M>;<DOT-BELOW>;<SMALL>;IGNORE <m-.> <M>;<DOT-BELOW>;<SMALL>;IGNORE
<m8> <m8>
<N> <N>;<NONE>;<CAPITAL>;IGNORE <N> <N>;<NONE>;<CAPITAL>;IGNORE
<n> <N>;<NONE>;<SMALL>;IGNORE <n> <N>;<NONE>;<SMALL>;IGNORE
<N'> <N>;<ACUTE>;<CAPITAL>;IGNORE <N'> <N>;<ACUTE>;<CAPITAL>;IGNORE
@ -1249,7 +1249,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<N_> <N>;<LINE-BELOW>;<CAPITAL>;IGNORE <N_> <N>;<LINE-BELOW>;<CAPITAL>;IGNORE
<n_> <N>;<LINE-BELOW>;<SMALL>;IGNORE <n_> <N>;<LINE-BELOW>;<SMALL>;IGNORE
<'n> <N>;<PRECEDED-BY-APOSTROPHE>;<SMALL>;IGNORE <'n> <N>;<PRECEDED-BY-APOSTROPHE>;<SMALL>;IGNORE
<n8> <n8>
<NG> "<N><G>";"<NG><NG>";"<CAPITAL><CAPITAL>";IGNORE <NG> "<N><G>";"<NG><NG>";"<CAPITAL><CAPITAL>";IGNORE
<ng> "<N><G>";"<NG><NG>";"<SMALL><SMALL>";IGNORE <ng> "<N><G>";"<NG><NG>";"<SMALL><SMALL>";IGNORE
<O> <O>;<NONE>;<CAPITAL>;IGNORE <O> <O>;<NONE>;<CAPITAL>;IGNORE
@ -1319,7 +1319,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<o9?> <O>;<HORN+TILDE>;<SMALL>;IGNORE <o9?> <O>;<HORN+TILDE>;<SMALL>;IGNORE
<O9-.> <O>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE <O9-.> <O>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE
<o9-.> <O>;<HORN+DOT-BELOW>;<SMALL>;IGNORE <o9-.> <O>;<HORN+DOT-BELOW>;<SMALL>;IGNORE
<o8> <o8>
<OE> "<O><E>";"<OE><OE>";"<CAPITAL><CAPITAL>";IGNORE <OE> "<O><E>";"<OE><OE>";"<CAPITAL><CAPITAL>";IGNORE
<oe> "<O><E>";"<OE><OE>";"<SMALL><SMALL>";IGNORE <oe> "<O><E>";"<OE><OE>";"<SMALL><SMALL>";IGNORE
<P> <P>;<NONE>;<CAPITAL>;IGNORE <P> <P>;<NONE>;<CAPITAL>;IGNORE
@ -1328,10 +1328,10 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<p'> <P>;<ACUTE>;<SMALL>;IGNORE <p'> <P>;<ACUTE>;<SMALL>;IGNORE
<P.> <P>;<DOT>;<CAPITAL>;IGNORE <P.> <P>;<DOT>;<CAPITAL>;IGNORE
<p.> <P>;<DOT>;<SMALL>;IGNORE <p.> <P>;<DOT>;<SMALL>;IGNORE
<p8> <p8>
<Q> <Q>;<NONE>;<CAPITAL>;IGNORE <Q> <Q>;<NONE>;<CAPITAL>;IGNORE
<q> <Q>;<NONE>;<SMALL>;IGNORE <q> <Q>;<NONE>;<SMALL>;IGNORE
<q8> <q8>
<R> <R>;<NONE>;<CAPITAL>;IGNORE <R> <R>;<NONE>;<CAPITAL>;IGNORE
<r> <R>;<NONE>;<SMALL>;IGNORE <r> <R>;<NONE>;<SMALL>;IGNORE
<R'> <R>;<ACUTE>;<CAPITAL>;IGNORE <R'> <R>;<ACUTE>;<CAPITAL>;IGNORE
@ -1352,7 +1352,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<r--.> <R>;<MACRON+DOT-BELOW>;<SMALL>;IGNORE <r--.> <R>;<MACRON+DOT-BELOW>;<SMALL>;IGNORE
<R_> <R>;<LINE-BELOW>;<CAPITAL>;IGNORE <R_> <R>;<LINE-BELOW>;<CAPITAL>;IGNORE
<r_> <R>;<LINE-BELOW>;<SMALL>;IGNORE <r_> <R>;<LINE-BELOW>;<SMALL>;IGNORE
<r8> <r8>
<S> <S>;<NONE>;<CAPITAL>;IGNORE <S> <S>;<NONE>;<CAPITAL>;IGNORE
<s> <S>;<NONE>;<SMALL>;IGNORE <s> <S>;<NONE>;<SMALL>;IGNORE
<st> "<S><T>";"<NONE><NONE>";"<st><st>";IGNORE <st> "<S><T>";"<NONE><NONE>";"<st><st>";IGNORE
@ -1374,7 +1374,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<s.-.> <S>;<DOT+DOT-BELOW>;<SMALL>;IGNORE <s.-.> <S>;<DOT+DOT-BELOW>;<SMALL>;IGNORE
<S,> <S>;<CEDILLA>;<CAPITAL>;IGNORE <S,> <S>;<CEDILLA>;<CAPITAL>;IGNORE
<s,> <S>;<CEDILLA>;<SMALL>;IGNORE <s,> <S>;<CEDILLA>;<SMALL>;IGNORE
<s8> <s8>
<s1> <S>;<s1>;<SMALL>;IGNORE <s1> <S>;<s1>;<SMALL>;IGNORE
<ss> "<S><S>";"<NONE><NONE>";"<SMALL><ss>";IGNORE <ss> "<S><S>";"<NONE><NONE>";"<SMALL><ss>";IGNORE
<T> <T>;<NONE>;<CAPITAL>;IGNORE <T> <T>;<NONE>;<CAPITAL>;IGNORE
@ -1393,7 +1393,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<t-/>> <T>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE <t-/>> <T>;<MACRON+CIRCUMFLEX>;<SMALL>;IGNORE
<T_> <T>;<LINE-BELOW>;<CAPITAL>;IGNORE <T_> <T>;<LINE-BELOW>;<CAPITAL>;IGNORE
<t_> <T>;<LINE-BELOW>;<SMALL>;IGNORE <t_> <T>;<LINE-BELOW>;<SMALL>;IGNORE
<t8> <t8>
<TH> "<T><H>";"<TH><TH>";"<CAPITAL><CAPITAL>";IGNORE <TH> "<T><H>";"<TH><TH>";"<CAPITAL><CAPITAL>";IGNORE
<th> "<T><H>";"<TH><TH>";"<SMALL><SMALL>";IGNORE <th> "<T><H>";"<TH><TH>";"<SMALL><SMALL>";IGNORE
<U> <U>;<NONE>;<CAPITAL>;IGNORE <U> <U>;<NONE>;<CAPITAL>;IGNORE
@ -1458,14 +1458,14 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<u9?> <U>;<HORN+TILDE>;<SMALL>;IGNORE <u9?> <U>;<HORN+TILDE>;<SMALL>;IGNORE
<U9-.> <U>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE <U9-.> <U>;<HORN+DOT-BELOW>;<CAPITAL>;IGNORE
<u9-.> <U>;<HORN+DOT-BELOW>;<SMALL>;IGNORE <u9-.> <U>;<HORN+DOT-BELOW>;<SMALL>;IGNORE
<u8> <u8>
<V> <V>;<NONE>;<CAPITAL>;IGNORE <V> <V>;<NONE>;<CAPITAL>;IGNORE
<v> <V>;<NONE>;<SMALL>;IGNORE <v> <V>;<NONE>;<SMALL>;IGNORE
<V?> <V>;<TILDE>;<CAPITAL>;IGNORE <V?> <V>;<TILDE>;<CAPITAL>;IGNORE
<v?> <V>;<TILDE>;<SMALL>;IGNORE <v?> <V>;<TILDE>;<SMALL>;IGNORE
<V-.> <V>;<DOT-BELOW>;<CAPITAL>;IGNORE <V-.> <V>;<DOT-BELOW>;<CAPITAL>;IGNORE
<v-.> <V>;<DOT-BELOW>;<SMALL>;IGNORE <v-.> <V>;<DOT-BELOW>;<SMALL>;IGNORE
<v8> <v8>
<W> <W>;<NONE>;<CAPITAL>;IGNORE <W> <W>;<NONE>;<CAPITAL>;IGNORE
<w> <W>;<NONE>;<SMALL>;IGNORE <w> <W>;<NONE>;<SMALL>;IGNORE
<W'> <W>;<ACUTE>;<CAPITAL>;IGNORE <W'> <W>;<ACUTE>;<CAPITAL>;IGNORE
@ -1480,14 +1480,14 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<w.> <W>;<DOT>;<SMALL>;IGNORE <w.> <W>;<DOT>;<SMALL>;IGNORE
<W-.> <W>;<DOT-BELOW>;<CAPITAL>;IGNORE <W-.> <W>;<DOT-BELOW>;<CAPITAL>;IGNORE
<w-.> <W>;<DOT-BELOW>;<SMALL>;IGNORE <w-.> <W>;<DOT-BELOW>;<SMALL>;IGNORE
<w8> <w8>
<X> <X>;<NONE>;<CAPITAL>;IGNORE <X> <X>;<NONE>;<CAPITAL>;IGNORE
<x> <X>;<NONE>;<SMALL>;IGNORE <x> <X>;<NONE>;<SMALL>;IGNORE
<X:> <X>;<DIAERESIS>;<CAPITAL>;IGNORE <X:> <X>;<DIAERESIS>;<CAPITAL>;IGNORE
<x:> <X>;<DIAERESIS>;<SMALL>;IGNORE <x:> <X>;<DIAERESIS>;<SMALL>;IGNORE
<X.> <X>;<DOT>;<CAPITAL>;IGNORE <X.> <X>;<DOT>;<CAPITAL>;IGNORE
<x.> <X>;<DOT>;<SMALL>;IGNORE <x.> <X>;<DOT>;<SMALL>;IGNORE
<x8> <x8>
<Y> <Y>;<NONE>;<CAPITAL>;IGNORE <Y> <Y>;<NONE>;<CAPITAL>;IGNORE
<y> <Y>;<NONE>;<SMALL>;IGNORE <y> <Y>;<NONE>;<SMALL>;IGNORE
<Y'> <Y>;<ACUTE>;<CAPITAL>;IGNORE <Y'> <Y>;<ACUTE>;<CAPITAL>;IGNORE
@ -1506,7 +1506,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<y.> <Y>;<DOT>;<SMALL>;IGNORE <y.> <Y>;<DOT>;<SMALL>;IGNORE
<Y-.> <Y>;<DOT-BELOW>;<CAPITAL>;IGNORE <Y-.> <Y>;<DOT-BELOW>;<CAPITAL>;IGNORE
<y-.> <Y>;<DOT-BELOW>;<SMALL>;IGNORE <y-.> <Y>;<DOT-BELOW>;<SMALL>;IGNORE
<y8> <y8>
<Z> <Z>;<NONE>;<CAPITAL>;IGNORE <Z> <Z>;<NONE>;<CAPITAL>;IGNORE
<z> <Z>;<NONE>;<SMALL>;IGNORE <z> <Z>;<NONE>;<SMALL>;IGNORE
<Z'> <Z>;<ACUTE>;<CAPITAL>;IGNORE <Z'> <Z>;<ACUTE>;<CAPITAL>;IGNORE
@ -1523,7 +1523,7 @@ UNDEFINED IGNORE;IGNORE;IGNORE
<z//> <Z>;<STROKE>;<SMALL>;IGNORE <z//> <Z>;<STROKE>;<SMALL>;IGNORE
<Z_> <Z>;<LINE-BELOW>;<CAPITAL>;IGNORE <Z_> <Z>;<LINE-BELOW>;<CAPITAL>;IGNORE
<z_> <Z>;<LINE-BELOW>;<SMALL>;IGNORE <z_> <Z>;<LINE-BELOW>;<SMALL>;IGNORE
<z8> <z8>
<A*> <A*>;<CAPITAL>;<GREEK>;IGNORE <A*> <A*>;<CAPITAL>;<GREEK>;IGNORE
<A%> <A*>;<CAPITAL>;<TONOS>;IGNORE <A%> <A*>;<CAPITAL>;<TONOS>;IGNORE
<a*> <A*>;<SMALL>;<GREEK>;IGNORE <a*> <A*>;<SMALL>;<GREEK>;IGNORE
@ -2134,18 +2134,18 @@ abday "<V=><s=><k=>";/
"<C%><t=><v=>";/ "<C%><t=><v=>";/
"<P=><t=><n=>";/ "<P=><t=><n=>";/
"<S=><u=><b=>" "<S=><u=><b=>"
mon "<JA><n=><v=><a=><r=><ja>";/ mon "<JA><n=><v=><a=><r=><%'>";/
"<F=><e=><v=><r=><a=><l=><ja>";/ "<F=><e=><v=><r=><a=><l=><%'>";/
"<M=><a=><r=><t=>";/ "<M=><a=><r=><t=>";/
"<A=><p=><r=><e=><l=><ja>";/ "<A=><p=><r=><e=><l=><%'>";/
"<M=><a=><j=>";/ "<M=><a=><j=>";/
"<I=><ju><n=><ja>";/ "<I=><ju><n=><%'>";/
"<I=><ju><l=><ja>";/ "<I=><ju><l=><%'>";/
"<A=><v=><g=><u=><s=><t=><a=>";/ "<A=><v=><g=><u=><s=><t=>";/
"<S=><e=><n=><t=><ja><b=><r=><ja>";/ "<S=><e=><n=><t=><ja><b=><r=><%'>";/
"<O=><k=><t=><ja><b=><r=><ja>";/ "<O=><k=><t=><ja><b=><r=><%'>";/
"<N=><o=><ja><b=><r=><ja>";/ "<N=><o=><ja><b=><r=><%'>";/
"<D=><e=><k=><a=><b=><r=><ja>" "<D=><e=><k=><a=><b=><r=><%'>"
abmon "<JA><n=><v=>";/ abmon "<JA><n=><v=>";/
"<F=><e=><v=>";/ "<F=><e=><v=>";/
"<M=><a=><r=>";/ "<M=><a=><r=>";/

37
localedata/tst-rpmatch.c Normal file
View File

@ -0,0 +1,37 @@
/* Test program for
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jochen Hein <jochen.hein@delphi.central.de>.
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 <locale.h>
#include <stdio.h>
#include <stdlib.h>
int
main (int argc, char* argv[])
{
setlocale (LC_ALL, argv[1]);
if (rpmatch (argv[2]) != atol (argv[3]))
{
fprintf (stderr,"Failed: Locale %s, String %s, Exp: %s, got %d\n",
argv[1], argv[2], argv[3], rpmatch (argv[2]));
exit (EXIT_FAILURE);
}
exit (EXIT_SUCCESS);
}

64
localedata/tst-rpmatch.sh Executable file
View File

@ -0,0 +1,64 @@
#! /bin/sh -f
#
# Copyright (C) 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library and contains tests for
# the rpmatch(3)-implementation.
# contributed by Jochen Hein <jochen.hein@delphi.central.de>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
common_objpfx=$1
IFS="<22>"
rc=0
while read locale string result dummy; do
if [ "$locale" != "#" ]; then
LOCPATH=${common_objpfx}localedata \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${common_objpfx}localedata/tst-rpmatch $locale $string $result \
|| exit 1
fi
done <<EOF
#<23> These are the tests for rpmatch in glibc. Each line contains one test,
#<23> comments start with #<23> in the first column. The fields are seperated
#<23> by paragraph signs and contain: the locale, the string, the expected
#<23> return value of rpmatch(3). If the test fails, test-rpmatch prints
#<23> all these informations
C<EFBFBD>Yes<EFBFBD>1
C<EFBFBD>yes<EFBFBD>1
C<EFBFBD>YES<EFBFBD>1
C<EFBFBD>YeS<EFBFBD>1
C<EFBFBD>YEs<EFBFBD>1
C<EFBFBD>yEs<EFBFBD>1
C<EFBFBD>yES<EFBFBD>1
C<EFBFBD>yeS<EFBFBD>1
C<EFBFBD>No<EFBFBD>0
C<EFBFBD>no<EFBFBD>0
#<23> Uh, that's nonsense
C<EFBFBD>nonsens<EFBFBD>0
C<EFBFBD>Error<EFBFBD>-1
de_DE<EFBFBD>Yes<EFBFBD>1
de_DE<EFBFBD>Ja<EFBFBD>1
de_DE<EFBFBD>Jammerschade<EFBFBD>1
de_DE<EFBFBD>dejavu<EFBFBD>-1
de_DE<EFBFBD>Nein<EFBFBD>0
de_DE<EFBFBD>Fehler<EFBFBD>-1
de_DE<EFBFBD>jein<EFBFBD>1
EOF
rc=$?
if [ $rc -eq 1 ]; then
echo "Errors"
fi
exit $rc

View File

@ -1,9 +1,9 @@
/* Getopt for GNU. /* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu "Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it! before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
Free Software Foundation, Inc. Free Software Foundation, Inc.
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
@ -31,7 +31,7 @@
#include <config.h> #include <config.h>
#endif #endif
#if !defined (__STDC__) || !__STDC__ #if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems /* This is a separate conditional since some stdc systems
reject `defined (const)'. */ reject `defined (const)'. */
#ifndef const #ifndef const
@ -50,7 +50,7 @@
it is simpler to just do this in the source for each such file. */ it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2 #define GETOPT_INTERFACE_VERSION 2
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h> #include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE #define ELIDE_CODE
@ -222,7 +222,7 @@ my_index (str, chr)
#ifdef __GNUC__ #ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */ That was relevant to code that was here before. */
#if !defined (__STDC__) || !__STDC__ #if !defined __STDC__ || !__STDC__
/* gcc with -traditional declares the built-in strlen to return int, /* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */ and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *); extern int strlen (const char *);
@ -289,7 +289,7 @@ text_set_element (__libc_subinit, store_args_and_env);
`first_nonopt' and `last_nonopt' are relocated so that they describe `first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */ the new indices of the non-options in ARGV after they are moved. */
#if defined (__STDC__) && __STDC__ #if defined __STDC__ && __STDC__
static void exchange (char **); static void exchange (char **);
#endif #endif
@ -375,7 +375,7 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */ /* Initialize the internal data when the first call is made. */
#if defined (__STDC__) && __STDC__ #if defined __STDC__ && __STDC__
static const char *_getopt_initialize (int, char *const *, const char *); static const char *_getopt_initialize (int, char *const *, const char *);
#endif #endif
static const char * static const char *

View File

@ -1,5 +1,6 @@
/* getopt_long and getopt_long_only entry points for GNU getopt. /* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
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
@ -23,7 +24,7 @@
#include "getopt.h" #include "getopt.h"
#if !defined (__STDC__) || !__STDC__ #if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems /* This is a separate conditional since some stdc systems
reject `defined (const)'. */ reject `defined (const)'. */
#ifndef const #ifndef const
@ -42,7 +43,7 @@
it is simpler to just do this in the source for each such file. */ it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2 #define GETOPT_INTERFACE_VERSION 2
#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h> #include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE #define ELIDE_CODE

View File

@ -21,6 +21,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <wordexp.h> #include <wordexp.h>
#define IFS ", \n\t"
struct test_case_struct struct test_case_struct
{ {
int retval; int retval;
@ -31,12 +33,57 @@ struct test_case_struct
const char *wordv[10]; const char *wordv[10];
} test_case[] = } test_case[] =
{ {
/* Simple word-splitting */
{ 0, NULL, "one", 0, 1, { "one", } }, { 0, NULL, "one", 0, 1, { "one", } },
{ 0, NULL, "one two", 0, 2, { "one", "two", } }, { 0, NULL, "one two", 0, 2, { "one", "two", } },
{ 0, NULL, "one two three", 0, 3, { "one", "two", "three", } }, { 0, NULL, "one two three", 0, 3, { "one", "two", "three", } },
/* Simple parameter expansion */
{ 0, "foo", "${var}", 0, 1, { "foo", } }, { 0, "foo", "${var}", 0, 1, { "foo", } },
{ 0, "foo", "$var", 0, 1, { "foo", } }, { 0, "foo", "$var", 0, 1, { "foo", } },
/* Simple quote removal */
{ 0, NULL, "\"quoted\"", 0, 1, { "quoted", } }, { 0, NULL, "\"quoted\"", 0, 1, { "quoted", } },
{ 0, "foo", "\"$var\"\"$var\"", 0, 1, { "foofoo", } },
{ 0, NULL, "'singly-quoted'", 0, 1, { "singly-quoted", } },
/* Simple command substitution */
{ 0, NULL, "$(echo hello)", 0, 1, { "hello", } },
{ 0, NULL, "$( (echo hello) )", 0, 1, { "hello", } },
/* Simple arithmetic expansion */
{ 0, NULL, "$((1 + 1))", 0, 1, { "2", } },
{ 0, NULL, "$((2-3))", 0, 1, { "-1", } },
{ 0, NULL, "$((-1))", 0, 1, { "-1", } },
/* Field splitting */
{ 0, NULL, " \tfoo\t\tbar ", 0, 2, { "foo", "bar", } },
{ 0, NULL, " red , white blue", 0, 3, { "red", "white", "blue", } },
/* Advanced parameter expansion */
{ 0, NULL, "${var:-bar}", 0, 1, { "bar", } },
{ 0, NULL, "${var-bar}", 0, 1, { "bar", } },
{ 0, "", "${var:-bar}", 0, 1, { "bar", } },
{ 0, "foo", "${var:-bar}", 0, 1, { "foo", } },
{ 0, "", "${var-bar}", 0, 0, { NULL, } },
{ 0, NULL, "${var:=bar}", 0, 1, { "bar", } },
{ 0, NULL, "${var=bar}", 0, 1, { "bar", } },
{ 0, "", "${var:=bar}", 0, 1, { "bar", } },
{ 0, "foo", "${var:=bar}", 0, 1, { "foo", } },
{ 0, "", "${var=bar}", 0, 0, { NULL, } },
{ 0, "foo", "${var:?bar}", 0, 1, { "foo", } },
{ 0, NULL, "${var:+bar}", 0, 0, { NULL, } },
{ 0, NULL, "${var+bar}", 0, 0, { NULL, } },
{ 0, "", "${var:+bar}", 0, 0, { NULL, } },
{ 0, "foo", "${var:+bar}", 0, 1, { "bar", } },
{ 0, "", "${var+bar}", 0, 1, { "bar", } },
{ 0, "12345", "${#var}", 0, 1, { "5", } },
{ 0, "banana", "${var%na*}", 0, 1, { "bana", } },
{ 0, "banana", "${var%%na*}", 0, 1, { "ba", } },
{ 0, "borabora-island", "${var#*bora}", 0, 1, { "bora-island", } },
{ 0, "borabora-island", "${var##*bora}", 0, 1, {"-island", } },
{ -1, NULL, NULL, 0, 0, { NULL, } }, { -1, NULL, NULL, 0, 0, { NULL, } },
}; };
@ -49,7 +96,7 @@ main (int argc, char * argv[])
int test; int test;
int fail = 0; int fail = 0;
setenv ("IFS", " \t\n", 1); setenv ("IFS", IFS, 1);
for (test = 0; test_case[test].retval != -1; test++) for (test = 0; test_case[test].retval != -1; test++)
if (testit (&test_case[test])) if (testit (&test_case[test]))
++fail; ++fail;

View File

@ -59,7 +59,7 @@ static int parse_backtick (char **word, size_t *word_length,
size_t *offset, int flags, wordexp_t *pwordexp, size_t *offset, int flags, wordexp_t *pwordexp,
const char *ifs, const char *ifs_white) const char *ifs, const char *ifs_white)
internal_function; internal_function;
static int eval_expr (char *expr, int *result) internal_function; static int eval_expr (char *expr, long int *result) internal_function;
/* The w_*() functions manipulate word lists. */ /* The w_*() functions manipulate word lists. */
@ -93,16 +93,12 @@ w_addchar (char *buffer, size_t *actlen, size_t *maxlen, char ch)
} }
static char * static char *
w_addstr (char *buffer, size_t *actlen, size_t *maxlen, const char *str) internal_function
/* (lengths exclude trailing zero) */ w_addmem (char *buffer, size_t *actlen, size_t *maxlen, const char *str,
size_t len)
{ {
/* Add a string to the buffer, allocating room for it if needed. /* Add a string to the buffer, allocating room for it if needed.
*/ */
size_t len;
assert (str != NULL); /* w_addstr only called from this file */
len = strlen (str);
if (*actlen + len > *maxlen) if (*actlen + len > *maxlen)
{ {
char *old_buffer = buffer; char *old_buffer = buffer;
@ -123,7 +119,24 @@ w_addstr (char *buffer, size_t *actlen, size_t *maxlen, const char *str)
return buffer; return buffer;
} }
static char *
internal_function
w_addstr (char *buffer, size_t *actlen, size_t *maxlen, const char *str)
/* (lengths exclude trailing zero) */
{
/* Add a string to the buffer, allocating room for it if needed.
*/
size_t len;
assert (str != NULL); /* w_addstr only called from this file */
len = strlen (str);
return w_addmem (buffer, actlen, maxlen, str, len);
}
static int static int
internal_function
w_addword (wordexp_t *pwordexp, char *word) w_addword (wordexp_t *pwordexp, char *word)
{ {
/* Add a word to the wordlist */ /* Add a word to the wordlist */
@ -229,8 +242,8 @@ parse_tilde (char **word, size_t *word_length, size_t *max_length,
{ {
if (!((*word)[*word_length - 1] == '=' && wordc == 0)) if (!((*word)[*word_length - 1] == '=' && wordc == 0))
{ {
if (!((*word)[*word_length - 1] == ':' && if (!((*word)[*word_length - 1] == ':'
strchr (*word, '=') && wordc == 0)) && strchr (*word, '=') && wordc == 0))
{ {
*word = w_addchar (*word, word_length, max_length, '~'); *word = w_addchar (*word, word_length, max_length, '~');
return *word ? 0 : WRDE_NOSPACE; return *word ? 0 : WRDE_NOSPACE;
@ -422,6 +435,7 @@ no_space:
} }
static int static int
internal_function
parse_squote (char **word, size_t *word_length, size_t *max_length, parse_squote (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset) const char *words, size_t *offset)
{ {
@ -444,7 +458,7 @@ parse_squote (char **word, size_t *word_length, size_t *max_length,
/* Functions to evaluate an arithmetic expression */ /* Functions to evaluate an arithmetic expression */
static int static int
internal_function internal_function
eval_expr_val (char **expr, int *result) eval_expr_val (char **expr, long int *result)
{ {
int sgn = +1; int sgn = +1;
char *digit; char *digit;
@ -495,12 +509,12 @@ eval_expr_val (char **expr, int *result)
static int static int
internal_function internal_function
eval_expr_multdiv (char **expr, int *result) eval_expr_multdiv (char **expr, long int *result)
{ {
int arg; long int arg;
/* Read a Value */ /* Read a Value */
if (eval_expr_val (expr, result)) if (eval_expr_val (expr, result) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
while (**expr) while (**expr)
@ -510,16 +524,16 @@ eval_expr_multdiv (char **expr, int *result)
if (**expr == '*') if (**expr == '*')
{ {
(*expr)++; ++(*expr);
if ((eval_expr_val (expr, &arg)) != 0) if (eval_expr_val (expr, &arg) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
*result *= arg; *result *= arg;
} }
else if (**expr == '/') else if (**expr == '/')
{ {
(*expr)++; ++(*expr);
if ((eval_expr_val (expr, &arg)) != 0) if (eval_expr_val (expr, &arg) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
*result /= arg; *result /= arg;
@ -532,12 +546,12 @@ eval_expr_multdiv (char **expr, int *result)
static int static int
internal_function internal_function
eval_expr (char *expr, int *result) eval_expr (char *expr, long int *result)
{ {
int arg; long int arg;
/* Read a Multdiv */ /* Read a Multdiv */
if ((eval_expr_multdiv (&expr, result)) != 0) if (eval_expr_multdiv (&expr, result) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
while (*expr) while (*expr)
@ -547,16 +561,16 @@ eval_expr (char *expr, int *result)
if (*expr == '+') if (*expr == '+')
{ {
expr++; ++expr;
if ((eval_expr_multdiv (&expr, &arg)) != 0) if (eval_expr_multdiv (&expr, &arg) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
*result += arg; *result += arg;
} }
else if (*expr == '-') else if (*expr == '-')
{ {
expr++; ++expr;
if ((eval_expr_multdiv (&expr, &arg)) != 0) if (eval_expr_multdiv (&expr, &arg) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
*result -= arg; *result -= arg;
@ -628,7 +642,8 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
if (--paren_depth == 0) if (--paren_depth == 0)
{ {
char result[21]; /* 21 = ceil(log10(2^64)) + 1 */ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
int numresult = 0; long int numresult = 0;
long long int convertme;
if (bracket || words[1 + *offset] != ')') if (bracket || words[1 + *offset] != ')')
return WRDE_SYNTAX; return WRDE_SYNTAX;
@ -636,13 +651,25 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
++(*offset); ++(*offset);
/* Go - evaluate. */ /* Go - evaluate. */
if (*expr && if (*expr && eval_expr (expr, &numresult) != 0)
eval_expr (expr, &numresult) != 0)
return WRDE_SYNTAX; return WRDE_SYNTAX;
if (numresult < 0)
{
convertme = -numresult;
*word = w_addchar (*word, word_length, max_length, '-');
if (!*word)
{
free (expr);
return WRDE_NOSPACE;
}
}
else
convertme = numresult;
result[20] = '\0'; result[20] = '\0';
*word = w_addstr (*word, word_length, max_length, *word = w_addstr (*word, word_length, max_length,
_itoa_word (numresult, &result[20], 10, 0)); _itoa (convertme, &result[20], 10, 0));
free (expr); free (expr);
return *word ? 0 : WRDE_NOSPACE; return *word ? 0 : WRDE_NOSPACE;
} }
@ -656,7 +683,7 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
if (bracket && paren_depth == 1) if (bracket && paren_depth == 1)
{ {
char result[21]; /* 21 = ceil(log10(2^64)) + 1 */ char result[21]; /* 21 = ceil(log10(2^64)) + 1 */
int numresult = 0; long int numresult = 0;
/* Go - evaluate. */ /* Go - evaluate. */
if (*expr && eval_expr (expr, &numresult) != 0) if (*expr && eval_expr (expr, &numresult) != 0)
@ -758,14 +785,11 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
break; break;
} }
for (i = 0; i < buflen; ++i) *word = w_addmem (*word, word_length, max_length, buffer, buflen);
if (*word == NULL)
{ {
*word = w_addchar (*word, word_length, max_length, buffer[i]); close (fildes[0]);
if (*word == NULL) return WRDE_NOSPACE;
{
close (fildes[0]);
return WRDE_NOSPACE;
}
} }
} }
@ -874,6 +898,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
} }
static int static int
internal_function
parse_comm (char **word, size_t *word_length, size_t *max_length, parse_comm (char **word, size_t *word_length, size_t *max_length,
const char *words, size_t *offset, int flags, wordexp_t *pwordexp, const char *words, size_t *offset, int flags, wordexp_t *pwordexp,
const char *ifs, const char *ifs_white) const char *ifs, const char *ifs_white)
@ -949,6 +974,7 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
enum remove_pattern_enum remove = RP_NONE; enum remove_pattern_enum remove = RP_NONE;
int colon_seen = 0; int colon_seen = 0;
int depth = 0; int depth = 0;
int substitute_length = 0;
int error; int error;
for (; words[*offset]; ++(*offset)) for (; words[*offset]; ++(*offset))
@ -997,11 +1023,7 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
goto envsubst; goto envsubst;
case '#': case '#':
/* At the start? (ie. 'string length') */ /* '#' only has special meaning inside braces */
if (*offset == start + 1)
/* FIXME: This isn't written yet! */
break;
if (words[start] != '{') if (words[start] != '{')
{ {
/* Evaluate */ /* Evaluate */
@ -1010,8 +1032,16 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
goto envsubst; goto envsubst;
} }
/* Separating variable name from prefix pattern? */ /* At the start? (i.e. 'string length') */
if (*offset == start + 1)
{
substitute_length = 1;
break;
}
else if (substitute_length)
goto syntax;
/* Separating variable name from prefix pattern? */
if (remove == RP_NONE) if (remove == RP_NONE)
{ {
remove = RP_SHORT_LEFT; remove = RP_SHORT_LEFT;
@ -1069,8 +1099,8 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
break; break;
} }
if ((words[1 + *offset] == '-') || (words[1 + *offset] == '=') || if ((words[1 + *offset] == '-') || (words[1 + *offset] == '=')
(words[1 + *offset] == '?') || (words[1 + *offset] == '+')) || (words[1 + *offset] == '?') || (words[1 + *offset] == '+'))
{ {
colon_seen = 1; colon_seen = 1;
break; break;
@ -1085,6 +1115,9 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
if (!*env) if (!*env)
goto syntax; goto syntax;
if (substitute_length)
goto syntax;
if (action != '\0' || remove != RP_NONE) if (action != '\0' || remove != RP_NONE)
{ {
pattern = w_addchar (pattern, &pat_length, &pat_maxlen, pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
@ -1184,7 +1217,7 @@ envsubst:
switch (remove) switch (remove)
{ {
case RP_SHORT_LEFT: case RP_SHORT_LEFT:
for (p = value; p <= end; p++) for (p = value; p <= end; ++p)
{ {
c = *p; c = *p;
*p = '\0'; *p = '\0';
@ -1200,7 +1233,7 @@ envsubst:
break; break;
case RP_LONG_LEFT: case RP_LONG_LEFT:
for (p = end; p >= value; p--) for (p = end; p >= value; --p)
{ {
c = *p; c = *p;
*p = '\0'; *p = '\0';
@ -1216,7 +1249,7 @@ envsubst:
break; break;
case RP_SHORT_RIGHT: case RP_SHORT_RIGHT:
for (p = end; p >= value; p--) for (p = end; p >= value; --p)
{ {
if (fnmatch (pattern, p, 0) != FNM_NOMATCH) if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
{ {
@ -1228,7 +1261,7 @@ envsubst:
break; break;
case RP_LONG_RIGHT: case RP_LONG_RIGHT:
for (p = value; p <= end; p++) for (p = value; p <= end; ++p)
{ {
if (fnmatch (pattern, p, 0) != FNM_NOMATCH) if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
{ {
@ -1248,6 +1281,7 @@ envsubst:
case '?': case '?':
if (value && *value) if (value && *value)
/* Substitute parameter */
break; break;
if (!colon_seen && value) if (!colon_seen && value)
@ -1292,8 +1326,94 @@ envsubst:
free (pattern); free (pattern);
return WRDE_BADVAL; return WRDE_BADVAL;
case '-':
if (value && *value)
/* Substitute parameter */
break;
if (!colon_seen && value)
{
/* Substitute NULL */
free (env);
free (pattern);
return 0;
}
subst_word:
{
/* Substitute word */
wordexp_t we;
char *expand_me = pattern;
int i;
if (pwordexp == NULL)
{
/* No field-splitting is allowed, so imagine
quotes around the word. */
expand_me = alloca (strlen (pattern) + 2);
sprintf (expand_me, "\"%s\"", pattern);
}
error = wordexp (expand_me, &we, flags);
if (error)
{
free (env);
free (pattern);
return error;
}
/* Fingers crossed that the quotes worked.. */
assert (pwordexp || we.we_wordc == 1);
/* Substitute */
for (i = 0; i < we.we_wordc; i++)
if (w_addword (pwordexp, __strdup(we.we_wordv[i]))
== WRDE_NOSPACE)
break;
if (action == '=')
/* Also assign */
setenv (env, we.we_wordv[0], 1); /* need to strdup? */
wordfree (&we);
if (i < we.we_wordc)
/* Ran out of space */
goto no_space;
return 0;
}
case '+':
if (value && *value)
goto subst_word;
if (!colon_seen && value)
goto subst_word;
/* Substitute NULL */
free (env);
free (pattern);
return 0;
case '=':
if (value && *value)
/* Substitute parameter */
break;
if (!colon_seen && value)
{
/* Substitute NULL */
free (env);
free (pattern);
return 0;
}
/* This checks for '=' so it knows to assign */
goto subst_word;
default: default:
printf ("warning: parameter substitution does not yet support \"%s%c\"\n", colon_seen?":":"", action); assert (! "Unrecognised action!");
} }
} }
@ -1309,9 +1429,22 @@ envsubst:
return 0; return 0;
} }
if (substitute_length)
{
char param_length[21];
param_length[20] = '\0';
*word = w_addstr (*word, word_length, max_length,
_itoa_word (strlen (value), &param_length[20], 10, 0));
return *word ? 0 : WRDE_NOSPACE;
}
if (pwordexp == NULL) if (pwordexp == NULL)
/* Quoted - no field split */ {
*word = w_addstr (*word, word_length, max_length, value); /* Quoted - no field split */
*word = w_addstr (*word, word_length, max_length, value);
return *word ? 0 : WRDE_NOSPACE;
}
else else
{ {
/* Need to field-split */ /* Need to field-split */
@ -1331,7 +1464,7 @@ envsubst:
if (!seen_nonws_ifs && *field_begin == 0) if (!seen_nonws_ifs && *field_begin == 0)
/* Nothing but whitespace */ /* Nothing but whitespace */
return 0; break;
/* Search for the end of the field */ /* Search for the end of the field */
field_end = field_begin; field_end = field_begin;
@ -1358,22 +1491,23 @@ envsubst:
*field_end = 0; *field_end = 0;
field = __strdup (field_begin); field = __strdup (field_begin);
if (field == NULL) if (field == NULL)
goto no_space; return WRDE_NOSPACE;
/* Tag the field onto the word list */ /* Tag the field onto the word list */
if (w_addword (pwordexp, field) == WRDE_NOSPACE) if (w_addword (pwordexp, field) == WRDE_NOSPACE)
return WRDE_NOSPACE; {
free (field);
return WRDE_NOSPACE;
}
*word = NULL; *word = NULL;
*word_length = *max_length = 0; *word_length = *max_length = 0;
field_begin = next_field; field_begin = next_field;
} while (seen_nonws_ifs || (field_begin && *field_begin)); } while (seen_nonws_ifs || (field_begin && *field_begin));
return 0;
} }
return *word ? 0 : WRDE_NOSPACE; return 0;
no_space: no_space:
if (env) if (env)
@ -1658,7 +1792,7 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
*whch++ = *ifsch; *whch++ = *ifsch;
} }
ifsch++; ++ifsch;
} }
*whch = '\0'; *whch = '\0';
} }

View File

@ -16,9 +16,29 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <stdlib.h>
#include <unistd.h>
int int
__libc_start_main (int (*main) (int, char **, char **), int argc, __libc_start_main (int (*main) (int, char **, char **), int argc,
char **argv, char **envp) char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void))
{ {
return (*main) (argc, argv, envp); /* Register the destructor of the dynamic linker if there is any. */
if (rtld_fini != NULL)
atexit (rtld_fini);
/* Call the initializer of the libc. */
__libc_init_first ();
/* Set the global _environ variable correctly. */
__environ = &argv[argc + 1];
/* Call the initializer of the program. */
(*init) ();
/* Register the destructor of the program. */
atexit (fini);
exit ((*main) (argc, argv, envp));
} }

View File

@ -43,57 +43,32 @@ _start:
the outermost frame obviously. */ the outermost frame obviously. */
xorl %ebp, %ebp xorl %ebp, %ebp
/* %edx contains the address of the shared library termination /* Extract the arguments as encoded on the stack and set up
function, which we will register with `atexit' to be called by the arguments for `main': argc, argv. envp will be determined
`exit'. I suspect that on some systems, and when statically later in __libc_start_main. */
linked, this will not be set by anything to any function
pointer; hopefully it will be zero so we don't try to call
random pointers. */
testl %edx,%edx
jz .Lnofini
pushl %edx
call atexit
popl %eax /* Pop value to unused register to remove
argument from stack. */
.Lnofini:
/* Do essential libc initialization. In statically linked
programs under the GNU Hurd, this is what sets up the
arguments on the stack for the code below. */
call __libc_init_first
/* Extract the arguments and environment as encoded on the stack
and set up the arguments for `main': argc, argv, envp. */
popl %esi /* Pop the argument count. */ popl %esi /* Pop the argument count. */
leal 4(%esp,%esi,4), %eax /* envp = &argv[argc + 1] */ movl %esp, %ecx /* argv starts just at the current stack top.*/
movl %eax, _environ /* Store it in the global variable. */
movl %esp, %edx /* argv starts just at the current stack top.*/
/* Before pushing the arguments align the stack to a double word /* Before pushing the arguments align the stack to a double word
boundary to avoid penalties from misaligned accesses. Thanks boundary to avoid penalties from misaligned accesses. Thanks
to Edward Seidl <seidl@janed.com> for pointing this out. */ to Edward Seidl <seidl@janed.com> for pointing this out. */
andl $0xfffffff8, %esp andl $0xfffffff8, %esp
pushl %eax /* Push garbage because we allocate pushl %edx /* Push address of the shared library
twelve more bytes. */ termination function. */
pushl %eax /* Push third argument: envp. */ /* Push address of our own entry points to .fini and .init. */
pushl %edx /* Push second argument: argv. */ pushl $_fini
pushl $_init
pushl %ecx /* Push second argument: argv. */
pushl %esi /* Push first argument: argc. */ pushl %esi /* Push first argument: argc. */
/* Call `_init', which is the entry point to our own `.init' pushl $main
section; and register with `atexit' to have `exit' call
`_fini', which is the entry point to our own `.fini' section. */
call _init
pushl $_fini
call atexit
popl %eax
/* Call the user's main function, and exit with its value. /* Call the user's main function, and exit with its value.
But let the libc call main. */ But let the libc call main. */
movl $main, %eax
pushl %eax
call __libc_start_main call __libc_start_main
call exit
hlt /* Crash if somehow `exit' does return. */ hlt /* Crash if somehow `exit' does return. */
/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so /* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so

View File

@ -1,5 +1,5 @@
/* Low-level statistical profiling support function. Linux/i386 version. /* Low-level statistical profiling support function. Linux/i386 version.
Copyright (C) 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 1998 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
@ -19,7 +19,7 @@
#include <signal.h> #include <signal.h>
void static void
profil_counter (int signo, struct sigcontext sc) profil_counter (int signo, struct sigcontext sc)
{ {
profil_count ((void *) sc.eip); profil_count ((void *) sc.eip);

View File

@ -17,15 +17,44 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <link.h> #include <link.h>
#include <stdlib.h>
#include <unistd.h>
extern void __libc_init_first (void);
int int
__libc_start_main (int (*main) (int, char **, char **), int argc, __libc_start_main (int (*main) (int, char **, char **), int argc,
char **argv, char **envp) char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void))
{ {
/* Register the destructor of the dynamic linker if there is any. */
if (rtld_fini != NULL)
atexit (rtld_fini);
/* Call the initializer of the libc. */
#ifdef PIC
if (_dl_debug_impcalls)
_dl_debug_message ("\tinitialize libc\n\n", NULL);
#endif
__libc_init_first ();
/* Set the global _environ variable correctly. */
__environ = &argv[argc + 1];
/* Call the initializer of the program. */
#ifdef PIC
if (_dl_debug_impcalls)
_dl_debug_message ("\tinitialize program: ", argv[0], "\n\n", NULL);
#endif
(*init) ();
/* Register the destructor of the program. */
atexit (fini);
#ifdef PIC #ifdef PIC
if (_dl_debug_impcalls) if (_dl_debug_impcalls)
_dl_debug_message ("\ttransferring control: ", argv[0], "\n\n", NULL); _dl_debug_message ("\ttransferring control: ", argv[0], "\n\n", NULL);
#endif #endif
return (*main) (argc, argv, envp); exit ((*main) (argc, argv, __environ));
} }