mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-09 05:59:27 +08:00
Compare commits
191
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
133192c659 | ||
|
|
07e85a9e7e | ||
|
|
6c60c46fcd | ||
|
|
438171b5ba | ||
|
|
4a764e3d3b | ||
|
|
0b25d4905e | ||
|
|
2dd2b17df7 | ||
|
|
870eeeb6b2 | ||
|
|
582b8e86e0 | ||
|
|
bab280f93a | ||
|
|
4749ee6c81 | ||
|
|
1a1f354cd7 | ||
|
|
71e4ceb22b | ||
|
|
6f7922d89c | ||
|
|
a16d0942d7 | ||
|
|
fea444e4d2 | ||
|
|
797f8dc9d5 | ||
|
|
20ce139ac1 | ||
|
|
eb46a9a4e2 | ||
|
|
0af17c40df | ||
|
|
b9cec87760 | ||
|
|
98d289f6b6 | ||
|
|
f175ece367 | ||
|
|
a91b462b62 | ||
|
|
5e9e4d273d | ||
|
|
a7071cbe63 | ||
|
|
ceb4bfd63d | ||
|
|
1cb5fbec42 | ||
|
|
6cc0f29734 | ||
|
|
7ec30d5937 | ||
|
|
ae6f93ebf0 | ||
|
|
8fa5aed6e8 | ||
|
|
1d7d57a23c | ||
|
|
ec6bc3a6c1 | ||
|
|
c544156ecf | ||
|
|
14b1c93b79 | ||
|
|
03a5167722 | ||
|
|
d17c16a1c0 | ||
|
|
46139b3cfb | ||
|
|
ba18232742 | ||
|
|
d03cbf630d | ||
|
|
d9c42342a1 | ||
|
|
cfa805f954 | ||
|
|
c55caac80e | ||
|
|
46da0971fe | ||
|
|
c1691f4661 | ||
|
|
41e2d09648 | ||
|
|
d69e5f014e | ||
|
|
630ee40e92 | ||
|
|
637a638f30 | ||
|
|
0b4a289092 | ||
|
|
d6b95af8bb | ||
|
|
80e41ab46e | ||
|
|
f47163fad3 | ||
|
|
4bf5771c23 | ||
|
|
66284f47ac | ||
|
|
43e2ba6ef6 | ||
|
|
6227894ac9 | ||
|
|
fa8ceb1f2c | ||
|
|
2c44d7573c | ||
|
|
35d80b24e3 | ||
|
|
f6bf4da124 | ||
|
|
e22307c48b | ||
|
|
9ca318cc03 | ||
|
|
254249b29a | ||
|
|
288238a6ea | ||
|
|
5286bb7e27 | ||
|
|
94941d2212 | ||
|
|
257b878d90 | ||
|
|
0e6e45afa2 | ||
|
|
68c0fa52a2 | ||
|
|
ff48318555 | ||
|
|
daa5c348d6 | ||
|
|
b234e8652a | ||
|
|
2018d9e2ee | ||
|
|
b8d4e46167 | ||
|
|
f581e9ca08 | ||
|
|
0966931ed7 | ||
|
|
dd4831ce37 | ||
|
|
db7cdaaaa4 | ||
|
|
721869072d | ||
|
|
83bbbdd08c | ||
|
|
b44c1e14db | ||
|
|
18d41844f1 | ||
|
|
ea00844dfb | ||
|
|
59c37b6b21 | ||
|
|
f42bf1bcfa | ||
|
|
6718095b09 | ||
|
|
b41fb4250f | ||
|
|
7e165c9059 | ||
|
|
d4fff052ce | ||
|
|
22c4356832 | ||
|
|
6f69fa17e5 | ||
|
|
a23087343b | ||
|
|
ba2ccfa167 | ||
|
|
71c5289b0f | ||
|
|
1893ec6a38 | ||
|
|
e2f8a38f47 | ||
|
|
e16db41ba6 | ||
|
|
13babeb0d3 | ||
|
|
c424f2da59 | ||
|
|
cac34d519a | ||
|
|
b47d1816eb | ||
|
|
8fbe82ee26 | ||
|
|
dd23f3b0d6 | ||
|
|
3365152cb0 | ||
|
|
4b3769bc7c | ||
|
|
cf2b29bfe0 | ||
|
|
98e994340a | ||
|
|
f4a0465b69 | ||
|
|
1908c08641 | ||
|
|
31d7822815 | ||
|
|
9b5225b600 | ||
|
|
f13f1b26e4 | ||
|
|
967578d96c | ||
|
|
421dcdf3a9 | ||
|
|
87a5e8a7a4 | ||
|
|
a2a3fc55fd | ||
|
|
02f25bd59b | ||
|
|
c7b0194ac3 | ||
|
|
885ba00117 | ||
|
|
3cfcebc885 | ||
|
|
2047317f3b | ||
|
|
ac7c207f14 | ||
|
|
a18be620a1 | ||
|
|
177f9d5cd4 | ||
|
|
afc1d235b7 | ||
|
|
c293f9bc63 | ||
|
|
24ea71e942 | ||
|
|
79df061031 | ||
|
|
375676b1b6 | ||
|
|
94f1773041 | ||
|
|
77055d99e4 | ||
|
|
fb63ae13d0 | ||
|
|
44a09a3306 | ||
|
|
579749498e | ||
|
|
52cff2eeb6 | ||
|
|
94f8647f1c | ||
|
|
88f4537c77 | ||
|
|
32fff90d82 | ||
|
|
00aec83a30 | ||
|
|
ff046934fd | ||
|
|
31f43cffe0 | ||
|
|
4c2d948abe | ||
|
|
c5cb336b87 | ||
|
|
8d7899fbb6 | ||
|
|
bca9fd93a8 | ||
|
|
9f3168cf9a | ||
|
|
24a09ef771 | ||
|
|
f0427c13e4 | ||
|
|
347415b76e | ||
|
|
ff407b13b9 | ||
|
|
265ede2a16 | ||
|
|
1bdf7624dc | ||
|
|
95a5089d2f | ||
|
|
760f9f4cd0 | ||
|
|
3a1db3bf88 | ||
|
|
0b7f4318c0 | ||
|
|
3316c605ba | ||
|
|
aa8ecd3c01 | ||
|
|
d35ffac1c7 | ||
|
|
b1f911a801 | ||
|
|
5b2cfa7797 | ||
|
|
3967ae2f20 | ||
|
|
3a7c62f09a | ||
|
|
571286fe50 | ||
|
|
28b5b97f16 | ||
|
|
4db14580ca | ||
|
|
379091f89d | ||
|
|
a6a5f54f28 | ||
|
|
a06faff6c1 | ||
|
|
e3d3d6c990 | ||
|
|
00926c6660 | ||
|
|
2f54e18d8b | ||
|
|
eb3b8b2ea7 | ||
|
|
731640fc24 | ||
|
|
1f574fe0be | ||
|
|
1b4d62a18d | ||
|
|
ce328bf180 | ||
|
|
58f6951944 | ||
|
|
450867ffea | ||
|
|
992b2c400b | ||
|
|
6145c5ea69 | ||
|
|
e3f24cf1bf | ||
|
|
1217a671f4 | ||
|
|
8814d1a72e | ||
|
|
d730f1d27c | ||
|
|
2e12a92961 | ||
|
|
4f72518358 | ||
|
|
655fe31070 | ||
|
|
9652be3de8 |
@@ -0,0 +1,62 @@
|
||||
List of known bugs (certainly very incomplete)
|
||||
----------------------------------------------
|
||||
|
||||
Time-stamp: <1997-03-22T04:30:57+0100 drepper>
|
||||
|
||||
This following list contains those bugs which I'm aware of. Please
|
||||
make sure that bugs you report are not listed here. If you can fix one
|
||||
of these bugs/limitations I'll certainly be glad to receive a patch.
|
||||
|
||||
Another source of information about bugs is the problem data base of the
|
||||
GNU project. There is an easy to use WWW interface is available at
|
||||
|
||||
http://pogo.gnu.ai.mit.edu:8080/cgi-bin/wwwgnats.pl
|
||||
|
||||
I would appreciate it very much if you could verify the problem was not
|
||||
reported before by looking though the database. To make the information
|
||||
in this data as useful as possible please report bugs always using the
|
||||
`glibcbug' shell script which gets installed with GNU libc.
|
||||
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Severity: [ *] to [***]
|
||||
|
||||
|
||||
[ **] For GNU libc on Linux, there is still no solution for the UTMP
|
||||
problem.
|
||||
[Among others: PR libc/39]
|
||||
|
||||
[ **] There are problems with signal handling when using LinuxThreads.
|
||||
|
||||
[ **] The `cbrtl' function is inaccurate. The algorithm used for `double'
|
||||
and `float' is not usable for `long double'.
|
||||
|
||||
[ **] Not really a bug, but it could lead to such:
|
||||
The RPC code is ugly ugly ugly. It's more or less verbatim taken
|
||||
from Sun's code and therefore mostly lacks complete prototypes and
|
||||
(more important) the use of `const'. It *definitely* needs to be
|
||||
cleaned.
|
||||
|
||||
[ *] The precision of the `sinhl' and/or `asinhl' function do not seem
|
||||
to be the best.
|
||||
|
||||
[ *] The syslog function should print to the console if the LOG_CONS
|
||||
flag was given.
|
||||
[PR libc/72]
|
||||
|
||||
[ *] On Linux, the <linux/posix_types.h> is not clean enough to satisfy
|
||||
the C++ namespace rules. Declaring `struct fd_set' also makes
|
||||
`fd_set' available in the global namespace which conflicts with
|
||||
the definition of `fd_set' in glibc.
|
||||
[PR libc/79]
|
||||
|
||||
[ *] On Linux, there should be a way to prevent defining the symbol
|
||||
NGROUPS_MAX in the <linux/limits.h> header file. In glibc it
|
||||
is defined in <posix1_lim.h> which must not make the other
|
||||
symbols in <linux/limits.h> available.
|
||||
[PR libc/140]
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Ulrich Drepper
|
||||
drepper@cygnus.com
|
||||
@@ -550,7 +550,8 @@ by
|
||||
|
||||
in the above example specs file to make it work for other systems.
|
||||
|
||||
Future versions of GCC will automatically provide the correct specs.
|
||||
Version 2.7.2.2 does and future versions of GCC will automatically
|
||||
provide the correct specs.
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
@@ -568,12 +569,6 @@ something like this:
|
||||
GROUP ( libc.so.6 ld.so.1 libc.a )
|
||||
|
||||
|
||||
{UD} The Linux ldconfig file probably generates a link libc.so ->
|
||||
libc.so.6 in /lib. This is not correct. There must not be such a
|
||||
link. The linker script with the above contents is placed in
|
||||
/usr/lib which is enough for the linker.
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
[Q18] ``The prototypes for `connect', `accept', `getsockopt',
|
||||
`setsockopt', `getsockname', `getpeername', `send',
|
||||
@@ -603,10 +598,22 @@ invalid. I.e., an emulated FPU is for the libc as good as a real one.
|
||||
[Q20] ``How can I compile gcc 2.7.2.1 from the gcc source code using
|
||||
glibc 2.x?
|
||||
|
||||
[A20] {HJL} There is no support in gcc for glibc 2.0 before gcc 2.8. It
|
||||
is very tricky to compile gcc 2.7.2.1 using glibc 2.x. You have to
|
||||
build it manually or with one pass only. You also have to use the
|
||||
specs file in this FAQ while compiling gcc.
|
||||
[A20] {AJ} There's only support for glibc 2.0 in gcc 2.7.2.2 or later.
|
||||
For 2.7.2.2 you should use the following patch and configure for
|
||||
e.g. i486-linux.
|
||||
-----------------------------------------------------------------------
|
||||
--- configure Tue Feb 11 15:57:17 1997
|
||||
+++ configure Wed Feb 12 23:09:29 1997
|
||||
@@ -1021,7 +1021,7 @@
|
||||
gnu_ld=yes
|
||||
# GNU libc version 2 does not supply these;
|
||||
# we want them from GCC.
|
||||
- extra_parts="crtbegin.o crtend.o"
|
||||
+ extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
|
||||
;;
|
||||
i[3456]86-go32-msdos | i[3456]86-*-go32)
|
||||
cpu_type=i386
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
|
||||
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
|
||||
@@ -142,10 +142,10 @@ ifdef subdir
|
||||
|
||||
foo:=$(shell echo subdir foo >&2)
|
||||
|
||||
+tsrcs := Makefile $(+tsrcs) \
|
||||
$(addsuffix .c,$(others) $(tests)) \
|
||||
$(wildcard $(addsuffix .input,$(tests)) \
|
||||
$(addsuffix .args,$(tests)))
|
||||
+tsrcs := Makefile $(+tsrcs) \
|
||||
$(addsuffix .c,$(others) $(tests) $(test-srcs)) \
|
||||
$(wildcard $(addsuffix .input,$(tests) $(test-srcs)) \
|
||||
$(addsuffix .args,$(tests) $(test-srcs)))
|
||||
+tardeps := $(strip $(+tsrcs))
|
||||
|
||||
verbose = v
|
||||
@@ -195,9 +195,9 @@ dist.tar: README $(tardir) $(+tsrcs)
|
||||
|
||||
$(tardir).tar: dist.tar subdir_dist
|
||||
@echo Files listed here have names exceeding 14 chars.
|
||||
tar xfv $< -C /tmp | sed -n '/[^/]\{15,\}/p'
|
||||
tar covf $@ -C /tmp $(tardir)
|
||||
-rm -fr /tmp/$(tardir) dist.tar &
|
||||
tar xfv $< -C $${TMPDIR-/tmp} | sed -n '/[^/]\{15,\}/p'
|
||||
tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
|
||||
-rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
|
||||
|
||||
%.Z: %
|
||||
compress -c $< > $@
|
||||
|
||||
@@ -88,7 +88,7 @@ sources += $(foreach lib,$(extra-libs),$($(lib)-routines:=.c))
|
||||
# sysdep directories, so don't bother searching them.
|
||||
sysdep-sources := $(filter-out $(wildcard $(sources)), $(sources))
|
||||
all-sources = $(wildcard $(sort $(sources) $(sources:.c=.S) $(sources:.c=.s) \
|
||||
$(others:=.c) $(tests:=.c))) \
|
||||
$(others:=.c) $(tests:=.c) $(test-srcs:=.c))) \
|
||||
$(foreach dir,$(all-dirs),\
|
||||
$(wildcard \
|
||||
$(addprefix $(dir)/,\
|
||||
|
||||
+6
-3
@@ -239,7 +239,8 @@ endif
|
||||
# other than there, so the zoneinfo directory contains only universal data,
|
||||
# localizing the configuration data elsewhere.
|
||||
ifndef localtime-file
|
||||
localtime-file = $(inst_sysconfdir)/localtime
|
||||
localtime-file = $(sysconfdir)/localtime
|
||||
inst_localtime-file = $(install_root)$(localtime-file)
|
||||
endif
|
||||
|
||||
# What to use for leap second specifications in compiling the default
|
||||
@@ -319,10 +320,10 @@ endif
|
||||
ifndef +link
|
||||
+link = $(CC) -nostdlib -nostartfiles -o $@ \
|
||||
$(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+prector) \
|
||||
$(filter-out $(addprefix $(csu-objpfx),start.o) $(+preinit) \
|
||||
$(link-extra-libs) $(common-objpfx)libc% $(+postinit),$^) \
|
||||
$(link-extra-libs) $(link-libc) $(+postinit)
|
||||
$(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
|
||||
endif
|
||||
ifndef config-LDFLAGS
|
||||
ifeq (yes,$(build-shared))
|
||||
@@ -366,6 +367,8 @@ endif
|
||||
ifeq ($(elf),yes)
|
||||
+preinit = $(addprefix $(csu-objpfx),crti.o)
|
||||
+postinit = $(addprefix $(csu-objpfx),crtn.o)
|
||||
+prector = `$(CC) --print-file-name=crtbegin.o`
|
||||
+postctor = `$(CC) --print-file-name=crtend.o`
|
||||
endif
|
||||
csu-objpfx = $(common-objpfx)csu/
|
||||
elf-objpfx = $(common-objpfx)elf/
|
||||
|
||||
@@ -279,7 +279,7 @@ parent_echo-distinfo:
|
||||
|
||||
# Make the distribution tarfile.
|
||||
|
||||
distribute := README INSTALL FAQ NOTES NEWS PROJECTS \
|
||||
distribute := README INSTALL FAQ NOTES NEWS PROJECTS BUGS \
|
||||
COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
|
||||
Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
|
||||
extra-lib.mk o-iterator.mk \
|
||||
|
||||
@@ -339,6 +339,8 @@ $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
||||
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
|
||||
-Wl,--whole-archive $^ $(no-whole-archive) \
|
||||
$(LDLIBS-$(@F:lib%.so=%).so)
|
||||
test -z "$($(@F)-version)" || \
|
||||
(rm -f $@$($(@F)-version); $(LN_S) $(@F) $@$($(@F)-version))
|
||||
endef
|
||||
|
||||
# Don't try to use -lc when making libc.so itself.
|
||||
@@ -354,12 +356,6 @@ $(common-objpfx)libc.so: $(elfobjdir)/soinit.so \
|
||||
$(common-objpfx)libc_pic.a \
|
||||
$(elfobjdir)/sofini.so $(elfobjdir)/ld.so
|
||||
$(build-shlib)
|
||||
|
||||
ifdef libc.so-version
|
||||
$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
|
||||
rm -f $@
|
||||
ln -s $(<F) $@ || ln $< $@
|
||||
endif
|
||||
endif
|
||||
|
||||
# Some files must not be compiled with the exception handler mechanism
|
||||
@@ -403,7 +399,7 @@ endif
|
||||
|
||||
+depfiles := $(strip $(sources:.c=.d) \
|
||||
$(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.so=.o))) \
|
||||
$(addsuffix .d,$(others) $(tests)))
|
||||
$(addsuffix .d,$(others) $(tests) $(test-srcs)))
|
||||
+depfiles := $(addprefix $(objpfx),\
|
||||
$(filter-out $(addsuffix .d,$(omit-deps)),\
|
||||
$(+depfiles)))
|
||||
@@ -839,9 +835,10 @@ mostlyclean: common-mostlyclean
|
||||
|
||||
# Remove the object files.
|
||||
common-mostlyclean:
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(others) \
|
||||
$(addsuffix .o,$(tests) $(others)) \
|
||||
$(addsuffix .out,$(tests)))
|
||||
-rm -f $(addprefix $(objpfx),$(tests) $(test-srcs) $(others) \
|
||||
$(addsuffix .o,$(tests) $(test-srcs) \
|
||||
$(others)) \
|
||||
$(addsuffix .out,$(tests) $(test-srcs)))
|
||||
-rm -f $(addprefix $(objpfx),$(extra-objs) $(install-lib))
|
||||
-rm -f core $(common-objpfx)stub-$(subdir)
|
||||
$(rmobjs)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
GNU C Library NEWS -- history of user-visible changes. 26 January 1997
|
||||
GNU C Library NEWS -- history of user-visible changes. 1997-03-18
|
||||
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
@@ -14,6 +14,8 @@ Version 2.0.2
|
||||
* add atoll function
|
||||
|
||||
* fix complex problems in Berkeley DB code
|
||||
|
||||
* fix math functions
|
||||
|
||||
Version 2.0.1
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This directory contains the version 2.0.1 test release of the GNU C Library.
|
||||
This directory contains the version 2.0.2 test release of the GNU C Library.
|
||||
Many bugs have been fixed since the last release.
|
||||
Some bugs surely remain.
|
||||
|
||||
@@ -46,7 +46,7 @@ provides the Unix `crypt' function, plus some other entry points.
|
||||
Because of the United States export restriction on DES implementations,
|
||||
we are distributing this code separately from the rest of the C
|
||||
library. There is an extra distribution tar file just for crypt; it is
|
||||
called `glibc-crypt-2.0.1.tar.gz'. You can just unpack the crypt
|
||||
called `glibc-crypt-2.0.2.tar.gz'. You can just unpack the crypt
|
||||
distribution along with the rest of the C library and build; you can
|
||||
also build the library without getting crypt. Users outside the USA
|
||||
can get the crypt distribution via anonymous FTP from ftp.ifi.uio.no
|
||||
|
||||
@@ -83,19 +83,19 @@ common-generated := $(common-generated) dummy.o dummy.c empty.c empty.o
|
||||
.PHONY: others tests
|
||||
others: $(addprefix $(objpfx),$(others) $(extra-objs))
|
||||
ifeq ($(cross-compiling),yes)
|
||||
tests: $(addprefix $(objpfx),$(tests))
|
||||
tests: $(addprefix $(objpfx),$(tests) $(test-srcs))
|
||||
else
|
||||
tests: $(tests:%=$(objpfx)%.out)
|
||||
tests: $(tests:%=$(objpfx)%.out) $(addprefix $(objpfx),$(test-srcs))
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(others) $(tests))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests)): %: %.o \
|
||||
ifneq "$(strip $(others) $(tests) $(test-srcs))" ""
|
||||
$(addprefix $(objpfx),$(others) $(tests) $(test-srcs)): %: %.o \
|
||||
$(sort $(filter $(common-objpfx)libc%,$(link-libc))) \
|
||||
$(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
|
||||
$(+link)
|
||||
endif
|
||||
|
||||
ifneq "$(strip $(tests))" ""
|
||||
ifneq "$(strip $(tests) $(test-srcs))" ""
|
||||
# These are the implicit rules for making test outputs
|
||||
# from the test programs and whatever input files are present.
|
||||
$(objpfx)%.out: %.args $(objpfx)% %.input
|
||||
|
||||
+12
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -34,6 +34,7 @@ catopen (const char *cat_name, int flag)
|
||||
{
|
||||
__nl_catd result;
|
||||
const char *env_var;
|
||||
const char *nlspath;
|
||||
|
||||
result = (__nl_catd) malloc (sizeof (*result));
|
||||
if (result == NULL)
|
||||
@@ -82,8 +83,16 @@ catopen (const char *cat_name, int flag)
|
||||
return (nl_catd) -1;
|
||||
}
|
||||
|
||||
if (__secure_getenv ("NLSPATH") != NULL)
|
||||
result->nlspath = __strdup (getenv ("NLSPATH"));
|
||||
nlspath = __secure_getenv ("NLSPATH");
|
||||
if (nlspath != NULL && *nlspath != '\0')
|
||||
{
|
||||
/* Append the system dependent directory. */
|
||||
size_t len = strlen (nlspath + 1 + sizeof NLSPATH);
|
||||
char *tmp = alloca (len);
|
||||
|
||||
__stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
|
||||
nlspath = tmp;
|
||||
}
|
||||
else
|
||||
result->nlspath = __strdup (NLSPATH);
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ __big_delete(hashp, bufp)
|
||||
bufp->flags |= BUF_MOD;
|
||||
if (rbufp)
|
||||
__free_ovflpage(hashp, rbufp);
|
||||
if (last_bfp != rbufp)
|
||||
if (last_bfp && last_bfp != rbufp)
|
||||
__free_ovflpage(hashp, last_bfp);
|
||||
|
||||
hashp->NKEYS--;
|
||||
|
||||
+17
-19
@@ -1,29 +1,27 @@
|
||||
/* Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <ansidecl.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
DEFUN(alphasort, (a, b),
|
||||
CONST PTR a AND CONST PTR b)
|
||||
alphasort (const void *a, const void *b)
|
||||
{
|
||||
return strcmp (((struct dirent *) a)->d_name,
|
||||
((struct dirent *) b)->d_name);
|
||||
return strcmp ((*(const struct dirent **) a)->d_name,
|
||||
(*(const struct dirent **) b)->d_name);
|
||||
}
|
||||
|
||||
+6
-3
@@ -1,5 +1,5 @@
|
||||
/* Relocate a shared object and resolve its references to other loaded objects.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997 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
|
||||
@@ -58,8 +58,11 @@ _dl_relocate_object (struct link_map *l, struct link_map *scope[], int lazy)
|
||||
|
||||
/* This macro is used as a callback from the ELF_DYNAMIC_RELOCATE code. */
|
||||
#define RESOLVE(ref, flags) \
|
||||
(_dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
||||
l->l_name, flags))
|
||||
(((*ref)->st_shndx != SHN_UNDEF && \
|
||||
ELFW(ST_BIND) ((*ref)->st_info) == STB_LOCAL) \
|
||||
? l->l_addr \
|
||||
: _dl_lookup_symbol (strtab + (*ref)->st_name, ref, scope, \
|
||||
l->l_name, flags))
|
||||
|
||||
#include "dynamic-link.h"
|
||||
ELF_DYNAMIC_RELOCATE (l, lazy);
|
||||
|
||||
@@ -18,13 +18,17 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LINK_H
|
||||
|
||||
#define _LINK_H 1
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
#include <elf.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* We use this macro to refer to ELF types independent of the native wordsize.
|
||||
`ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */
|
||||
#define ElfW(type) _ElfW (Elf, __ELF_NATIVE_CLASS, type)
|
||||
@@ -340,5 +344,6 @@ extern void _dl_debug_state (void);
|
||||
in the `r_ldbase' member. Returns the address of the structure. */
|
||||
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* link.h */
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ sed -e "
|
||||
/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
|
||||
" $TEMP > $TEMP.x
|
||||
|
||||
if $MAIL_AGENT $BUGGLIBC < $TEMP.x; then
|
||||
if $MAIL_AGENT < $TEMP.x; then
|
||||
echo "$COMMAND: problem report sent"
|
||||
xs=0; exit
|
||||
else
|
||||
|
||||
+58
-36
@@ -34,6 +34,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/gmon.h>
|
||||
#include <sys/gmon_out.h>
|
||||
#include <sys/uio.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
@@ -165,21 +166,26 @@ static void
|
||||
write_hist (fd)
|
||||
int fd;
|
||||
{
|
||||
const u_char tag = GMON_TAG_TIME_HIST;
|
||||
struct gmon_hist_hdr thdr;
|
||||
u_char tag = GMON_TAG_TIME_HIST;
|
||||
struct gmon_hist_hdr thdr __attribute__ ((aligned (__alignof__ (char *))));
|
||||
|
||||
if (_gmonparam.kcountsize > 0)
|
||||
{
|
||||
thdr.low_pc = _gmonparam.lowpc;
|
||||
thdr.high_pc = _gmonparam.highpc;
|
||||
thdr.hist_size = _gmonparam.kcountsize / sizeof(HISTCOUNTER);
|
||||
thdr.prof_rate = __profile_frequency();
|
||||
strncpy(thdr.dimen, "seconds", sizeof(thdr.dimen));
|
||||
struct iovec iov[3] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &thdr, sizeof (struct gmon_hist_hdr) },
|
||||
{ _gmonparam.kcount, _gmonparam.kcountsize }
|
||||
};
|
||||
|
||||
*(char **) thdr.low_pc = (char *) _gmonparam.lowpc;
|
||||
*(char **) thdr.high_pc = (char *) _gmonparam.highpc;
|
||||
*(int *) thdr.hist_size = _gmonparam.kcountsize / sizeof (HISTCOUNTER);
|
||||
*(int *) thdr.prof_rate = __profile_frequency ();
|
||||
strncpy (thdr.dimen, "seconds", sizeof (thdr.dimen));
|
||||
thdr.dimen_abbrev = 's';
|
||||
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &thdr, sizeof(thdr));
|
||||
write(fd, _gmonparam.kcount, _gmonparam.kcountsize);
|
||||
__writev (fd, iov, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +194,19 @@ static void
|
||||
write_call_graph (fd)
|
||||
int fd;
|
||||
{
|
||||
const u_char tag = GMON_TAG_CG_ARC;
|
||||
struct gmon_cg_arc_record raw_arc;
|
||||
u_char tag = GMON_TAG_CG_ARC;
|
||||
struct gmon_cg_arc_record raw_arc
|
||||
__attribute__ ((aligned (__alignof__ (char*))));
|
||||
int from_index, to_index, from_len;
|
||||
u_long frompc;
|
||||
|
||||
from_len = _gmonparam.fromssize / sizeof(*_gmonparam.froms);
|
||||
struct iovec iov[2] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &raw_arc, sizeof (struct gmon_cg_arc_record) }
|
||||
};
|
||||
|
||||
from_len = _gmonparam.fromssize / sizeof (*_gmonparam.froms);
|
||||
for (from_index = 0; from_index < from_len; ++from_index)
|
||||
{
|
||||
if (_gmonparam.froms[from_index] == 0)
|
||||
@@ -201,17 +214,16 @@ write_call_graph (fd)
|
||||
|
||||
frompc = _gmonparam.lowpc;
|
||||
frompc += (from_index * _gmonparam.hashfraction
|
||||
* sizeof(*_gmonparam.froms));
|
||||
* sizeof (*_gmonparam.froms));
|
||||
for (to_index = _gmonparam.froms[from_index];
|
||||
to_index != 0;
|
||||
to_index = _gmonparam.tos[to_index].link)
|
||||
{
|
||||
raw_arc.from_pc = frompc;
|
||||
raw_arc.self_pc = _gmonparam.tos[to_index].selfpc;
|
||||
raw_arc.count = _gmonparam.tos[to_index].count;
|
||||
*(char **) raw_arc.from_pc = (char *)frompc;
|
||||
*(char **) raw_arc.self_pc = (char *)_gmonparam.tos[to_index].selfpc;
|
||||
*(int *) raw_arc.count = _gmonparam.tos[to_index].count;
|
||||
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &raw_arc, sizeof(raw_arc));
|
||||
__writev (fd, iov, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,22 +234,32 @@ write_bb_counts (fd)
|
||||
int fd;
|
||||
{
|
||||
struct __bb *grp;
|
||||
const u_char tag = GMON_TAG_BB_COUNT;
|
||||
u_char tag = GMON_TAG_BB_COUNT;
|
||||
int ncounts;
|
||||
int i;
|
||||
|
||||
struct iovec bbhead[2] =
|
||||
{
|
||||
{ &tag, sizeof (tag) },
|
||||
{ &ncounts, sizeof (ncounts) }
|
||||
};
|
||||
struct iovec bbbody[2];
|
||||
|
||||
bbbody[0].iov_len = sizeof (grp->addresses[0]);
|
||||
bbbody[1].iov_len = sizeof (grp->addresses[0]);
|
||||
|
||||
/* Write each group of basic-block info (all basic-blocks in a
|
||||
compilation unit form a single group). */
|
||||
|
||||
for (grp = __bb_head; grp; grp = grp->next)
|
||||
{
|
||||
ncounts = grp->ncounts;
|
||||
write(fd, &tag, sizeof(tag));
|
||||
write(fd, &ncounts, sizeof(ncounts));
|
||||
__writev (fd, bbhead, 2);
|
||||
for (i = 0; i < ncounts; ++i)
|
||||
{
|
||||
write(fd, &grp->addresses[i], sizeof(grp->addresses[0]));
|
||||
write(fd, &grp->counts[i], sizeof(grp->counts[0]));
|
||||
bbbody[0].iov_base = (char *) &grp->addresses[i];
|
||||
bbbody[1].iov_base = &grp->counts[i];
|
||||
__writev (fd, bbbody, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,31 +268,31 @@ write_bb_counts (fd)
|
||||
void
|
||||
_mcleanup ()
|
||||
{
|
||||
struct gmon_hdr ghdr;
|
||||
struct gmon_hdr ghdr __attribute__ ((aligned (__alignof__ (int))));
|
||||
int fd;
|
||||
|
||||
moncontrol(0);
|
||||
fd = open("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
moncontrol (0);
|
||||
fd = __open ("gmon.out", O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
if (fd < 0)
|
||||
{
|
||||
perror("_mcleanup: gmon.out");
|
||||
perror ("_mcleanup: gmon.out");
|
||||
return;
|
||||
}
|
||||
|
||||
/* write gmon.out header: */
|
||||
memset(&ghdr, 0, sizeof(ghdr));
|
||||
memcpy(&ghdr.cookie[0], GMON_MAGIC, sizeof(ghdr.cookie));
|
||||
ghdr.version = GMON_VERSION;
|
||||
write(fd, &ghdr, sizeof(ghdr));
|
||||
memset (&ghdr, 0, sizeof (struct gmon_hdr));
|
||||
memcpy (&ghdr.cookie[0], GMON_MAGIC, sizeof (ghdr.cookie));
|
||||
*(int *) ghdr.version = GMON_VERSION;
|
||||
__write (fd, &ghdr, sizeof (struct gmon_hdr));
|
||||
|
||||
/* write PC histogram: */
|
||||
write_hist(fd);
|
||||
write_hist (fd);
|
||||
|
||||
/* write call-graph: */
|
||||
write_call_graph(fd);
|
||||
write_call_graph (fd);
|
||||
|
||||
/* write basic-block execution counts: */
|
||||
write_bb_counts(fd);
|
||||
write_bb_counts (fd);
|
||||
|
||||
close(fd);
|
||||
__close (fd);
|
||||
}
|
||||
|
||||
+27
-21
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by David Mosberger <davidm@cs.arizona.edu>.
|
||||
|
||||
@@ -40,30 +40,36 @@ __BEGIN_DECLS
|
||||
* always comes first in gmon.out and is then followed by a series
|
||||
* records defined below.
|
||||
*/
|
||||
struct gmon_hdr {
|
||||
char cookie[4];
|
||||
int version;
|
||||
int spare[3];
|
||||
};
|
||||
struct gmon_hdr
|
||||
{
|
||||
char cookie[4];
|
||||
char version[4];
|
||||
char spare[3 * 4];
|
||||
};
|
||||
|
||||
/* types of records in this file: */
|
||||
typedef enum {
|
||||
GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
|
||||
} GMON_Record_Tag;
|
||||
typedef enum
|
||||
{
|
||||
GMON_TAG_TIME_HIST = 0,
|
||||
GMON_TAG_CG_ARC = 1,
|
||||
GMON_TAG_BB_COUNT = 2
|
||||
} GMON_Record_Tag;
|
||||
|
||||
struct gmon_hist_hdr {
|
||||
unsigned long low_pc; /* base pc address of sample buffer */
|
||||
unsigned long high_pc; /* max pc address of sampled buffer */
|
||||
int hist_size; /* size of sample buffer */
|
||||
int prof_rate; /* profiling clock rate */
|
||||
char dimen[15]; /* phys. dim., usually "seconds" */
|
||||
char dimen_abbrev; /* usually 's' for "seconds" */
|
||||
};
|
||||
struct gmon_hist_hdr
|
||||
{
|
||||
char low_pc[sizeof (char *)]; /* base pc address of sample buffer */
|
||||
char high_pc[sizeof (char *)]; /* max pc address of sampled buffer */
|
||||
char hist_size[4]; /* size of sample buffer */
|
||||
char prof_rate[4]; /* profiling clock rate */
|
||||
char dimen[15]; /* phys. dim., usually "seconds" */
|
||||
char dimen_abbrev; /* usually 's' for "seconds" */
|
||||
};
|
||||
|
||||
struct gmon_cg_arc_record {
|
||||
unsigned long from_pc; /* address within caller's body */
|
||||
unsigned long self_pc; /* address within callee's body */
|
||||
int count; /* number of arc traversals */
|
||||
struct gmon_cg_arc_record
|
||||
{
|
||||
char from_pc[sizeof (char *)]; /* address within caller's body */
|
||||
char self_pc[sizeof (char *)]; /* address within callee's body */
|
||||
char count[4]; /* number of arc traversals */
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
+22
-17
@@ -1,22 +1,21 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <ansidecl.h>
|
||||
#include <unistd.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
@@ -24,7 +23,7 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Change the current root directory to FD. */
|
||||
int
|
||||
DEFUN(fchroot, (fd), int fd)
|
||||
fchroot (int fd)
|
||||
{
|
||||
error_t err;
|
||||
file_t dir;
|
||||
@@ -36,7 +35,13 @@ DEFUN(fchroot, (fd), int fd)
|
||||
}));
|
||||
|
||||
if (! err)
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], dir);
|
||||
{
|
||||
file_t root;
|
||||
err = __file_reparent (dir, MACH_PORT_NULL, &root);
|
||||
__mach_port_deallocate (__mach_task_self (), dir);
|
||||
if (! err)
|
||||
_hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], root);
|
||||
}
|
||||
|
||||
return err ? __hurd_fail (err) : 0;
|
||||
}
|
||||
|
||||
+17
-16
@@ -1,26 +1,27 @@
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1992, 1994, 1995, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <hurd.h>
|
||||
|
||||
/* This is initialized in dtable.c when that gets linked in.
|
||||
If dtable.c is not linked in, it will be zero. */
|
||||
file_t (*_hurd_getdport_fn) (int fd);
|
||||
static file_t (*_default_hurd_getdport_fn) (int fd) = 0;
|
||||
weak_alias (_default_hurd_getdport_fn, _hurd_getdport_fn)
|
||||
|
||||
file_t
|
||||
__getdport (int fd)
|
||||
@@ -43,7 +44,7 @@ __getdport (int fd)
|
||||
errno = EBADF;
|
||||
return MACH_PORT_NULL;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
__mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd],
|
||||
MACH_PORT_RIGHT_SEND, 1);
|
||||
|
||||
+23
-17
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1993, 1994, 1995, 1996, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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. */
|
||||
|
||||
#ifndef _HURD_H
|
||||
|
||||
@@ -109,11 +109,10 @@ extern pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
|
||||
extern int _hurd_orphaned;
|
||||
|
||||
/* This variable is incremented every time the process IDs change. */
|
||||
|
||||
unsigned int _hurd_pids_changed_stamp;
|
||||
extern unsigned int _hurd_pids_changed_stamp;
|
||||
|
||||
/* This condition is broadcast every time the process IDs change. */
|
||||
struct condition _hurd_pids_changed_sync;
|
||||
extern struct condition _hurd_pids_changed_sync;
|
||||
|
||||
/* Unix `data break', for brk and sbrk.
|
||||
If brk and sbrk are not used, this info will not be initialized or used. */
|
||||
@@ -304,4 +303,11 @@ extern int hurd_check_cancel (void);
|
||||
extern io_t __getdport (int fd), getdport (int fd);
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
|
||||
according to the format string FORMAT, using the argument list in ARG. */
|
||||
int vpprintf (io_t port, const char *format, va_list arg);
|
||||
|
||||
|
||||
#endif /* hurd.h */
|
||||
|
||||
+16
-15
@@ -1,21 +1,21 @@
|
||||
/* Internal per-thread variables for the Hurd.
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1994, 1995, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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. */
|
||||
|
||||
#ifndef _HURD_THREADVAR_H
|
||||
#define _HURD_THREADVAR_H
|
||||
@@ -33,7 +33,7 @@ Cambridge, MA 02139, USA. */
|
||||
stack pointer is ignored; and __hurd_threadvar_stack_offset gives the
|
||||
address of a small allocated region which contains the variables for the
|
||||
single thread. */
|
||||
|
||||
|
||||
extern unsigned long int __hurd_threadvar_stack_mask;
|
||||
extern unsigned long int __hurd_threadvar_stack_offset;
|
||||
|
||||
@@ -60,6 +60,7 @@ enum __hurd_threadvar_index
|
||||
_HURD_THREADVAR_ERRNO, /* `errno' value for this thread. */
|
||||
_HURD_THREADVAR_SIGSTATE, /* This thread's `struct hurd_sigstate'. */
|
||||
_HURD_THREADVAR_DYNAMIC_USER, /* Dynamically-assigned user variables. */
|
||||
_HURD_THREADVAR_MALLOC, /* For use of malloc. */
|
||||
_HURD_THREADVAR_MAX /* Default value for __hurd_threadvar_max. */
|
||||
};
|
||||
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/* Handle faults in the signal thread.
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996, 1997 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
|
||||
@@ -31,6 +31,9 @@
|
||||
jmp_buf _hurdsig_fault_env;
|
||||
struct hurd_signal_preemptor _hurdsig_fault_preemptor;
|
||||
|
||||
/* XXX temporary to deal with spelling fix */
|
||||
weak_alias (_hurdsig_fault_preemptor, _hurdsig_fault_preempter)
|
||||
|
||||
static mach_port_t forward_sigexc;
|
||||
|
||||
kern_return_t
|
||||
|
||||
+16
-14
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 93, 94, 95, 96, 97 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
@@ -31,7 +31,9 @@ struct hurd_port *_hurd_ports;
|
||||
unsigned int _hurd_nports;
|
||||
mode_t _hurd_umask;
|
||||
sigset_t _hurdsig_traced;
|
||||
|
||||
char **__libc_argv;
|
||||
int __libc_argc;
|
||||
|
||||
|
||||
error_t
|
||||
|
||||
+9
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
|
||||
@@ -39,6 +39,11 @@ thread_t _hurd_msgport_thread;
|
||||
/* Thread which receives task-global signals. */
|
||||
thread_t _hurd_sigthread;
|
||||
|
||||
/* These are set up by _hurdsig_init. */
|
||||
unsigned long int __hurd_sigthread_stack_base;
|
||||
unsigned long int __hurd_sigthread_stack_end;
|
||||
unsigned long int *__hurd_sigthread_variables;
|
||||
|
||||
/* Linked-list of per-thread signal state. */
|
||||
struct hurd_sigstate *_hurd_sigstates;
|
||||
|
||||
@@ -424,6 +429,9 @@ abort_all_rpcs (int signo, struct machine_thread_all_state *state, int live)
|
||||
struct hurd_signal_preemptor *_hurdsig_preemptors;
|
||||
sigset_t _hurdsig_preempted_set;
|
||||
|
||||
/* XXX temporary to deal with spelling fix */
|
||||
weak_alias (_hurdsig_preemptors, _hurdsig_preempters)
|
||||
|
||||
/* Mask of stop signals. */
|
||||
#define STOPSIGS (sigmask (SIGTTIN) | sigmask (SIGTTOU) | \
|
||||
sigmask (SIGSTOP) | sigmask (SIGTSTP))
|
||||
|
||||
+14
-23
@@ -1,21 +1,21 @@
|
||||
/* Initial program startup for running under the GNU Hurd.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <stdlib.h>
|
||||
@@ -35,15 +35,6 @@ Cambridge, MA 02139, USA. */
|
||||
mach_port_t *_hurd_init_dtable;
|
||||
mach_msg_type_number_t _hurd_init_dtablesize;
|
||||
|
||||
unsigned int __hurd_threadvar_max;
|
||||
unsigned long int __hurd_threadvar_stack_mask;
|
||||
unsigned long int __hurd_threadvar_stack_offset;
|
||||
|
||||
/* These are set up by _hurdsig_init. */
|
||||
unsigned long int __hurd_sigthread_stack_base;
|
||||
unsigned long int __hurd_sigthread_stack_end;
|
||||
unsigned long int *__hurd_sigthread_variables;
|
||||
|
||||
extern void __mach_init (void);
|
||||
|
||||
/* Entry point. This is the first thing in the text segment.
|
||||
|
||||
+24
-17
@@ -1,21 +1,21 @@
|
||||
/* Report on what a thread in our task is waiting for.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <hurd.h>
|
||||
#include <hurd/signal.h>
|
||||
@@ -93,8 +93,15 @@ describe_port (string_t description, mach_port_t port)
|
||||
}
|
||||
|
||||
|
||||
/* Common defn so we don't link in the itimer code unnecessarily. */
|
||||
thread_t _hurd_itimer_thread; /* XXX */
|
||||
/* We want _HURD_ITIMER_THREAD, but don't want to link in the itimer code
|
||||
unnecessarily. */
|
||||
#if 0 /* libc.so.0.0 needs this defined, so make it a weak alias for now. */
|
||||
extern thread_t _hurd_itimer_thread; /* XXX */
|
||||
weak_extern (_hurd_itimer_thread)
|
||||
#else
|
||||
static thread_t default_hurd_itimer_thread;
|
||||
weak_alias (default_hurd_itimer_thread, _hurd_itimer_thread)
|
||||
#endif
|
||||
|
||||
kern_return_t
|
||||
_S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
@@ -105,7 +112,7 @@ _S_msg_report_wait (mach_port_t msgport, thread_t thread,
|
||||
if (thread == _hurd_msgport_thread)
|
||||
/* Cute. */
|
||||
strcpy (description, "msgport");
|
||||
else if (thread == _hurd_itimer_thread)
|
||||
else if (&_hurd_msgport_thread && thread == _hurd_itimer_thread)
|
||||
strcpy (description, "itimer");
|
||||
else
|
||||
{
|
||||
|
||||
+15
-15
@@ -1,21 +1,21 @@
|
||||
/* Set a host configuration item kept as the whole contents of a file.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <fcntl.h>
|
||||
#include <hurd.h>
|
||||
@@ -28,7 +28,7 @@ _hurd_set_host_config (const char *item, const char *value, size_t valuelen)
|
||||
mach_msg_type_number_t nwrote;
|
||||
file_t new, dir;
|
||||
|
||||
dir = __file_name_split (item, &item);
|
||||
dir = __file_name_split (item, (char **)&item);
|
||||
if (dir == MACH_PORT_NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
+23
-22
@@ -1,30 +1,30 @@
|
||||
/* Copyright (C) 1991, 1994 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1991, 1994, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <ansidecl.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <hurd.h>
|
||||
|
||||
static ssize_t
|
||||
DEFUN(pwrite, (cookie, buf, n),
|
||||
PTR cookie AND CONST char *buf AND size_t n)
|
||||
pwrite (void *cookie,
|
||||
const char *buf,
|
||||
size_t n)
|
||||
{
|
||||
error_t error = __io_write ((io_t) cookie, buf, n, -1,
|
||||
(mach_msg_type_number_t *) &n);
|
||||
@@ -37,24 +37,25 @@ DEFUN(pwrite, (cookie, buf, n),
|
||||
/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
|
||||
according to the format string FORMAT, using the argument list in ARG. */
|
||||
int
|
||||
DEFUN(vpprintf, (port, format, arg),
|
||||
io_t port AND CONST char *format AND va_list arg)
|
||||
vpprintf (io_t port,
|
||||
const char *format,
|
||||
va_list arg)
|
||||
{
|
||||
int done;
|
||||
FILE f;
|
||||
|
||||
/* Create an unbuffered stream talking to PORT on the stack. */
|
||||
memset((PTR) &f, 0, sizeof(f));
|
||||
memset ((void *) &f, 0, sizeof (f));
|
||||
f.__magic = _IOMAGIC;
|
||||
f.__mode.__write = 1;
|
||||
f.__cookie = (PTR) port;
|
||||
f.__cookie = (void *) port;
|
||||
f.__room_funcs = __default_room_functions;
|
||||
f.__io_funcs.__write = pwrite;
|
||||
f.__seen = 1;
|
||||
f.__userbuf = 1;
|
||||
|
||||
/* vfprintf will use a buffer on the stack for the life of the call. */
|
||||
done = vfprintf(&f, format, arg);
|
||||
done = vfprintf (&f, format, arg);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
+29
-23
@@ -1,21 +1,21 @@
|
||||
/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1996, 1997 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 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.
|
||||
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. */
|
||||
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. */
|
||||
|
||||
#ifndef __NETINET_ETHER_H
|
||||
|
||||
@@ -25,24 +25,30 @@ Boston, MA 02111-1307, USA. */
|
||||
/* Get definition of `struct ether_addr'. */
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Convert 48 bit Ethernet ADDRess to ASCII. */
|
||||
char *ether_ntoa __P ((const struct ether_addr *__addr));
|
||||
char *ether_ntoa_r __P ((const struct ether_addr *__addr, char *__buf));
|
||||
extern char *ether_ntoa __P ((__const struct ether_addr *__addr));
|
||||
extern char *ether_ntoa_r __P ((__const struct ether_addr *__addr,
|
||||
char *__buf));
|
||||
|
||||
/* Convert ASCII string S to 48 bit Ethernet address. */
|
||||
struct ether_addr *ether_aton __P ((const char *__asc));
|
||||
struct ether_addr *ether_aton_r __P ((const char *__asc,
|
||||
struct ether_addr *__addr));
|
||||
extern struct ether_addr *ether_aton __P ((__const char *__asc));
|
||||
extern struct ether_addr *ether_aton_r __P ((__const char *__asc,
|
||||
struct ether_addr *__addr));
|
||||
|
||||
/* Map 48 bit Ethernet number ADDR to HOSTNAME. */
|
||||
int ether_ntohost __P ((char *__hostname, const struct ether_addr *__addr));
|
||||
extern int ether_ntohost __P ((char *__hostname,
|
||||
__const struct ether_addr *__addr));
|
||||
|
||||
/* Map HOSTNAME to 48 bit Ethernet address. */
|
||||
int ether_hostton __P ((const char *__hostname, struct ether_addr *__addr));
|
||||
extern int ether_hostton __P ((__const char *__hostname,
|
||||
struct ether_addr *__addr));
|
||||
|
||||
/* Scan LINE and set ADDR and HOSTNAME. */
|
||||
int ether_line __P ((const char *__line, struct ether_addr *__addr,
|
||||
char *__hostname));
|
||||
extern int ether_line __P ((__const char *__line, struct ether_addr *__addr,
|
||||
char *__hostname));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* netinet/ether.h */
|
||||
|
||||
+11
-7
@@ -306,7 +306,6 @@ iruserok(raddr, superuser, ruser, luser)
|
||||
struct stat sbuf;
|
||||
struct passwd pwdbuf, *pwd;
|
||||
FILE *hostf;
|
||||
uid_t uid;
|
||||
int first;
|
||||
|
||||
first = 1;
|
||||
@@ -326,7 +325,7 @@ again:
|
||||
char *buffer = __alloca (buflen);
|
||||
|
||||
first = 0;
|
||||
if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
|
||||
if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) < 0)
|
||||
return -1;
|
||||
|
||||
dirlen = strlen (pwd->pw_dir);
|
||||
@@ -339,10 +338,15 @@ again:
|
||||
* reading an NFS mounted file system, can't read files that
|
||||
* are protected read/write owner only.
|
||||
*/
|
||||
uid = geteuid();
|
||||
(void)seteuid(pwd->pw_uid);
|
||||
hostf = fopen(pbuf, "r");
|
||||
(void)seteuid(uid);
|
||||
if (__euidaccess (pbuf, R_OK) != 0)
|
||||
hostf = NULL;
|
||||
else
|
||||
{
|
||||
uid_t uid = geteuid ();
|
||||
seteuid (pwd->pw_uid);
|
||||
hostf = fopen (pbuf, "r");
|
||||
seteuid (uid);
|
||||
}
|
||||
|
||||
if (hostf == NULL)
|
||||
return (-1);
|
||||
@@ -390,7 +394,7 @@ __ivaliduser(hostf, raddr, luser, ruser)
|
||||
size_t bufsize = 0;
|
||||
ssize_t nread;
|
||||
|
||||
while ((nread = getline (&buf, &bufsize, hostf)) > 0) {
|
||||
while ((nread = __getline (&buf, &bufsize, hostf)) > 0) {
|
||||
buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */
|
||||
p = buf;
|
||||
while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
|
||||
|
||||
+2
-1
@@ -206,7 +206,8 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
|
||||
? strlen (modifier) + 1 : 0)
|
||||
+ ((mask & CEN_SPECIAL) != 0
|
||||
? strlen (special) + 1 : 0)
|
||||
+ ((mask & (CEN_SPONSOR | CEN_REVISION) != 0)
|
||||
+ (((mask & CEN_SPONSOR) != 0
|
||||
|| (mask & CEN_REVISION) != 0)
|
||||
? (1 + ((mask & CEN_SPONSOR) != 0
|
||||
? strlen (sponsor) + 1 : 0)
|
||||
+ ((mask & CEN_REVISION) != 0
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#define _FTW_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <statbuf.h>
|
||||
|
||||
/* The FLAG argument to the user function passed to ftw. */
|
||||
@@ -41,4 +43,6 @@ extern int ftw __P ((__const char *__dir,
|
||||
int __flag),
|
||||
int __descriptors));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ftw.h */
|
||||
|
||||
+3
-3
@@ -138,8 +138,8 @@ DEFUN(_IO_file_close_it, (fp),
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN(_IO_file_finish, (fp),
|
||||
register _IO_FILE* fp)
|
||||
DEFUN(_IO_file_finish, (fp, dummy),
|
||||
register _IO_FILE* fp AND int dummy)
|
||||
{
|
||||
if (_IO_file_is_open(fp))
|
||||
{
|
||||
@@ -147,7 +147,7 @@ DEFUN(_IO_file_finish, (fp),
|
||||
if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
|
||||
_IO_SYSCLOSE (fp);
|
||||
}
|
||||
_IO_default_finish(fp);
|
||||
_IO_default_finish(fp, 0);
|
||||
}
|
||||
|
||||
_IO_FILE *
|
||||
|
||||
+2
-2
@@ -481,8 +481,8 @@ DEFUN(_IO_default_sync, (fp),
|
||||
current implementation, this function can get called twice! */
|
||||
|
||||
void
|
||||
DEFUN(_IO_default_finish, (fp),
|
||||
_IO_FILE *fp)
|
||||
DEFUN(_IO_default_finish, (fp, dummy),
|
||||
_IO_FILE *fp AND int dummy)
|
||||
{
|
||||
struct _IO_marker *mark;
|
||||
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
|
||||
|
||||
+5
-5
@@ -101,8 +101,8 @@ extern "C" {
|
||||
/* The 'finish' function does any final cleaning up of an _IO_FILE object.
|
||||
It does not delete (free) it, but does everything else to finalize it/
|
||||
It matches the streambuf::~streambuf virtual destructor. */
|
||||
typedef void (*_IO_finish_t) __P((_IO_FILE*)); /* finalize */
|
||||
#define _IO_FINISH(FP) JUMP0(__finish, FP)
|
||||
typedef void (*_IO_finish_t) __P((_IO_FILE*, int)); /* finalize */
|
||||
#define _IO_FINISH(FP) JUMP1(__finish, FP, 0)
|
||||
|
||||
/* The 'overflow' hook flushes the buffer.
|
||||
The second argument is a character, or EOF.
|
||||
@@ -295,7 +295,7 @@ extern int _IO_seekmark __P((_IO_FILE *, struct _IO_marker *, int));
|
||||
extern int _IO_default_underflow __P((_IO_FILE*));
|
||||
extern int _IO_default_uflow __P((_IO_FILE*));
|
||||
extern int _IO_default_doallocate __P((_IO_FILE*));
|
||||
extern void _IO_default_finish __P((_IO_FILE *));
|
||||
extern void _IO_default_finish __P((_IO_FILE *, int));
|
||||
extern int _IO_default_pbackfail __P((_IO_FILE*, int));
|
||||
extern _IO_FILE* _IO_default_setbuf __P((_IO_FILE *, char*, _IO_ssize_t));
|
||||
extern _IO_size_t _IO_default_xsputn __P((_IO_FILE *, const void*, _IO_size_t));
|
||||
@@ -352,7 +352,7 @@ extern _IO_ssize_t _IO_file_read __P((_IO_FILE*, void*, _IO_ssize_t));
|
||||
extern int _IO_file_sync __P((_IO_FILE*));
|
||||
extern int _IO_file_close_it __P((_IO_FILE*));
|
||||
extern _IO_fpos_t _IO_file_seek __P((_IO_FILE *, _IO_off_t, int));
|
||||
extern void _IO_file_finish __P((_IO_FILE*));
|
||||
extern void _IO_file_finish __P((_IO_FILE*, int));
|
||||
|
||||
/* Other file functions. */
|
||||
extern _IO_FILE* _IO_file_attach __P((_IO_FILE *, int));
|
||||
@@ -366,7 +366,7 @@ extern int _IO_str_underflow __P((_IO_FILE*));
|
||||
extern int _IO_str_overflow __P((_IO_FILE *, int));
|
||||
extern int _IO_str_pbackfail __P((_IO_FILE*, int));
|
||||
extern _IO_fpos_t _IO_str_seekoff __P((_IO_FILE*,_IO_off_t,int,int));
|
||||
extern void _IO_str_finish __P ((_IO_FILE*));
|
||||
extern void _IO_str_finish __P ((_IO_FILE*, int));
|
||||
|
||||
/* Other strfile functions */
|
||||
extern void _IO_str_init_static __P((_IO_FILE *, char*, int, char*));
|
||||
|
||||
+18
-17
@@ -1,20 +1,20 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1995, 1996, 1997 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 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.
|
||||
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. */
|
||||
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 "libioP.h"
|
||||
#include "strfile.h"
|
||||
@@ -31,7 +31,7 @@ struct _IO_FILE_memstream
|
||||
|
||||
|
||||
static int _IO_mem_sync __P ((_IO_FILE* fp));
|
||||
static void _IO_mem_finish __P ((_IO_FILE* fp));
|
||||
static void _IO_mem_finish __P ((_IO_FILE* fp, int));
|
||||
|
||||
|
||||
static const struct _IO_jump_t _IO_mem_jumps =
|
||||
@@ -124,8 +124,9 @@ _IO_mem_sync (fp)
|
||||
|
||||
|
||||
static void
|
||||
_IO_mem_finish (fp)
|
||||
_IO_mem_finish (fp, dummy)
|
||||
_IO_FILE* fp;
|
||||
int dummy;
|
||||
{
|
||||
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
|
||||
|
||||
@@ -139,5 +140,5 @@ _IO_mem_finish (fp)
|
||||
|
||||
fp->_IO_buf_base = NULL;
|
||||
|
||||
_IO_default_finish (fp);
|
||||
_IO_default_finish (fp, 0);
|
||||
}
|
||||
|
||||
+3
-3
@@ -258,14 +258,14 @@ DEFUN(_IO_str_pbackfail, (fp, c),
|
||||
}
|
||||
|
||||
void
|
||||
DEFUN (_IO_str_finish, (fp),
|
||||
register _IO_FILE* fp)
|
||||
DEFUN (_IO_str_finish, (fp, dummy),
|
||||
register _IO_FILE* fp AND int dummy)
|
||||
{
|
||||
if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF))
|
||||
(((_IO_strfile*)fp)->_s._free_buffer)(fp->_IO_buf_base);
|
||||
fp->_IO_buf_base = NULL;
|
||||
|
||||
_IO_default_finish(fp);
|
||||
_IO_default_finish(fp, 0);
|
||||
}
|
||||
|
||||
struct _IO_jump_t _IO_str_jumps = {
|
||||
|
||||
+2
-1
@@ -26,7 +26,7 @@ const struct locale_data _nl_C_LC_TIME =
|
||||
{
|
||||
_nl_C_name,
|
||||
NULL, 0, /* no file mapped */
|
||||
53,
|
||||
54,
|
||||
{
|
||||
{ string: "Sun" },
|
||||
{ string: "Mon" },
|
||||
@@ -79,6 +79,7 @@ const struct locale_data _nl_C_LC_TIME =
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
{ word: 0 },
|
||||
{ word: 0 },
|
||||
{ string: "" },
|
||||
{ string: "" },
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ charmap_read (const char *filename)
|
||||
|
||||
result = parse_charmap (pathnfile);
|
||||
|
||||
if (result == NULL)
|
||||
if (result == NULL && !be_quiet)
|
||||
error (0, errno, _("character map file `%s' not found"), filename);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ parse_charmap (const char *filename)
|
||||
result->mb_cur_max = 1;
|
||||
if (result->mb_cur_min == 0)
|
||||
result->mb_cur_min = result->mb_cur_max;
|
||||
if (result->mb_cur_min > result->mb_cur_max)
|
||||
if (result->mb_cur_min > result->mb_cur_max && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
%s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
|
||||
@@ -596,7 +596,7 @@ only WIDTH definitions are allowed to follow the CHARMAP definition"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (state != 91)
|
||||
if (state != 91 && !be_quiet)
|
||||
error (0, 0, _("%s: premature end of file"), cmfile->fname);
|
||||
|
||||
lr_close (cmfile);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -56,6 +56,9 @@ struct charset_t
|
||||
#define ILLEGAL_CHAR_VALUE ((wchar_t) 0xffffffffu)
|
||||
|
||||
|
||||
/* Declared in localedef.c. */
|
||||
extern int be_quiet;
|
||||
|
||||
/* Prototypes for charmap handling functions. */
|
||||
struct charset_t *charmap_read (const char *filename);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
else
|
||||
value = 0;
|
||||
|
||||
if (value == 0)
|
||||
if (value == 0 && !be_quiet)
|
||||
error_at_line (0, 0, patch->fname, patch->lineno,
|
||||
_("no weight defined for symbol `%s'"), patch->token);
|
||||
else
|
||||
@@ -256,7 +256,8 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
\**************************************************************/
|
||||
u_int32_t weight;
|
||||
|
||||
error (0, 0, _("no definition of `UNDEFINED'"));
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("no definition of `UNDEFINED'"));
|
||||
|
||||
collate->undefined.ordering_len = collate->nrules;
|
||||
weight = ++collate->order_cnt;
|
||||
@@ -324,9 +325,10 @@ collate_output (struct localedef_t *locale, struct charset_t *charset,
|
||||
level_best = 0xffff;
|
||||
|
||||
/* Compute table size. */
|
||||
fputs (_("\
|
||||
if (!be_quiet)
|
||||
fputs (_("\
|
||||
Computing table size for collation information might take a while..."),
|
||||
stderr);
|
||||
stderr);
|
||||
for (table_size = 256; table_size < sum_best; ++table_size)
|
||||
{
|
||||
size_t hits[table_size];
|
||||
@@ -357,7 +359,8 @@ Computing table size for collation information might take a while..."),
|
||||
}
|
||||
}
|
||||
assert (table_best != 0xffff || level_best != 0xffff);
|
||||
fputs (_(" done\n"), stderr);
|
||||
if (!be_quiet)
|
||||
fputs (_(" done\n"), stderr);
|
||||
|
||||
obstack_init (&non_simple);
|
||||
obstack_init (&string_pool);
|
||||
|
||||
+43
-36
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -262,10 +262,11 @@ ctype_finish (struct localedef_t *locale, struct charset_t *charset)
|
||||
cp += sprintf (cp, "\\%o", (value >> 8) & 0xff);
|
||||
sprintf (cp, "\\%o", value & 0xff);
|
||||
|
||||
error (0, 0, _("\
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("\
|
||||
character %s'%s' in class `%s' must be in class `%s'"), value > 256 ? "L" : "",
|
||||
cp, valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
cp, valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -286,10 +287,12 @@ character %s'%s' in class `%s' must be in class `%s'"), value > 256 ? "L" : "",
|
||||
cp += sprintf (cp, "\\%o", (value >> 8) & 0xff);
|
||||
sprintf (cp, "\\%o", value & 0xff);
|
||||
|
||||
error (0, 0, _("\
|
||||
if (!be_quiet)
|
||||
error (0, 0, _("\
|
||||
character %s'%s' in class `%s' must not be in class `%s'"),
|
||||
value > 256 ? "L" : "", cp,
|
||||
valid_table[cls1].name, valid_table[cls2].name);
|
||||
value > 256 ? "L" : "", cp,
|
||||
valid_table[cls1].name,
|
||||
valid_table[cls2].name);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -306,23 +309,25 @@ character %s'%s' in class `%s' must not be in class `%s'"),
|
||||
|
||||
/* ... and now test <SP> as a special case. */
|
||||
space_value = charset_find_value (charset, "SP", 2);
|
||||
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("character <SP> not defined in character map"));
|
||||
else if ((cnt = BITPOS (tok_space),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_space)) == 0)
|
||||
|| (cnt = BITPOS (tok_blank),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_blank)) == 0))
|
||||
else if (((cnt = BITPOS (tok_space),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_space)) == 0)
|
||||
|| (cnt = BITPOS (tok_blank),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_blank)) == 0))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("<SP> character not in class `%s'"),
|
||||
valid_table[cnt].name);
|
||||
else if ((cnt = BITPOS (tok_punct),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_punct)) != 0)
|
||||
|| (cnt = BITPOS (tok_graph),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_graph))
|
||||
!= 0))
|
||||
else if (((cnt = BITPOS (tok_punct),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_punct)) != 0)
|
||||
|| (cnt = BITPOS (tok_graph),
|
||||
(ELEM (ctype, class_collection, , space_value)
|
||||
& BIT (tok_graph))
|
||||
!= 0))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("<SP> character must not be in class `%s'"),
|
||||
valid_table[cnt].name);
|
||||
else
|
||||
@@ -934,7 +939,7 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
|
||||
tmp[0] = ch;
|
||||
|
||||
value = charset_find_value (charset, tmp, 1);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -998,7 +1003,7 @@ character `%s' not defined while needed as default value"),
|
||||
unsigned int value;
|
||||
|
||||
value = charset_find_value (charset, "space", 5);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1006,7 +1011,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "form-feed", 9);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<form-feed>");
|
||||
@@ -1014,7 +1019,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "newline", 7);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<newline>");
|
||||
@@ -1022,7 +1027,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "carriage-return", 15);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<carriage-return>");
|
||||
@@ -1030,7 +1035,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "tab", 3);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<tab>");
|
||||
@@ -1038,7 +1043,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
|
||||
|
||||
value = charset_find_value (charset, "vertical-tab", 12);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<vertical-tab>");
|
||||
@@ -1064,7 +1069,7 @@ character `%s' not defined while needed as default value"),
|
||||
unsigned int value;
|
||||
|
||||
value = charset_find_value (charset, "space", 5);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1072,7 +1077,7 @@ character `%s' not defined while needed as default value"),
|
||||
ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
|
||||
|
||||
value = charset_find_value (charset, "tab", 3);
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<tab>");
|
||||
@@ -1110,7 +1115,7 @@ character `%s' not defined while needed as default value"),
|
||||
ctype->class_collection[cnt] |= BIT (tok_print);
|
||||
|
||||
space = charset_find_value (charset, "space", 5);
|
||||
if (space == ILLEGAL_CHAR_VALUE)
|
||||
if (space == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
"<space>");
|
||||
@@ -1136,7 +1141,7 @@ character `%s' not defined while needed as default value"),
|
||||
tmp[1] = (char) ch;
|
||||
|
||||
value_from = charset_find_value (charset, &tmp[1], 1);
|
||||
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -1147,7 +1152,7 @@ character `%s' not defined while needed as default value"),
|
||||
/* This conversion is implementation defined. */
|
||||
tmp[1] = (char) (ch + ('A' - 'a'));
|
||||
value_to = charset_find_value (charset, &tmp[1], 1);
|
||||
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
|
||||
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
character `%s' not defined while needed as default value"),
|
||||
@@ -1195,9 +1200,10 @@ allocate_arrays (struct locale_ctype_t *ctype, struct charset_t *charset)
|
||||
size_t min_total = UINT_MAX;
|
||||
size_t act_size = 256;
|
||||
|
||||
fputs (_("\
|
||||
if (!be_quiet)
|
||||
fputs (_("\
|
||||
Computing table size for character classes might take a while..."),
|
||||
stderr);
|
||||
stderr);
|
||||
|
||||
while (act_size < min_total)
|
||||
{
|
||||
@@ -1232,7 +1238,8 @@ Computing table size for character classes might take a while..."),
|
||||
++act_size;
|
||||
}
|
||||
|
||||
fprintf (stderr, _(" done\n"));
|
||||
if (!be_quiet)
|
||||
fprintf (stderr, _(" done\n"));
|
||||
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -77,7 +77,7 @@ messages_finish (struct localedef_t *locale)
|
||||
= locale->categories[LC_MESSAGES].messages;
|
||||
|
||||
/* The fields YESSTR and NOSTR are optional. */
|
||||
if (messages->yesexpr == NULL)
|
||||
if (messages->yesexpr == NULL && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' undefined"),
|
||||
"yesexpr", "LC_MESSAGES");
|
||||
else
|
||||
@@ -87,7 +87,7 @@ messages_finish (struct localedef_t *locale)
|
||||
|
||||
/* Test whether it are correct regular expressions. */
|
||||
result = regcomp (&re, messages->yesexpr, REG_EXTENDED);
|
||||
if (result != 0)
|
||||
if (result != 0 && !be_quiet)
|
||||
{
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
@@ -98,7 +98,7 @@ no correct regular expression for field `%s' in category `%s': %s"),
|
||||
}
|
||||
}
|
||||
|
||||
if (messages->noexpr == NULL)
|
||||
if (messages->noexpr == NULL && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' undefined"),
|
||||
"noexpr", "LC_MESSAGES");
|
||||
else
|
||||
@@ -108,7 +108,7 @@ no correct regular expression for field `%s' in category `%s': %s"),
|
||||
|
||||
/* Test whether it are correct regular expressions. */
|
||||
result = regcomp (&re, messages->noexpr, REG_EXTENDED);
|
||||
if (result != 0)
|
||||
if (result != 0 && !be_quiet)
|
||||
{
|
||||
char errbuf[BUFSIZ];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -115,7 +115,7 @@ monetary_finish (struct localedef_t *locale)
|
||||
= locale->categories[LC_MONETARY].monetary;
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (monetary->cat == NULL) \
|
||||
if (monetary->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_MONETARY")
|
||||
|
||||
@@ -129,12 +129,13 @@ monetary_finish (struct localedef_t *locale)
|
||||
/* The international currency symbol must come from ISO 4217. */
|
||||
if (monetary->int_curr_symbol != NULL)
|
||||
{
|
||||
if (strlen (monetary->int_curr_symbol) != 4)
|
||||
if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet)
|
||||
error (0, 0, _("\
|
||||
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
|
||||
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
|
||||
NR_VALID_INT_CURR, sizeof (const char *),
|
||||
(comparison_fn_t) curr_strcmp) == NULL)
|
||||
(comparison_fn_t) curr_strcmp) == NULL
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("\
|
||||
value of field `int_curr_symbol' in category `LC_MONETARY' does \
|
||||
not correspond to a valid name in ISO 4217"));
|
||||
@@ -143,23 +144,23 @@ not correspond to a valid name in ISO 4217"));
|
||||
/* The decimal point must not be empty. This is not said explicitly
|
||||
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
|
||||
!= "". */
|
||||
if (monetary->mon_decimal_point[0] == '\0')
|
||||
if (monetary->mon_decimal_point[0] == '\0' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must not be the empty string"),
|
||||
"mon_decimal_point", "LC_MONETARY");
|
||||
}
|
||||
|
||||
if (monetary->mon_grouping_act == 0)
|
||||
if (monetary->mon_grouping_act == 0 && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"),
|
||||
"mon_grouping", "LC_MONETARY");
|
||||
|
||||
#undef TEST_ELEM
|
||||
#define TEST_ELEM(cat, min, max) \
|
||||
if (monetary->cat == -2) \
|
||||
if (monetary->cat == -2 && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_MONETARY"); \
|
||||
else if (monetary->cat < min || monetary->cat > max) \
|
||||
else if ((monetary->cat < min || monetary->cat > max) && !be_quiet) \
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must be in range %d...%d"), \
|
||||
#cat, "LC_MONETARY", min, max)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -74,7 +74,7 @@ numeric_finish (struct localedef_t *locale)
|
||||
struct locale_numeric_t *numeric = locale->categories[LC_NUMERIC].numeric;
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (numeric->cat == NULL) \
|
||||
if (numeric->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_NUMERIC")
|
||||
|
||||
@@ -84,14 +84,14 @@ numeric_finish (struct localedef_t *locale)
|
||||
/* The decimal point must not be empty. This is not said explicitly
|
||||
in POSIX but ANSI C (ISO/IEC 9899) says in 4.4.2.1 it has to be
|
||||
!= "". */
|
||||
if (numeric->decimal_point[0] == '\0')
|
||||
if (numeric->decimal_point[0] == '\0' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("\
|
||||
value for field `%s' in category `%s' must not be the empty string"),
|
||||
"decimal_point", "LC_NUMERIC");
|
||||
}
|
||||
|
||||
if (numeric->grouping_act == 0)
|
||||
if (numeric->grouping_act == 0 && !be_quiet)
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"),
|
||||
"grouping", "LC_NUMERIC");
|
||||
}
|
||||
|
||||
+31
-29
@@ -106,10 +106,10 @@ time_finish (struct localedef_t *locale)
|
||||
struct locale_time_t *time = locale->categories[LC_TIME].time;
|
||||
|
||||
#define TESTARR_ELEM(cat, max) \
|
||||
if (time->cur_num_##cat == 0) \
|
||||
if (time->cur_num_##cat == 0 && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_TIME"); \
|
||||
else if (time->cur_num_##cat != max) \
|
||||
else if (time->cur_num_##cat != max && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' has not enough values"), \
|
||||
#cat, "LC_TIME")
|
||||
|
||||
@@ -120,7 +120,7 @@ time_finish (struct localedef_t *locale)
|
||||
TESTARR_ELEM (am_pm, 2);
|
||||
|
||||
#define TEST_ELEM(cat) \
|
||||
if (time->cat == NULL) \
|
||||
if (time->cat == NULL && !be_quiet) \
|
||||
error (0, 0, _("field `%s' in category `%s' not defined"), \
|
||||
#cat, "LC_TIME")
|
||||
|
||||
@@ -149,7 +149,7 @@ time_finish (struct localedef_t *locale)
|
||||
memcpy (str, time->era[idx], era_len + 1);
|
||||
|
||||
/* First character must be + or - for the direction. */
|
||||
if (*str != '+' && *str != '-')
|
||||
if (*str != '+' && *str != '-' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("direction flag in string %d in `era' field"
|
||||
" in category `%s' is not '+' nor '-'"),
|
||||
@@ -159,7 +159,7 @@ time_finish (struct localedef_t *locale)
|
||||
}
|
||||
else
|
||||
time->era_entries[idx].direction = *str;
|
||||
if (*++str != ':')
|
||||
if (*++str != ':' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("direction flag in string %d in `era' field"
|
||||
" in category `%s' is not a single character"),
|
||||
@@ -171,14 +171,14 @@ time_finish (struct localedef_t *locale)
|
||||
|
||||
/* Now the offset year. */
|
||||
time->era_entries[idx].offset = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("illegal number for offset in string %d in"
|
||||
" `era' field in category `%s'"),
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("garbage at end of offset value in string %d in"
|
||||
" `era' field in category `%s'"),
|
||||
@@ -224,7 +224,7 @@ time_finish (struct localedef_t *locale)
|
||||
time->era_entries[idx].start_date[1] -= 1;
|
||||
|
||||
time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
invalid_start_date:
|
||||
error (0, 0, _("illegal starting date in string %d in"
|
||||
@@ -232,7 +232,7 @@ time_finish (struct localedef_t *locale)
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
garbage_start_date:
|
||||
error (0, 0, _("garbage at end of starting date in string %d"
|
||||
@@ -245,14 +245,15 @@ time_finish (struct localedef_t *locale)
|
||||
str = endp + 1;
|
||||
|
||||
/* Check for valid value. */
|
||||
if (time->era_entries[idx].start_date[1] < 0
|
||||
|| time->era_entries[idx].start_date[1] >= 12
|
||||
|| time->era_entries[idx].start_date[2] < 0
|
||||
|| (time->era_entries[idx].start_date[2]
|
||||
> days_per_month[time->era_entries[idx].start_date[1]])
|
||||
|| (time->era_entries[idx].start_date[1] == 2
|
||||
&& time->era_entries[idx].start_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].start_date[0])))
|
||||
if ((time->era_entries[idx].start_date[1] < 0
|
||||
|| time->era_entries[idx].start_date[1] >= 12
|
||||
|| time->era_entries[idx].start_date[2] < 0
|
||||
|| (time->era_entries[idx].start_date[2]
|
||||
> days_per_month[time->era_entries[idx].start_date[1]])
|
||||
|| (time->era_entries[idx].start_date[1] == 2
|
||||
&& time->era_entries[idx].start_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].start_date[0])))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("starting date is illegal in"
|
||||
" string %d in `era' field in"
|
||||
" category `%s'"),
|
||||
@@ -296,7 +297,7 @@ time_finish (struct localedef_t *locale)
|
||||
time->era_entries[idx].stop_date[1] -= 1;
|
||||
|
||||
time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
|
||||
if (endp == str)
|
||||
if (endp == str && !be_quiet)
|
||||
{
|
||||
invalid_stop_date:
|
||||
error (0, 0, _("illegal stopping date in string %d in"
|
||||
@@ -304,7 +305,7 @@ time_finish (struct localedef_t *locale)
|
||||
idx + 1, "LC_TIME");
|
||||
(void) strsep (&str, ":");
|
||||
}
|
||||
else if (*endp != ':')
|
||||
else if (*endp != ':' && !be_quiet)
|
||||
{
|
||||
garbage_stop_date:
|
||||
error (0, 0, _("garbage at end of stopping date in string %d"
|
||||
@@ -317,14 +318,15 @@ time_finish (struct localedef_t *locale)
|
||||
str = endp + 1;
|
||||
|
||||
/* Check for valid value. */
|
||||
if (time->era_entries[idx].stop_date[1] < 0
|
||||
|| time->era_entries[idx].stop_date[1] >= 12
|
||||
|| time->era_entries[idx].stop_date[2] < 0
|
||||
|| (time->era_entries[idx].stop_date[2]
|
||||
> days_per_month[time->era_entries[idx].stop_date[1]])
|
||||
|| (time->era_entries[idx].stop_date[1] == 2
|
||||
&& time->era_entries[idx].stop_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].stop_date[0])))
|
||||
if ((time->era_entries[idx].stop_date[1] < 0
|
||||
|| time->era_entries[idx].stop_date[1] >= 12
|
||||
|| time->era_entries[idx].stop_date[2] < 0
|
||||
|| (time->era_entries[idx].stop_date[2]
|
||||
> days_per_month[time->era_entries[idx].stop_date[1]])
|
||||
|| (time->era_entries[idx].stop_date[1] == 2
|
||||
&& time->era_entries[idx].stop_date[2] == 29
|
||||
&& !__isleap (time->era_entries[idx].stop_date[0])))
|
||||
&& !be_quiet)
|
||||
error (0, 0, _("stopping date is illegal in"
|
||||
" string %d in `era' field in"
|
||||
" category `%s'"),
|
||||
@@ -332,7 +334,7 @@ time_finish (struct localedef_t *locale)
|
||||
}
|
||||
}
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
if ((str == NULL || *str == '\0') && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("missing era name in string %d in `era' field"
|
||||
" in category `%s'"), idx + 1, "LC_TIME");
|
||||
@@ -343,7 +345,7 @@ time_finish (struct localedef_t *locale)
|
||||
{
|
||||
time->era_entries[idx].name = strsep (&str, ":");
|
||||
|
||||
if (str == NULL || *str == '\0')
|
||||
if ((str == NULL || *str == '\0') && !be_quiet)
|
||||
{
|
||||
error (0, 0, _("missing era format in string %d in `era'"
|
||||
" field in category `%s'"),
|
||||
|
||||
@@ -70,6 +70,8 @@ int posix_conformance;
|
||||
/* If not zero give a lot more messages. */
|
||||
int verbose;
|
||||
|
||||
/* If not zero don't print warnings. */
|
||||
int be_quiet;
|
||||
|
||||
|
||||
/* Long options. */
|
||||
@@ -81,6 +83,7 @@ static const struct option long_options[] =
|
||||
{ "force", no_argument, NULL, 'c' },
|
||||
{ "inputfile", required_argument, NULL, 'i' },
|
||||
{ "posix", no_argument, &posix_conformance, 1 },
|
||||
{ "quiet", no_argument, &be_quiet, 1 },
|
||||
{ "verbose", no_argument, &verbose, 1},
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
@@ -258,21 +261,22 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
|
||||
if (! avail)
|
||||
{
|
||||
const char *locale_names[] = { "LC_COLLATE", "LC_CTYPE",
|
||||
"LC_MONETARY", "LC_NUMERIC",
|
||||
"LC_TIME", "LC_MESSAGES" };
|
||||
static const char *locale_names[] =
|
||||
{ "LC_COLLATE", "LC_CTYPE", "LC_MONETARY",
|
||||
"LC_NUMERIC", "LC_TIME", "LC_MESSAGES"
|
||||
};
|
||||
char *fname;
|
||||
int fd;
|
||||
struct stat st;
|
||||
|
||||
asprintf (&fname, LOCALE_PATH "/%s/%s", act_add_locdef->name,
|
||||
asprintf (&fname, LOCALEDIR "/%s/%s", act_add_locdef->name,
|
||||
locale_names[cat]);
|
||||
fd = open (fname, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
free (fname);
|
||||
|
||||
asprintf (&fname, LOCALE_PATH "/%s/%s/SYS_%s",
|
||||
asprintf (&fname, LOCALEDIR "/%s/%s/SYS_%s",
|
||||
act_add_locdef->name, locale_names[cat],
|
||||
locale_names[cat]);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
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
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <locale.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -76,10 +77,31 @@ locfile_read (const char *filename, struct charset_t *charset)
|
||||
{
|
||||
if (filename[0] != '/')
|
||||
{
|
||||
char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)];
|
||||
char *i18npath = __secure_getenv ("I18NPATH");
|
||||
if (i18npath != NULL && *i18npath != '\0')
|
||||
{
|
||||
char path[strlen (filename) + 1 + strlen (i18npath) + 1];
|
||||
char *next;
|
||||
i18npath = strdupa (i18npath);
|
||||
|
||||
stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename);
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
|
||||
while (ldfile == NULL
|
||||
&& (next = strsep (&i18npath, ":")) != NULL)
|
||||
{
|
||||
stpcpy (stpcpy (stpcpy (path, next), "/"), filename);
|
||||
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
}
|
||||
}
|
||||
|
||||
/* Test in the default directory. */
|
||||
if (ldfile == NULL)
|
||||
{
|
||||
char path[strlen (filename) + 1 + sizeof (LOCSRCDIR)];
|
||||
|
||||
stpcpy (stpcpy (stpcpy (path, LOCSRCDIR), "/"), filename);
|
||||
ldfile = lr_open (path, locfile_hash);
|
||||
}
|
||||
}
|
||||
|
||||
if (ldfile == NULL)
|
||||
@@ -981,7 +1003,7 @@ write_locale_data (const char *output_path, const char *category,
|
||||
save_err = errno;
|
||||
}
|
||||
|
||||
if (fd == -1)
|
||||
if (fd == -1 && !be_quiet)
|
||||
{
|
||||
error (0, save_err, _("\
|
||||
cannot open output file `%s' for category `%s'"),
|
||||
@@ -1005,7 +1027,7 @@ cannot open output file `%s' for category `%s'"),
|
||||
if (maxiov > 0)
|
||||
step = MIN (maxiov, step);
|
||||
|
||||
if (writev (fd, &vec[cnt], step) < 0)
|
||||
if (writev (fd, &vec[cnt], step) < 0 && !be_quiet)
|
||||
{
|
||||
error (0, errno, _("failure while writing data for category `%s'"),
|
||||
category);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
|
||||
|
||||
@@ -53,6 +53,8 @@ struct localedef_t
|
||||
size_t len[6];
|
||||
};
|
||||
|
||||
/* Declared in localedef.c. */
|
||||
extern int be_quiet;
|
||||
|
||||
/* Found in localedef.c. */
|
||||
void def_to_process (const char *name, int category);
|
||||
|
||||
+7
-9
@@ -55,8 +55,8 @@ typedef struct weight_t
|
||||
((u_int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_RULES))
|
||||
|
||||
|
||||
static __inline int get_weight (const STRING_TYPE **str, weight_t *result);
|
||||
static __inline int
|
||||
static __inline void get_weight (const STRING_TYPE **str, weight_t *result);
|
||||
static __inline void
|
||||
get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
{
|
||||
unsigned int ch = *((USTRING_TYPE *) (*str))++;
|
||||
@@ -86,7 +86,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].value = &__collate_extra[idx];
|
||||
idx += result->data[cnt].number;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
slot += level_size;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].number = 1;
|
||||
result->data[cnt].value = &__collate_table[slot + 1 + cnt];
|
||||
}
|
||||
return ch == 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We now look for any collation element which starts with CH.
|
||||
@@ -135,14 +135,12 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
result->data[cnt].value = &__collate_extra[idx];
|
||||
idx += result->data[cnt].number;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* To next entry in list. */
|
||||
slot += __collate_extra[slot];
|
||||
}
|
||||
/* NOTREACHED */
|
||||
return 0; /* To calm down gcc. */
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +153,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
do \
|
||||
{ \
|
||||
weight_t *newp; \
|
||||
do \
|
||||
while (*str != '\0') \
|
||||
{ \
|
||||
newp = (weight_t *) alloca (sizeof (weight_t) \
|
||||
+ (collate_nrules \
|
||||
@@ -168,7 +166,7 @@ get_weight (const STRING_TYPE **str, weight_t *result)
|
||||
backw->next = newp; \
|
||||
newp->next = NULL; \
|
||||
backw = newp; \
|
||||
get_weight (&str, newp); \
|
||||
} \
|
||||
while (get_weight (&str, newp) == 0); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Get system dependent values and data structures. */
|
||||
#include <utmpbits.h>
|
||||
|
||||
+21
-16
@@ -1,23 +1,22 @@
|
||||
/* stdio on a Mach device port.
|
||||
Translates \n to \r\n on output, echos and translates \r to \n on input.
|
||||
Copyright (C) 1992, 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 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 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.
|
||||
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <stdio.h>
|
||||
#include <mach.h>
|
||||
@@ -148,10 +147,16 @@ output (FILE *f, int c)
|
||||
{
|
||||
kern_return_t err;
|
||||
int wrote;
|
||||
int thiswrite;
|
||||
|
||||
while (to_write > 0)
|
||||
{
|
||||
thiswrite = to_write;
|
||||
if (thiswrite > IO_INBAND_MAX)
|
||||
thiswrite = IO_INBAND_MAX;
|
||||
|
||||
if (err = device_write_inband ((device_t) f->__cookie, 0,
|
||||
f->__target, p, to_write, &wrote))
|
||||
f->__target, p, thiswrite, &wrote))
|
||||
{
|
||||
errno = err;
|
||||
f->__error = 1;
|
||||
|
||||
+23
-2
@@ -26,6 +26,28 @@
|
||||
|
||||
/* This file was broken out from:
|
||||
$Log$
|
||||
Revision 1.1.2.1 1997/03/17 03:52:14 drepper
|
||||
(__mach_error_map_compat): Give full prototype.
|
||||
|
||||
Revision 1.2 1997/03/16 17:41:36 drepper
|
||||
(__mach_error_map_compat): Give full prototype.
|
||||
|
||||
Revision 1.2 1997/03/14 15:26:28 thomas
|
||||
Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
|
||||
* mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
|
||||
* mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
swtch_pri.
|
||||
|
||||
* mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
|
||||
* mach/mach_error.h (mach_error_string, mach_error,
|
||||
mach_error_type): Always provide prototypes.
|
||||
|
||||
Revision 1.1 1993/11/30 17:35:24 roland
|
||||
entered into RCS
|
||||
|
||||
@@ -39,8 +61,7 @@
|
||||
|
||||
|
||||
void
|
||||
__mach_error_map_compat( org_err )
|
||||
mach_error_t * org_err;
|
||||
__mach_error_map_compat(mach_error_t *org_err)
|
||||
{
|
||||
mach_error_t err = *org_err;
|
||||
|
||||
|
||||
+24
-3
@@ -26,6 +26,28 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.1.2.1 1997/03/17 03:52:30 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/16 17:41:48 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/14 15:26:29 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.1 1993/11/30 17:35:58 roland
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -67,9 +89,8 @@ mach_error_type( err )
|
||||
boolean_t mach_error_full_diag = FALSE;
|
||||
|
||||
const char *
|
||||
mach_error_string_int( err, diag )
|
||||
mach_error_t err;
|
||||
boolean_t * diag;
|
||||
mach_error_string_int(mach_error_t err,
|
||||
boolean_t * diag)
|
||||
{
|
||||
int sub, system, code;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1994, 1996, 1997 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
|
||||
@@ -26,7 +26,7 @@
|
||||
#define _MACH_MACH_TRAPS_H_ 1
|
||||
|
||||
#include <mach/port.h>
|
||||
|
||||
#include <mach/kern_return.h>
|
||||
|
||||
/* Create and return a new receive right. */
|
||||
extern mach_port_t mach_reply_port (void);
|
||||
|
||||
+23
-1
@@ -26,6 +26,28 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.1.2.1 1997/03/17 03:52:38 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/16 17:42:02 drepper
|
||||
* (mach_error_string_int): Give full prototype.
|
||||
*
|
||||
* Revision 1.2 1997/03/14 15:26:30 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.1 1992/10/06 18:29:54 roland
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -63,7 +85,7 @@
|
||||
#include <mach_error.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
extern char * mach_error_string_int();
|
||||
extern char * mach_error_string_int(mach_error_t, boolean_t *);
|
||||
|
||||
void
|
||||
mach_error( str, err )
|
||||
|
||||
+26
-6
@@ -26,6 +26,32 @@
|
||||
/*
|
||||
* HISTORY
|
||||
* $Log$
|
||||
* Revision 1.2.2.1 1997/03/17 03:52:48 drepper
|
||||
* (mach_error_string, mach_error, mach_error_type): Always provide
|
||||
* prototypes.
|
||||
*
|
||||
* Revision 1.3 1997/03/16 17:42:25 drepper
|
||||
* (mach_error_string, mach_error, mach_error_type): Always provide
|
||||
* prototypes.
|
||||
* (mach_error_fn_t): Comment out declaration; it appears to be entirely
|
||||
* unused dead code.
|
||||
*
|
||||
* Revision 1.3 1997/03/14 15:26:31 thomas
|
||||
* Wed Mar 5 10:40:05 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
|
||||
*
|
||||
* * mach/mach_error.c (mach_error_string_int): Give full prototype.
|
||||
* * mach/errstring.c (mach_error_string_int): Likewise.
|
||||
* * mach/error_compat.c (__mach_error_map_compat): Likewise.
|
||||
*
|
||||
* * mach/spin-solid.c: Include <mach/mach_traps.h>.
|
||||
* * mach/spin-solid.c (__spin_lock_solid): Provide arg to
|
||||
* swtch_pri.
|
||||
*
|
||||
* * mach/mach_init.c: Include <mach/mig_support.h>.
|
||||
*
|
||||
* * mach/mach_error.h (mach_error_string, mach_error,
|
||||
* mach_error_type): Always provide prototypes.
|
||||
*
|
||||
* Revision 1.2 1993/11/23 20:39:08 mib
|
||||
* entered into RCS
|
||||
*
|
||||
@@ -53,28 +79,22 @@ const char *mach_error_string(
|
||||
/*
|
||||
* Returns a string appropriate to the error argument given
|
||||
*/
|
||||
#if c_plusplus
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
void mach_error(
|
||||
/*
|
||||
* Prints an appropriate message on the standard error stream
|
||||
*/
|
||||
#if c_plusplus
|
||||
char *str,
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
const char *mach_error_type(
|
||||
/*
|
||||
* Returns a string with the error system, subsystem and code
|
||||
*/
|
||||
#if c_plusplus
|
||||
mach_error_t error_value
|
||||
#endif c_plusplus
|
||||
);
|
||||
|
||||
#endif _MACH_ERROR_
|
||||
|
||||
+15
-14
@@ -1,23 +1,24 @@
|
||||
/* Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1992, 1993, 1995, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <mach_init.h>
|
||||
#include <mach/mach_interface.h>
|
||||
#include <mach/mig_support.h>
|
||||
|
||||
mach_port_t __mach_task_self_;
|
||||
vm_size_t __vm_page_size = 0; /* Must be data not bss for weak alias. */
|
||||
|
||||
+16
-15
@@ -1,28 +1,29 @@
|
||||
/* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
/* Copyright (C) 1994, 1995, 1997 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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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 <spin-lock.h>
|
||||
#include <mach/mach_traps.h>
|
||||
|
||||
void
|
||||
__spin_lock_solid (spin_lock_t *lock)
|
||||
{
|
||||
while (__spin_lock_locked (lock) || ! __spin_try_lock (lock))
|
||||
/* Yield to another thread (system call). */
|
||||
__swtch_pri ();
|
||||
__swtch_pri (0);
|
||||
}
|
||||
weak_alias (__spin_lock_solid, spin_lock_solid);
|
||||
|
||||
+160
-3
@@ -19,7 +19,7 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* V2.6.4-pt2 Sat Dec 14 1996
|
||||
/* V2.6.4-pt3 Thu Feb 20 1997
|
||||
|
||||
This work is mainly derived from malloc-2.6.4 by Doug Lea
|
||||
<dl@cs.oswego.edu>, which is available from:
|
||||
@@ -835,6 +835,7 @@ Void_t *(*__morecore)() = __default_morecore;
|
||||
#define mmap __mmap
|
||||
#define munmap __munmap
|
||||
#define mremap __mremap
|
||||
#define mprotect __mprotect
|
||||
#undef malloc_getpagesize
|
||||
#define malloc_getpagesize __getpagesize()
|
||||
|
||||
@@ -874,6 +875,8 @@ extern Void_t* sbrk();
|
||||
#define mALLOC_STATs __malloc_stats
|
||||
#define mALLOC_USABLE_SIZe __malloc_usable_size
|
||||
#define mALLOC_TRIm __malloc_trim
|
||||
#define mALLOC_GET_STATe __malloc_get_state
|
||||
#define mALLOC_SET_STATe __malloc_set_state
|
||||
|
||||
#else
|
||||
|
||||
@@ -889,6 +892,8 @@ extern Void_t* sbrk();
|
||||
#define mALLOC_STATs malloc_stats
|
||||
#define mALLOC_USABLE_SIZe malloc_usable_size
|
||||
#define mALLOC_TRIm malloc_trim
|
||||
#define mALLOC_GET_STATe malloc_get_state
|
||||
#define mALLOC_SET_STATe malloc_set_state
|
||||
|
||||
#endif
|
||||
|
||||
@@ -912,7 +917,11 @@ size_t mALLOC_USABLE_SIZe(Void_t*);
|
||||
void mALLOC_STATs(void);
|
||||
int mALLOPt(int, int);
|
||||
struct mallinfo mALLINFo(void);
|
||||
#else
|
||||
Void_t* mALLOC_GET_STATe(void);
|
||||
int mALLOC_SET_STATe(Void_t*);
|
||||
|
||||
#else /* !__STD_C */
|
||||
|
||||
#ifndef _LIBC
|
||||
void ptmalloc_init();
|
||||
#endif
|
||||
@@ -929,7 +938,10 @@ size_t mALLOC_USABLE_SIZe();
|
||||
void mALLOC_STATs();
|
||||
int mALLOPt();
|
||||
struct mallinfo mALLINFo();
|
||||
#endif
|
||||
Void_t* mALLOC_GET_STATe();
|
||||
int mALLOC_SET_STATe();
|
||||
|
||||
#endif /* __STD_C */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -3775,6 +3787,144 @@ int mALLOPt(param_number, value) int param_number; int value;
|
||||
|
||||
|
||||
|
||||
/* Get/set state: malloc_get_state() records the current state of all
|
||||
malloc variables (_except_ for the actual heap contents and `hook'
|
||||
function pointers) in a system dependent, opaque data structure.
|
||||
This data structure is dynamically allocated and can be free()d
|
||||
after use. malloc_set_state() restores the state of all malloc
|
||||
variables to the previously obtained state. This is especially
|
||||
useful when using this malloc as part of a shared library, and when
|
||||
the heap contents are saved/restored via some other method. The
|
||||
primary example for this is GNU Emacs with its `dumping' procedure.
|
||||
`Hook' function pointers are never saved or restored by these
|
||||
functions. */
|
||||
|
||||
#define MALLOC_STATE_MAGIC 0x444c4541l
|
||||
#define MALLOC_STATE_VERSION (0*0x100l + 0l) /* major*0x100 + minor */
|
||||
|
||||
struct malloc_state {
|
||||
long magic;
|
||||
long version;
|
||||
mbinptr av[NAV * 2 + 2];
|
||||
char* sbrk_base;
|
||||
int sbrked_mem_bytes;
|
||||
unsigned long trim_threshold;
|
||||
unsigned long top_pad;
|
||||
unsigned int n_mmaps_max;
|
||||
unsigned long mmap_threshold;
|
||||
int check_action;
|
||||
unsigned long max_sbrked_mem;
|
||||
unsigned long max_total_mem;
|
||||
unsigned int n_mmaps;
|
||||
unsigned int max_n_mmaps;
|
||||
unsigned long mmapped_mem;
|
||||
unsigned long max_mmapped_mem;
|
||||
};
|
||||
|
||||
Void_t*
|
||||
mALLOC_GET_STATe()
|
||||
{
|
||||
mchunkptr victim;
|
||||
struct malloc_state* ms;
|
||||
int i;
|
||||
mbinptr b;
|
||||
|
||||
ptmalloc_init();
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
victim = chunk_alloc(&main_arena, request2size(sizeof(*ms)));
|
||||
if(!victim) {
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return 0;
|
||||
}
|
||||
ms = (struct malloc_state*)chunk2mem(victim);
|
||||
ms->magic = MALLOC_STATE_MAGIC;
|
||||
ms->version = MALLOC_STATE_VERSION;
|
||||
ms->av[0] = main_arena.av[0];
|
||||
ms->av[1] = main_arena.av[1];
|
||||
for(i=0; i<NAV; i++) {
|
||||
b = bin_at(&main_arena, i);
|
||||
if(first(b) == b)
|
||||
ms->av[2*i+2] = ms->av[2*i+3] = 0; /* empty bin (or initial top) */
|
||||
else {
|
||||
ms->av[2*i+2] = first(b);
|
||||
ms->av[2*i+3] = last(b);
|
||||
}
|
||||
}
|
||||
ms->sbrk_base = sbrk_base;
|
||||
ms->sbrked_mem_bytes = sbrked_mem;
|
||||
ms->trim_threshold = trim_threshold;
|
||||
ms->top_pad = top_pad;
|
||||
ms->n_mmaps_max = n_mmaps_max;
|
||||
ms->mmap_threshold = mmap_threshold;
|
||||
ms->check_action = check_action;
|
||||
ms->max_sbrked_mem = max_sbrked_mem;
|
||||
#ifdef NO_THREADS
|
||||
ms->max_total_mem = max_total_mem;
|
||||
#else
|
||||
ms->max_total_mem = 0;
|
||||
#endif
|
||||
ms->n_mmaps = n_mmaps;
|
||||
ms->max_n_mmaps = max_n_mmaps;
|
||||
ms->mmapped_mem = mmapped_mem;
|
||||
ms->max_mmapped_mem = max_mmapped_mem;
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return (Void_t*)ms;
|
||||
}
|
||||
|
||||
int
|
||||
#if __STD_C
|
||||
mALLOC_SET_STATe(Void_t* msptr)
|
||||
#else
|
||||
mALLOC_SET_STATe(msptr) Void_t* msptr;
|
||||
#endif
|
||||
{
|
||||
struct malloc_state* ms = (struct malloc_state*)msptr;
|
||||
int i;
|
||||
mbinptr b;
|
||||
|
||||
ptmalloc_init();
|
||||
if(ms->magic != MALLOC_STATE_MAGIC) return -1;
|
||||
/* Must fail if the major version is too high. */
|
||||
if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2;
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
main_arena.av[0] = ms->av[0];
|
||||
main_arena.av[1] = ms->av[1];
|
||||
for(i=0; i<NAV; i++) {
|
||||
b = bin_at(&main_arena, i);
|
||||
if(ms->av[2*i+2] == 0)
|
||||
first(b) = last(b) = b;
|
||||
else {
|
||||
first(b) = ms->av[2*i+2];
|
||||
last(b) = ms->av[2*i+3];
|
||||
if(i > 0) {
|
||||
/* Make sure the links to the `av'-bins in the heap are correct. */
|
||||
first(b)->bk = b;
|
||||
last(b)->fd = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
sbrk_base = ms->sbrk_base;
|
||||
sbrked_mem = ms->sbrked_mem_bytes;
|
||||
trim_threshold = ms->trim_threshold;
|
||||
top_pad = ms->top_pad;
|
||||
n_mmaps_max = ms->n_mmaps_max;
|
||||
mmap_threshold = ms->mmap_threshold;
|
||||
check_action = ms->check_action;
|
||||
max_sbrked_mem = ms->max_sbrked_mem;
|
||||
#ifdef NO_THREADS
|
||||
max_total_mem = ms->max_total_mem;
|
||||
#endif
|
||||
n_mmaps = ms->n_mmaps;
|
||||
max_n_mmaps = ms->max_n_mmaps;
|
||||
mmapped_mem = ms->mmapped_mem;
|
||||
max_mmapped_mem = ms->max_mmapped_mem;
|
||||
/* add version-dependent code here */
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(_LIBC) || defined(MALLOC_HOOKS)
|
||||
|
||||
/* A simple, standard set of debugging hooks. Overhead is `only' one
|
||||
@@ -4048,12 +4198,19 @@ weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
|
||||
weak_alias (__malloc_stats, malloc_stats)
|
||||
weak_alias (__malloc_usable_size, malloc_usable_size)
|
||||
weak_alias (__malloc_trim, malloc_trim)
|
||||
weak_alias (__malloc_get_state, malloc_get_state)
|
||||
weak_alias (__malloc_set_state, malloc_set_state)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
History:
|
||||
|
||||
V2.6.4-pt3 Thu Feb 20 1997 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
|
||||
* Added malloc_get/set_state() (mainly for use in GNU emacs),
|
||||
using interface from Marcus Daniels
|
||||
* All parameters are now adjustable via environment variables
|
||||
|
||||
V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
|
||||
* Added debugging hooks
|
||||
* Fixed possible deadlock in realloc() when out of memory
|
||||
|
||||
@@ -171,6 +171,13 @@ extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
/* Prints brief summary statistics on stderr. */
|
||||
extern void malloc_stats __MALLOC_P ((void));
|
||||
|
||||
/* Record the state of all malloc variables in an opaque data structure. */
|
||||
extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
|
||||
|
||||
/* Restore the state of all malloc variables from data obtained with
|
||||
malloc_get_state(). */
|
||||
extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
|
||||
|
||||
#if defined(__GLIBC__) || defined(MALLOC_HOOKS)
|
||||
|
||||
/* Hooks for debugging versions. */
|
||||
|
||||
@@ -106,6 +106,10 @@ Summary:
|
||||
|
||||
#ifndef __OBSTACK_H__
|
||||
#define __OBSTACK_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* We use subtraction of (char *) 0 instead of casting to int
|
||||
because on word-addressable machines a simple cast to int
|
||||
@@ -578,4 +582,8 @@ __extension__ \
|
||||
|
||||
#endif /* not __GNUC__ or not __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* not __OBSTACK_H__ */
|
||||
|
||||
+27
-9
@@ -1,6 +1,6 @@
|
||||
/* Basic platform-independent macro definitions for mutexes and
|
||||
thread-specific data.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
|
||||
|
||||
@@ -66,19 +66,37 @@ static Void_t *malloc_key_data;
|
||||
(__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (m) : 0)
|
||||
|
||||
#elif defined(MUTEX_INITIALIZER)
|
||||
/* Assume hurd, with cthreads */
|
||||
|
||||
typedef thread_t thread_id;
|
||||
/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
|
||||
mutex itself. */
|
||||
#undef mutex_t
|
||||
#define mutex_t struct mutex
|
||||
|
||||
/* mutex */
|
||||
typedef mutex_t mutex_t;
|
||||
#undef mutex_lock
|
||||
#define mutex_lock(m) (__mutex_lock(m), 0)
|
||||
|
||||
#undef mutex_unlock
|
||||
#define mutex_unlock(m) (__mutex_unlock(m), 0)
|
||||
|
||||
#define mutex_trylock(m) (!__mutex_trylock(m))
|
||||
|
||||
#include <hurd/threadvar.h>
|
||||
|
||||
/* thread specific data */
|
||||
typedef pthread_key_t tsd_key_t;
|
||||
typedef int tsd_key_t;
|
||||
|
||||
#define mutex_init(m) __mutex_init (m)
|
||||
#define mutex_lock(m) __mutex_lock (m)
|
||||
#define mutex_trylock(m) __mutex_trylock (m)
|
||||
#define mutex_unlock(m) __mutex_unlock (m)
|
||||
static int tsd_keys_alloced = 0;
|
||||
|
||||
#define tsd_key_create(key, destr) \
|
||||
(assert (tsd_keys_alloced == 0), tsd_keys_alloced++)
|
||||
#define tsd_setspecific(key, data) \
|
||||
(*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC) = (unsigned long)(data))
|
||||
#define tsd_getspecific(key, vptr) \
|
||||
((vptr) = (void *)*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC))
|
||||
|
||||
/* No we're *not* using pthreads. */
|
||||
#define __pthread_initialize ((void (*)(void))0)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
+16
-1
@@ -21,6 +21,9 @@
|
||||
subdir := manual
|
||||
export subdir := $(subdir)
|
||||
|
||||
# We need GNU awk for the xtract-typefun script.
|
||||
GAWK = gawk
|
||||
|
||||
.PHONY: all dvi info
|
||||
all: dvi info
|
||||
dvi: libc.dvi
|
||||
@@ -60,6 +63,17 @@ stamp-summary: summary.awk $(chapters) $(chapters-incl)
|
||||
# touch is broken on our machines. Sigh.
|
||||
date > $@
|
||||
|
||||
# Generate a file which can be added to the `dir' content to provide direct
|
||||
# access to the documentation of the function, variables, and other
|
||||
# definitions.
|
||||
dir-add.texi: manual/xtract-typefun.awk $(chapters-incl)
|
||||
if test -n "$(chapters-incl)"; then \
|
||||
(for i in $(chapters-incl); do \
|
||||
$(GAWK) -f $< < $i; \
|
||||
done) | sort > $@.new; \
|
||||
./move-if-change $@.new $@; \
|
||||
fi
|
||||
|
||||
# Generate Texinfo files from the C source for the example programs.
|
||||
%.c.texi: examples/%.c
|
||||
sed -e 's,[{}],@&,g' \
|
||||
@@ -78,7 +92,8 @@ distribute = $(minimal-dist) \
|
||||
$(patsubst examples/%.c,%.c.texi,$(filter examples/%.c, \
|
||||
$(minimal-dist))) \
|
||||
libc.info* libc.?? libc.??s texinfo.tex summary.texi \
|
||||
stamp-summary chapters chapters-incl
|
||||
stamp-summary chapters chapters-incl \
|
||||
xtract-typefun.awk
|
||||
export distribute := $(distribute)
|
||||
|
||||
tar-it = tar chovf $@ $^
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*@group*/
|
||||
#include <stdio.h>
|
||||
#include <dirent.h>
|
||||
/*@end group*/
|
||||
|
||||
static int
|
||||
one (struct dirent *unused)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
struct dirent **eps;
|
||||
int n;
|
||||
|
||||
n = scandir ("./", &eps, one, alphasort);
|
||||
if (n >= 0)
|
||||
{
|
||||
int cnt;
|
||||
for (cnt = 0; cnt < n; ++cnt)
|
||||
puts (eps[cnt]->d_name);
|
||||
}
|
||||
else
|
||||
perror ("Couldn't open the directory");
|
||||
|
||||
return 0;
|
||||
}
|
||||
+68
-2
@@ -166,6 +166,9 @@ parallels here to the stream facilities for ordinary files, described in
|
||||
* Simple Directory Lister:: A very simple directory listing program.
|
||||
* Random Access Directory:: Rereading part of the directory
|
||||
already read with the same stream.
|
||||
* Scanning Directory Content:: Get entries for user selected subset of
|
||||
contents in given directory.
|
||||
* Simple Directory Lister Mark II:: Revised version of the program.
|
||||
@end menu
|
||||
|
||||
@node Directory Entries
|
||||
@@ -386,9 +389,9 @@ the current working directory:
|
||||
|
||||
The order in which files appear in a directory tends to be fairly
|
||||
random. A more useful program would sort the entries (perhaps by
|
||||
alphabetizing them) before printing them; see @ref{Array Sort Function}.
|
||||
alphabetizing them) before printing them; see
|
||||
@ref{Scanning Directory Content} and @ref{Array Sort Function}.
|
||||
|
||||
@c ??? not documented: scandir, alphasort
|
||||
|
||||
@node Random Access Directory
|
||||
@subsection Random Access in a Directory Stream
|
||||
@@ -429,6 +432,69 @@ closing and reopening the directory can invalidate values returned by
|
||||
@code{telldir}.
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@node Scanning Directory Content
|
||||
@subsection Scanning the Content of a Directory
|
||||
|
||||
A higher-level interface to the directory handling functions is the
|
||||
@code{scandir} function. With its help one can select a subset of the
|
||||
entries in a directory, possibly sort them and get as the result a list
|
||||
of names.
|
||||
|
||||
@deftypefun int scandir (const char *@var{dir}, struct dirent ***@var{namelist}, int (*@var{selector}) (struct dirent *), int (*@var{cmp}) (const void *, const void *))
|
||||
|
||||
The @code{scandir} function scans the contents of the directory selected
|
||||
by @var{dir}. The result in @var{namelist} is an array of pointers to
|
||||
structure of type @code{struct dirent} which describe all selected
|
||||
directory entries and which is allocated using @code{malloc}. Instead
|
||||
of always getting all directory entries returned, the user supplied
|
||||
function @var{selector} can be used to decide which entries are in the
|
||||
result. Only the entries for which @var{selector} returns a nonzero
|
||||
value are selected.
|
||||
|
||||
Finally the entries in the @var{namelist} are sorted using the user
|
||||
supplied function @var{cmp}. The arguments of the @var{cmp} function
|
||||
are of type @code{struct dirent **}. I.e., one cannot directly use the
|
||||
@code{strcmp} or @code{strcoll} function; see the function
|
||||
@code{alphasort} below.
|
||||
|
||||
The return value of the function gives the number of entries placed in
|
||||
@var{namelist}. If it is @code{-1} an error occurred and the global
|
||||
variable @code{errno} contains more information on the error.
|
||||
@end deftypefun
|
||||
|
||||
As said above the fourth argument to the @code{scandir} function must be
|
||||
a pointer to a sorting function. For the convenience of the programmer
|
||||
the GNU C library contains an implementation of a function which is very
|
||||
helpful for this purpose.
|
||||
|
||||
@deftypefun int alphasort (const void *@var{a}, const void *@var{b})
|
||||
The @code{alphasort} function behaves like the @code{strcmp} function
|
||||
(@pxref{String/Array Comparison}). The difference is that the arguments
|
||||
are not string pointers but instead they are of type
|
||||
@code{struct dirent **}.
|
||||
|
||||
Return value of is less than, equal to, or greater than zero depending
|
||||
on the order of the two entries @var{a} and @var{b}.
|
||||
@end deftypefun
|
||||
|
||||
@node Simple Directory Lister Mark II
|
||||
@subsection Simple Program to List a Directory, Mark II
|
||||
|
||||
Here is a revised version of the directory lister found above
|
||||
(@pxref{Simple Directory Lister}). Using the @code{scandir} function we
|
||||
can avoid using the functions which directly work with the directory
|
||||
contents. After the call the found entries are available for direct
|
||||
used.
|
||||
|
||||
@smallexample
|
||||
@include dir2.c.texi
|
||||
@end smallexample
|
||||
|
||||
Please note the simple selector function for this example. Since
|
||||
we want to see all directory entries we always return @code{1}.
|
||||
|
||||
|
||||
@node Hard Links
|
||||
@section Hard Links
|
||||
@cindex hard link
|
||||
|
||||
+1
-1
@@ -830,7 +830,7 @@ unsuccessful program completion in a general sense.
|
||||
|
||||
On POSIX systems, the value of this macro is @code{1}. On other
|
||||
systems, the value might be some other (possibly non-constant) integer
|
||||
expression. Other nonzero status values also indicate future. Certain
|
||||
expression. Other nonzero status values also indicate failures. Certain
|
||||
programs use different nonzero status values to indicate particular
|
||||
kinds of "non-success". For example, @code{diff} uses status value
|
||||
@code{1} to mean that the files are different, and @code{2} or more to
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#! /usr/local/bin/gawk -f
|
||||
BEGIN {
|
||||
last_node="";
|
||||
}
|
||||
|
||||
/^@node/ {
|
||||
last_node = gensub (/@node +([^@,]+).*/, "\\1", 1);
|
||||
}
|
||||
|
||||
/^@deftypefun/ {
|
||||
printf ("* %s: (libc)%s.\n",
|
||||
gensub (/@deftypefun +([^{ ]+|\{[^}]+\}) +([[:alpha:]_][[:alnum:]_]+).*/, "\\2", 1),
|
||||
last_node);
|
||||
}
|
||||
|
||||
/^@deftypevr/ {
|
||||
printf ("* %s: (libc)%s.\n",
|
||||
gensub (/@deftypevr +([^{ ]+|\{[^}]+\}) +([^{ ]+|\{[^}]+\}) +([[:alpha:]_][[:alnum:]_]+).*/, "\\3", 1),
|
||||
last_node);
|
||||
}
|
||||
|
||||
/^@deftypefn/ {
|
||||
printf ("* %s: (libc)%s.\n",
|
||||
gensub (/@deftypefn +([^{ ]+|\{[^}]+\}) +[^{ ]*(\{[^}]+\})? +([[:alpha:]_][[:alnum:]_]+).*/, "\\3", 1),
|
||||
last_node);
|
||||
}
|
||||
+41
-6
@@ -1,5 +1,5 @@
|
||||
/* Declarations for math functions.
|
||||
Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 92, 93, 95, 96, 97 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
|
||||
@@ -44,15 +44,15 @@ __BEGIN_DECLS
|
||||
and can declare the float versions `namef' and `__namef'. */
|
||||
|
||||
#define __MATHCALL(function,suffix, args) \
|
||||
__MATHDECL (_Mdouble_, function,suffix, args)
|
||||
__MATHDECL (_Mdouble_,function,suffix, args)
|
||||
#define __MATHDECL(type, function,suffix, args) \
|
||||
__MATHDECL_1(type, function,suffix, args); \
|
||||
__MATHDECL_1(type, __##function,suffix, args)
|
||||
__MATHDECL_1(type, __CONCAT(__,function),suffix, args)
|
||||
#define __MATHDECL_1(type, function,suffix, args) \
|
||||
extern type __MATH_PRECNAME(function,suffix) args
|
||||
|
||||
#define _Mdouble_ double
|
||||
#define __MATH_PRECNAME(name,r) name##r
|
||||
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
|
||||
#include <mathcalls.h>
|
||||
#undef _Mdouble_
|
||||
#undef __MATH_PRECNAME
|
||||
@@ -67,7 +67,11 @@ __BEGIN_DECLS
|
||||
#define _Mfloat_ float
|
||||
#endif
|
||||
#define _Mdouble_ _Mfloat_
|
||||
#ifdef __STDC__
|
||||
#define __MATH_PRECNAME(name,r) name##f##r
|
||||
#else
|
||||
#define __MATH_PRECNAME(name,r) name/**/f/**/r
|
||||
#endif
|
||||
#include <mathcalls.h>
|
||||
#undef _Mdouble_
|
||||
#undef __MATH_PRECNAME
|
||||
@@ -79,7 +83,11 @@ __BEGIN_DECLS
|
||||
#define _Mlong_double_ long double
|
||||
#endif
|
||||
#define _Mdouble_ _Mlong_double_
|
||||
#ifdef __STDC__
|
||||
#define __MATH_PRECNAME(name,r) name##l##r
|
||||
#else
|
||||
#define __MATH_PRECNAME(name,r) name/**/l/**/r
|
||||
#endif
|
||||
#include <mathcalls.h>
|
||||
#undef _Mdouble_
|
||||
#undef __MATH_PRECNAME
|
||||
@@ -87,6 +95,12 @@ __BEGIN_DECLS
|
||||
#endif /* Use misc. */
|
||||
|
||||
|
||||
#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
|
||||
/* This variable is used by `gamma' and `lgamma'. */
|
||||
extern int signgam;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
/* Support for various different standard error handling behaviors. */
|
||||
|
||||
@@ -101,8 +115,15 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#ifdef __USE_SVID
|
||||
/* In SVID error handling, `matherr' is called with this description
|
||||
of the exceptional condition. */
|
||||
of the exceptional condition.
|
||||
|
||||
We have a problem when using C++ since `exception' is reserved in
|
||||
C++. */
|
||||
#ifdef __cplusplus
|
||||
struct __exception
|
||||
#else
|
||||
struct exception
|
||||
#endif
|
||||
{
|
||||
int type;
|
||||
char *name;
|
||||
@@ -111,8 +132,13 @@ struct exception
|
||||
double retval;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern int __matherr __P ((struct __exception *));
|
||||
extern int matherr __P ((struct __exception *));
|
||||
#else
|
||||
extern int __matherr __P ((struct exception *));
|
||||
extern int matherr __P ((struct exception *));
|
||||
#endif
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
|
||||
@@ -128,8 +154,16 @@ extern int matherr __P ((struct exception *));
|
||||
#define HUGE FLT_MAX
|
||||
#include <float.h> /* Defines FLT_MAX. */
|
||||
|
||||
#else /* !SVID */
|
||||
|
||||
#ifdef __USE_XOPEN
|
||||
/* X/Open wants another strange constant. */
|
||||
#define MAXFLOAT FLT_MAX
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
#endif /* SVID */
|
||||
|
||||
|
||||
#ifdef __USE_BSD
|
||||
|
||||
@@ -161,7 +195,8 @@ extern int matherr __P ((struct exception *));
|
||||
|
||||
|
||||
/* Get machine-dependent inline versions (if there are any). */
|
||||
#if defined (__NO_MATH_INLINES) || defined (__OPTIMIZE__)
|
||||
#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
|
||||
|| defined __LIBC_M81_MATH_INLINES
|
||||
#include <__math.h>
|
||||
#endif
|
||||
|
||||
|
||||
+4
-6
@@ -147,10 +147,10 @@ __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
|
||||
|
||||
/* Return 0 if VALUE is finite or NaN, +1 if it
|
||||
is +Infinity, -1 if it is -Infinity. */
|
||||
__MATHDECL (int, isinf,, (_Mdouble_ __value));
|
||||
__MATHDECL (int,isinf,, (_Mdouble_ __value));
|
||||
|
||||
/* Return nonzero if VALUE is finite and not NaN. */
|
||||
__MATHDECL (int, finite,, (_Mdouble_ __value));
|
||||
__MATHDECL (int,finite,, (_Mdouble_ __value));
|
||||
|
||||
/* Deal with an infinite or NaN result.
|
||||
If ERROR is ERANGE, result is +Inf;
|
||||
@@ -186,10 +186,10 @@ __MATHCALL (significand,, (_Mdouble_ __x));
|
||||
#if defined(__USE_MISC) || defined(__USE_XOPEN)
|
||||
|
||||
/* Return nonzero if VALUE is not a number. */
|
||||
__MATHDECL (int, isnan,, (_Mdouble_ __value));
|
||||
__MATHDECL (int,isnan,, (_Mdouble_ __value));
|
||||
|
||||
/* Return the binary exponent of X, which must be nonzero. */
|
||||
__MATHDECL (int, ilogb,, (_Mdouble_ __x));
|
||||
__MATHDECL (int,ilogb,, (_Mdouble_ __x));
|
||||
|
||||
/* Return `sqrt(X*X + Y*Y)'. */
|
||||
__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
|
||||
@@ -207,8 +207,6 @@ __MATHCALL (y0,, (_Mdouble_));
|
||||
__MATHCALL (y1,, (_Mdouble_));
|
||||
__MATHCALL (yn,, (int, _Mdouble_));
|
||||
|
||||
/* This variable is used by `gamma' and `lgamma'. */
|
||||
extern int signgam;
|
||||
|
||||
#ifdef __USE_MISC
|
||||
|
||||
|
||||
@@ -71,6 +71,11 @@ unsigned int error_message_count;
|
||||
#define program_name program_invocation_name
|
||||
#include <errno.h>
|
||||
|
||||
/* In GNU libc we want do not want to use the common name `error' directly.
|
||||
Instead make it a weak alias. */
|
||||
#define error __error
|
||||
#define error_at_line __error_at_line
|
||||
|
||||
#else
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
@@ -230,3 +235,11 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
|
||||
if (status)
|
||||
exit (status);
|
||||
}
|
||||
|
||||
#ifdef _LIBC
|
||||
/* Make the weak alias. */
|
||||
#undef error
|
||||
#undef error_at_line
|
||||
weak_alias (__error, error)
|
||||
weak_alias (__error_at_line, error_at_line)
|
||||
#endif
|
||||
|
||||
+1
-3
@@ -59,9 +59,7 @@ getpass (prompt)
|
||||
/* Save the old one. */
|
||||
s = t;
|
||||
/* Tricky, tricky. */
|
||||
t.c_lflag &= ~(ECHO|ISIG|ICANON);
|
||||
t.c_cc[VTIME] = 0;
|
||||
t.c_cc[VMIN] = 1;
|
||||
t.c_lflag &= ~(ECHO|ISIG);
|
||||
tty_changed = (tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &t) == 0);
|
||||
}
|
||||
else
|
||||
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 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
|
||||
@@ -21,10 +21,14 @@
|
||||
#define _LIBGEN_H 1
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Return directory part of PATH or "." if none is available. */
|
||||
extern char *dirname __P ((char *__path));
|
||||
|
||||
/* Return filename part of PATH. */
|
||||
extern char *basename __P ((__const char *__path));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* libgen.h */
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* search.h -- declarations for System V style searching functions.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Declarations for System V style searching functions.
|
||||
Copyright (C) 1995, 1996, 1997 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
|
||||
|
||||
+59
-45
@@ -67,21 +67,22 @@ typedef struct _code {
|
||||
int c_val;
|
||||
} CODE;
|
||||
|
||||
CODE prioritynames[] = {
|
||||
"alert", LOG_ALERT,
|
||||
"crit", LOG_CRIT,
|
||||
"debug", LOG_DEBUG,
|
||||
"emerg", LOG_EMERG,
|
||||
"err", LOG_ERR,
|
||||
"error", LOG_ERR, /* DEPRECATED */
|
||||
"info", LOG_INFO,
|
||||
"none", INTERNAL_NOPRI, /* INTERNAL */
|
||||
"notice", LOG_NOTICE,
|
||||
"panic", LOG_EMERG, /* DEPRECATED */
|
||||
"warn", LOG_WARNING, /* DEPRECATED */
|
||||
"warning", LOG_WARNING,
|
||||
NULL, -1,
|
||||
};
|
||||
CODE prioritynames[] =
|
||||
{
|
||||
{ "alert", LOG_ALERT },
|
||||
{ "crit", LOG_CRIT },
|
||||
{ "debug", LOG_DEBUG },
|
||||
{ "emerg", LOG_EMERG },
|
||||
{ "err", LOG_ERR },
|
||||
{ "error", LOG_ERR }, /* DEPRECATED */
|
||||
{ "info", LOG_INFO },
|
||||
{ "none", INTERNAL_NOPRI }, /* INTERNAL */
|
||||
{ "notice", LOG_NOTICE },
|
||||
{ "panic", LOG_EMERG }, /* DEPRECATED */
|
||||
{ "warn", LOG_WARNING }, /* DEPRECATED */
|
||||
{ "warning", LOG_WARNING },
|
||||
{ NULL, -1 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* facility codes */
|
||||
@@ -114,31 +115,32 @@ CODE prioritynames[] = {
|
||||
#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
|
||||
|
||||
#ifdef SYSLOG_NAMES
|
||||
CODE facilitynames[] = {
|
||||
"auth", LOG_AUTH,
|
||||
"authpriv", LOG_AUTHPRIV,
|
||||
"cron", LOG_CRON,
|
||||
"daemon", LOG_DAEMON,
|
||||
"ftp", LOG_FTP,
|
||||
"kern", LOG_KERN,
|
||||
"lpr", LOG_LPR,
|
||||
"mail", LOG_MAIL,
|
||||
"mark", INTERNAL_MARK, /* INTERNAL */
|
||||
"news", LOG_NEWS,
|
||||
"security", LOG_AUTH, /* DEPRECATED */
|
||||
"syslog", LOG_SYSLOG,
|
||||
"user", LOG_USER,
|
||||
"uucp", LOG_UUCP,
|
||||
"local0", LOG_LOCAL0,
|
||||
"local1", LOG_LOCAL1,
|
||||
"local2", LOG_LOCAL2,
|
||||
"local3", LOG_LOCAL3,
|
||||
"local4", LOG_LOCAL4,
|
||||
"local5", LOG_LOCAL5,
|
||||
"local6", LOG_LOCAL6,
|
||||
"local7", LOG_LOCAL7,
|
||||
NULL, -1,
|
||||
};
|
||||
CODE facilitynames[] =
|
||||
{
|
||||
{ "auth", LOG_AUTH },
|
||||
{ "authpriv", LOG_AUTHPRIV },
|
||||
{ "cron", LOG_CRON },
|
||||
{ "daemon", LOG_DAEMON },
|
||||
{ "ftp", LOG_FTP },
|
||||
{ "kern", LOG_KERN },
|
||||
{ "lpr", LOG_LPR },
|
||||
{ "mail", LOG_MAIL },
|
||||
{ "mark", INTERNAL_MARK }, /* INTERNAL */
|
||||
{ "news", LOG_NEWS },
|
||||
{ "security", LOG_AUTH }, /* DEPRECATED */
|
||||
{ "syslog", LOG_SYSLOG },
|
||||
{ "user", LOG_USER },
|
||||
{ "uucp", LOG_UUCP },
|
||||
{ "local0", LOG_LOCAL0 },
|
||||
{ "local1", LOG_LOCAL1 },
|
||||
{ "local2", LOG_LOCAL2 },
|
||||
{ "local3", LOG_LOCAL3 },
|
||||
{ "local4", LOG_LOCAL4 },
|
||||
{ "local5", LOG_LOCAL5 },
|
||||
{ "local6", LOG_LOCAL6 },
|
||||
{ "local7", LOG_LOCAL7 },
|
||||
{ NULL, -1 }
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
@@ -186,11 +188,23 @@ CODE facilitynames[] = {
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
void closelog __P((void));
|
||||
void openlog __P((const char *, int, int));
|
||||
int setlogmask __P((int));
|
||||
void syslog __P((int, const char *, ...));
|
||||
void vsyslog __P((int, const char *, _BSD_VA_LIST_));
|
||||
|
||||
/* Close desriptor used to write to system logger. */
|
||||
extern void closelog __P ((void));
|
||||
|
||||
/* Open connection to system logger. */
|
||||
extern void openlog __P ((__const char *__ident, int __option,
|
||||
int __facility));
|
||||
|
||||
/* Set the log mask level. */
|
||||
extern int setlogmask __P ((int __mask));
|
||||
|
||||
/* Generate a log message using FMT string and option arguments. */
|
||||
extern void syslog __P ((int __pri, __const char *__fmt, ...));
|
||||
|
||||
/* Generate a log message using FMT and using arguments pointed to by AP. */
|
||||
extern void vsyslog __P ((int __pri, __const char *__fmt, _BSD_VA_LIST_ __ap));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !KERNEL */
|
||||
|
||||
+5
-1
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1992, 1996, 1997 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
|
||||
@@ -34,6 +34,8 @@ __BEGIN_DECLS
|
||||
The buffers are filled in the order specified.
|
||||
Operates just like `read' (see <unistd.h>) except that data are
|
||||
put in VECTOR instead of a contiguous buffer. */
|
||||
extern ssize_t __readv __P ((int __fd, __const struct iovec *__vector,
|
||||
int __count));
|
||||
extern ssize_t readv __P ((int __fd, __const struct iovec *__vector,
|
||||
int __count));
|
||||
|
||||
@@ -42,6 +44,8 @@ extern ssize_t readv __P ((int __fd, __const struct iovec *__vector,
|
||||
The data is written in the order specified.
|
||||
Operates just like `write' (see <unistd.h>) except that the data
|
||||
are taken from VECTOR instead of a contiguous buffer. */
|
||||
extern ssize_t __writev __P ((int __fd, __const struct iovec *__vector,
|
||||
int __count));
|
||||
extern ssize_t writev __P ((int __fd, __const struct iovec *__vector,
|
||||
int __count));
|
||||
|
||||
|
||||
+87
-55
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -43,26 +43,82 @@ struct ether
|
||||
#define EXTERN_PARSER
|
||||
#include "../nss/nss_files/files-parse.c"
|
||||
|
||||
static bool_t new_start = 1;
|
||||
static char *oldkey = NULL;
|
||||
static int oldkeylen = 0;
|
||||
struct response
|
||||
{
|
||||
char *val;
|
||||
struct response *next;
|
||||
};
|
||||
|
||||
static struct response *start = NULL;
|
||||
static struct response *next = NULL;
|
||||
|
||||
static int
|
||||
saveit (int instatus, char *inkey, int inkeylen, char *inval,
|
||||
int invallen, char *indata)
|
||||
{
|
||||
if (instatus != YP_TRUE)
|
||||
return instatus;
|
||||
|
||||
if (inkey && inkeylen > 0 && inval && invallen > 0)
|
||||
{
|
||||
if (start == NULL)
|
||||
{
|
||||
start = malloc (sizeof (struct response));
|
||||
next = start;
|
||||
}
|
||||
else
|
||||
{
|
||||
next->next = malloc (sizeof (struct response));
|
||||
next = next->next;
|
||||
}
|
||||
next->next = NULL;
|
||||
next->val = malloc (invallen + 1);
|
||||
strncpy (next->val, inval, invallen);
|
||||
next->val[invallen] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
internal_nis_setetherent (void)
|
||||
{
|
||||
char *domainname;
|
||||
struct ypall_callback ypcb;
|
||||
enum nss_status status;
|
||||
|
||||
yp_get_default_domain (&domainname);
|
||||
|
||||
while (start != NULL)
|
||||
{
|
||||
if (start->val != NULL)
|
||||
free (start->val);
|
||||
next = start;
|
||||
start = start->next;
|
||||
free (next);
|
||||
}
|
||||
start = NULL;
|
||||
|
||||
ypcb.foreach = saveit;
|
||||
ypcb.data = NULL;
|
||||
status = yperr2nss (yp_all (domainname, "ethers.byname", &ypcb));
|
||||
next = start;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_setetherent (void)
|
||||
{
|
||||
enum nss_status result;
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
new_start = 1;
|
||||
if (oldkey != NULL)
|
||||
{
|
||||
free (oldkey);
|
||||
oldkey = NULL;
|
||||
oldkeylen = 0;
|
||||
}
|
||||
result = internal_nis_setetherent ();
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
@@ -70,13 +126,16 @@ _nss_nis_endetherent (void)
|
||||
{
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
new_start = 1;
|
||||
if (oldkey != NULL)
|
||||
while (start != NULL)
|
||||
{
|
||||
free (oldkey);
|
||||
oldkey = NULL;
|
||||
oldkeylen = 0;
|
||||
if (start->val != NULL)
|
||||
free (start->val);
|
||||
next = start;
|
||||
start = start->next;
|
||||
free (next);
|
||||
}
|
||||
start = NULL;
|
||||
next = NULL;
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
@@ -87,54 +146,27 @@ static enum nss_status
|
||||
internal_nis_getetherent_r (struct ether *eth, char *buffer, size_t buflen)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *outkey;
|
||||
int len, keylen, parse_res;
|
||||
int parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
if (start == NULL)
|
||||
internal_nis_setetherent ();
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "ethers.byaddr",
|
||||
&outkey, &keylen, &result, &len));
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "ethers.byaddr",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
if (next == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
p = strcpy (buffer, next->val);
|
||||
next = next->next;
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
__set_errno (EAGAIN);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
{
|
||||
free (result);
|
||||
__set_errno (ERANGE);
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_etherent (p, eth, data, buflen);
|
||||
if (!parse_res && errno == ERANGE)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
||||
free (oldkey);
|
||||
oldkey = outkey;
|
||||
oldkeylen = keylen;
|
||||
new_start = 0;
|
||||
}
|
||||
while (!parse_res);
|
||||
|
||||
@@ -156,8 +188,8 @@ _nss_nis_getetherent_r (struct ether *result, char *buffer, size_t buflen)
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_getethernam_r (const char *name, struct ether *eth,
|
||||
char *buffer, size_t buflen)
|
||||
_nss_nis_gethostton_r (const char *name, struct ether *eth,
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
@@ -210,8 +242,8 @@ _nss_nis_getethernam_r (const char *name, struct ether *eth,
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_getetherbyaddr_r (struct ether_addr *addr, struct ether *eth,
|
||||
char *buffer, size_t buflen)
|
||||
_nss_nis_getntohost_r (struct ether_addr *addr, struct ether *eth,
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
enum nss_status retval;
|
||||
|
||||
+22
-4
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -242,7 +242,7 @@ _nss_nis_gethostent_r (struct hostent *host, char *buffer, size_t buflen,
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_gethostbyname_r (const char *name, struct hostent *host,
|
||||
_nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
|
||||
char *buffer, size_t buflen, int *h_errnop)
|
||||
{
|
||||
enum nss_status retval;
|
||||
@@ -297,9 +297,9 @@ _nss_nis_gethostbyname_r (const char *name, struct hostent *host,
|
||||
|
||||
parse_res = parse_line (p, host, data, buflen);
|
||||
|
||||
if (!parse_res)
|
||||
if (!parse_res || host->h_addrtype != af)
|
||||
{
|
||||
if (errno == ERANGE)
|
||||
if (!parse_res && errno == ERANGE)
|
||||
{
|
||||
*h_errnop = NETDB_INTERNAL;
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
@@ -315,6 +315,24 @@ _nss_nis_gethostbyname_r (const char *name, struct hostent *host,
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_gethostbyname_r (const char *name, struct hostent *host,
|
||||
char *buffer, size_t buflen, int *h_errnop)
|
||||
{
|
||||
if (_res.options & RES_USE_INET6)
|
||||
{
|
||||
enum nss_status status;
|
||||
|
||||
status = _nss_nis_gethostbyname2_r (name, AF_INET6, host, buffer, buflen,
|
||||
h_errnop);
|
||||
if (status == NSS_STATUS_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
return _nss_nis_gethostbyname2_r (name, AF_INET, host, buffer, buflen,
|
||||
h_errnop);
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_gethostbyaddr_r (char *addr, int addrlen, int type,
|
||||
struct hostent *host, char *buffer, size_t buflen,
|
||||
|
||||
+88
-56
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -35,26 +35,82 @@
|
||||
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
static bool_t new_start = 1;
|
||||
static char *oldkey = NULL;
|
||||
static int oldkeylen = 0;
|
||||
struct response
|
||||
{
|
||||
char *val;
|
||||
struct response *next;
|
||||
};
|
||||
|
||||
static struct response *start = NULL;
|
||||
static struct response *next = NULL;
|
||||
|
||||
static int
|
||||
saveit (int instatus, char *inkey, int inkeylen, char *inval,
|
||||
int invallen, char *indata)
|
||||
{
|
||||
if (instatus != YP_TRUE)
|
||||
return instatus;
|
||||
|
||||
if (inkey && inkeylen > 0 && inval && invallen > 0)
|
||||
{
|
||||
if (start == NULL)
|
||||
{
|
||||
start = malloc (sizeof (struct response));
|
||||
next = start;
|
||||
}
|
||||
else
|
||||
{
|
||||
next->next = malloc (sizeof (struct response));
|
||||
next = next->next;
|
||||
}
|
||||
next->next = NULL;
|
||||
next->val = malloc (invallen + 1);
|
||||
strncpy (next->val, inval, invallen);
|
||||
next->val[invallen] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
internal_nis_setprotoent (void)
|
||||
{
|
||||
char *domainname;
|
||||
struct ypall_callback ypcb;
|
||||
enum nss_status status;
|
||||
|
||||
yp_get_default_domain (&domainname);
|
||||
|
||||
while (start != NULL)
|
||||
{
|
||||
if (start->val != NULL)
|
||||
free (start->val);
|
||||
next = start;
|
||||
start = start->next;
|
||||
free (next);
|
||||
}
|
||||
start = NULL;
|
||||
|
||||
ypcb.foreach = saveit;
|
||||
ypcb.data = NULL;
|
||||
status = yperr2nss (yp_all (domainname, "protocols.bynumber", &ypcb));
|
||||
next = start;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
_nss_nis_setprotoent (void)
|
||||
{
|
||||
enum nss_status status;
|
||||
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
new_start = 1;
|
||||
if (oldkey != NULL)
|
||||
{
|
||||
free (oldkey);
|
||||
oldkey = NULL;
|
||||
oldkeylen = 0;
|
||||
}
|
||||
status = internal_nis_setprotoent ();
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
@@ -62,16 +118,19 @@ _nss_nis_endprotoent (void)
|
||||
{
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
new_start = 1;
|
||||
if (oldkey != NULL)
|
||||
while (start != NULL)
|
||||
{
|
||||
free (oldkey);
|
||||
oldkey = NULL;
|
||||
oldkeylen = 0;
|
||||
if (start->val != NULL)
|
||||
free (start->val);
|
||||
next = start;
|
||||
start = start->next;
|
||||
free (next);
|
||||
}
|
||||
|
||||
start = NULL;
|
||||
next = NULL;
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -80,57 +139,30 @@ internal_nis_getprotoent_r (struct protoent *proto,
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
struct parser_data *data = (void *) buffer;
|
||||
char *domain, *result, *outkey;
|
||||
int len, keylen, parse_res;
|
||||
int parse_res;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
if (start == NULL)
|
||||
internal_nis_setprotoent ();
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
char *p;
|
||||
|
||||
if (new_start)
|
||||
retval = yperr2nss (yp_first (domain, "protocols.bynumber",
|
||||
&outkey, &keylen, &result, &len));
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "protocols.bynumber",
|
||||
oldkey, oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
__set_errno (EAGAIN);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
{
|
||||
free (result);
|
||||
__set_errno (ERANGE);
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
|
||||
if (next == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
p = strcpy (buffer, next->val);
|
||||
next = next->next;
|
||||
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_protoent (p, proto, data, buflen);
|
||||
if (!parse_res && errno == ERANGE)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
||||
free (oldkey);
|
||||
oldkey = outkey;
|
||||
oldkeylen = keylen;
|
||||
new_start = 0;
|
||||
}
|
||||
while (!parse_res);
|
||||
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -130,6 +130,7 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
|
||||
gid_t *gidlist)
|
||||
{
|
||||
char *p;
|
||||
int gidlen;
|
||||
|
||||
if (!s || !isdigit (*s))
|
||||
{
|
||||
@@ -162,14 +163,15 @@ parse_netid_str (const char *s, uid_t *uidp, gid_t *gidp, int *gidlenp,
|
||||
|
||||
*gidp = (atoi (p));
|
||||
|
||||
*gidlenp = 0;
|
||||
#if 0
|
||||
gidlen = 0;
|
||||
|
||||
while ((p = strchr (p, ',')) != NULL)
|
||||
{
|
||||
p++;
|
||||
gidlist[*gidlenp++] = atoi (p);
|
||||
gidlist[gidlen++] = atoi (p);
|
||||
}
|
||||
#endif
|
||||
|
||||
*gidlenp = gidlen;
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+83
-62
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -35,27 +35,77 @@
|
||||
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
struct response_t
|
||||
{
|
||||
char *val;
|
||||
struct response_t *next;
|
||||
};
|
||||
|
||||
struct intern_t
|
||||
{
|
||||
bool_t new_start;
|
||||
char *oldkey;
|
||||
int oldkeylen;
|
||||
struct response_t *start;
|
||||
struct response_t *next;
|
||||
};
|
||||
typedef struct intern_t intern_t;
|
||||
|
||||
static intern_t intern = {TRUE, NULL, 0};
|
||||
static intern_t intern = {NULL, NULL};
|
||||
|
||||
static int
|
||||
saveit (int instatus, char *inkey, int inkeylen, char *inval,
|
||||
int invallen, char *indata)
|
||||
{
|
||||
intern_t *intern = (intern_t *)indata;
|
||||
|
||||
if (instatus != YP_TRUE)
|
||||
return instatus;
|
||||
|
||||
if (inkey && inkeylen > 0 && inval && invallen > 0)
|
||||
{
|
||||
if (intern->start == NULL)
|
||||
{
|
||||
intern->start = malloc (sizeof (struct response_t));
|
||||
intern->next = intern->start;
|
||||
}
|
||||
else
|
||||
{
|
||||
intern->next->next = malloc (sizeof (struct response_t));
|
||||
intern->next = intern->next->next;
|
||||
}
|
||||
intern->next->next = NULL;
|
||||
intern->next->val = malloc (invallen + 1);
|
||||
strncpy (intern->next->val, inval, invallen);
|
||||
intern->next->val[invallen] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum nss_status
|
||||
internal_nis_setrpcent (intern_t *data)
|
||||
internal_nis_setrpcent (intern_t *intern)
|
||||
{
|
||||
data->new_start = 1;
|
||||
if (data->oldkey != NULL)
|
||||
char *domainname;
|
||||
struct ypall_callback ypcb;
|
||||
enum nss_status status;
|
||||
|
||||
if (yp_get_default_domain (&domainname))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
while (intern->start != NULL)
|
||||
{
|
||||
free (data->oldkey);
|
||||
data->oldkey = NULL;
|
||||
data->oldkeylen = 0;
|
||||
if (intern->start->val != NULL)
|
||||
free (intern->start->val);
|
||||
intern->next = intern->start;
|
||||
intern->start = intern->start->next;
|
||||
free (intern->next);
|
||||
}
|
||||
return NSS_STATUS_SUCCESS;
|
||||
intern->start = NULL;
|
||||
|
||||
ypcb.foreach = saveit;
|
||||
ypcb.data = (char *)intern;
|
||||
status = yperr2nss (yp_all(domainname, "rpc.bynumber", &ypcb));
|
||||
intern->next = intern->start;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
enum nss_status
|
||||
@@ -73,15 +123,18 @@ _nss_nis_setrpcent (void)
|
||||
}
|
||||
|
||||
static enum nss_status
|
||||
internal_nis_endrpcent (intern_t *data)
|
||||
internal_nis_endrpcent (intern_t *intern)
|
||||
{
|
||||
data->new_start = 1;
|
||||
if (data->oldkey != NULL)
|
||||
while (intern->start != NULL)
|
||||
{
|
||||
free (data->oldkey);
|
||||
data->oldkey = NULL;
|
||||
data->oldkeylen = 0;
|
||||
if (intern->start->val != NULL)
|
||||
free (intern->start->val);
|
||||
intern->next = intern->start;
|
||||
intern->start = intern->start->next;
|
||||
free (intern->next);
|
||||
}
|
||||
intern->start = NULL;
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -104,60 +157,28 @@ internal_nis_getrpcent_r (struct rpcent *rpc, char *buffer, size_t buflen,
|
||||
intern_t *data)
|
||||
{
|
||||
struct parser_data *pdata = (void *) buffer;
|
||||
char *domain;
|
||||
char *result;
|
||||
int len, parse_res;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
|
||||
if (data->start == NULL)
|
||||
internal_nis_setrpcent (data);
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
|
||||
if (data->new_start)
|
||||
retval = yperr2nss (yp_first (domain, "rpc.bynumber",
|
||||
&outkey, &keylen, &result, &len));
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "rpc.bynumber",
|
||||
data->oldkey, data->oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
__set_errno (EAGAIN);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
{
|
||||
free (result);
|
||||
__set_errno (ERANGE);
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
if (data->next == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
p = strcpy (buffer, data->next->val);
|
||||
data->next = data->next->next;
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
|
||||
parse_res = _nss_files_parse_rpcent (p, rpc, pdata, buflen);
|
||||
if (!parse_res && errno == ERANGE)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
||||
free (data->oldkey);
|
||||
data->oldkey = outkey;
|
||||
data->oldkeylen = keylen;
|
||||
data->new_start = 0;
|
||||
}
|
||||
while (!parse_res);
|
||||
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -179,7 +200,7 @@ enum nss_status
|
||||
_nss_nis_getrpcbyname_r (const char *name, struct rpcent *rpc,
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
intern_t data = {TRUE, NULL, 0};
|
||||
intern_t data = {NULL, NULL};
|
||||
enum nss_status status;
|
||||
int found;
|
||||
|
||||
|
||||
+91
-66
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -37,27 +37,77 @@ extern int _nss_files_parse_servent (char *line, struct servent *result,
|
||||
|
||||
__libc_lock_define_initialized (static, lock)
|
||||
|
||||
struct response_t
|
||||
{
|
||||
char *val;
|
||||
struct response_t *next;
|
||||
};
|
||||
|
||||
struct intern_t
|
||||
{
|
||||
bool_t new_start;
|
||||
char *oldkey;
|
||||
int oldkeylen;
|
||||
struct response_t *start;
|
||||
struct response_t *next;
|
||||
};
|
||||
typedef struct intern_t intern_t;
|
||||
|
||||
static intern_t intern = {TRUE, NULL, 0};
|
||||
static intern_t intern = { NULL, NULL };
|
||||
|
||||
static int
|
||||
saveit (int instatus, char *inkey, int inkeylen, char *inval,
|
||||
int invallen, char *indata)
|
||||
{
|
||||
intern_t *intern = (intern_t *) indata;
|
||||
|
||||
if (instatus != YP_TRUE)
|
||||
return instatus;
|
||||
|
||||
if (inkey && inkeylen > 0 && inval && invallen > 0)
|
||||
{
|
||||
if (intern->start == NULL)
|
||||
{
|
||||
intern->start = malloc (sizeof (struct response_t));
|
||||
intern->next = intern->start;
|
||||
}
|
||||
else
|
||||
{
|
||||
intern->next->next = malloc (sizeof (struct response_t));
|
||||
intern->next = intern->next->next;
|
||||
}
|
||||
intern->next->next = NULL;
|
||||
intern->next->val = malloc (invallen + 1);
|
||||
strncpy (intern->next->val, inval, invallen);
|
||||
intern->next->val[invallen] = '\0';
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static enum nss_status
|
||||
internal_nis_setservent (intern_t * intern)
|
||||
internal_nis_setservent (intern_t *intern)
|
||||
{
|
||||
intern->new_start = 1;
|
||||
if (intern->oldkey != NULL)
|
||||
char *domainname;
|
||||
struct ypall_callback ypcb;
|
||||
enum nss_status status;
|
||||
|
||||
if (yp_get_default_domain (&domainname))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
|
||||
while (intern->start != NULL)
|
||||
{
|
||||
free (intern->oldkey);
|
||||
intern->oldkey = NULL;
|
||||
intern->oldkeylen = 0;
|
||||
if (intern->start->val != NULL)
|
||||
free (intern->start->val);
|
||||
intern->next = intern->start;
|
||||
intern->start = intern->start->next;
|
||||
free (intern->next);
|
||||
}
|
||||
return NSS_STATUS_SUCCESS;
|
||||
intern->start = NULL;
|
||||
|
||||
ypcb.foreach = saveit;
|
||||
ypcb.data = (char *) intern;
|
||||
status = yperr2nss (yp_all (domainname, "services.byname", &ypcb));
|
||||
intern->next = intern->start;
|
||||
|
||||
return status;
|
||||
}
|
||||
enum nss_status
|
||||
_nss_nis_setservent (void)
|
||||
@@ -76,13 +126,16 @@ _nss_nis_setservent (void)
|
||||
static enum nss_status
|
||||
internal_nis_endservent (intern_t * intern)
|
||||
{
|
||||
intern->new_start = 1;
|
||||
if (intern->oldkey != NULL)
|
||||
while (intern->start != NULL)
|
||||
{
|
||||
free (intern->oldkey);
|
||||
intern->oldkey = NULL;
|
||||
intern->oldkeylen = 0;
|
||||
if (intern->start->val != NULL)
|
||||
free (intern->start->val);
|
||||
intern->next = intern->start;
|
||||
intern->start = intern->start->next;
|
||||
free (intern->next);
|
||||
}
|
||||
intern->start = NULL;
|
||||
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -104,57 +157,25 @@ static enum nss_status
|
||||
internal_nis_getservent_r (struct servent *serv, char *buffer,
|
||||
size_t buflen, intern_t *data)
|
||||
{
|
||||
char *domain;
|
||||
char *result;
|
||||
int len, parse_res;
|
||||
char *outkey;
|
||||
int keylen;
|
||||
int parse_res;
|
||||
char *p;
|
||||
|
||||
if (yp_get_default_domain (&domain))
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
if (data->start == NULL)
|
||||
internal_nis_setservent (data);
|
||||
|
||||
/* Get the next entry until we found a correct one. */
|
||||
do
|
||||
{
|
||||
enum nss_status retval;
|
||||
|
||||
if (data->new_start)
|
||||
retval = yperr2nss (yp_first (domain, "services.byname",
|
||||
&outkey, &keylen, &result, &len));
|
||||
else
|
||||
retval = yperr2nss ( yp_next (domain, "services.byname",
|
||||
data->oldkey, data->oldkeylen,
|
||||
&outkey, &keylen, &result, &len));
|
||||
|
||||
if (retval != NSS_STATUS_SUCCESS)
|
||||
{
|
||||
if (retval == NSS_STATUS_TRYAGAIN)
|
||||
__set_errno (EAGAIN);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((size_t) (len + 1) > buflen)
|
||||
{
|
||||
free (result);
|
||||
__set_errno (ERANGE);
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
}
|
||||
|
||||
p = strncpy (buffer, result, len);
|
||||
buffer[len] = '\0';
|
||||
if (data->next == NULL)
|
||||
return NSS_STATUS_NOTFOUND;
|
||||
p = strcpy (buffer, data->next->val);
|
||||
data->next = data->next->next;
|
||||
while (isspace (*p))
|
||||
++p;
|
||||
free (result);
|
||||
|
||||
parse_res = _nss_files_parse_servent (p, serv, buffer, buflen);
|
||||
if (!parse_res && errno == ERANGE)
|
||||
return NSS_STATUS_TRYAGAIN;
|
||||
|
||||
free (data->oldkey);
|
||||
data->oldkey = outkey;
|
||||
data->oldkeylen = keylen;
|
||||
data->new_start = 0;
|
||||
}
|
||||
while (!parse_res);
|
||||
|
||||
@@ -179,11 +200,11 @@ enum nss_status
|
||||
_nss_nis_getservbyname_r (const char *name, char *protocol,
|
||||
struct servent *serv, char *buffer, size_t buflen)
|
||||
{
|
||||
intern_t data = {TRUE, NULL, 0};
|
||||
intern_t data = { NULL, NULL };
|
||||
enum nss_status status;
|
||||
int found;
|
||||
|
||||
if (name == NULL || protocol == NULL)
|
||||
if (name == NULL)
|
||||
{
|
||||
__set_errno (EINVAL);
|
||||
return NSS_STATUS_UNAVAIL;
|
||||
@@ -198,13 +219,17 @@ _nss_nis_getservbyname_r (const char *name, char *protocol,
|
||||
((status = internal_nis_getservent_r (serv, buffer, buflen, &data))
|
||||
== NSS_STATUS_SUCCESS))
|
||||
{
|
||||
if (strcmp (serv->s_name, name) == 0)
|
||||
{
|
||||
if (strcmp (serv->s_proto, protocol) == 0)
|
||||
{
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
if (protocol == NULL || strcmp (serv->s_proto, protocol) == 0)
|
||||
{
|
||||
char **cp;
|
||||
|
||||
if (strcmp (serv->s_name, name) == 0)
|
||||
found = 1;
|
||||
else
|
||||
for (cp = serv->s_aliases; *cp; cp++)
|
||||
if (strcmp (name, *cp) == 0)
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
internal_nis_endservent (&data);
|
||||
@@ -219,7 +244,7 @@ enum nss_status
|
||||
_nss_nis_getservbyport_r (int port, char *protocol, struct servent *serv,
|
||||
char *buffer, size_t buflen)
|
||||
{
|
||||
intern_t data = {TRUE, NULL, 0};
|
||||
intern_t data = { NULL, NULL };
|
||||
enum nss_status status;
|
||||
int found;
|
||||
|
||||
|
||||
+3
-2
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
|
||||
|
||||
@@ -167,7 +167,8 @@ __yp_bind (const char *domain, dom_binding ** ypdb)
|
||||
ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
|
||||
sizeof (ysd->dom_server_addr.sin_addr.s_addr));
|
||||
ysd->dom_vers = YPVERS;
|
||||
strcpy (ysd->dom_domain, domain);
|
||||
strncpy (ysd->dom_domain, domain, YPMAXDOMAIN);
|
||||
ysd->dom_domain[YPMAXDOMAIN] = '\0';
|
||||
}
|
||||
|
||||
if (ysd->dom_client)
|
||||
|
||||
+4
-1
@@ -236,7 +236,10 @@
|
||||
{
|
||||
if (!*cp)
|
||||
{
|
||||
if (*--cp == '.') break;
|
||||
if (*--cp == '.')
|
||||
break;
|
||||
if (!strchr (name, ':'))
|
||||
break;
|
||||
|
||||
/* All-IPv6-legal, no dot at the end. Fake up a
|
||||
hostent as if we'd actually done a lookup. */
|
||||
|
||||
@@ -98,6 +98,13 @@ DB_LOOKUP (hostbyname, ,,
|
||||
LOOKUP_NAME (h_name, h_aliases),
|
||||
const char *name)
|
||||
|
||||
DB_LOOKUP (hostbyname2, ,,
|
||||
{
|
||||
if (result->h_addrtype != af)
|
||||
continue;
|
||||
LOOKUP_NAME (h_name, h_aliases)
|
||||
}, const char *name, int af)
|
||||
|
||||
DB_LOOKUP (hostbyaddr, ,,
|
||||
{
|
||||
if (result->h_addrtype == type && result->h_length == len &&
|
||||
|
||||
@@ -41,8 +41,8 @@ LINE_PARSER
|
||||
|
||||
DB_LOOKUP (servbyname, 1 + strlen (name), (".%s/%s", name, proto),
|
||||
{
|
||||
/* Must match both protocol and name. */
|
||||
if (strcmp (result->s_proto, proto))
|
||||
/* Must match both protocol (if specified) and name. */
|
||||
if (proto != NULL && strcmp (result->s_proto, proto))
|
||||
continue;
|
||||
LOOKUP_NAME (s_name, s_aliases)
|
||||
},
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
TODO COPYING* AUTHORS copyr-* copying.*
|
||||
glibc-*
|
||||
distinfo
|
||||
glob
|
||||
|
||||
+9
-2
@@ -27,7 +27,7 @@ headers := sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h \
|
||||
utsnamelen.h confname.h waitflags.h waitstatus.h sys/unistd.h \
|
||||
sched.h schedbits.h re_comp.h wait.h
|
||||
|
||||
distribute := confstr.h
|
||||
distribute := confstr.h TESTS TESTS2C.sed testcases.h
|
||||
|
||||
routines := \
|
||||
uname \
|
||||
@@ -49,12 +49,14 @@ routines := \
|
||||
getaddrinfo
|
||||
|
||||
aux := init-posix environ
|
||||
tests := tstgetopt testfnm
|
||||
tests := tstgetopt testfnm runtests
|
||||
others := getconf
|
||||
install-bin := getconf
|
||||
install-lib := libposix.a
|
||||
gpl2lgpl := getopt.c getopt1.c getopt.h regex.c regex.h
|
||||
|
||||
before-compile := testcases.h
|
||||
|
||||
include ../Rules
|
||||
|
||||
CFLAGS-regex.c = -Wno-unused -Wno-strict-prototypes
|
||||
@@ -62,6 +64,11 @@ CFLAGS-getaddrinfo.c = -DRESOLVER
|
||||
|
||||
$(objpfx)libposix.a: $(dep-dummy-lib); $(make-dummy-lib)
|
||||
lib: $(objpfx)libposix.a
|
||||
|
||||
testcases.h: TESTS TESTS2C.sed
|
||||
sed -f TESTS2C.sed < $< > $@T
|
||||
mv -f $@T $@
|
||||
test ! -d CVS || cvs commit -mRegenerated $@
|
||||
|
||||
# Make the standalone glob/fnmatch package.
|
||||
|
||||
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
0:(.*)*\1:xx
|
||||
0:^:
|
||||
0:$:
|
||||
0:^$:
|
||||
0:^a$:a
|
||||
0:abc:abc
|
||||
1:abc:xbc
|
||||
1:abc:axc
|
||||
1:abc:abx
|
||||
0:abc:xabcy
|
||||
0:abc:ababc
|
||||
0:ab*c:abc
|
||||
0:ab*bc:abc
|
||||
0:ab*bc:abbc
|
||||
0:ab*bc:abbbbc
|
||||
0:ab+bc:abbc
|
||||
1:ab+bc:abc
|
||||
1:ab+bc:abq
|
||||
0:ab+bc:abbbbc
|
||||
0:ab?bc:abbc
|
||||
0:ab?bc:abc
|
||||
1:ab?bc:abbbbc
|
||||
0:ab?c:abc
|
||||
0:^abc$:abc
|
||||
1:^abc$:abcc
|
||||
0:^abc:abcc
|
||||
1:^abc$:aabc
|
||||
0:abc$:aabc
|
||||
0:^:abc
|
||||
0:$:abc
|
||||
0:a.c:abc
|
||||
0:a.c:axc
|
||||
0:a.*c:axyzc
|
||||
1:a.*c:axyzd
|
||||
1:a[bc]d:abc
|
||||
0:a[bc]d:abd
|
||||
1:a[b-d]e:abd
|
||||
0:a[b-d]e:ace
|
||||
0:a[b-d]:aac
|
||||
0:a[-b]:a-
|
||||
0:a[b-]:a-
|
||||
1:a[b-a]:-
|
||||
2:a[]b:-
|
||||
2:a[:-
|
||||
0:a]:a]
|
||||
0:a[]]b:a]b
|
||||
0:a[^bc]d:aed
|
||||
1:a[^bc]d:abd
|
||||
0:a[^-b]c:adc
|
||||
1:a[^-b]c:a-c
|
||||
1:a[^]b]c:a]c
|
||||
0:a[^]b]c:adc
|
||||
0:ab|cd:abc
|
||||
0:ab|cd:abcd
|
||||
0:()ef:def
|
||||
0:()*:-
|
||||
1:*a:-
|
||||
0:^*:-
|
||||
0:$*:-
|
||||
1:(*)b:-
|
||||
1:$b:b
|
||||
2:a\:-
|
||||
0:a\(b:a(b
|
||||
0:a\(*b:ab
|
||||
0:a\(*b:a((b
|
||||
1:a\x:a\x
|
||||
1:abc):-
|
||||
2:(abc:-
|
||||
0:((a)):abc
|
||||
0:(a)b(c):abc
|
||||
0:a+b+c:aabbabc
|
||||
0:a**:-
|
||||
0:a*?:-
|
||||
0:(a*)*:-
|
||||
0:(a*)+:-
|
||||
0:(a|)*:-
|
||||
0:(a*|b)*:-
|
||||
0:(a+|b)*:ab
|
||||
0:(a+|b)+:ab
|
||||
0:(a+|b)?:ab
|
||||
0:[^ab]*:cde
|
||||
0:(^)*:-
|
||||
0:(ab|)*:-
|
||||
2:)(:-
|
||||
1:abc:
|
||||
1:abc:
|
||||
0:a*:
|
||||
0:([abc])*d:abbbcd
|
||||
0:([abc])*bcd:abcd
|
||||
0:a|b|c|d|e:e
|
||||
0:(a|b|c|d|e)f:ef
|
||||
0:((a*|b))*:-
|
||||
0:abcd*efg:abcdefg
|
||||
0:ab*:xabyabbbz
|
||||
0:ab*:xayabbbz
|
||||
0:(ab|cd)e:abcde
|
||||
0:[abhgefdc]ij:hij
|
||||
1:^(ab|cd)e:abcde
|
||||
0:(abc|)ef:abcdef
|
||||
0:(a|b)c*d:abcd
|
||||
0:(ab|ab*)bc:abc
|
||||
0:a([bc]*)c*:abc
|
||||
0:a([bc]*)(c*d):abcd
|
||||
0:a([bc]+)(c*d):abcd
|
||||
0:a([bc]*)(c+d):abcd
|
||||
0:a[bcd]*dcdcde:adcdcde
|
||||
1:a[bcd]+dcdcde:adcdcde
|
||||
0:(ab|a)b*c:abc
|
||||
0:((a)(b)c)(d):abcd
|
||||
0:[A-Za-z_][A-Za-z0-9_]*:alpha
|
||||
0:^a(bc+|b[eh])g|.h$:abh
|
||||
0:(bc+d$|ef*g.|h?i(j|k)):effgz
|
||||
0:(bc+d$|ef*g.|h?i(j|k)):ij
|
||||
1:(bc+d$|ef*g.|h?i(j|k)):effg
|
||||
1:(bc+d$|ef*g.|h?i(j|k)):bcdd
|
||||
0:(bc+d$|ef*g.|h?i(j|k)):reffgz
|
||||
1:((((((((((a)))))))))):-
|
||||
0:(((((((((a))))))))):a
|
||||
1:multiple words of text:uh-uh
|
||||
0:multiple words:multiple words, yeah
|
||||
0:(.*)c(.*):abcde
|
||||
1:\((.*),:(.*)\)
|
||||
1:[k]:ab
|
||||
0:abcd:abcd
|
||||
0:a(bc)d:abcd
|
||||
0:a[-]?c:ac
|
||||
0:(....).*\1:beriberi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Qaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mo'ammar Gadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Kaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Qadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar El Kadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Gadafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qadafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamer El Kazzafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar al-Gaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Al Qathafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Al Qathafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mo'ammar el-Gadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar El Kadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar al-Qadhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qadhdhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Qadafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moamar Gaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar Qadhdhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Khaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar al-Khaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'amar al-Kadafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghaddafy
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghadafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Ghaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muamar Kaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Quathafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muammar Gheddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Muamar Al-Kaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar Khadafy
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar Qudhafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qaddafi
|
||||
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi
|
||||
@@ -0,0 +1,2 @@
|
||||
s/\\/\\\\/g
|
||||
s/\(.*\):\(.*\):\(.*\)/ {\1, "\2", "\3"},/
|
||||
+188
-108
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
@@ -33,6 +33,10 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* Outcomment the following line for production quality code. */
|
||||
/* #define NDEBUG 1 */
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/* Comment out all this code if we are using the GNU C Library, and are not
|
||||
actually compiling the library itself. This code is part of the GNU C
|
||||
@@ -159,7 +163,7 @@ extern void bcopy ();
|
||||
((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
|
||||
#endif /* Not ANSI_STRING. */
|
||||
|
||||
#ifndef HAVE_STRCOLL
|
||||
#if !defined HAVE_STRCOLL && !defined _LIBC
|
||||
#define strcoll strcmp
|
||||
#endif
|
||||
|
||||
@@ -254,6 +258,51 @@ static int glob_in_dir __P ((const char *pattern, const char *directory,
|
||||
static int prefix_array __P ((const char *prefix, char **array, size_t n));
|
||||
static int collated_compare __P ((const __ptr_t, const __ptr_t));
|
||||
|
||||
|
||||
/* Find the end of the sub-pattern in a brace expression. We define
|
||||
this as an inline function if the compiler permits. */
|
||||
static
|
||||
#if __GNUC__ - 0 >= 2
|
||||
inline
|
||||
#endif
|
||||
const char *
|
||||
next_brace_sub (const char *begin)
|
||||
{
|
||||
unsigned int depth = 0;
|
||||
const char *cp = begin;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (depth == 0)
|
||||
{
|
||||
if (*cp != ',' && *cp != '}' && *cp != '\0')
|
||||
{
|
||||
if (*cp == '{')
|
||||
++depth;
|
||||
++cp;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*cp != '\0' && (*cp != '}' || depth > 0))
|
||||
{
|
||||
if (*cp == '}')
|
||||
++depth;
|
||||
++cp;
|
||||
}
|
||||
if (*cp == '\0')
|
||||
/* An incorrectly terminated brace expression. */
|
||||
return NULL;
|
||||
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return cp;
|
||||
}
|
||||
|
||||
/* Do glob searching for PATTERN, placing results in PGLOB.
|
||||
The bits defined above may be set in FLAGS.
|
||||
If a directory cannot be opened or read and ERRFUNC is not nil,
|
||||
@@ -286,38 +335,59 @@ glob (pattern, flags, errfunc, pglob)
|
||||
const char *begin = strchr (pattern, '{');
|
||||
if (begin != NULL)
|
||||
{
|
||||
/* Allocate working buffer large enough for our work. Note that
|
||||
we have at least an opening and closing brace. */
|
||||
int firstc;
|
||||
size_t restlen;
|
||||
const char *p, *end, *next;
|
||||
unsigned int depth = 0;
|
||||
|
||||
/* Find the end of the brace expression, by counting braces.
|
||||
While we're at it, notice the first comma at top brace level. */
|
||||
end = begin + 1;
|
||||
next = NULL;
|
||||
while (1)
|
||||
char *alt_start;
|
||||
const char *p;
|
||||
const char *next;
|
||||
const char *rest;
|
||||
size_t rest_len;
|
||||
#ifdef __GNUC__
|
||||
char onealt[strlen (pattern) - 1];
|
||||
#else
|
||||
char *onealt = (char *) malloc (strlen (pattern) - 1);
|
||||
if (onealt == NULL)
|
||||
{
|
||||
switch (*end++)
|
||||
{
|
||||
case ',':
|
||||
if (depth == 0 && next == NULL)
|
||||
next = end;
|
||||
continue;
|
||||
case '{':
|
||||
++depth;
|
||||
continue;
|
||||
case '}':
|
||||
if (depth-- == 0)
|
||||
break;
|
||||
continue;
|
||||
case '\0':
|
||||
return glob (pattern, flags &~ GLOB_BRACE, errfunc, pglob);
|
||||
}
|
||||
break;
|
||||
if (!(flags & GLOB_APPEND))
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
restlen = strlen (end) + 1;
|
||||
#endif
|
||||
|
||||
/* We know the prefix for all sub-patterns. */
|
||||
memcpy (onealt, pattern, begin - pattern);
|
||||
alt_start = &onealt[begin - pattern];
|
||||
|
||||
/* Find the first sub-pattern and at the same time find the
|
||||
rest after the closing brace. */
|
||||
next = next_brace_sub (begin + 1);
|
||||
if (next == NULL)
|
||||
next = end;
|
||||
{
|
||||
/* It is an illegal expression. */
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
|
||||
}
|
||||
|
||||
/* Now find the end of the whole brace expression. */
|
||||
rest = next;
|
||||
while (*rest != '}')
|
||||
{
|
||||
rest = next_brace_sub (rest + 1);
|
||||
if (rest == NULL)
|
||||
{
|
||||
/* It is an illegal expression. */
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
|
||||
}
|
||||
}
|
||||
/* Please note that we now can be sure the brace expression
|
||||
is well-formed. */
|
||||
rest_len = strlen (++rest) + 1;
|
||||
|
||||
/* We have a brace expression. BEGIN points to the opening {,
|
||||
NEXT points past the terminator of the first element, and END
|
||||
@@ -334,72 +404,47 @@ glob (pattern, flags, errfunc, pglob)
|
||||
}
|
||||
firstc = pglob->gl_pathc;
|
||||
|
||||
/* In this loop P points to the beginning of the current element
|
||||
and NEXT points past its terminator. */
|
||||
p = begin + 1;
|
||||
while (1)
|
||||
{
|
||||
/* Construct a whole name that is one of the brace
|
||||
alternatives in a temporary buffer. */
|
||||
int result;
|
||||
size_t bufsz = (begin - pattern) + (next - 1 - p) + restlen;
|
||||
#ifdef __GNUC__
|
||||
char onealt[bufsz];
|
||||
#else
|
||||
char *onealt = malloc (bufsz);
|
||||
if (onealt == NULL)
|
||||
{
|
||||
if (!(flags & GLOB_APPEND))
|
||||
globfree (pglob);
|
||||
return GLOB_NOSPACE;
|
||||
}
|
||||
#endif
|
||||
memcpy (onealt, pattern, begin - pattern);
|
||||
memcpy (&onealt[begin - pattern], p, next - 1 - p);
|
||||
memcpy (&onealt[(begin - pattern) + (next - 1 - p)],
|
||||
end, restlen);
|
||||
|
||||
/* Construct the new glob expression. */
|
||||
memcpy (alt_start, p, next - p);
|
||||
memcpy (&alt_start[next - p], rest, rest_len);
|
||||
|
||||
result = glob (onealt,
|
||||
((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC)) |
|
||||
GLOB_APPEND), errfunc, pglob);
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
((flags & ~(GLOB_NOCHECK|GLOB_NOMAGIC))
|
||||
| GLOB_APPEND), errfunc, pglob);
|
||||
|
||||
/* If we got an error, return it. */
|
||||
if (result && result != GLOB_NOMATCH)
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
if (!(flags & GLOB_APPEND))
|
||||
globfree (pglob);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Advance past this alternative and process the next. */
|
||||
p = next;
|
||||
depth = 0;
|
||||
scan:
|
||||
switch (*p++)
|
||||
{
|
||||
case ',':
|
||||
if (depth == 0)
|
||||
{
|
||||
/* Found the next alternative. Loop to glob it. */
|
||||
next = p;
|
||||
continue;
|
||||
}
|
||||
goto scan;
|
||||
case '{':
|
||||
++depth;
|
||||
goto scan;
|
||||
case '}':
|
||||
if (depth-- == 0)
|
||||
/* End of the brace expression. Break out of the loop. */
|
||||
break;
|
||||
goto scan;
|
||||
}
|
||||
if (*next == '}')
|
||||
/* We saw the last entry. */
|
||||
break;
|
||||
|
||||
p = next + 1;
|
||||
next = next_brace_sub (p);
|
||||
assert (next != NULL);
|
||||
}
|
||||
|
||||
if (pglob->gl_pathc == firstc &&
|
||||
!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
|
||||
#ifndef __GNUC__
|
||||
free (onealt);
|
||||
#endif
|
||||
|
||||
if (pglob->gl_pathc != firstc)
|
||||
/* We found some entries. */
|
||||
return 0;
|
||||
else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
|
||||
return GLOB_NOMATCH;
|
||||
}
|
||||
}
|
||||
@@ -452,19 +497,19 @@ glob (pattern, flags, errfunc, pglob)
|
||||
#ifndef VMS
|
||||
if ((flags & GLOB_TILDE) && dirname[0] == '~')
|
||||
{
|
||||
if (dirname[1] == '\0')
|
||||
if (dirname[1] == '\0' || dirname[1] == '/')
|
||||
{
|
||||
/* Look up home directory. */
|
||||
dirname = getenv ("HOME");
|
||||
char *home_dir = getenv ("HOME");
|
||||
#ifdef _AMIGA
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "SYS:";
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
home_dir = "SYS:";
|
||||
#else
|
||||
#ifdef WIN32
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "c:/users/default"; /* poor default */
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
home_dir = "c:/users/default"; /* poor default */
|
||||
#else
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
{
|
||||
extern char *getlogin __P ((void));
|
||||
extern int getlogin_r __P ((char *, size_t));
|
||||
@@ -501,39 +546,74 @@ glob (pattern, flags, errfunc, pglob)
|
||||
success = p != NULL;
|
||||
#endif
|
||||
if (success)
|
||||
dirname = p->pw_dir;
|
||||
home_dir = p->pw_dir;
|
||||
}
|
||||
}
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = (char *) "~"; /* No luck. */
|
||||
if (home_dir == NULL || home_dir[0] == '\0')
|
||||
home_dir = (char *) "~"; /* No luck. */
|
||||
#endif /* WIN32 */
|
||||
#endif
|
||||
/* Now construct the full directory. */
|
||||
if (dirname[1] == '\0')
|
||||
dirname = home_dir;
|
||||
else
|
||||
{
|
||||
char *newp;
|
||||
size_t home_len = strlen (home_dir);
|
||||
newp = __alloca (home_len + dirlen);
|
||||
memcpy (newp, home_dir, home_len);
|
||||
memcpy (&newp[home_len], &dirname[1], dirlen);
|
||||
dirname = newp;
|
||||
}
|
||||
}
|
||||
#if !defined _AMIGA && !defined WIN32
|
||||
else
|
||||
{
|
||||
#ifdef _AMIGA
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "SYS:";
|
||||
#else
|
||||
#ifdef WIN32
|
||||
if (dirname == NULL || dirname[0] == '\0')
|
||||
dirname = "c:/users/default"; /* poor default */
|
||||
#else
|
||||
char *end_name = strchr (dirname, '/');
|
||||
char *user_name;
|
||||
char *home_dir;
|
||||
|
||||
if (end_name == NULL)
|
||||
user_name = dirname + 1;
|
||||
else
|
||||
{
|
||||
user_name = __alloca (end_name - dirname);
|
||||
memcpy (user_name, dirname + 1, end_name - dirname);
|
||||
user_name[end_name - dirname - 1] = '\0';
|
||||
}
|
||||
|
||||
/* Look up specific user's home directory. */
|
||||
{
|
||||
#if defined HAVE_GETPWNAM_R || defined _LIBC
|
||||
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
|
||||
char *pwtmpbuf = __alloca (buflen);
|
||||
struct passwd pwbuf, *p;
|
||||
if (__getpwnam_r (dirname + 1, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
|
||||
dirname = p->pw_dir;
|
||||
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
|
||||
char *pwtmpbuf = __alloca (buflen);
|
||||
struct passwd pwbuf, *p;
|
||||
if (__getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) >= 0)
|
||||
home_dir = p->pw_dir;
|
||||
else
|
||||
home_dir = NULL;
|
||||
#else
|
||||
struct passwd *p = getpwnam (dirname + 1);
|
||||
if (p != NULL)
|
||||
dirname = p->pw_dir;
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
struct passwd *p = getpwnam (user_name);
|
||||
if (p != NULL)
|
||||
home_dir = p->pw_dir;
|
||||
else
|
||||
home_dir = NULL;
|
||||
#endif
|
||||
}
|
||||
/* If we found a home directory use this. */
|
||||
if (home_dir != NULL)
|
||||
{
|
||||
char *newp;
|
||||
size_t home_len = strlen (home_dir);
|
||||
size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
|
||||
newp = __alloca (home_len + rest_len + 1);
|
||||
memcpy (newp, home_dir, home_len);
|
||||
memcpy (&newp[home_len], end_name, rest_len);
|
||||
newp[home_len + rest_len] = '\0';
|
||||
dirname = newp;
|
||||
}
|
||||
}
|
||||
#endif /* Not Amiga && not Win32. */
|
||||
}
|
||||
#endif /* Not VMS. */
|
||||
|
||||
|
||||
+177
-57
@@ -3,25 +3,25 @@
|
||||
(Implements POSIX draft P10003.2/D11.2, except for
|
||||
internationalization features.)
|
||||
|
||||
Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
|
||||
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 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.
|
||||
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., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
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. */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#if defined (_AIX) && !defined (REGEX_MALLOC)
|
||||
@@ -35,8 +35,12 @@ Cambridge, MA 02139, USA. */
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(STDC_HEADERS) && !defined(emacs)
|
||||
#include <stddef.h>
|
||||
#else
|
||||
/* We need this for `regex.h', and perhaps for the Emacs include files. */
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* This is for other GNU distributions with internationalized messages. */
|
||||
#if HAVE_LIBINTL_H || defined (_LIBC)
|
||||
@@ -500,6 +504,7 @@ typedef enum
|
||||
} while (0)
|
||||
|
||||
#ifdef DEBUG
|
||||
static void extract_number _RE_ARGS ((int *dest, unsigned char *source));
|
||||
static void
|
||||
extract_number (dest, source)
|
||||
int *dest;
|
||||
@@ -527,6 +532,8 @@ extract_number (dest, source)
|
||||
} while (0)
|
||||
|
||||
#ifdef DEBUG
|
||||
static void extract_number_and_incr _RE_ARGS ((int *destination,
|
||||
unsigned char **source));
|
||||
static void
|
||||
extract_number_and_incr (destination, source)
|
||||
int *destination;
|
||||
@@ -890,6 +897,13 @@ print_double_string (where, string1, size1, string2, size2)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
printchar (c)
|
||||
int c;
|
||||
{
|
||||
putc (c, stderr);
|
||||
}
|
||||
|
||||
#else /* not DEBUG */
|
||||
|
||||
#undef assert
|
||||
@@ -1007,9 +1021,35 @@ static const char *re_error_msgid[] =
|
||||
#endif
|
||||
|
||||
/* Roughly the maximum number of failure points on the stack. Would be
|
||||
exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
|
||||
exactly that if always used MAX_FAILURE_SPACE each time we failed.
|
||||
This is a variable only so users of regex can assign to it; we never
|
||||
change it ourselves. */
|
||||
|
||||
#ifdef INT_IS_16BIT
|
||||
|
||||
#if defined (MATCH_MAY_ALLOCATE)
|
||||
long re_max_failures = 4000;
|
||||
#else
|
||||
long re_max_failures = 2000;
|
||||
#endif
|
||||
|
||||
union fail_stack_elt
|
||||
{
|
||||
unsigned char *pointer;
|
||||
long integer;
|
||||
};
|
||||
|
||||
typedef union fail_stack_elt fail_stack_elt_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fail_stack_elt_t *stack;
|
||||
unsigned long size;
|
||||
unsigned long avail; /* Offset of next open position. */
|
||||
} fail_stack_type;
|
||||
|
||||
#else /* not INT_IS_16BIT */
|
||||
|
||||
#if defined (MATCH_MAY_ALLOCATE)
|
||||
/* 4400 was enough to cause a crash on Alpha OSF/1,
|
||||
whose default stack limit is 2mb. */
|
||||
@@ -1033,6 +1073,8 @@ typedef struct
|
||||
unsigned avail; /* Offset of next open position. */
|
||||
} fail_stack_type;
|
||||
|
||||
#endif /* INT_IS_16BIT */
|
||||
|
||||
#define FAIL_STACK_EMPTY() (fail_stack.avail == 0)
|
||||
#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0)
|
||||
#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
|
||||
@@ -1123,7 +1165,7 @@ typedef struct
|
||||
/* Used to omit pushing failure point id's when we're not debugging. */
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_PUSH PUSH_FAILURE_INT
|
||||
#define DEBUG_POP(item_addr) *(item_addr) = POP_FAILURE_INT ()
|
||||
#define DEBUG_POP(item_addr) (item_addr)->integer = POP_FAILURE_INT ()
|
||||
#else
|
||||
#define DEBUG_PUSH(item)
|
||||
#define DEBUG_POP(item_addr)
|
||||
@@ -1144,7 +1186,10 @@ typedef struct
|
||||
char *destination; \
|
||||
/* Must be int, so when we don't save any registers, the arithmetic \
|
||||
of 0 + -1 isn't done as unsigned. */ \
|
||||
unsigned this_reg; \
|
||||
/* Can't be int, since there is not a shred of a guarantee that int \
|
||||
is wide enough to hold a value of something to which pointer can \
|
||||
be assigned */ \
|
||||
s_reg_t this_reg; \
|
||||
\
|
||||
DEBUG_STATEMENT (failure_id++); \
|
||||
DEBUG_STATEMENT (nfailure_points_pushed++); \
|
||||
@@ -1257,7 +1302,7 @@ typedef struct
|
||||
#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\
|
||||
{ \
|
||||
DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \
|
||||
unsigned this_reg; \
|
||||
s_reg_t this_reg; \
|
||||
const unsigned char *string_temp; \
|
||||
\
|
||||
assert (!FAIL_STACK_EMPTY ()); \
|
||||
@@ -1288,10 +1333,10 @@ typedef struct
|
||||
DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
|
||||
\
|
||||
/* Restore register info. */ \
|
||||
high_reg = (unsigned) POP_FAILURE_INT (); \
|
||||
high_reg = (active_reg_t) POP_FAILURE_INT (); \
|
||||
DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \
|
||||
\
|
||||
low_reg = (unsigned) POP_FAILURE_INT (); \
|
||||
low_reg = (active_reg_t) POP_FAILURE_INT (); \
|
||||
DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
|
||||
\
|
||||
if (1) \
|
||||
@@ -1336,6 +1381,9 @@ typedef struct
|
||||
the type of `word', i.e., is something that fits into one item on the
|
||||
failure stack. */
|
||||
|
||||
|
||||
/* Declarations and macros for re_match_2. */
|
||||
|
||||
typedef union
|
||||
{
|
||||
fail_stack_elt_t word;
|
||||
@@ -1365,7 +1413,7 @@ typedef union
|
||||
{ \
|
||||
if (!set_regs_matched_done) \
|
||||
{ \
|
||||
unsigned r; \
|
||||
active_reg_t r; \
|
||||
set_regs_matched_done = 1; \
|
||||
for (r = lowest_active_reg; r <= highest_active_reg; r++) \
|
||||
{ \
|
||||
@@ -1384,11 +1432,25 @@ static char reg_unset_dummy;
|
||||
|
||||
/* Subroutine declarations and macros for regex_compile. */
|
||||
|
||||
static void store_op1 (), store_op2 ();
|
||||
static void insert_op1 (), insert_op2 ();
|
||||
static boolean at_begline_loc_p (), at_endline_loc_p ();
|
||||
static boolean group_in_compile_stack ();
|
||||
static reg_errcode_t compile_range ();
|
||||
static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size,
|
||||
reg_syntax_t syntax,
|
||||
struct re_pattern_buffer *bufp));
|
||||
static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg));
|
||||
static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
|
||||
int arg1, int arg2));
|
||||
static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
|
||||
int arg, unsigned char *end));
|
||||
static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
|
||||
int arg1, int arg2, unsigned char *end));
|
||||
static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p,
|
||||
reg_syntax_t syntax));
|
||||
static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend,
|
||||
reg_syntax_t syntax));
|
||||
static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr,
|
||||
const char *pend,
|
||||
char *translate,
|
||||
reg_syntax_t syntax,
|
||||
unsigned char *b));
|
||||
|
||||
/* Fetch the next character in the uncompiled pattern---translating it
|
||||
if necessary. Also cast from a signed character in the constant
|
||||
@@ -1463,26 +1525,39 @@ static reg_errcode_t compile_range ();
|
||||
/* Store a jump with opcode OP at LOC to location TO. We store a
|
||||
relative address offset by the three bytes the jump itself occupies. */
|
||||
#define STORE_JUMP(op, loc, to) \
|
||||
store_op1 (op, loc, (to) - (loc) - 3)
|
||||
store_op1 (op, loc, (int) ((to) - (loc) - 3))
|
||||
|
||||
/* Likewise, for a two-argument jump. */
|
||||
#define STORE_JUMP2(op, loc, to, arg) \
|
||||
store_op2 (op, loc, (to) - (loc) - 3, arg)
|
||||
store_op2 (op, loc, (int) ((to) - (loc) - 3), arg)
|
||||
|
||||
/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */
|
||||
#define INSERT_JUMP(op, loc, to) \
|
||||
insert_op1 (op, loc, (to) - (loc) - 3, b)
|
||||
insert_op1 (op, loc, (int) ((to) - (loc) - 3), b)
|
||||
|
||||
/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */
|
||||
#define INSERT_JUMP2(op, loc, to, arg) \
|
||||
insert_op2 (op, loc, (to) - (loc) - 3, arg, b)
|
||||
insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b)
|
||||
|
||||
|
||||
/* This is not an arbitrary limit: the arguments which represent offsets
|
||||
into the pattern are two bytes long. So if 2^16 bytes turns out to
|
||||
be too small, many things would have to change. */
|
||||
/* Any other compiler which, like MSC, has allocation limit below 2^16
|
||||
bytes will have to use approach similar to what was done below for
|
||||
MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up
|
||||
reallocating to 0 bytes. Such thing is not going to work too well.
|
||||
You have been warned!! */
|
||||
#ifdef _MSC_VER
|
||||
/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes.
|
||||
The REALLOC define eliminates a flurry of conversion warnings,
|
||||
but is not required. */
|
||||
#define MAX_BUF_SIZE 65500L
|
||||
#define REALLOC(p,s) realloc ((p), (size_t) (s))
|
||||
#else
|
||||
#define MAX_BUF_SIZE (1L << 16)
|
||||
|
||||
#define REALLOC(p,s) realloc ((p), (s))
|
||||
#endif
|
||||
|
||||
/* Extend the buffer by twice its current size via realloc and
|
||||
reset the pointers that pointed into the old block to point to the
|
||||
@@ -1496,7 +1571,7 @@ static reg_errcode_t compile_range ();
|
||||
bufp->allocated <<= 1; \
|
||||
if (bufp->allocated > MAX_BUF_SIZE) \
|
||||
bufp->allocated = MAX_BUF_SIZE; \
|
||||
bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
|
||||
bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\
|
||||
if (bufp->buffer == NULL) \
|
||||
return REG_ESPACE; \
|
||||
/* If the buffer moved, move all the pointers into it. */ \
|
||||
@@ -1528,7 +1603,8 @@ typedef unsigned regnum_t;
|
||||
|
||||
/* Since offsets can go either forwards or backwards, this type needs to
|
||||
be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */
|
||||
typedef int pattern_offset_t;
|
||||
/* int may be not enough when sizeof(int) == 2. */
|
||||
typedef long pattern_offset_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -1638,6 +1714,10 @@ regex_grow_registers (num_regs)
|
||||
|
||||
#endif /* not MATCH_MAY_ALLOCATE */
|
||||
|
||||
static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
|
||||
compile_stack,
|
||||
regnum_t regnum));
|
||||
|
||||
/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
|
||||
Returns one of error codes defined in `regex.h', or zero for success.
|
||||
|
||||
@@ -1663,7 +1743,7 @@ regex_grow_registers (num_regs)
|
||||
static reg_errcode_t
|
||||
regex_compile (pattern, size, syntax, bufp)
|
||||
const char *pattern;
|
||||
int size;
|
||||
size_t size;
|
||||
reg_syntax_t syntax;
|
||||
struct re_pattern_buffer *bufp;
|
||||
{
|
||||
@@ -2104,6 +2184,9 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
|| (is_upper && ISUPPER (ch))
|
||||
|| (is_xdigit && ISXDIGIT (ch)))
|
||||
SET_LIST_BIT (ch);
|
||||
if ( translate && (is_upper || is_lower)
|
||||
&& (ISUPPER (ch) || ISLOWER (ch)))
|
||||
SET_LIST_BIT (ch);
|
||||
}
|
||||
had_char_class = true;
|
||||
}
|
||||
@@ -2529,38 +2612,54 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
|
||||
|
||||
case 'w':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
laststart = b;
|
||||
BUF_PUSH (wordchar);
|
||||
break;
|
||||
|
||||
|
||||
case 'W':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
laststart = b;
|
||||
BUF_PUSH (notwordchar);
|
||||
break;
|
||||
|
||||
|
||||
case '<':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (wordbeg);
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (wordend);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (wordbound);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (notwordbound);
|
||||
break;
|
||||
|
||||
case '`':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (begbuf);
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
if (re_syntax_options & RE_NO_GNU_OPS)
|
||||
goto normal_char;
|
||||
BUF_PUSH (endbuf);
|
||||
break;
|
||||
|
||||
@@ -2575,7 +2674,7 @@ regex_compile (pattern, size, syntax, bufp)
|
||||
FREE_STACK_RETURN (REG_ESUBREG);
|
||||
|
||||
/* Can't back reference to a subexpression if inside of it. */
|
||||
if (group_in_compile_stack (compile_stack, c1))
|
||||
if (group_in_compile_stack (compile_stack, (regnum_t) c1))
|
||||
goto normal_char;
|
||||
|
||||
laststart = b;
|
||||
@@ -2802,7 +2901,7 @@ at_begline_loc_p (pattern, p, syntax)
|
||||
static boolean
|
||||
at_endline_loc_p (p, pend, syntax)
|
||||
const char *p, *pend;
|
||||
int syntax;
|
||||
reg_syntax_t syntax;
|
||||
{
|
||||
const char *next = p;
|
||||
boolean next_backslash = *next == '\\';
|
||||
@@ -2924,13 +3023,14 @@ re_compile_fastmap (bufp)
|
||||
|
||||
register char *fastmap = bufp->fastmap;
|
||||
unsigned char *pattern = bufp->buffer;
|
||||
unsigned long size = bufp->used;
|
||||
unsigned char *p = pattern;
|
||||
register unsigned char *pend = pattern + size;
|
||||
register unsigned char *pend = pattern + bufp->used;
|
||||
|
||||
#ifdef REL_ALLOC
|
||||
/* This holds the pointer to the failure stack, when
|
||||
it is allocated relocatably. */
|
||||
fail_stack_elt_t *failure_stack_ptr;
|
||||
#endif
|
||||
|
||||
/* Assume that each path through the pattern can be null until
|
||||
proven otherwise. We set this false at the bottom of switch
|
||||
@@ -3406,13 +3506,6 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
|
||||
return -1;
|
||||
} /* re_search_2 */
|
||||
|
||||
/* Declarations and macros for re_match_2. */
|
||||
|
||||
static int bcmp_translate ();
|
||||
static boolean alt_match_null_string_p (),
|
||||
common_op_match_null_string_p (),
|
||||
group_match_null_string_p ();
|
||||
|
||||
/* This converts PTR, a pointer into one of the search strings `string1'
|
||||
and `string2' into an offset from the beginning of that string. */
|
||||
#define POINTER_TO_OFFSET(ptr) \
|
||||
@@ -3453,14 +3546,12 @@ static boolean alt_match_null_string_p (),
|
||||
: (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
|
||||
== Sword)
|
||||
|
||||
/* Disabled due to a compiler bug -- see comment at case wordbound */
|
||||
#if 0
|
||||
/* Test if the character before D and the one at D differ with respect
|
||||
to being word-constituent. */
|
||||
#define AT_WORD_BOUNDARY(d) \
|
||||
(AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
|
||||
|| WORDCHAR_P (d - 1) != WORDCHAR_P (d))
|
||||
#endif
|
||||
|
||||
|
||||
/* Free everything we malloc. */
|
||||
#ifdef MATCH_MAY_ALLOCATE
|
||||
@@ -3506,11 +3597,26 @@ re_match (bufp, string, size, pos, regs)
|
||||
{
|
||||
int result = re_match_2_internal (bufp, NULL, 0, string, size,
|
||||
pos, regs, size);
|
||||
#ifndef REGEX_MALLOC
|
||||
#ifdef C_ALLOCA
|
||||
alloca (0);
|
||||
#endif
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
#endif /* not emacs */
|
||||
|
||||
static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p,
|
||||
unsigned char *end,
|
||||
register_info_type *reg_info));
|
||||
static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p,
|
||||
unsigned char *end,
|
||||
register_info_type *reg_info));
|
||||
static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p,
|
||||
unsigned char *end,
|
||||
register_info_type *reg_info));
|
||||
static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2,
|
||||
int len, char *translate));
|
||||
|
||||
/* re_match_2 matches the compiled pattern in BUFP against the
|
||||
the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1
|
||||
@@ -3536,7 +3642,11 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
{
|
||||
int result = re_match_2_internal (bufp, string1, size1, string2, size2,
|
||||
pos, regs, stop);
|
||||
#ifndef REGEX_MALLOC
|
||||
#ifdef C_ALLOCA
|
||||
alloca (0);
|
||||
#endif
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3593,18 +3703,20 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
|
||||
#endif
|
||||
|
||||
#ifdef REL_ALLOC
|
||||
/* This holds the pointer to the failure stack, when
|
||||
it is allocated relocatably. */
|
||||
fail_stack_elt_t *failure_stack_ptr;
|
||||
#endif
|
||||
|
||||
/* We fill all the registers internally, independent of what we
|
||||
return, for use in backreferences. The number here includes
|
||||
an element for register zero. */
|
||||
unsigned num_regs = bufp->re_nsub + 1;
|
||||
size_t num_regs = bufp->re_nsub + 1;
|
||||
|
||||
/* The currently active registers. */
|
||||
unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
|
||||
unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
|
||||
active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG;
|
||||
active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG;
|
||||
|
||||
/* Information on the contents of registers. These are pointers into
|
||||
the input strings; they record just what was matched (on this
|
||||
@@ -4511,10 +4623,17 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
= *p2 == (unsigned char) endline ? '\n' : p2[2];
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if ((re_opcode_t) p1[3] == exactn
|
||||
&& ! ((int) p2[1] * BYTEWIDTH > (int) p1[5]
|
||||
&& (p2[2 + p1[5] / BYTEWIDTH]
|
||||
& (1 << (p1[5] % BYTEWIDTH)))))
|
||||
#else
|
||||
if ((re_opcode_t) p1[3] == exactn
|
||||
&& ! ((int) p2[1] * BYTEWIDTH > (int) p1[4]
|
||||
&& (p2[2 + p1[4] / BYTEWIDTH]
|
||||
& (1 << (p1[4] % BYTEWIDTH)))))
|
||||
#endif
|
||||
{
|
||||
p[-3] = (unsigned char) pop_failure_jump;
|
||||
DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n",
|
||||
@@ -4580,7 +4699,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||
actual values. Otherwise, we will restore only one
|
||||
register from the stack, since lowest will == highest in
|
||||
`pop_failure_point'. */
|
||||
unsigned dummy_low_reg, dummy_high_reg;
|
||||
active_reg_t dummy_low_reg, dummy_high_reg;
|
||||
unsigned char *pdummy;
|
||||
const char *sdummy;
|
||||
|
||||
@@ -5133,11 +5252,12 @@ common_op_match_null_string_p (p, end, reg_info)
|
||||
|
||||
static int
|
||||
bcmp_translate (s1, s2, len, translate)
|
||||
unsigned char *s1, *s2;
|
||||
const char *s1, *s2;
|
||||
register int len;
|
||||
RE_TRANSLATE_TYPE translate;
|
||||
{
|
||||
register unsigned char *p1 = s1, *p2 = s2;
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||
while (len)
|
||||
{
|
||||
if (translate[*p1++] != translate[*p2++]) return 1;
|
||||
@@ -5160,7 +5280,7 @@ bcmp_translate (s1, s2, len, translate)
|
||||
const char *
|
||||
re_compile_pattern (pattern, length, bufp)
|
||||
const char *pattern;
|
||||
int length;
|
||||
size_t length;
|
||||
struct re_pattern_buffer *bufp;
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
@@ -5289,7 +5409,7 @@ regcomp (preg, pattern, cflags)
|
||||
int cflags;
|
||||
{
|
||||
reg_errcode_t ret;
|
||||
unsigned syntax
|
||||
reg_syntax_t syntax
|
||||
= (cflags & REG_EXTENDED) ?
|
||||
RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC;
|
||||
|
||||
|
||||
+38
-10
@@ -1,6 +1,6 @@
|
||||
/* Definitions for data structures and routines for the regular
|
||||
expression library, version 0.12.
|
||||
Copyright (C) 1985,89,90,91,92,93,95,96 Free Software Foundation, Inc.
|
||||
Copyright (C) 1985,89,90,91,92,93,95,96,97 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
@@ -23,6 +23,11 @@
|
||||
#ifndef __REGEXP_LIBRARY_H__
|
||||
#define __REGEXP_LIBRARY_H__
|
||||
|
||||
/* Allow the use in C++ code. */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
||||
<regex.h>. */
|
||||
|
||||
@@ -32,17 +37,23 @@
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/* The following two types have to be signed and unsigned integer type
|
||||
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||
types is 2 for Microsoft C. Ugh... */
|
||||
typedef long int s_reg_t;
|
||||
typedef unsigned long int active_reg_t;
|
||||
|
||||
/* The following bits are used to determine the regexp syntax we
|
||||
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||
remains the value 0. The bits are given in alphabetical order, and
|
||||
the definitions shifted by one from the previous bit; thus, when we
|
||||
add or remove a bit, only one other definition need change. */
|
||||
typedef unsigned reg_syntax_t;
|
||||
typedef unsigned long int reg_syntax_t;
|
||||
|
||||
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||
If set, then such a \ quotes the following character. */
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS (1)
|
||||
#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||
|
||||
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||
literals.
|
||||
@@ -137,6 +148,10 @@ typedef unsigned reg_syntax_t;
|
||||
without further backtracking. */
|
||||
#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||
|
||||
/* If this bit is set, do not process the GNU regex operators.
|
||||
If not set, then the GNU regex operators are recognized. */
|
||||
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||
|
||||
/* This global variable defines the particular regexp syntax to use (for
|
||||
some interfaces). When a regexp is compiled, the syntax used is
|
||||
stored in the pattern buffer, so changing this does not affect
|
||||
@@ -150,13 +165,18 @@ extern reg_syntax_t re_syntax_options;
|
||||
#define RE_SYNTAX_EMACS 0
|
||||
|
||||
#define RE_SYNTAX_AWK \
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||
| RE_DOT_NEWLINE \
|
||||
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GNU_AWK \
|
||||
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) \
|
||||
& ~(RE_DOT_NOT_NULL | RE_INTERVALS))
|
||||
|
||||
#define RE_SYNTAX_POSIX_AWK \
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)
|
||||
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_NO_GNU_OPS)
|
||||
|
||||
#define RE_SYNTAX_GREP \
|
||||
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||
@@ -212,7 +232,8 @@ extern reg_syntax_t re_syntax_options;
|
||||
#ifdef RE_DUP_MAX
|
||||
#undef RE_DUP_MAX
|
||||
#endif
|
||||
#define RE_DUP_MAX ((1 << 15) - 1)
|
||||
/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */
|
||||
#define RE_DUP_MAX (0x7fff)
|
||||
|
||||
|
||||
/* POSIX `cflags' bits (i.e., information for `regcomp'). */
|
||||
@@ -413,7 +434,7 @@ extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
|
||||
and syntax given by the global `re_syntax_options', into the buffer
|
||||
BUFFER. Return NULL if successful, and an error string if not. */
|
||||
extern const char *re_compile_pattern
|
||||
_RE_ARGS ((const char *pattern, int length,
|
||||
_RE_ARGS ((const char *pattern, size_t length,
|
||||
struct re_pattern_buffer *buffer));
|
||||
|
||||
|
||||
@@ -472,10 +493,12 @@ extern void re_set_registers
|
||||
unsigned num_regs, regoff_t *starts, regoff_t *ends));
|
||||
|
||||
#ifdef _REGEX_RE_COMP
|
||||
#ifndef _CRAY
|
||||
/* 4.2 bsd compatibility. */
|
||||
extern char *re_comp _RE_ARGS ((const char *));
|
||||
extern int re_exec _RE_ARGS ((const char *));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* POSIX compatibility. */
|
||||
extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));
|
||||
@@ -487,6 +510,11 @@ extern size_t regerror
|
||||
size_t errbuf_size));
|
||||
extern void regfree _RE_ARGS ((regex_t *preg));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* C++ */
|
||||
|
||||
#endif /* not __REGEXP_LIBRARY_H__ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/***********************************************************
|
||||
|
||||
Copyright 1995 by Tom Lord
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of the copyright holder not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
Tom Lord DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
EVENT SHALL TOM LORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
struct a_test
|
||||
{
|
||||
int expected;
|
||||
const char * pattern;
|
||||
const unsigned char * data;
|
||||
};
|
||||
|
||||
static const struct a_test the_tests[] =
|
||||
{
|
||||
#include "testcases.h"
|
||||
{-1, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
run_a_test (int id, const struct a_test * t)
|
||||
{
|
||||
static const char * last_pattern = 0;
|
||||
static regex_t r;
|
||||
int err;
|
||||
char errmsg[100];
|
||||
int x;
|
||||
regmatch_t regs[10];
|
||||
|
||||
if (!last_pattern || strcmp (last_pattern, t->pattern))
|
||||
{
|
||||
if (last_pattern)
|
||||
regfree (&r);
|
||||
last_pattern = t->pattern;
|
||||
err = regcomp (&r, t->pattern, REG_EXTENDED);
|
||||
if (err)
|
||||
{
|
||||
if (t->expected)
|
||||
{
|
||||
puts (" OK.");
|
||||
return 0;
|
||||
}
|
||||
regerror (err, &r, errmsg, 100);
|
||||
printf ("test %d\n", id);
|
||||
puts (errmsg);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
err = regexec (&r, t->data, 10, regs, 0);
|
||||
|
||||
if (err != t->expected)
|
||||
{
|
||||
printf ("test %d\n", id);
|
||||
printf ("pattern \"%s\" data \"%s\" wanted %d got %d\n",
|
||||
t->pattern, t->data, t->expected, err);
|
||||
for (x = 0; x < 10; ++x)
|
||||
printf ("reg %d == (%d, %d) %.*s\n",
|
||||
x,
|
||||
regs[x].rm_so,
|
||||
regs[x].rm_eo,
|
||||
regs[x].rm_eo - regs[x].rm_so,
|
||||
t->data + regs[x].rm_so);
|
||||
return 1;
|
||||
}
|
||||
puts (" OK.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char * argv[])
|
||||
{
|
||||
int x;
|
||||
int lo;
|
||||
int hi;
|
||||
int res = 0;
|
||||
|
||||
lo = 0;
|
||||
hi = (sizeof (the_tests) / sizeof (the_tests[0])) - 1;
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
lo = atoi (argv[1]);
|
||||
hi = lo + 1;
|
||||
|
||||
if (argc > 2)
|
||||
hi = atoi (argv[2]);
|
||||
}
|
||||
|
||||
for (x = lo; x < hi; ++x)
|
||||
{
|
||||
printf ("#%d:", x);
|
||||
res |= run_a_test (x, &the_tests[x]);
|
||||
}
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
{0, "(.*)*\\1", "xx"},
|
||||
{0, "^", ""},
|
||||
{0, "$", ""},
|
||||
{0, "^$", ""},
|
||||
{0, "^a$", "a"},
|
||||
{0, "abc", "abc"},
|
||||
{1, "abc", "xbc"},
|
||||
{1, "abc", "axc"},
|
||||
{1, "abc", "abx"},
|
||||
{0, "abc", "xabcy"},
|
||||
{0, "abc", "ababc"},
|
||||
{0, "ab*c", "abc"},
|
||||
{0, "ab*bc", "abc"},
|
||||
{0, "ab*bc", "abbc"},
|
||||
{0, "ab*bc", "abbbbc"},
|
||||
{0, "ab+bc", "abbc"},
|
||||
{1, "ab+bc", "abc"},
|
||||
{1, "ab+bc", "abq"},
|
||||
{0, "ab+bc", "abbbbc"},
|
||||
{0, "ab?bc", "abbc"},
|
||||
{0, "ab?bc", "abc"},
|
||||
{1, "ab?bc", "abbbbc"},
|
||||
{0, "ab?c", "abc"},
|
||||
{0, "^abc$", "abc"},
|
||||
{1, "^abc$", "abcc"},
|
||||
{0, "^abc", "abcc"},
|
||||
{1, "^abc$", "aabc"},
|
||||
{0, "abc$", "aabc"},
|
||||
{0, "^", "abc"},
|
||||
{0, "$", "abc"},
|
||||
{0, "a.c", "abc"},
|
||||
{0, "a.c", "axc"},
|
||||
{0, "a.*c", "axyzc"},
|
||||
{1, "a.*c", "axyzd"},
|
||||
{1, "a[bc]d", "abc"},
|
||||
{0, "a[bc]d", "abd"},
|
||||
{1, "a[b-d]e", "abd"},
|
||||
{0, "a[b-d]e", "ace"},
|
||||
{0, "a[b-d]", "aac"},
|
||||
{0, "a[-b]", "a-"},
|
||||
{0, "a[b-]", "a-"},
|
||||
{1, "a[b-a]", "-"},
|
||||
{2, "a[]b", "-"},
|
||||
{2, "a[", "-"},
|
||||
{0, "a]", "a]"},
|
||||
{0, "a[]]b", "a]b"},
|
||||
{0, "a[^bc]d", "aed"},
|
||||
{1, "a[^bc]d", "abd"},
|
||||
{0, "a[^-b]c", "adc"},
|
||||
{1, "a[^-b]c", "a-c"},
|
||||
{1, "a[^]b]c", "a]c"},
|
||||
{0, "a[^]b]c", "adc"},
|
||||
{0, "ab|cd", "abc"},
|
||||
{0, "ab|cd", "abcd"},
|
||||
{0, "()ef", "def"},
|
||||
{0, "()*", "-"},
|
||||
{1, "*a", "-"},
|
||||
{0, "^*", "-"},
|
||||
{0, "$*", "-"},
|
||||
{1, "(*)b", "-"},
|
||||
{1, "$b", "b"},
|
||||
{2, "a\\", "-"},
|
||||
{0, "a\\(b", "a(b"},
|
||||
{0, "a\\(*b", "ab"},
|
||||
{0, "a\\(*b", "a((b"},
|
||||
{1, "a\\x", "a\\x"},
|
||||
{1, "abc)", "-"},
|
||||
{2, "(abc", "-"},
|
||||
{0, "((a))", "abc"},
|
||||
{0, "(a)b(c)", "abc"},
|
||||
{0, "a+b+c", "aabbabc"},
|
||||
{0, "a**", "-"},
|
||||
{0, "a*?", "-"},
|
||||
{0, "(a*)*", "-"},
|
||||
{0, "(a*)+", "-"},
|
||||
{0, "(a|)*", "-"},
|
||||
{0, "(a*|b)*", "-"},
|
||||
{0, "(a+|b)*", "ab"},
|
||||
{0, "(a+|b)+", "ab"},
|
||||
{0, "(a+|b)?", "ab"},
|
||||
{0, "[^ab]*", "cde"},
|
||||
{0, "(^)*", "-"},
|
||||
{0, "(ab|)*", "-"},
|
||||
{2, ")(", "-"},
|
||||
{1, "abc", ""},
|
||||
{1, "abc", ""},
|
||||
{0, "a*", ""},
|
||||
{0, "([abc])*d", "abbbcd"},
|
||||
{0, "([abc])*bcd", "abcd"},
|
||||
{0, "a|b|c|d|e", "e"},
|
||||
{0, "(a|b|c|d|e)f", "ef"},
|
||||
{0, "((a*|b))*", "-"},
|
||||
{0, "abcd*efg", "abcdefg"},
|
||||
{0, "ab*", "xabyabbbz"},
|
||||
{0, "ab*", "xayabbbz"},
|
||||
{0, "(ab|cd)e", "abcde"},
|
||||
{0, "[abhgefdc]ij", "hij"},
|
||||
{1, "^(ab|cd)e", "abcde"},
|
||||
{0, "(abc|)ef", "abcdef"},
|
||||
{0, "(a|b)c*d", "abcd"},
|
||||
{0, "(ab|ab*)bc", "abc"},
|
||||
{0, "a([bc]*)c*", "abc"},
|
||||
{0, "a([bc]*)(c*d)", "abcd"},
|
||||
{0, "a([bc]+)(c*d)", "abcd"},
|
||||
{0, "a([bc]*)(c+d)", "abcd"},
|
||||
{0, "a[bcd]*dcdcde", "adcdcde"},
|
||||
{1, "a[bcd]+dcdcde", "adcdcde"},
|
||||
{0, "(ab|a)b*c", "abc"},
|
||||
{0, "((a)(b)c)(d)", "abcd"},
|
||||
{0, "[A-Za-z_][A-Za-z0-9_]*", "alpha"},
|
||||
{0, "^a(bc+|b[eh])g|.h$", "abh"},
|
||||
{0, "(bc+d$|ef*g.|h?i(j|k))", "effgz"},
|
||||
{0, "(bc+d$|ef*g.|h?i(j|k))", "ij"},
|
||||
{1, "(bc+d$|ef*g.|h?i(j|k))", "effg"},
|
||||
{1, "(bc+d$|ef*g.|h?i(j|k))", "bcdd"},
|
||||
{0, "(bc+d$|ef*g.|h?i(j|k))", "reffgz"},
|
||||
{1, "((((((((((a))))))))))", "-"},
|
||||
{0, "(((((((((a)))))))))", "a"},
|
||||
{1, "multiple words of text", "uh-uh"},
|
||||
{0, "multiple words", "multiple words, yeah"},
|
||||
{0, "(.*)c(.*)", "abcde"},
|
||||
{1, "\\((.*),", "(.*)\\)"},
|
||||
{1, "[k]", "ab"},
|
||||
{0, "abcd", "abcd"},
|
||||
{0, "a(bc)d", "abcd"},
|
||||
{0, "a[-]?c", "ac"},
|
||||
{0, "(....).*\\1", "beriberi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Qaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mo'ammar Gadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Kaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Qadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moammar El Kadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Gadafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar al-Qadafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moamer El Kazzafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moamar al-Gaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar Al Qathafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Al Qathafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mo'ammar el-Gadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moamar El Kadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar al-Qadhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar al-Qadhdhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar Qadafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moamar Gaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar Qadhdhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Khaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar al-Khaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'amar al-Kadafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Ghaddafy"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Ghadafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Ghaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muamar Kaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Quathafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muammar Gheddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Muamar Al-Kaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moammar Khadafy "},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Moammar Qudhafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mu'ammar al-Qaddafi"},
|
||||
{0, "M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]", "Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi"},
|
||||
@@ -171,6 +171,7 @@ extern int access __P ((__const char *__name, int __type));
|
||||
#ifdef __USE_GNU
|
||||
/* Test for access to NAME using the effective UID and GID
|
||||
(as normal file operations use). */
|
||||
extern int __euidaccess __P ((__const char *__name, int __type));
|
||||
extern int euidaccess __P ((__const char *__name, int __type));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -513,6 +513,8 @@ gethostbyname2(name, af)
|
||||
if (!*cp) {
|
||||
if (*--cp == '.')
|
||||
break;
|
||||
if (!strchr (name, ':'))
|
||||
break;
|
||||
/*
|
||||
* All-IPv6-legal, no dot at the end.
|
||||
* Fake up a hostent as if we'd actually
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 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
|
||||
@@ -51,7 +51,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
|
||||
#ifndef __FAVOR_BSD
|
||||
/* Set ENV to the current position and return 0, not saving the signal mask.
|
||||
This is just like `sigsetjmp (ENV, 0)'.
|
||||
The ANSI C standard says `setjmp' is a macro. */
|
||||
The ISO C standard says `setjmp' is a macro. */
|
||||
#define setjmp(env) __sigsetjmp ((env), 0)
|
||||
#else
|
||||
/* We are in 4.3 BSD-compatibility mode in which `setjmp'
|
||||
@@ -61,7 +61,7 @@ extern int __sigsetjmp __P ((jmp_buf __env, int __savemask));
|
||||
|
||||
#ifdef __USE_BSD
|
||||
/* Set ENV to the current position and return 0, not saving the signal mask.
|
||||
This is the 4.3 BSD name for ANSI `setjmp'. */
|
||||
This is the 4.3 BSD name for ISO `setjmp'. */
|
||||
#define _setjmp(env) __sigsetjmp ((env), 0)
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user