1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
1998-02-16 17:33  Ulrich Drepper  <drepper@cygnus.com>

	* elf/rtld.c (dl_main): Recognize --library-path parameter and
	pass value (or NULL) to _dl_init_paths.
	* elf/dl-load.c (_dl_init_paths): Change to take one parameter,
	replacing local variable llp.  If llp is NULL examine LD_LIBRARY_PATH
	environment variable.
	* elf/link.h: Change prototype for _dl_init_paths.
	* elf/dl-support.c: Pass NULL in _dl_init_paths call.

	* localedata/Makefile (distribute): Add test files.

1998-02-17  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* localedata/tests/{test1.cm, test2.cm, test3.cm, test4.cm,
	test1.def, test2.def, test3.def, test4.def}: Simple input files
	for localedef. Contributed by Yung-Ching Hsiao
	<yhsiao@cae.wisc.edu>.

	* localedata/Makefile (tests): Call tst-locale.sh.

	* localedata/tst-locale.sh: New file, regression tests for some
	localedef problems.

1998-02-15  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nss_nisplus/nisplus-alias.c: Use __stpncpy.

	* nis/nss_nisplus/nisplus-hosts.c: Make sure buffer is always NUL
	terminated.
	* nis/nss_nisplus/nisplus-network.c: Likewise.
	* nis/nss_nisplus/nisplus-proto.c: Likewise.
	* nis/nss_nisplus/nisplus-rpc.c: Likewise.
	* nis/nss_nisplus/nisplus-service.c: Likewise.

	Add more changes from TI-RPC 2.3 for rpcgen to fix include/C++ bug
	and support generating thread safe RPC code.
	* sunrpc/rpc_main.c: Add changes.
	* sunrpc/rpc_clntout.c: Likewise.
	* sunrpc/rpc_cout.c: Likewise.
	* sunrpc/rpc_hout.c: Likewise.
	* sunrpc/rpc_parse.c: Likewise.
	* sunrpc/rpc_sample.c: Likewise.
	* sunrpc/rpc_scan.c: Likewise.
	* sunrpc/rpc_svcout.c: Likewise.
	* sunrpc/rpc_util.c: Likewise.
	* sunrpc/rpc_util.h: Add new structs and prototypes.
	* sunrpc/proto.h: Remove prototypes for static functions.

1998-02-15  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* locale/programs/ld-messages.c (messages_finish): Don't skip
	error checking when being quiet.
	* locale/programs/ld-ctype.c (ctype_finish): Likewise.
	(set_class_defaults): Likewise.
	* locale/programs/charmap.c (parse_charmap): Likewise.
	* locale/programs/ld-collate.c (collate_finish): Likewise.
	* locale/programs/ld-monetary.c (monetary_finish): Likewise.
	* locale/programs/ld-time.c (time_finish): Likewise.
	* locale/programs/locfile.c (write_locale_data): Likewise.

	* locale/programs/ld-ctype.c (ctype_class_to): Silently ignore
	unknown characters and empty ranges.
	* locale/programs/ld-collate.c (collate_order_elem): When
	processing an ellipsis properly form a linked list in the result
	table, fix typo when allocating ordering array.
	[PR libc/419]

1998-02-13  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* elf/Makefile (ld-map): Define.
	(rtld-ldscript): Define.  Change all `$(objpfx)rtld-ldscript' to
	`$(rtld-ldscript)'.
	($(objpfx)ld.so): Combine the two versions of this rule.  Depend
	on $(ld-map).
	(rtld-link): Combine the two versions of this definition.  Fixed
	to make it work when no symbol versioning is used.

1998-02-16  Ulrich Drepper  <drepper@cygnus.com>

	* Makeconfig (build-program-cmd): Use --library-path parameter to
	ld.so instead of environment variable.

	* sunrpc/Makefile (rpcgen-cmd): Don't use -$ parameter.
	* sunrpc/rpc_main.c: Remove support for -$$ option again.

1998-02-16  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* Make-dist: Respect with-cvs setting.
	* MakeTAGS (all-pot): Likewise.
	* sysdeps/sparc/sparc32/Makefile: Likewise.
	* sysdeps/mach/hurd/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* posix/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* po/Makefile (linguas): Likewise
This commit is contained in:
Ulrich Drepper
1998-02-16 17:42:46 +00:00
parent f565518e7e
commit 880f421fc3
52 changed files with 5170 additions and 2716 deletions

View File

@ -1,3 +1,100 @@
1998-02-16 17:33 Ulrich Drepper <drepper@cygnus.com>
* elf/rtld.c (dl_main): Recognize --library-path parameter and
pass value (or NULL) to _dl_init_paths.
* elf/dl-load.c (_dl_init_paths): Change to take one parameter,
replacing local variable llp. If llp is NULL examine LD_LIBRARY_PATH
environment variable.
* elf/link.h: Change prototype for _dl_init_paths.
* elf/dl-support.c: Pass NULL in _dl_init_paths call.
* localedata/Makefile (distribute): Add test files.
1998-02-17 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* localedata/tests/{test1.cm, test2.cm, test3.cm, test4.cm,
test1.def, test2.def, test3.def, test4.def}: Simple input files
for localedef. Contributed by Yung-Ching Hsiao
<yhsiao@cae.wisc.edu>.
* localedata/Makefile (tests): Call tst-locale.sh.
* localedata/tst-locale.sh: New file, regression tests for some
localedef problems.
1998-02-15 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nisplus/nisplus-alias.c: Use __stpncpy.
* nis/nss_nisplus/nisplus-hosts.c: Make sure buffer is always NUL
terminated.
* nis/nss_nisplus/nisplus-network.c: Likewise.
* nis/nss_nisplus/nisplus-proto.c: Likewise.
* nis/nss_nisplus/nisplus-rpc.c: Likewise.
* nis/nss_nisplus/nisplus-service.c: Likewise.
Add more changes from TI-RPC 2.3 for rpcgen to fix include/C++ bug
and support generating thread safe RPC code.
* sunrpc/rpc_main.c: Add changes.
* sunrpc/rpc_clntout.c: Likewise.
* sunrpc/rpc_cout.c: Likewise.
* sunrpc/rpc_hout.c: Likewise.
* sunrpc/rpc_parse.c: Likewise.
* sunrpc/rpc_sample.c: Likewise.
* sunrpc/rpc_scan.c: Likewise.
* sunrpc/rpc_svcout.c: Likewise.
* sunrpc/rpc_util.c: Likewise.
* sunrpc/rpc_util.h: Add new structs and prototypes.
* sunrpc/proto.h: Remove prototypes for static functions.
1998-02-15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* locale/programs/ld-messages.c (messages_finish): Don't skip
error checking when being quiet.
* locale/programs/ld-ctype.c (ctype_finish): Likewise.
(set_class_defaults): Likewise.
* locale/programs/charmap.c (parse_charmap): Likewise.
* locale/programs/ld-collate.c (collate_finish): Likewise.
* locale/programs/ld-monetary.c (monetary_finish): Likewise.
* locale/programs/ld-time.c (time_finish): Likewise.
* locale/programs/locfile.c (write_locale_data): Likewise.
* locale/programs/ld-ctype.c (ctype_class_to): Silently ignore
unknown characters and empty ranges.
* locale/programs/ld-collate.c (collate_order_elem): When
processing an ellipsis properly form a linked list in the result
table, fix typo when allocating ordering array.
[PR libc/419]
1998-02-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/Makefile (ld-map): Define.
(rtld-ldscript): Define. Change all `$(objpfx)rtld-ldscript' to
`$(rtld-ldscript)'.
($(objpfx)ld.so): Combine the two versions of this rule. Depend
on $(ld-map).
(rtld-link): Combine the two versions of this definition. Fixed
to make it work when no symbol versioning is used.
1998-02-16 Ulrich Drepper <drepper@cygnus.com>
* Makeconfig (build-program-cmd): Use --library-path parameter to
ld.so instead of environment variable.
* sunrpc/Makefile (rpcgen-cmd): Don't use -$ parameter.
* sunrpc/rpc_main.c: Remove support for -$$ option again.
1998-02-16 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* Make-dist: Respect with-cvs setting.
* MakeTAGS (all-pot): Likewise.
* sysdeps/sparc/sparc32/Makefile: Likewise.
* sysdeps/mach/hurd/Makefile: Likewise.
* stdlib/Makefile: Likewise.
* posix/Makefile: Likewise.
* intl/Makefile: Likewise.
* po/Makefile (linguas): Likewise
1998-02-15 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> 1998-02-15 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/ypclnt.c (yp_all): Remove error message, user should print it. * nis/ypclnt.c (yp_all): Remove error message, user should print it.

View File

@ -185,11 +185,18 @@ foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
+tsrcs := $(+tsrcs) $(+sysdep-tsrcs) +tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
ifeq ($(with-cvs),yes)
define autoconf-it define autoconf-it
autoconf $(ACFLAGS) $< > $@.new autoconf $(ACFLAGS) $< > $@.new
mv -f $@.new $@ mv -f $@.new $@
test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@ test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
endef endef
else
define autoconf-it
autoconf $(ACFLAGS) $< > $@.new
mv -f $@.new $@
endef
endif
configure: configure.in aclocal.m4; $(autoconf-it) configure: configure.in aclocal.m4; $(autoconf-it)
%/configure: %/configure.in aclocal.m4; $(autoconf-it) %/configure: %/configure.in aclocal.m4; $(autoconf-it)
@ -225,7 +232,9 @@ README: README.template version.h
sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@ sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
# Make it unwritable so I won't change it by mistake. # Make it unwritable so I won't change it by mistake.
chmod 444 $@ chmod 444 $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@ test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
endif
endif # Subdirectory vs. parent makefile endif # Subdirectory vs. parent makefile

View File

@ -176,7 +176,9 @@ $P/libc.pot: $(all-pot)
po/header.pot > $@.new po/header.pot > $@.new
$(XGETTEXT) -d - --omit-header -n -s $^ >> $@.new $(XGETTEXT) -d - --omit-header -n -s $^ >> $@.new
mv -f $@.new $@ mv -f $@.new $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@ test ! -d CVS || cvs $(CVSOPTS) ci -m'Regenerated from source files' $@
endif
$(subdirs:%=$P/%.pot): $P/%.pot: FORCE $(subdirs:%=$P/%.pot): $P/%.pot: FORCE
$(MAKE) -C $* no_deps=t ../$@ $(MAKE) -C $* no_deps=t ../$@

View File

@ -467,8 +467,9 @@ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
$(filter -Wl$(comma)-rpath-link=%,\ $(filter -Wl$(comma)-rpath-link=%,\
$(sysdep-LDFLAGS))))) $(sysdep-LDFLAGS)))))
define built-program-cmd define built-program-cmd
LD_LIBRARY_PATH=$(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \ $(elf-objpfx)$(rtld-installed-name) \
$(elf-objpfx)$(rtld-installed-name) $(built-program-file) --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(built-program-file)
endef endef
endif endif

View File

@ -35,6 +35,7 @@ elide-routines.os = $(dl-routines) dl-support enbl-secure
# ld.so uses those routines, plus some special stuff for being the program # ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc. # interpreter and operating independent of libc.
rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal
ld-map = $(libc-map)
distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \ distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \ dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
genrtldtbl.awk atomicity.h dl-procinfo.h genrtldtbl.awk atomicity.h dl-procinfo.h
@ -88,22 +89,22 @@ $(objpfx)librtld.os: $(objpfx)dl-allobjs.os $(common-objpfx)libc_pic.a
# Do we need a linker script? # Do we need a linker script?
rtld-ldscript-in := $(firstword $(wildcard $(+sysdep_dirs:%=%/rtld-ldscript.in))) rtld-ldscript-in := $(firstword $(wildcard $(+sysdep_dirs:%=%/rtld-ldscript.in)))
ifeq ($(versioning),yes)
RTLD-VERSIONS = -Wl,--version-script=$(libc-map)
endif
ifneq (,$(rtld-ldscript-in)) ifneq (,$(rtld-ldscript-in))
LDFLAGS-rtld = -T $(objpfx)rtld-ldscript rtld-ldscript = $(objpfx)rtld-ldscript
generated += rtld-ldscript
LDFLAGS-rtld = -T $(rtld-ldscript)
before-compile += $(rtld-ldscript)
before-compile += $(objpfx)rtld-ldscript
rtld-parms = $(wildcard $(+sysdep_dirs:%=%/rtld-parms)) rtld-parms = $(wildcard $(+sysdep_dirs:%=%/rtld-parms))
include $(rtld-parms) include $(rtld-parms)
generated += rtld-ldscript
$(objpfx)rtld-ldscript: $(rtld-ldscript-in) $(rtld-parms) $(rtld-ldscript): $(rtld-ldscript-in) $(rtld-parms)
sed -e 's#@@rtld-oformat@@#$(rtld-oformat)#' \ sed -e 's#@@rtld-oformat@@#$(rtld-oformat)#' \
-e 's#@@rtld-arch@@#$(rtld-arch)#' \ -e 's#@@rtld-arch@@#$(rtld-arch)#' \
-e 's#@@rtld-entry@@#$(rtld-entry)#' \ -e 's#@@rtld-entry@@#$(rtld-entry)#' \
-e 's#@@rtld-base@@#$(rtld-base)#' $< >$@ -e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
endif
$(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
$(rtld-link) -Wl,-soname=$(rtld-installed-name) $(rtld-link) -Wl,-soname=$(rtld-installed-name)
@ -111,18 +112,9 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
define rtld-link define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \ $(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \ -Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
$(filter-out $(objpfx)rtld-ldscript,$^) \ $(filter-out $(rtld-ldscript) $($(@F:.so=)-map),$^) \
$(RTLD-VERSIONS) $(load-map-file:%=-Wl,--version-script=%)
endef endef
else
$(objpfx)ld.so: $(objpfx)librtld.os
$(rtld-link) -Wl,-soname=$(rtld-installed-name)
define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $^ $(RTLD-VERSIONS)
endef
endif
# The dl code in the static libc needs a default library path. # The dl code in the static libc needs a default library path.
CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"' CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'

View File

@ -1,5 +1,5 @@
/* Map in a shared object's segments from the file. /* Map in a shared object's segments from the file.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -309,7 +309,7 @@ decompose_rpath (const char *rpath, size_t additional_room)
void void
_dl_init_paths (void) _dl_init_paths (const char *llp)
{ {
static const char *trusted_dirs[] = static const char *trusted_dirs[] =
{ {
@ -325,10 +325,15 @@ _dl_init_paths (void)
variable. */ variable. */
struct link_map *l; struct link_map *l;
/* First determine how many elements the LD_LIBRARY_PATH contents has. */ /* Number of elements in the library path. */
const char *llp = getenv ("LD_LIBRARY_PATH");
size_t nllp; size_t nllp;
/* If the user has not specified a library path consider the environment
variable. */
if (llp == NULL)
llp = getenv ("LD_LIBRARY_PATH");
/* First determine how many elements the LD_LIBRARY_PATH contents has. */
if (llp != NULL && *llp != '\0') if (llp != NULL && *llp != '\0')
{ {
/* Simply count the number of colons. */ /* Simply count the number of colons. */

View File

@ -1,5 +1,5 @@
/* Support for dynamic linking code in static libc. /* Support for dynamic linking code in static libc.
Copyright (C) 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -58,7 +58,7 @@ non_dynamic_init (void)
/* Initialize the data structures for the search paths for shared /* Initialize the data structures for the search paths for shared
objects. */ objects. */
_dl_init_paths (); _dl_init_paths (NULL);
#ifdef DL_PLATFORM_INIT #ifdef DL_PLATFORM_INIT
DL_PLATFORM_INIT; DL_PLATFORM_INIT;

View File

@ -1,5 +1,5 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects. /* Run-time dynamic linker data structures for loaded ELF shared objects.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -443,7 +443,7 @@ extern void _dl_debug_state (void);
extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase); extern struct r_debug *_dl_debug_initialize (ElfW(Addr) ldbase);
/* Initialize the basic data structure for the search paths. */ /* Initialize the basic data structure for the search paths. */
extern void _dl_init_paths (void); extern void _dl_init_paths (const char *library_path);
/* Gather the information needed to install the profiling tables and start /* Gather the information needed to install the profiling tables and start
the timers. */ the timers. */

View File

@ -264,6 +264,7 @@ dl_main (const ElfW(Phdr) *phdr,
size_t file_size; size_t file_size;
char *file; char *file;
int has_interp = 0; int has_interp = 0;
const char *library_path = NULL; /* Overwrites LD_LIBRARY_PATH if given. */
/* Test whether we want to see the content of the auxiliary array passed /* Test whether we want to see the content of the auxiliary array passed
up from the kernel. */ up from the kernel. */
@ -343,6 +344,15 @@ dl_main (const ElfW(Phdr) *phdr,
--_dl_argc; --_dl_argc;
++_dl_argv; ++_dl_argv;
} }
else if (! strcmp (_dl_argv[1], "--library-path")
&& _dl_argc > 2)
{
library_path = _dl_argv[2];
_dl_skip_args += 2;
_dl_argc -= 2;
_dl_argv += 2;
}
else else
break; break;
@ -484,7 +494,7 @@ of this helper program; chances are you did not intend to run this program.\n",
/* Initialize the data structures for the search paths for shared /* Initialize the data structures for the search paths for shared
objects. */ objects. */
_dl_init_paths (); _dl_init_paths (library_path);
preloadlist = getenv ("LD_PRELOAD"); preloadlist = getenv ("LD_PRELOAD");
if (preloadlist) if (preloadlist)

View File

@ -42,12 +42,20 @@ ifdef gettext-srcdir
%.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc) %.h:: ../gpl2lgpl.sed $(gettext-srcdir)/intl/%.h; $(copysrc)
locale.alias:: ../gpl2lgpl.sed $(gettext-srcdir)/misc/locale.alias; $(copysrc) locale.alias:: ../gpl2lgpl.sed $(gettext-srcdir)/misc/locale.alias; $(copysrc)
ifeq ($(with-cvs),yes)
define copysrc define copysrc
sed -f $^ > $@.new sed -f $^ > $@.new
chmod a-w $@.new chmod a-w $@.new
mv -f $@.new $@ mv -f $@.new $@
test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $<' $@ test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $<' $@
endef endef
else
define copysrc
sed -f $^ > $@.new
chmod a-w $@.new
mv -f $@.new $@
endef
endif
endif endif

View File

@ -253,11 +253,12 @@ parse_charmap (const char *filename)
result->mb_cur_max = 1; result->mb_cur_max = 1;
if (result->mb_cur_min == 0) if (result->mb_cur_min == 0)
result->mb_cur_min = result->mb_cur_max; result->mb_cur_min = result->mb_cur_max;
if (result->mb_cur_min > result->mb_cur_max && !be_quiet) if (result->mb_cur_min > result->mb_cur_max)
{ {
error (0, 0, _("\ if (!be_quiet)
error (0, 0, _("\
%s: <mb_cur_max> must be greater than <mb_cur_min>\n"), %s: <mb_cur_max> must be greater than <mb_cur_min>\n"),
cmfile->fname); cmfile->fname);
result->mb_cur_min = result->mb_cur_max; result->mb_cur_min = result->mb_cur_max;
} }

View File

@ -239,9 +239,13 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
else else
value = 0; value = 0;
if (value == 0 && !be_quiet) if (value == 0)
error_at_line (0, 0, patch->fname, patch->lineno, {
_("no weight defined for symbol `%s'"), patch->token); if (!be_quiet)
error_at_line (0, 0, patch->fname, patch->lineno,
_("no weight defined for symbol `%s'"),
patch->token);
}
else else
*patch->where.pos = value; *patch->where.pos = value;
} }
@ -1477,7 +1481,7 @@ line after ellipsis must contain character definition"));
pelem->ordering pelem->ordering
= (unsigned int *) obstack_copy (&collate->element_mem, data, = (unsigned int *) obstack_copy (&collate->element_mem, data,
(collate->nrules (collate->nrules
* pelem->ordering_len) + pelem->ordering_len)
* sizeof (unsigned int)); * sizeof (unsigned int));
/* `...' weights need to be adjusted. */ /* `...' weights need to be adjusted. */
@ -1490,13 +1494,16 @@ line after ellipsis must contain character definition"));
(void *) &pelem->next) >= 0) (void *) &pelem->next) >= 0)
{ {
if (set_entry (&collate->result, name, sizeof (wchar_t), if (set_entry (&collate->result, name, sizeof (wchar_t),
(void *) pelem->next) < 0) (void *) pelem) < 0)
error (4, 0, _("cannot insert into result table")); error (4, 0, _("cannot insert into result table"));
} }
else else
if (insert_entry (&collate->result, name, sizeof (wchar_t), {
(void *) pelem->next) < 0) pelem->next = NULL;
error (4, 0, _("cannot insert into result table")); if (insert_entry (&collate->result, name, sizeof (wchar_t),
(void *) pelem) < 0)
error (4, 0, _("cannot insert into result table"));
}
/* Increment counter. */ /* Increment counter. */
++name[0]; ++name[0];

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -309,27 +309,34 @@ character %s'%s' in class `%s' must not be in class `%s'"),
/* ... and now test <SP> as a special case. */ /* ... and now test <SP> as a special case. */
space_value = charset_find_value (charset, "SP", 2); space_value = charset_find_value (charset, "SP", 2);
if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) space_value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("character <SP> not defined in character map")); {
if (!be_quiet)
error (0, 0, _("character <SP> not defined in character map"));
}
else if (((cnt = BITPOS (tok_space), else if (((cnt = BITPOS (tok_space),
(ELEM (ctype, class_collection, , space_value) (ELEM (ctype, class_collection, , space_value)
& BIT (tok_space)) == 0) & BIT (tok_space)) == 0)
|| (cnt = BITPOS (tok_blank), || (cnt = BITPOS (tok_blank),
(ELEM (ctype, class_collection, , space_value) (ELEM (ctype, class_collection, , space_value)
& BIT (tok_blank)) == 0)) & BIT (tok_blank)) == 0)))
&& !be_quiet) {
error (0, 0, _("<SP> character not in class `%s'"), if (!be_quiet)
valid_table[cnt].name); error (0, 0, _("<SP> character not in class `%s'"),
valid_table[cnt].name);
}
else if (((cnt = BITPOS (tok_punct), else if (((cnt = BITPOS (tok_punct),
(ELEM (ctype, class_collection, , space_value) (ELEM (ctype, class_collection, , space_value)
& BIT (tok_punct)) != 0) & BIT (tok_punct)) != 0)
|| (cnt = BITPOS (tok_graph), || (cnt = BITPOS (tok_graph),
(ELEM (ctype, class_collection, , space_value) (ELEM (ctype, class_collection, , space_value)
& BIT (tok_graph)) & BIT (tok_graph))
!= 0)) != 0)))
&& !be_quiet) {
error (0, 0, _("<SP> character must not be in class `%s'"), if (!be_quiet)
valid_table[cnt].name); error (0, 0, _("<SP> character must not be in class `%s'"),
valid_table[cnt].name);
}
else else
ELEM (ctype, class_collection, , space_value) |= BIT (tok_print); ELEM (ctype, class_collection, , space_value) |= BIT (tok_print);
@ -651,12 +658,14 @@ ctype_class_to (struct linereader *lr, struct localedef_t *locale,
value = charset_find_value (charset, code->val.str.start, code->val.str.len); value = charset_find_value (charset, code->val.str.start, code->val.str.len);
assert (value >= ctype->last_class_char); /* In the LC_CTYPE category it is no error when a character is
not found. This has to be ignored silently. */
for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt) if ((wchar_t) ctype->last_class_char != ILLEGAL_CHAR_VALUE
*find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max, && (wchar_t) value != ILLEGAL_CHAR_VALUE)
&ctype->class_collection_act, cnt) for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt)
|= ctype->current_class_mask; *find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max,
&ctype->class_collection_act, cnt)
|= ctype->current_class_mask;
ctype->last_class_char = ILLEGAL_CHAR_VALUE; ctype->last_class_char = ILLEGAL_CHAR_VALUE;
} }
@ -940,11 +949,12 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
tmp[0] = ch; tmp[0] = ch;
value = charset_find_value (charset, tmp, 1); value = charset_find_value (charset, tmp, 1);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{ {
error (0, 0, _("\ if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
tmp); tmp);
continue; continue;
} }
else else
@ -1004,50 +1014,68 @@ character `%s' not defined while needed as default value"),
unsigned int value; unsigned int value;
value = charset_find_value (charset, "space", 5); value = charset_find_value (charset, "space", 5);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<space>"); "<space>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "form-feed", 9); value = charset_find_value (charset, "form-feed", 9);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<form-feed>"); "<form-feed>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "newline", 7); value = charset_find_value (charset, "newline", 7);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<newline>"); "<newline>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "carriage-return", 15); value = charset_find_value (charset, "carriage-return", 15);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<carriage-return>"); "<carriage-return>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "tab", 3); value = charset_find_value (charset, "tab", 3);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<tab>"); "<tab>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "vertical-tab", 12); value = charset_find_value (charset, "vertical-tab", 12);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<vertical-tab>"); "<vertical-tab>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_space); ELEM (ctype, class_collection, , value) |= BIT (tok_space);
} }
@ -1070,18 +1098,24 @@ character `%s' not defined while needed as default value"),
unsigned int value; unsigned int value;
value = charset_find_value (charset, "space", 5); value = charset_find_value (charset, "space", 5);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<space>"); "<space>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_blank); ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
value = charset_find_value (charset, "tab", 3); value = charset_find_value (charset, "tab", 3);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<tab>"); "<tab>");
}
else else
ELEM (ctype, class_collection, , value) |= BIT (tok_blank); ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
} }
@ -1116,10 +1150,13 @@ character `%s' not defined while needed as default value"),
ctype->class_collection[cnt] |= BIT (tok_print); ctype->class_collection[cnt] |= BIT (tok_print);
space = charset_find_value (charset, "space", 5); space = charset_find_value (charset, "space", 5);
if (space == ILLEGAL_CHAR_VALUE && !be_quiet) if (space == ILLEGAL_CHAR_VALUE)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
"<space>"); "<space>");
}
else else
ELEM (ctype, class_collection, , space) |= BIT (tok_print); ELEM (ctype, class_collection, , space) |= BIT (tok_print);
} }
@ -1142,22 +1179,24 @@ character `%s' not defined while needed as default value"),
tmp[1] = (char) ch; tmp[1] = (char) ch;
value_from = charset_find_value (charset, &tmp[1], 1); value_from = charset_find_value (charset, &tmp[1], 1);
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
{ {
error (0, 0, _("\ if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
tmp); tmp);
continue; continue;
} }
/* This conversion is implementation defined. */ /* This conversion is implementation defined. */
tmp[1] = (char) (ch + ('A' - 'a')); tmp[1] = (char) (ch + ('A' - 'a'));
value_to = charset_find_value (charset, &tmp[1], 1); value_to = charset_find_value (charset, &tmp[1], 1);
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet) if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
{ {
error (0, 0, _("\ if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"), character `%s' not defined while needed as default value"),
tmp); tmp);
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -41,7 +41,7 @@
#include "localeinfo.h" #include "localeinfo.h"
void *xmalloc (size_t __n); extern void *xmalloc (size_t __n);
/* The real definition of the struct for the LC_MESSAGES locale. */ /* The real definition of the struct for the LC_MESSAGES locale. */
@ -77,9 +77,12 @@ messages_finish (struct localedef_t *locale)
= locale->categories[LC_MESSAGES].messages; = locale->categories[LC_MESSAGES].messages;
/* The fields YESSTR and NOSTR are optional. */ /* The fields YESSTR and NOSTR are optional. */
if (messages->yesexpr == NULL && !be_quiet) if (messages->yesexpr == NULL)
error (0, 0, _("field `%s' in category `%s' undefined"), {
"yesexpr", "LC_MESSAGES"); if (!be_quiet)
error (0, 0, _("field `%s' in category `%s' undefined"),
"yesexpr", "LC_MESSAGES");
}
else else
{ {
int result; int result;
@ -98,9 +101,12 @@ no correct regular expression for field `%s' in category `%s': %s"),
} }
} }
if (messages->noexpr == NULL && !be_quiet) if (messages->noexpr == NULL)
error (0, 0, _("field `%s' in category `%s' undefined"), {
"noexpr", "LC_MESSAGES"); if (!be_quiet)
error (0, 0, _("field `%s' in category `%s' undefined"),
"noexpr", "LC_MESSAGES");
}
else else
{ {
int result; int result;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -35,8 +35,8 @@
#include "localeinfo.h" #include "localeinfo.h"
#include "stringtrans.h" #include "stringtrans.h"
void *xmalloc (size_t __n); extern void *xmalloc (size_t __n);
void *xrealloc (void *__ptr, size_t __n); extern void *xrealloc (void *__ptr, size_t __n);
/* The real definition of the struct for the LC_NUMERIC locale. */ /* The real definition of the struct for the LC_NUMERIC locale. */
@ -129,9 +129,12 @@ monetary_finish (struct localedef_t *locale)
/* The international currency symbol must come from ISO 4217. */ /* The international currency symbol must come from ISO 4217. */
if (monetary->int_curr_symbol != NULL) if (monetary->int_curr_symbol != NULL)
{ {
if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet) if (strlen (monetary->int_curr_symbol) != 4)
error (0, 0, _("\ {
if (!be_quiet)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length")); value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
}
else if (bsearch (monetary->int_curr_symbol, valid_int_curr, else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
NR_VALID_INT_CURR, sizeof (const char *), NR_VALID_INT_CURR, sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL (comparison_fn_t) curr_strcmp) == NULL

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -37,8 +37,8 @@
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24)) (((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
void *xmalloc (size_t __n); extern void *xmalloc (size_t __n);
void *xrealloc (void *__p, size_t __n); extern void *xrealloc (void *__p, size_t __n);
/* Entry describing an entry of the era specification. */ /* Entry describing an entry of the era specification. */
@ -154,21 +154,23 @@ time_finish (struct localedef_t *locale)
memcpy (str, time->era[idx], era_len + 1); memcpy (str, time->era[idx], era_len + 1);
/* First character must be + or - for the direction. */ /* First character must be + or - for the direction. */
if (*str != '+' && *str != '-' && !be_quiet) if (*str != '+' && *str != '-')
{ {
error (0, 0, _("direction flag in string %d in `era' field" if (!be_quiet)
" in category `%s' is not '+' nor '-'"), error (0, 0, _("direction flag in string %d in `era' field"
idx + 1, "LC_TIME"); " in category `%s' is not '+' nor '-'"),
idx + 1, "LC_TIME");
/* Default arbitrarily to '+'. */ /* Default arbitrarily to '+'. */
time->era_entries[idx].direction = '+'; time->era_entries[idx].direction = '+';
} }
else else
time->era_entries[idx].direction = *str; time->era_entries[idx].direction = *str;
if (*++str != ':' && !be_quiet) if (*++str != ':')
{ {
error (0, 0, _("direction flag in string %d in `era' field" if (!be_quiet)
" in category `%s' is not a single character"), error (0, 0, _("direction flag in string %d in `era' field"
idx + 1, "LC_TIME"); " in category `%s' is not a single character"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else else
@ -176,18 +178,20 @@ time_finish (struct localedef_t *locale)
/* Now the offset year. */ /* Now the offset year. */
time->era_entries[idx].offset = strtol (str, &endp, 10); time->era_entries[idx].offset = strtol (str, &endp, 10);
if (endp == str && !be_quiet) if (endp == str)
{ {
error (0, 0, _("illegal number for offset in string %d in" if (!be_quiet)
" `era' field in category `%s'"), error (0, 0, _("illegal number for offset in string %d in"
idx + 1, "LC_TIME"); " `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else if (*endp != ':' && !be_quiet) else if (*endp != ':')
{ {
error (0, 0, _("garbage at end of offset value in string %d in" if (!be_quiet)
" `era' field in category `%s'"), error (0, 0, _("garbage at end of offset value in string %d in"
idx + 1, "LC_TIME"); " `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else else
@ -229,20 +233,23 @@ time_finish (struct localedef_t *locale)
time->era_entries[idx].start_date[1] -= 1; time->era_entries[idx].start_date[1] -= 1;
time->era_entries[idx].start_date[2] = strtol (str, &endp, 10); time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
if (endp == str && !be_quiet) if (endp == str)
{ {
invalid_start_date: invalid_start_date:
error (0, 0, _("illegal starting date in string %d in" if (!be_quiet)
" `era' field in category `%s'"), error (0, 0, _("illegal starting date in string %d in"
idx + 1, "LC_TIME"); " `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else if (*endp != ':' && !be_quiet) else if (*endp != ':')
{ {
garbage_start_date: garbage_start_date:
error (0, 0, _("garbage at end of starting date in string %d" if (!be_quiet)
" in `era' field in category `%s'"), error (0, 0, _("garbage at end of starting date "
idx + 1, "LC_TIME"); "in string %d in `era' field "
"in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else else
@ -302,20 +309,23 @@ time_finish (struct localedef_t *locale)
time->era_entries[idx].stop_date[1] -= 1; time->era_entries[idx].stop_date[1] -= 1;
time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10); time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
if (endp == str && !be_quiet) if (endp == str)
{ {
invalid_stop_date: invalid_stop_date:
error (0, 0, _("illegal stopping date in string %d in" if (!be_quiet)
" `era' field in category `%s'"), error (0, 0, _("illegal stopping date in string %d in"
idx + 1, "LC_TIME"); " `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else if (*endp != ':' && !be_quiet) else if (*endp != ':')
{ {
garbage_stop_date: garbage_stop_date:
error (0, 0, _("garbage at end of stopping date in string %d" if (!be_quiet)
" in `era' field in category `%s'"), error (0, 0, _("garbage at end of stopping date "
idx + 1, "LC_TIME"); "in string %d in `era' field "
"in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":"); (void) strsep (&str, ":");
} }
else else
@ -339,10 +349,11 @@ time_finish (struct localedef_t *locale)
} }
} }
if ((str == NULL || *str == '\0') && !be_quiet) if (str == NULL || *str == '\0')
{ {
error (0, 0, _("missing era name in string %d in `era' field" if (!be_quiet)
" in category `%s'"), idx + 1, "LC_TIME"); error (0, 0, _("missing era name in string %d in `era' field"
" in category `%s'"), idx + 1, "LC_TIME");
time->era_entries[idx].name = time->era_entries[idx].name =
time->era_entries[idx].format = ""; time->era_entries[idx].format = "";
} }
@ -350,11 +361,12 @@ time_finish (struct localedef_t *locale)
{ {
time->era_entries[idx].name = strsep (&str, ":"); time->era_entries[idx].name = strsep (&str, ":");
if ((str == NULL || *str == '\0') && !be_quiet) if (str == NULL || *str == '\0')
{ {
error (0, 0, _("missing era format in string %d in `era'" if (!be_quiet)
" field in category `%s'"), error (0, 0, _("missing era format in string %d in `era'"
idx + 1, "LC_TIME"); " field in category `%s'"),
idx + 1, "LC_TIME");
time->era_entries[idx].name = time->era_entries[idx].name =
time->era_entries[idx].format = ""; time->era_entries[idx].format = "";
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@ -1015,11 +1015,12 @@ write_locale_data (const char *output_path, const char *category,
save_err = errno; save_err = errno;
} }
if (fd == -1 && !be_quiet) if (fd == -1)
{ {
error (0, save_err, _("\ if (!be_quiet)
error (0, save_err, _("\
cannot open output file `%s' for category `%s'"), cannot open output file `%s' for category `%s'"),
fname, category); fname, category);
return; return;
} }
} }
@ -1039,10 +1040,11 @@ cannot open output file `%s' for category `%s'"),
if (maxiov > 0) if (maxiov > 0)
step = MIN (maxiov, step); step = MIN (maxiov, step);
if (writev (fd, &vec[cnt], step) < 0 && !be_quiet) if (writev (fd, &vec[cnt], step) < 0)
{ {
error (0, errno, _("failure while writing data for category `%s'"), if (!be_quiet)
category); error (0, errno, _("failure while writing data for category `%s'"),
category);
break; break;
} }
} }

View File

@ -37,9 +37,13 @@ test-output := $(foreach s, .out .xout, \
generated := $(test-input) $(test-output) generated := $(test-input) $(test-output)
generated-dirs := $(basename $(test-input)) en_US generated-dirs := $(basename $(test-input)) en_US
test-names := test1 test2 test3 test4
test-srcs := $(addprefix tests/,$(addsuffix .cm,$(test-names)) \
$(addsuffix .def,$(test-names)))
distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \ distribute := CHECKSUMS tst-fmon.sh tst-fmon.data ChangeLog sort-test.sh \
README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \ README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \
$(charmaps) $(locales) $(charmaps) $(locales) $(test-srcs)
# Get $(inst_i18ndir) defined. # Get $(inst_i18ndir) defined.
include ../Makeconfig include ../Makeconfig
@ -58,4 +62,5 @@ ifeq (no,$(cross-compiling))
tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon
$(SHELL) -e sort-test.sh $(common-objpfx) $(test-input) $(SHELL) -e sort-test.sh $(common-objpfx) $(test-input)
$(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data $(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data
$(SHELL) -e tst-locale.sh $(common-objpfx)
endif endif

File diff suppressed because it is too large Load Diff

73
localedata/tests/test1.cm Normal file
View File

@ -0,0 +1,73 @@
<code_set_name> BIG5
<comment_char> %
<escape_char> /
<mb_cur_max> 2
<mb_cur_min> 1
CHARMAP
<A> /x41
<B> /x42
<C> /x43
<D> /x44
<E> /x45
<F> /x46
<G> /x47
<H> /x48
<I> /x49
<J> /x4A
<K> /x4B
<L> /x4C
<M> /x4D
<N> /x4E
<O> /x4F
<P> /x50
<Q> /x51
<R> /x52
<S> /x53
<T> /x54
<U> /x55
<V> /x56
<W> /x57
<X> /x58
<Y> /x59
<Z> /x5A
<a> /x61
<b> /x62
<c> /x63
<d> /x64
<e> /x65
<f> /x66
<g> /x67
<h> /x68
<i> /x69
<j> /x6a
<k> /x6b
<l> /x6c
<m> /x6d
<n> /x6e
<o> /x6f
<p> /x70
<q> /x71
<r> /x72
<s> /x73
<t> /x74
<u> /x75
<v> /x76
<w> /x77
<x> /x78
<y> /x79
<z> /x7a
<SP> /x20
<space> /x20
<0> /x30
<1> /x31
<2> /x32
<3> /x33
<4> /x34
<5> /x35
<6> /x36
<7> /x37
<8> /x38
<9> /x39
<B1>...<B3> /xa1/x40
END CHARMAP

View File

@ -0,0 +1,9 @@
LC_CTYPE
upper <A>
lower <a>
space <SP>
blank <SP>
alpha <A>;<a>;<b1>;...;<b3>
END LC_CTYPE

73
localedata/tests/test2.cm Normal file
View File

@ -0,0 +1,73 @@
<code_set_name> BIG5
<comment_char> %
<escape_char> /
<mb_cur_max> 2
<mb_cur_min> 1
CHARMAP
<A> /x41
<B> /x42
<C> /x43
<D> /x44
<E> /x45
<F> /x46
<G> /x47
<H> /x48
<I> /x49
<J> /x4A
<K> /x4B
<L> /x4C
<M> /x4D
<N> /x4E
<O> /x4F
<P> /x50
<Q> /x51
<R> /x52
<S> /x53
<T> /x54
<U> /x55
<V> /x56
<W> /x57
<X> /x58
<Y> /x59
<Z> /x5A
<a> /x61
<b> /x62
<c> /x63
<d> /x64
<e> /x65
<f> /x66
<g> /x67
<h> /x68
<i> /x69
<j> /x6a
<k> /x6b
<l> /x6c
<m> /x6d
<n> /x6e
<o> /x6f
<p> /x70
<q> /x71
<r> /x72
<s> /x73
<t> /x74
<u> /x75
<v> /x76
<w> /x77
<x> /x78
<y> /x79
<z> /x7a
<SP> /x20
<space> /x20
<0> /x30
<1> /x31
<2> /x32
<3> /x33
<4> /x34
<5> /x35
<6> /x36
<7> /x37
<8> /x38
<9> /x39
<b01>...<b03> /xa1/x40
END CHARMAP

View File

@ -0,0 +1,9 @@
LC_CTYPE
upper <A>
lower <a>
space <SP>
blank <SP>
alpha <A>;<a>;<b01>;...;<b03>
END LC_CTYPE

73
localedata/tests/test3.cm Normal file
View File

@ -0,0 +1,73 @@
<code_set_name> BIG5
<comment_char> %
<escape_char> /
<mb_cur_max> 2
<mb_cur_min> 1
CHARMAP
<A> /x41
<B> /x42
<C> /x43
<D> /x44
<E> /x45
<F> /x46
<G> /x47
<H> /x48
<I> /x49
<J> /x4A
<K> /x4B
<L> /x4C
<M> /x4D
<N> /x4E
<O> /x4F
<P> /x50
<Q> /x51
<R> /x52
<S> /x53
<T> /x54
<U> /x55
<V> /x56
<W> /x57
<X> /x58
<Y> /x59
<Z> /x5A
<a> /x61
<b> /x62
<c> /x63
<d> /x64
<e> /x65
<f> /x66
<g> /x67
<h> /x68
<i> /x69
<j> /x6a
<k> /x6b
<l> /x6c
<m> /x6d
<n> /x6e
<o> /x6f
<p> /x70
<q> /x71
<r> /x72
<s> /x73
<t> /x74
<u> /x75
<v> /x76
<w> /x77
<x> /x78
<y> /x79
<z> /x7a
<SP> /x20
<space> /x20
<0> /x30
<1> /x31
<2> /x32
<3> /x33
<4> /x34
<5> /x35
<6> /x36
<7> /x37
<8> /x38
<9> /x39
<b1>...<b3> /xa1/x40
END CHARMAP

View File

@ -0,0 +1,9 @@
LC_CTYPE
upper <A>
lower <a>
space <SP>
blank <SP>
alpha <A>;<a>;<b1>;...;<b3>
END LC_CTYPE

12
localedata/tests/test4.cm Normal file
View File

@ -0,0 +1,12 @@
<code_set_name> BIG5
<escape_char> /
<mb_cur_max> 2
<mb_cur_min> 1
CHARMAP
<b0101>...<b0103> /xa1/x40
<B0101>...<B0103> /xa1/xa1
<b0901>...<b0903> /xa1/x40
<B0901>...<B0903> /xa1/xa1
<b1001>...<b1003> /xaa/x40
<B1001>...<B1003> /xaa/xa1
END CHARMAP

View File

@ -0,0 +1,7 @@
LC_COLLATE
order_start forward
<b1001>
<B1001>
UNDEFINED IGNORE
order_end
END LC_COLLATE

51
localedata/tst-locale.sh Executable file
View File

@ -0,0 +1,51 @@
#! /bin/sh
# Testing the implementation of localedata.
# Copyright (C) 1998 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# Contributed by Andreas Jaeger, <aj@arthur.rhein-neckar.de>, 1998.
#
# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB. If
# not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
common_objpfx=$1; shift
test_locale ()
{
charmap=$1
input=$2
out=$3
I18NPATH=./locales \
${common_objpfx}elf/ld.so --library-path $common_objpfx \
${common_objpfx}locale/localedef --quiet -c -f $charmap -i $input \
${common_objpfx}localedata/$out
if [ $? -ne 0 ]; then
echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
"Outputdir: \"${out}\" failed"
exit 1
fi
}
test_locale IBM437 de_DE de_DE.437
test_locale tests/test1.cm tests/test1.def test1
test_locale tests/test2.cm tests/test2.def test2
test_locale tests/test3.cm tests/test3.def test3
test_locale tests/test4.cm tests/test4.def test4
exit 0
# Local Variables:
# mode:shell-script
# End:

View File

@ -46,6 +46,7 @@ These functions are declared in the header files @file{math.h} and
division. division.
* Parsing of Numbers:: Functions for ``reading'' numbers * Parsing of Numbers:: Functions for ``reading'' numbers
from strings. from strings.
* Old-style number conversion:: Low-level number to string conversion.
@end menu @end menu
@node Infinity @node Infinity
@ -1324,3 +1325,169 @@ need not detect overflow and underflow errors. The @code{atof} function
is provided mostly for compatibility with existing code; using is provided mostly for compatibility with existing code; using
@code{strtod} is more robust. @code{strtod} is more robust.
@end deftypefun @end deftypefun
@node Old-style number conversion
@subsection Old-style way of converting numbers to strings
The @w{System V} library provided three functions to convert numbers to
strings which have a unusual and hard-to-be-used semantic. The GNU C
library also provides these functions together with some useful
extensions in the same sense.
Generally, you should avoid using these functions unless the really fit
into the problem you have to to solve. Otherwise it is almost always
better to use @code{sprinf} since it's greater availability (it is an
@w{ISO C} function).
@comment stdlib.h
@comment SVID, Unix98
@deftypefun {char *} ecvt (double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign})
The function @code{ecvt} converts the floating-point number @var{value}
to a string with at most @var{ndigit} decimal digits. If @code{ndigit}
is greater than the accuracy of the @code{double} floating-point type
the implementation can shorten @var{ndigit} to a reasonable value. The
returned string neither contains decimal point nor sign. The high-order
digit of the string is non-zero (unless @var{value} is actually zero)
and the low-order digit is rounded. The variable pointed to by
@var{decpt} gets the position of the decimal character relative to the
start of the string. If @var{value} is negativ, @var{sign} is set to a
non-zero value, otherwise to 0.
The returned string is statically allocated and overwritten by each call
to @code{ecvt}.
If @var{value} is zero, it's implementation defined if @var{decpt} is
@code{0} or @code{1}.
The prototype for this function can be found in @file{stdlib.h}.
@end deftypefun
As an example @code{ecvt (12.3, 5, &decpt, &sign)} returns @code{"12300"}
and sets @var{decpt} to @code{2} and @var{sign} to @code{0}.
@comment stdlib.h
@comment SVID, Unix98
@deftypefun {char *} fcvt (double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign})
The function @code{fcvt} is similar to @code{ecvt} with the difference
that @var{ndigit} specifies the digits after the decimal point. If
@var{ndigit} is less than zero, @var{value} is rounded to the left of
the decimal point upto the reasonable limit (e.g., @math{123.45} is only
rounded to the third digit before the decimal point, even if
@var{ndigit} is less than @math{-3}).
The returned string is statically allocated and overwritten by each call
to @code{fcvt}.
The prototype for this function can be found in @file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment SVID, Unix98
@deftypefun {char *} gcvt (double @var{value}, int @var{ndigit}, char *@var{buf})
The @code{gcvt} function also converts @var{value} to a NUL terminated
string but does in a way similar to the @code{%g} format of
@code{printf}. It also does not use a static buffer but instead uses
the user-provided buffer starting at @var{buf}. It is the user's
responsibility to make sure the buffer is long enough to contain the
result. Unlike the @code{ecvt} and @code{fcvt} function @code{gcvt}
includes the sign and the decimal point character (which is determined
according to the current locale) in the result. Therefore there are yet
less reasons to use this function instead of @code{printf}.
The return value is @var{buf}.
The prototype for this function can be found in @file{stdlib.h}.
@end deftypefun
All these three functions have in common that they use @code{double}
values as the parameters. Calling these functions using @code{long
double} values would mean a loss of precision due to the implicit
rounding. Therefore the GNU C library contains three more functions
with similar semantic which take @code{long double} values.
@comment stdlib.h
@comment GNU
@deftypefun {char *} qecvt (long double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign})
This function is equivalent to the @code{ecvt} function except that it
takes an @code{long double} value for the first parameter.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment GNU
@deftypefun {char *} qfcvt (long double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign})
This function is equivalent to the @code{fcvt} function except that it
takes an @code{long double} value for the first parameter.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment GNU
@deftypefun {char *} qgcvt (long double @var{value}, int @var{ndigit}, char *@var{buf})
This function is equivalent to the @code{gcvt} function except that it
takes an @code{long double} value for the first parameter.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@cindex gcvt_r
As said above the @code{ecvt} and @code{fcvt} function along with their
@code{long double} equivalents have the problem that they return a value
located in a static buffer which is overwritten by the next call of the
function. This limitation is lifted in yet another set of functions
which also are GNU extensions. These reentrant functions can be
recognized by the by the conventional @code{_r} ending. Obviously there
is no need for a @code{gcvt_r} function.
@comment stdlib.h
@comment GNU
@deftypefun {char *} ecvt_r (double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
The @code{ecvt_r} function is similar to the @code{ecvt} function except
that it places its result into the user-specified buffer starting at
@var{buf}.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment SVID, Unix98
@deftypefun {char *} fcvt_r (double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
The @code{fcvt_r} function is similar to the @code{fcvt} function except
that it places its result into the user-specified buffer starting at
@var{buf}.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment GNU
@deftypefun {char *} qecvt_r (long double @var{value}, int @var{ndigit}, int *@var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
The @code{qecvt_r} function is similar to the @code{qecvt} function except
that it places its result into the user-specified buffer starting at
@var{buf}.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun
@comment stdlib.h
@comment GNU
@deftypefun {char *} qfcvt (long double @var{value}, int @var{ndigit}, int @var{decpt}, int *@var{sign}, char *@var{buf}, size_t @var{len})
The @code{qfcvt_r} function is similar to the @code{qfcvt} function except
that it places its result into the user-specified buffer starting at
@var{buf}.
This function is a GNU extension. The prototype can be found in
@file{stdlib.h}.
@end deftypefun

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -93,9 +93,9 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
} }
else else
{ {
strncpy (buffer, NISENTRYVAL (entry, 1, result), cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result),
NISENTRYLEN (entry, 1, result)); NISENTRYLEN (entry, 1, result));
buffer[NISENTRYLEN (entry, 1, result)] = '\0'; *cp = '\0';
} }
if (NISENTRYLEN(entry, 0, result) >= room_left) if (NISENTRYLEN(entry, 0, result) >= room_left)
@ -105,8 +105,9 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
alias->alias_members_len = 0; alias->alias_members_len = 0;
*first_unused = '\0'; *first_unused = '\0';
++first_unused; ++first_unused;
strcpy (first_unused, NISENTRYVAL (entry, 0, result)); cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result),
first_unused[NISENTRYLEN (entry, 0, result)] = '\0'; NISENTRYLEN (entry, 0, result));
*cp = '\0';
alias->alias_name = first_unused; alias->alias_name = first_unused;
/* Terminate the line for any case. */ /* Terminate the line for any case. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -107,7 +107,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
p = first_unused; p = first_unused;
line = p; line = p;
for (i = 0; i < result->objects.objects_len; i++) for (i = 0; i < result->objects.objects_len; ++i)
{ {
if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0) if (strcmp (NISENTRYVAL (i, 1, result), host->h_name) != 0)
{ {
@ -121,8 +121,9 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
room_left -= (NISENTRYLEN (i, 1, result) + 1); room_left -= (NISENTRYLEN (i, 1, result) + 1);
} }
} }
++p; *p++ = '\0';
first_unused = p; first_unused = p;
/* Adjust the pointer so it is aligned for /* Adjust the pointer so it is aligned for
storing pointers. */ storing pointers. */
first_unused += __alignof__ (char *) - 1; first_unused += __alignof__ (char *) - 1;
@ -142,7 +143,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
{ {
/* Skip leading blanks. */ /* Skip leading blanks. */
while (isspace (*line)) while (isspace (*line))
line++; ++line;
if (*line == '\0') if (*line == '\0')
break; break;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -79,7 +79,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
p = first_unused; p = first_unused;
line = p; line = p;
for (i = 0; i < result->objects.objects_len; i++) for (i = 0; i < result->objects.objects_len; ++i)
{ {
if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0) if (strcmp (NISENTRYVAL (i, 1, result), network->n_name) != 0)
{ {
@ -93,7 +93,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
room_left -= (NISENTRYLEN (i, 1, result) + 1); room_left -= (NISENTRYLEN (i, 1, result) + 1);
} }
} }
++p; *p++ = '\0';
first_unused = p; first_unused = p;
/* Adjust the pointer so it is aligned for /* Adjust the pointer so it is aligned for
@ -106,7 +106,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
room_left -= (2 * sizeof (char *)); room_left -= (2 * sizeof (char *));
network->n_aliases[0] = NULL; network->n_aliases[0] = NULL;
i = 0; i = 0;
while (*line != '\0') while (*line != '\0')
{ {
/* Skip leading blanks. */ /* Skip leading blanks. */
@ -125,17 +125,14 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
while (*line != '\0' && *line != ' ') while (*line != '\0' && *line != ' ')
++line; ++line;
if (line != network->n_aliases[i]) if (*line == ' ')
{ {
if (*line != '\0') *line = '\0';
{ ++line;
*line = '\0';
++line;
}
++i; ++i;
} }
else else
network->n_aliases[i] = NULL; network->n_aliases[i+1] = NULL;
} }
return 1; return 1;
@ -385,39 +382,57 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
nis_result *result; nis_result *result;
char buf[1024 + tablename_len]; char buf[1024 + tablename_len];
struct in_addr in; struct in_addr in;
char buf2[256];
int b2len;
in = inet_makeaddr (addr, 0); in = inet_makeaddr (addr, 0);
sprintf (buf, "[addr=%s],%s", inet_ntoa (in), tablename_val); strcpy (buf2, inet_ntoa (in));
b2len = strlen (buf2);
result = nis_list (buf, EXPAND_NAME, NULL, NULL); while (1)
retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS)
{ {
if (retval == NSS_STATUS_TRYAGAIN) sprintf (buf, "[addr=%s],%s", buf2, tablename_val);
result = nis_list (buf, EXPAND_NAME, NULL, NULL);
retval = niserr2nss (result->status);
if (retval != NSS_STATUS_SUCCESS)
{ {
*errnop = errno; if (buf2[b2len -2] == '.' && buf2[b2len -1] == '0')
*herrnop = NETDB_INTERNAL; {
/* Try again, but with trailing dot(s)
removed (one by one) */
buf2[b2len - 2] = '\0';
b2len -= 2;
continue;
}
else
return NSS_STATUS_NOTFOUND;
if (retval == NSS_STATUS_TRYAGAIN)
{
*errnop = errno;
*herrnop = NETDB_INTERNAL;
}
nis_freeresult (result);
return retval;
} }
parse_res = _nss_nisplus_parse_netent (result, network, buffer,
buflen, errnop);
nis_freeresult (result); nis_freeresult (result);
return retval;
if (parse_res > 0)
return NSS_STATUS_SUCCESS;
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
}
else
return NSS_STATUS_NOTFOUND;
} }
parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen,
errnop);
nis_freeresult (result);
if (parse_res > 0)
return NSS_STATUS_SUCCESS;
*herrnop = NETDB_INTERNAL;
if (parse_res == -1)
{
*errnop = ERANGE;
return NSS_STATUS_TRYAGAIN;
}
else
return NSS_STATUS_NOTFOUND;
} }
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -79,7 +79,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
p = first_unused; p = first_unused;
line = p; line = p;
for (i = 0; i < result->objects.objects_len; i++) for (i = 0; i < result->objects.objects_len; ++i)
{ {
if (strcmp (NISENTRYVAL (i, 1, result), proto->p_name) != 0) if (strcmp (NISENTRYVAL (i, 1, result), proto->p_name) != 0)
{ {
@ -92,7 +92,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
room_left -= (NISENTRYLEN (i, 1, result) + 1); room_left -= (NISENTRYLEN (i, 1, result) + 1);
} }
} }
++p; *p++ = '\0';
first_unused = p; first_unused = p;
/* Adjust the pointer so it is aligned for /* Adjust the pointer so it is aligned for

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -69,13 +69,13 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
NISENTRYLEN (0, 0, result)); NISENTRYLEN (0, 0, result));
first_unused[NISENTRYLEN (0, 0, result)] = '\0'; first_unused[NISENTRYLEN (0, 0, result)] = '\0';
rpc->r_name = first_unused; rpc->r_name = first_unused;
room_left -= strlen (first_unused) + 1; room_left -= (strlen (first_unused) + 1);
first_unused += strlen (first_unused) + 1; first_unused += strlen (first_unused) + 1;
rpc->r_number = atoi (NISENTRYVAL (0, 2, result)); rpc->r_number = atoi (NISENTRYVAL (0, 2, result));
p = first_unused; p = first_unused;
line = p; line = p;
for (i = 0; i < result->objects.objects_len; i++) for (i = 0; i < result->objects.objects_len; ++i)
{ {
if (strcmp (NISENTRYVAL (i, 1, result), rpc->r_name) != 0) if (strcmp (NISENTRYVAL (i, 1, result), rpc->r_name) != 0)
{ {
@ -106,7 +106,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
{ {
/* Skip leading blanks. */ /* Skip leading blanks. */
while (isspace (*line)) while (isspace (*line))
line++; ++line;
if (*line == '\0') if (*line == '\0')
break; break;
@ -120,17 +120,14 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
while (*line != '\0' && *line != ' ') while (*line != '\0' && *line != ' ')
++line; ++line;
if (line != rpc->r_aliases[i]) if (*line == ' ')
{ {
if (*line != '\0') *line = '\0';
{ ++line;
*line = '\0';
++line;
}
++i; ++i;
} }
else else
rpc->r_aliases[i] = NULL; rpc->r_aliases[i+1] = NULL;
} }
return 1; return 1;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -84,7 +84,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
p = first_unused; p = first_unused;
line = p; line = p;
for (i = 0; i < result->objects.objects_len; i++) for (i = 0; i < result->objects.objects_len; ++i)
{ {
if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0) if (strcmp (NISENTRYVAL (i, 1, result), serv->s_name) != 0)
{ {
@ -97,7 +97,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
room_left -= (NISENTRYLEN (i, 1, result) + 1); room_left -= (NISENTRYLEN (i, 1, result) + 1);
} }
} }
++p; *p++ = '\0';
first_unused = p; first_unused = p;
/* Adjust the pointer so it is aligned for /* Adjust the pointer so it is aligned for

View File

@ -81,7 +81,9 @@ ifneq (,$(pofiles))
chmod 444 $@ chmod 444 $@
linguas: $(pofiles:$(podir)/%=%) linguas: $(pofiles:$(podir)/%=%)
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Copied from $(podir)' $^ test ! -d CVS || cvs $(CVSOPTS) commit -m'Copied from $(podir)' $^
endif
linguas.mo: $(pofiles:$(podir)/%.po=%.mo) linguas.mo: $(pofiles:$(podir)/%.po=%.mo)
endif endif

View File

@ -77,7 +77,9 @@ lib: $(objpfx)libposix.a
testcases.h: TESTS TESTS2C.sed testcases.h: TESTS TESTS2C.sed
sed -f TESTS2C.sed < $< > $@T sed -f TESTS2C.sed < $< > $@T
mv -f $@T $@ mv -f $@T $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@ test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
endif
# Make the standalone glob/fnmatch package. # Make the standalone glob/fnmatch package.
@ -95,13 +97,17 @@ glob/%.h: %.h
glob/configure: glob/configure.in glob/configure: glob/configure.in
cd glob; autoconf $(ACFLAGS) cd glob; autoconf $(ACFLAGS)
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@ test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
endif
glob/ChangeLog: ../ChangeLog glob/ChangeLog: ../ChangeLog
changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new changelog-extract --regexp 'posix/(glob|fnmatch).*' < $< > $@.new
chmod a-w $@.new chmod a-w $@.new
mv -f $@.new $@ mv -f $@.new $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@ test ! -d CVS || cvs $(CVSOPTS) commit -mRegenerated $@
endif
%.Z: % %.Z: %
compress -c $< > $@-tmp compress -c $< > $@-tmp

View File

@ -113,7 +113,9 @@ $(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
.PHONY: copy-mpn clean-mpn mpn-stuff .PHONY: copy-mpn clean-mpn mpn-stuff
mpn-stuff: $(mpn-stuff) mpn-stuff: $(mpn-stuff)
copy-mpn: $(mpn-stuff) copy-mpn: $(mpn-stuff)
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $(gmp-srcdir)' $+ test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $(gmp-srcdir)' $+
endif
clean-mpn: clean-mpn:
rm -f $(mpn-stuff) rm -f $(mpn-stuff)

View File

@ -118,7 +118,7 @@ $(objpfx)rpcgen: $(addprefix $(objpfx),$(rpcgen-objs)) \
# Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the # Tell rpcgen that it should unset LD_LIBRARY_PATH before executing the
# preprocessor. # preprocessor.
rpcgen-cmd = $(built-program-cmd) -$$ rpcgen-cmd = $(built-program-cmd)
# The proper file name is longer than 14 chars, so we install it under # The proper file name is longer than 14 chars, so we install it under
# a shorter name. But if the filesystem can handle it, we want to # a shorter name. But if the filesystem can handle it, we want to

View File

@ -1,14 +1,12 @@
/****** rpc_clntout.c ******/ /****** rpc_clntout.c ******/
void write_stubs(void); void write_stubs(void);
void printarglist(proc_list *proc, void printarglist(proc_list *proc, const char *result,
const char *addargname, const char *addargtype); const char *addargname, const char *addargtype);
/****** rpc_cout.c ******/ /****** rpc_cout.c ******/
void emit(definition *def); void emit (definition *def);
void emit_inline(declaration *decl, int flag);
void emit_single_in_line(declaration *decl, int flag, relation rel);
/****** rpc_hout.c ******/ /****** rpc_hout.c ******/
@ -19,6 +17,7 @@ void pprocdef(proc_list *proc, version_list *vp,
const char *addargtype, int server_p, int mode); const char *addargtype, int server_p, int mode);
void pdeclaration(const char *name, declaration *dec, int tab, void pdeclaration(const char *name, declaration *dec, int tab,
const char *separator); const char *separator);
void print_xdr_func_def (char* name, int pointerp, int i);
/****** rpc_main.c ******/ /****** rpc_main.c ******/
/* nil */ /* nil */

View File

@ -60,9 +60,9 @@ write_stubs (void)
list *l; list *l;
definition *def; definition *def;
f_print (fout, fprintf (fout,
"\n/* Default timeout can be changed using clnt_control() */\n"); "\n/* Default timeout can be changed using clnt_control() */\n");
f_print (fout, "static struct timeval TIMEOUT = { %d, 0 };\n", fprintf (fout, "static struct timeval TIMEOUT = { %d, 0 };\n",
DEFAULT_TIMEOUT); DEFAULT_TIMEOUT);
for (l = defined; l != NULL; l = l->next) for (l = defined; l != NULL; l = l->next)
{ {
@ -84,14 +84,23 @@ write_program (definition * def)
{ {
for (proc = vp->procs; proc != NULL; proc = proc->next) for (proc = vp->procs; proc != NULL; proc = proc->next)
{ {
f_print (fout, "\n"); fprintf (fout, "\n");
ptype (proc->res_prefix, proc->res_type, 1); if (mtflag == 0)
f_print (fout, "*\n"); {
pvname (proc->proc_name, vp->vers_num); ptype (proc->res_prefix, proc->res_type, 1);
printarglist (proc, "clnt", "CLIENT *"); fprintf (fout, "*\n");
f_print (fout, "{\n"); pvname (proc->proc_name, vp->vers_num);
printarglist (proc, RESULT, "clnt", "CLIENT *");
}
else
{
fprintf (fout, "enum clnt_stat \n");
pvname (proc->proc_name, vp->vers_num);
printarglist (proc, RESULT, "clnt", "CLIENT *");
}
fprintf (fout, "{\n");
printbody (proc); printbody (proc);
f_print (fout, "}\n"); fprintf (fout, "}\n");
} }
} }
} }
@ -104,67 +113,109 @@ write_program (definition * def)
/* sample addargname = "clnt"; sample addargtype = "CLIENT * " */ /* sample addargname = "clnt"; sample addargtype = "CLIENT * " */
void void
printarglist (proc_list * proc, printarglist (proc_list * proc, const char *result,
const char *addargname, const char *addargtype) const char *addargname, const char *addargtype)
{ {
decl_list *l; decl_list *l;
if (!newstyle) if (!newstyle)
{ /* old style: always pass argument by reference */ { /* old style: always pass argument by reference */
if (Cflag) if (Cflag)
{ /* C++ style heading */ { /* C++ style heading */
f_print (fout, "("); fprintf (fout, "(");
ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); ptype (proc->args.decls->decl.prefix,
f_print (fout, "*argp, %s%s)\n", addargtype, addargname); proc->args.decls->decl.type, 1);
if (mtflag)
{/* Generate result field */
fprintf (fout, "*argp, ");
ptype(proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s, %s%s)\n", result, addargtype, addargname);
}
else
fprintf (fout, "*argp, %s%s)\n", addargtype, addargname);
} }
else else
{ {
f_print (fout, "(argp, %s)\n", addargname); if (!mtflag)
f_print (fout, "\t"); fprintf (fout, "(argp, %s)\n", addargname);
ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); else
f_print (fout, "*argp;\n"); fprintf (fout, "(argp, %s, %s)\n", result, addargname);
fprintf (fout, "\t");
ptype (proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
fprintf (fout, "*argp;\n");
if (mtflag)
{
fprintf (fout, "\t");
ptype (proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s;\n", result);
}
} }
} }
else if (streq (proc->args.decls->decl.type, "void")) else if (streq (proc->args.decls->decl.type, "void"))
{ {
/* newstyle, 0 argument */ /* newstyle, 0 argument */
if (Cflag) if (mtflag)
f_print (fout, "(%s%s)\n", addargtype, addargname); {
fprintf (fout, "(");
if (Cflag)
{
ptype(proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s, %s%s)\n", result, addargtype, addargname);
}
else
fprintf (fout, "(%s)\n", addargname);
}
else if (Cflag)
fprintf (fout, "(%s%s)\n", addargtype, addargname);
else else
f_print (fout, "(%s)\n", addargname); fprintf (fout, "(%s)\n", addargname);
} }
else else
{ {
/* new style, 1 or multiple arguments */ /* new style, 1 or multiple arguments */
if (!Cflag) if (!Cflag)
{ {
f_print (fout, "("); fprintf (fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next) for (l = proc->args.decls; l != NULL; l = l->next)
f_print (fout, "%s, ", l->decl.name); fprintf (fout, "%s, ", l->decl.name);
f_print (fout, "%s)\n", addargname); if (mtflag)
fprintf (fout, "%s, ", result);
fprintf (fout, "%s)\n", addargname);
for (l = proc->args.decls; l != NULL; l = l->next) for (l = proc->args.decls; l != NULL; l = l->next)
{ {
pdeclaration (proc->args.argname, &l->decl, 1, ";\n"); pdeclaration (proc->args.argname, &l->decl, 1, ";\n");
} }
if (mtflag)
{
fprintf (fout, "\t");
ptype (proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s;\n", result);
}
} }
else else
{ /* C++ style header */ { /* C++ style header */
f_print (fout, "("); fprintf (fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next) for (l = proc->args.decls; l != NULL; l = l->next)
{ {
pdeclaration (proc->args.argname, &l->decl, 0, ", "); pdeclaration (proc->args.argname, &l->decl, 0, ", ");
} }
f_print (fout, " %s%s)\n", addargtype, addargname); if (mtflag)
{
ptype (proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s, ", result);
}
fprintf (fout, " %s%s)\n", addargtype, addargname);
} }
} }
if (!Cflag) if (!Cflag)
f_print (fout, "\t%s%s;\n", addargtype, addargname); fprintf (fout, "\t%s%s;\n", addargtype, addargname);
} }
static static
const char * const char *
ampr (const char *type) ampr (const char *type)
@ -190,66 +241,102 @@ printbody (proc_list * proc)
to stuff the arguments. */ to stuff the arguments. */
if (newstyle && args2) if (newstyle && args2)
{ {
f_print (fout, "\t%s", proc->args.argname); fprintf (fout, "\t%s", proc->args.argname);
f_print (fout, " arg;\n"); fprintf (fout, " arg;\n");
} }
f_print (fout, "\tstatic "); if (!mtflag)
if (streq (proc->res_type, "void"))
{ {
f_print (fout, "char "); fprintf (fout, "\tstatic ");
if (streq (proc->res_type, "void"))
{
fprintf (fout, "char ");
}
else
{
ptype (proc->res_prefix, proc->res_type, 0);
}
fprintf (fout, "%s;\n", RESULT);
fprintf (fout, "\n");
fprintf (fout, "\tmemset((char *)%s%s, 0, sizeof(%s));\n",
ampr (proc->res_type), RESULT, RESULT);
} }
else
{
ptype (proc->res_prefix, proc->res_type, 0);
}
f_print (fout, "%s;\n", RESULT);
f_print (fout, "\n");
f_print (fout, "\tmemset((char *)%s%s, 0, sizeof(%s));\n",
ampr (proc->res_type), RESULT, RESULT);
if (newstyle && !args2 && (streq (proc->args.decls->decl.type, "void"))) if (newstyle && !args2 && (streq (proc->args.decls->decl.type, "void")))
{ {
/* newstyle, 0 arguments */ /* newstyle, 0 arguments */
f_print (fout, if (mtflag)
"\tif (clnt_call(clnt, %s, xdr_void", proc->proc_name); fprintf (fout, "\t return ");
f_print (fout, else
", NULL, xdr_%s, %s,%s, TIMEOUT) != RPC_SUCCESS) {\n", fprintf (fout, "\t if ");
stringfix (proc->res_type), ampr (proc->res_type), RESULT); fprintf (fout,
"(clnt_call (clnt, %s, (xdrproc_t) xdr_void", proc->proc_name);
fprintf (fout,
"(caddr_t) NULL,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
RESULT);
if (mtflag)
fprintf (fout, "\n\t\tTIMEOUT));\n}\n");
else
fprintf (fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
} }
else if (newstyle && args2) else if (newstyle && args2)
{ {
/* newstyle, multiple arguments: stuff arguments into structure */ /* newstyle, multiple arguments: stuff arguments into structure */
for (l = proc->args.decls; l != NULL; l = l->next) for (l = proc->args.decls; l != NULL; l = l->next)
{ {
f_print (fout, "\targ.%s = %s;\n", fprintf (fout, "\targ.%s = %s;\n",
l->decl.name, l->decl.name); l->decl.name, l->decl.name);
} }
f_print (fout, if (mtflag)
"\tif (clnt_call(clnt, %s, xdr_%s", proc->proc_name, fprintf (fout, "\treturn ");
else
fprintf (fout, "\tif ");
fprintf (fout,
"(clnt_call (clnt, %s, (xdrproc_t) xdr_%s", proc->proc_name,
proc->args.argname); proc->args.argname);
f_print (fout, fprintf (fout,
", &arg, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n", ", (caddr_t) &arg,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,",
stringfix (proc->res_type), ampr (proc->res_type), RESULT); stringfix(proc->res_type), (mtflag)?"":ampr(proc->res_type),
RESULT);
if (mtflag)
fprintf (fout, "\n\t\tTIMEOUT));\n");
else
fprintf (fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
} }
else else
{ /* single argument, new or old style */ { /* single argument, new or old style */
f_print (fout, if (!mtflag)
"\tif (clnt_call(clnt, %s, xdr_%s, %s%s, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n", fprintf (fout,
proc->proc_name, "\tif (clnt_call (clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT) != RPC_SUCCESS) {\n",
stringfix (proc->args.decls->decl.type), proc->proc_name,
(newstyle ? "&" : ""), stringfix (proc->args.decls->decl.type),
(newstyle ? proc->args.decls->decl.name : "argp"), (newstyle ? "&" : ""),
stringfix (proc->res_type), ampr (proc->res_type), RESULT); (newstyle ? proc->args.decls->decl.name : "argp"),
stringfix (proc->res_type), ampr (proc->res_type),
RESULT);
else
fprintf(fout,
"\treturn (clnt_call(clnt, %s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\t(xdrproc_t) xdr_%s, (caddr_t) %s%s,\n\t\tTIMEOUT));\n",
proc->proc_name,
stringfix (proc->args.decls->decl.type),
(newstyle ? "&" : ""),
(newstyle ? proc->args.decls->decl.name : "argp"),
stringfix (proc->res_type), "",
RESULT);
} }
f_print (fout, "\t\treturn (NULL);\n"); if (!mtflag)
f_print (fout, "\t}\n");
if (streq (proc->res_type, "void"))
{ {
f_print (fout, "\treturn ((void *)%s%s);\n", fprintf (fout, "\t\treturn (NULL);\n");
ampr (proc->res_type), RESULT); fprintf (fout, "\t}\n");
} if (streq (proc->res_type, "void"))
else {
{ fprintf (fout, "\treturn ((void *)%s%s);\n",
f_print (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT); ampr (proc->res_type), RESULT);
}
else
{
fprintf (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT);
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -31,11 +31,11 @@
/* /*
* From: @(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI * From: @(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI
*/ */
char hout_rcsid[] = char hout_rcsid[] =
"$Id$"; "$Id$";
/* /*
* rpc_hout.c, Header file outputter for the RPC protocol compiler * rpc_hout.c, Header file outputter for the RPC protocol compiler
*/ */
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -43,456 +43,575 @@ char hout_rcsid[] =
#include "rpc_util.h" #include "rpc_util.h"
#include "proto.h" #include "proto.h"
static void pconstdef(definition *def); static void pconstdef (definition * def);
static void pargdef(definition *def); static void pargdef (definition * def);
static void pstructdef(definition *def); static void pstructdef (definition * def);
static void puniondef(definition *def); static void puniondef (definition * def);
static void pdefine(const char *name, const char *num); static void pdefine (const char *name, const char *num);
static void puldefine(const char *name, const char *num); static void puldefine (const char *name, const char *num);
static int define_printed(proc_list *stop, version_list *start); static int define_printed (proc_list * stop, version_list * start);
static void pprogramdef(definition *def); static void pprogramdef (definition * def);
static void parglist(proc_list *proc, const char *addargtype); static void parglist (proc_list * proc, const char *addargtype);
static void penumdef(definition *def); static void penumdef (definition * def);
static void ptypedef(definition *def); static void ptypedef (definition * def);
static int undefined2(const char *type, const char *stop); static int undefined2 (const char *type, const char *stop);
/* store away enough information to allow the XDR functions to be spat
out at the end of the file */
void
storexdrfuncdecl (const char *name, int pointerp)
{
xdrfunc * xdrptr;
xdrptr = (xdrfunc *) malloc(sizeof (struct xdrfunc));
xdrptr->name = (char *)name;
xdrptr->pointerp = pointerp;
xdrptr->next = NULL;
if (xdrfunc_tail == NULL)
{
xdrfunc_head = xdrptr;
xdrfunc_tail = xdrptr;
}
else
{
xdrfunc_tail->next = xdrptr;
xdrfunc_tail = xdrptr;
}
}
/* /*
* Print the C-version of an xdr definition * Print the C-version of an xdr definition
*/ */
void void
print_datadef(definition *def) print_datadef (definition *def)
{ {
if (def->def_kind == DEF_PROGRAM ) /* handle data only */ if (def->def_kind == DEF_PROGRAM) /* handle data only */
return; return;
if (def->def_kind != DEF_CONST) { if (def->def_kind != DEF_CONST)
f_print(fout, "\n"); {
} f_print (fout, "\n");
switch (def->def_kind) { }
case DEF_STRUCT: switch (def->def_kind)
pstructdef(def); {
break; case DEF_STRUCT:
case DEF_UNION: pstructdef (def);
puniondef(def); break;
break; case DEF_UNION:
case DEF_ENUM: puniondef (def);
penumdef(def); break;
break; case DEF_ENUM:
case DEF_TYPEDEF: penumdef (def);
ptypedef(def); break;
break; case DEF_TYPEDEF:
case DEF_PROGRAM: ptypedef (def);
pprogramdef(def); break;
break; case DEF_PROGRAM:
case DEF_CONST: pprogramdef (def);
pconstdef(def); break;
break; case DEF_CONST:
} pconstdef (def);
if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) { break;
pxdrfuncdecl( def->def_name, }
def->def_kind != DEF_TYPEDEF || if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST)
!isvectordef(def->def.ty.old_type, def->def.ty.rel)); {
storexdrfuncdecl(def->def_name,
} def->def_kind != DEF_TYPEDEF ||
!isvectordef(def->def.ty.old_type,
def->def.ty.rel));
}
} }
void void
print_funcdef(definition *def) print_funcdef (definition *def)
{ {
switch (def->def_kind) { switch (def->def_kind)
case DEF_PROGRAM: {
f_print(fout, "\n"); case DEF_PROGRAM:
pprogramdef(def); f_print (fout, "\n");
break; pprogramdef (def);
default: break;
/* ?... shouldn't happen I guess */ default:
} /* ?... shouldn't happen I guess */
}
} }
void void
pxdrfuncdecl(const char *name, int pointerp) print_xdr_func_def (char *name, int pointerp, int i)
{ {
if (i == 2)
f_print(fout,"#ifdef __cplusplus \n"); {
f_print(fout, "extern \"C\" bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : ""); f_print (fout, "extern bool_t xdr_%s ();\n", name);
f_print(fout,"#elif __STDC__ \n"); return;
f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : ""); }
f_print(fout,"#else /* Old Style C */ \n"); else
f_print(fout, "bool_t xdr_%s();\n", name); f_print(fout, "extern bool_t xdr_%s (XDR *, %s%s);\n", name,
f_print(fout,"#endif /* Old Style C */ \n\n"); name, pointerp ? "*" : "");
} }
static void static void
pconstdef(definition *def) pconstdef (definition *def)
{ {
pdefine(def->def_name, def->def.co); pdefine (def->def_name, def->def.co);
} }
/* print out the definitions for the arguments of functions in the /* print out the definitions for the arguments of functions in the
header file header file
*/ */
static void static void
pargdef(definition *def) pargdef (definition * def)
{ {
decl_list *l; decl_list *l;
version_list *vers; version_list *vers;
const char *name; const char *name;
proc_list *plist; proc_list *plist;
for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) { {
for(plist = vers->procs; plist != NULL; for (plist = vers->procs; plist != NULL;
plist = plist->next) { plist = plist->next)
{
if (!newstyle || plist->arg_num < 2) {
continue; /* old style or single args */
}
name = plist->args.argname;
f_print(fout, "struct %s {\n", name);
for (l = plist->args.decls;
l != NULL; l = l->next) {
pdeclaration(name, &l->decl, 1, ";\n" );
}
f_print(fout, "};\n");
f_print(fout, "typedef struct %s %s;\n", name, name);
pxdrfuncdecl(name, 0);
f_print( fout, "\n" );
}
}
} if (!newstyle || plist->arg_num < 2)
{
continue; /* old style or single args */
static void }
pstructdef(definition *def) name = plist->args.argname;
{ f_print (fout, "struct %s {\n", name);
decl_list *l; for (l = plist->args.decls;
const char *name = def->def_name; l != NULL; l = l->next)
{
f_print(fout, "struct %s {\n", name); pdeclaration (name, &l->decl, 1, ";\n");
for (l = def->def.st.decls; l != NULL; l = l->next) { }
pdeclaration(name, &l->decl, 1, ";\n"); f_print (fout, "};\n");
f_print (fout, "typedef struct %s %s;\n", name, name);
storexdrfuncdecl (name, 0);
f_print (fout, "\n");
} }
f_print(fout, "};\n"); }
f_print(fout, "typedef struct %s %s;\n", name, name);
} }
static void static void
puniondef(definition *def) pstructdef (definition *def)
{ {
case_list *l; decl_list *l;
const char *name = def->def_name; const char *name = def->def_name;
declaration *decl;
f_print(fout, "struct %s {\n", name); f_print (fout, "struct %s {\n", name);
decl = &def->def.un.enum_decl; for (l = def->def.st.decls; l != NULL; l = l->next)
if (streq(decl->type, "bool")) { {
f_print(fout, "\tbool_t %s;\n", decl->name); pdeclaration (name, &l->decl, 1, ";\n");
} else { }
f_print(fout, "\t%s %s;\n", decl->type, decl->name); f_print (fout, "};\n");
} f_print (fout, "typedef struct %s %s;\n", name, name);
f_print(fout, "\tunion {\n");
for (l = def->def.un.cases; l != NULL; l = l->next) {
if(l->contflag == 0)
pdeclaration(name, &l->case_decl, 2, ";\n" );
}
decl = def->def.un.default_decl;
if (decl && !streq(decl->type, "void")) {
pdeclaration(name, decl, 2, ";\n" );
}
f_print(fout, "\t} %s_u;\n", name);
f_print(fout, "};\n");
f_print(fout, "typedef struct %s %s;\n", name, name);
} }
static void static void
pdefine(const char *name, const char *num) puniondef (definition *def)
{ {
f_print(fout, "#define %s %s\n", name, num); case_list *l;
const char *name = def->def_name;
declaration *decl;
f_print (fout, "struct %s {\n", name);
decl = &def->def.un.enum_decl;
if (streq (decl->type, "bool"))
{
f_print (fout, "\tbool_t %s;\n", decl->name);
}
else
{
f_print (fout, "\t%s %s;\n", decl->type, decl->name);
}
f_print (fout, "\tunion {\n");
for (l = def->def.un.cases; l != NULL; l = l->next)
{
if (l->contflag == 0)
pdeclaration (name, &l->case_decl, 2, ";\n");
}
decl = def->def.un.default_decl;
if (decl && !streq (decl->type, "void"))
{
pdeclaration (name, decl, 2, ";\n");
}
f_print (fout, "\t} %s_u;\n", name);
f_print (fout, "};\n");
f_print (fout, "typedef struct %s %s;\n", name, name);
} }
static void static void
puldefine(const char *name, const char *num) pdefine (const char *name, const char *num)
{ {
f_print(fout, "#define %s ((u_long)%s)\n", name, num); f_print (fout, "#define %s %s\n", name, num);
}
static void
puldefine (const char *name, const char *num)
{
f_print (fout, "#define %s ((u_long)%s)\n", name, num);
} }
static int static int
define_printed(proc_list *stop, version_list *start) define_printed (proc_list *stop, version_list *start)
{ {
version_list *vers; version_list *vers;
proc_list *proc; proc_list *proc;
for (vers = start; vers != NULL; vers = vers->next) { for (vers = start; vers != NULL; vers = vers->next)
for (proc = vers->procs; proc != NULL; proc = proc->next) { {
if (proc == stop) { for (proc = vers->procs; proc != NULL; proc = proc->next)
return (0); {
} else if (streq(proc->proc_name, stop->proc_name)) { if (proc == stop)
return (1); {
} return 0;
} }
else if (streq (proc->proc_name, stop->proc_name))
{
return 1;
}
} }
abort(); }
/* NOTREACHED */ abort ();
/* NOTREACHED */
} }
static void static void
pprogramdef(definition *def) pfreeprocdef (const char *name, const char *vers, int mode)
{ {
version_list *vers; f_print (fout, "extern int ");
proc_list *proc; pvname (name, vers);
int i; if (mode == 1)
const char *ext; f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, caddr_t);\n");
else
pargdef(def); f_print (fout,"_freeresult ();\n");
}
puldefine(def->def_name, def->def.pr.prog_num); static void
for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) { pprogramdef (definition *def)
if (tblflag) { {
f_print(fout, "extern struct rpcgen_table %s_%s_table[];\n", version_list *vers;
locase(def->def_name), vers->vers_num); proc_list *proc;
f_print(fout, "extern %s_%s_nproc;\n", int i;
locase(def->def_name), vers->vers_num); const char *ext;
}
puldefine(vers->vers_name, vers->vers_num);
/* pargdef (def);
* Print out 3 definitions, one for ANSI-C, another for C++,
* a third for old style C
*/
for (i=0;i<3;i++) {
if (i==0) {
f_print(fout,"\n#ifdef __cplusplus\n");
ext="extern \"C\" ";
}
else if (i==1) {
f_print(fout,"\n#elif __STDC__\n");
ext="extern " ;
}
else {
f_print(fout,"\n#else /* Old Style C */ \n");
ext="extern ";
}
for (proc = vers->procs; proc != NULL; proc = proc->next) {
if (!define_printed(proc, def->def.pr.versions)) {
puldefine(proc->proc_name, proc->proc_num);
}
f_print(fout,"%s",ext);
pprocdef(proc, vers, "CLIENT *", 0,i);
f_print(fout,"%s",ext);
pprocdef(proc, vers, "struct svc_req *", 1,i);
}
} puldefine (def->def_name, def->def.pr.prog_num);
f_print(fout,"#endif /* Old Style C */ \n"); for (vers = def->def.pr.versions; vers != NULL; vers = vers->next)
{
if (tblflag)
{
f_print (fout, "extern struct rpcgen_table %s_%s_table[];\n",
locase (def->def_name), vers->vers_num);
f_print (fout, "extern %s_%s_nproc;\n",
locase (def->def_name), vers->vers_num);
} }
puldefine (vers->vers_name, vers->vers_num);
/*
* Print out 2 definitions, one for ANSI-C, another for
* old K & R C
*/
if(!Cflag)
{
ext = "extern ";
for (proc = vers->procs; proc != NULL;
proc = proc->next)
{
if (!define_printed(proc, def->def.pr.versions))
{
puldefine (proc->proc_name, proc->proc_num);
}
f_print (fout, "%s", ext);
pprocdef (proc, vers, NULL, 0, 2);
if (mtflag)
{
f_print(fout, "%s", ext);
pprocdef (proc, vers, NULL, 1, 2);
}
}
pfreeprocdef (def->def_name, vers->vers_num, 2);
}
else
{
for (i = 1; i < 3; i++)
{
if (i == 1)
{
f_print (fout, "\n#if defined(__STDC__) || defined(__cplusplus)\n");
ext = "extern ";
}
else
{
f_print (fout, "\n#else /* K&R C */\n");
ext = "extern ";
}
for (proc = vers->procs; proc != NULL; proc = proc->next)
{
if (!define_printed(proc, def->def.pr.versions))
{
puldefine(proc->proc_name, proc->proc_num);
}
f_print (fout, "%s", ext);
pprocdef (proc, vers, "CLIENT *", 0, i);
f_print (fout, "%s", ext);
pprocdef (proc, vers, "struct svc_req *", 1, i);
}
pfreeprocdef (def->def_name, vers->vers_num, i);
}
f_print (fout, "#endif /* K&R C */\n");
}
}
} }
void void
pprocdef(proc_list *proc, version_list *vp, pprocdef (proc_list * proc, version_list * vp,
const char *addargtype, int server_p, int mode) const char *addargtype, int server_p, int mode)
{ {
if (mtflag)
{/* Print MT style stubs */
if (server_p)
f_print (fout, "bool_t ");
else
f_print (fout, "enum clnt_stat ");
}
else
{
ptype (proc->res_prefix, proc->res_type, 1);
f_print (fout, "* ");
}
if (server_p)
pvname_svc (proc->proc_name, vp->vers_num);
else
pvname (proc->proc_name, vp->vers_num);
/*
* mode 1 = ANSI-C, mode 2 = K&R C
*/
ptype( proc->res_prefix, proc->res_type, 1 ); if (mode == 1)
f_print( fout, "* " ); parglist (proc, addargtype);
if( server_p ) else
pvname_svc(proc->proc_name, vp->vers_num); f_print (fout, "();\n");
else
pvname(proc->proc_name, vp->vers_num);
/*
* mode 0 == cplusplus, mode 1 = ANSI-C, mode 2 = old style C
*/
if(mode == 0 || mode ==1)
parglist(proc, addargtype);
else
f_print(fout, "();\n");
} }
/* print out argument list of procedure */ /* print out argument list of procedure */
static void static void
parglist(proc_list *proc, const char *addargtype) parglist (proc_list *proc, const char *addargtype)
{ {
decl_list *dl; decl_list *dl;
f_print(fout,"("); f_print(fout,"(");
if (proc->arg_num < 2 && newstyle &&
streq (proc->args.decls->decl.type, "void"))
{
/* 0 argument in new style: do nothing */
}
else
{
for (dl = proc->args.decls; dl != NULL; dl = dl->next)
{
ptype (dl->decl.prefix, dl->decl.type, 1);
if (!newstyle)
f_print (fout, "*"); /* old style passes by reference */
if( proc->arg_num < 2 && newstyle && f_print (fout, ", ");
streq( proc->args.decls->decl.type, "void")) { }
/* 0 argument in new style: do nothing */ }
} else { if (mtflag)
for (dl = proc->args.decls; dl != NULL; dl = dl->next) { {
ptype( dl->decl.prefix, dl->decl.type, 1 ); ptype(proc->res_prefix, proc->res_type, 1);
if( !newstyle ) f_print(fout, "*, ");
f_print( fout, "*" ); /* old style passes by reference */ }
f_print( fout, ", " );
}
}
f_print(fout, "%s);\n", addargtype);
f_print (fout, "%s);\n", addargtype);
} }
static void static void
penumdef(definition *def) penumdef (definition *def)
{ {
const char *name = def->def_name; const char *name = def->def_name;
enumval_list *l; enumval_list *l;
const char *last = NULL; const char *last = NULL;
int count = 0; int count = 0;
f_print(fout, "enum %s {\n", name); f_print (fout, "enum %s {\n", name);
for (l = def->def.en.vals; l != NULL; l = l->next) { for (l = def->def.en.vals; l != NULL; l = l->next)
f_print(fout, "\t%s", l->name); {
if (l->assignment) { f_print (fout, "\t%s", l->name);
f_print(fout, " = %s", l->assignment); if (l->assignment)
last = l->assignment; {
count = 1; f_print (fout, " = %s", l->assignment);
} else { last = l->assignment;
if (last == NULL) { count = 1;
f_print(fout, " = %d", count++);
} else {
f_print(fout, " = %s + %d", last, count++);
}
}
f_print(fout, ",\n");
} }
f_print(fout, "};\n"); else
f_print(fout, "typedef enum %s %s;\n", name, name); {
if (last == NULL)
{
f_print (fout, " = %d", count++);
}
else
{
f_print (fout, " = %s + %d", last, count++);
}
}
f_print (fout, ",\n");
}
f_print (fout, "};\n");
f_print (fout, "typedef enum %s %s;\n", name, name);
} }
static void static void
ptypedef(definition *def) ptypedef (definition *def)
{ {
const char *name = def->def_name; const char *name = def->def_name;
const char *old = def->def.ty.old_type; const char *old = def->def.ty.old_type;
char prefix[8]; /* enough to contain "struct ", including NUL */ char prefix[8]; /* enough to contain "struct ", including NUL */
relation rel = def->def.ty.rel; relation rel = def->def.ty.rel;
if (!streq (name, old))
if (!streq(name, old)) { {
if (streq(old, "string")) { if (streq (old, "string"))
old = "char"; {
rel = REL_POINTER; old = "char";
} else if (streq(old, "opaque")) { rel = REL_POINTER;
old = "char";
} else if (streq(old, "bool")) {
old = "bool_t";
}
if (undefined2(old, name) && def->def.ty.old_prefix) {
s_print(prefix, "%s ", def->def.ty.old_prefix);
} else {
prefix[0] = 0;
}
f_print(fout, "typedef ");
switch (rel) {
case REL_ARRAY:
f_print(fout, "struct {\n");
f_print(fout, "\tu_int %s_len;\n", name);
f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);
f_print(fout, "} %s", name);
break;
case REL_POINTER:
f_print(fout, "%s%s *%s", prefix, old, name);
break;
case REL_VECTOR:
f_print(fout, "%s%s %s[%s]", prefix, old, name,
def->def.ty.array_max);
break;
case REL_ALIAS:
f_print(fout, "%s%s %s", prefix, old, name);
break;
}
f_print(fout, ";\n");
} }
else if (streq (old, "opaque"))
{
old = "char";
}
else if (streq (old, "bool"))
{
old = "bool_t";
}
if (undefined2 (old, name) && def->def.ty.old_prefix)
{
s_print (prefix, "%s ", def->def.ty.old_prefix);
}
else
{
prefix[0] = 0;
}
f_print (fout, "typedef ");
switch (rel)
{
case REL_ARRAY:
f_print (fout, "struct {\n");
f_print (fout, "\tu_int %s_len;\n", name);
f_print (fout, "\t%s%s *%s_val;\n", prefix, old, name);
f_print (fout, "} %s", name);
break;
case REL_POINTER:
f_print (fout, "%s%s *%s", prefix, old, name);
break;
case REL_VECTOR:
f_print (fout, "%s%s %s[%s]", prefix, old, name,
def->def.ty.array_max);
break;
case REL_ALIAS:
f_print (fout, "%s%s %s", prefix, old, name);
break;
}
f_print (fout, ";\n");
}
} }
void void
pdeclaration(const char *name, declaration *dec, int tab, pdeclaration (const char *name, declaration * dec, int tab,
const char *separator) const char *separator)
{ {
char buf[8]; /* enough to hold "struct ", include NUL */ char buf[8]; /* enough to hold "struct ", include NUL */
const char *prefix; const char *prefix;
const char *type; const char *type;
if (streq(dec->type, "void")) { if (streq (dec->type, "void"))
return; {
return;
}
tabify (fout, tab);
if (streq (dec->type, name) && !dec->prefix)
{
f_print (fout, "struct ");
}
if (streq (dec->type, "string"))
{
f_print (fout, "char *%s", dec->name);
}
else
{
prefix = "";
if (streq (dec->type, "bool"))
{
type = "bool_t";
} }
tabify(fout, tab); else if (streq (dec->type, "opaque"))
if (streq(dec->type, name) && !dec->prefix) { {
f_print(fout, "struct "); type = "char";
} }
if (streq(dec->type, "string")) { else
f_print(fout, "char *%s", dec->name); {
} else { if (dec->prefix)
prefix = ""; {
if (streq(dec->type, "bool")) { s_print (buf, "%s ", dec->prefix);
type = "bool_t"; prefix = buf;
} else if (streq(dec->type, "opaque")) { }
type = "char"; type = dec->type;
} else {
if (dec->prefix) {
s_print(buf, "%s ", dec->prefix);
prefix = buf;
}
type = dec->type;
}
switch (dec->rel) {
case REL_ALIAS:
f_print(fout, "%s%s %s", prefix, type, dec->name);
break;
case REL_VECTOR:
f_print(fout, "%s%s %s[%s]", prefix, type, dec->name,
dec->array_max);
break;
case REL_POINTER:
f_print(fout, "%s%s *%s", prefix, type, dec->name);
break;
case REL_ARRAY:
f_print(fout, "struct {\n");
tabify(fout, tab);
f_print(fout, "\tu_int %s_len;\n", dec->name);
tabify(fout, tab);
f_print(fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
tabify(fout, tab);
f_print(fout, "} %s", dec->name);
break;
}
} }
f_print(fout, separator ); switch (dec->rel)
{
case REL_ALIAS:
f_print (fout, "%s%s %s", prefix, type, dec->name);
break;
case REL_VECTOR:
f_print (fout, "%s%s %s[%s]", prefix, type, dec->name,
dec->array_max);
break;
case REL_POINTER:
f_print (fout, "%s%s *%s", prefix, type, dec->name);
break;
case REL_ARRAY:
f_print (fout, "struct {\n");
tabify (fout, tab);
f_print (fout, "\tu_int %s_len;\n", dec->name);
tabify (fout, tab);
f_print (fout, "\t%s%s *%s_val;\n", prefix, type, dec->name);
tabify (fout, tab);
f_print (fout, "} %s", dec->name);
break;
}
}
f_print (fout, separator);
} }
static int static int
undefined2(const char *type, const char *stop) undefined2 (const char *type, const char *stop)
{ {
list *l; list *l;
definition *def; definition *def;
for (l = defined; l != NULL; l = l->next) { for (l = defined; l != NULL; l = l->next)
def = (definition *) l->val; {
if (def->def_kind != DEF_PROGRAM) { def = (definition *) l->val;
if (streq(def->def_name, stop)) { if (def->def_kind != DEF_PROGRAM)
return (1); {
} else if (streq(def->def_name, type)) { if (streq (def->def_name, stop))
return (0); {
} return 1;
} }
else if (streq (def->def_name, type))
{
return 0;
}
} }
return (1); }
return 1;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -69,14 +69,14 @@ write_sample_clnt (definition * def)
int count = 0; int count = 0;
if (def->def_kind != DEF_PROGRAM) if (def->def_kind != DEF_PROGRAM)
return (0); return 0;
/* generate sample code for each version */ /* generate sample code for each version */
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{ {
write_sample_client (def->def_name, vp); write_sample_client (def->def_name, vp);
++count; ++count;
} }
return (count); return count;
} }
@ -90,7 +90,7 @@ write_sample_client (const char *program_name, version_list * vp)
f_print (fout, "\n\nvoid\n"); f_print (fout, "\n\nvoid\n");
pvname (program_name, vp->vers_num); pvname (program_name, vp->vers_num);
if (Cflag) if (Cflag)
f_print (fout, "( char* host )\n{\n"); f_print (fout, "(char *host)\n{\n");
else else
f_print (fout, "(host)\nchar *host;\n{\n"); f_print (fout, "(host)\nchar *host;\n{\n");
f_print (fout, "\tCLIENT *clnt;\n"); f_print (fout, "\tCLIENT *clnt;\n");
@ -99,17 +99,33 @@ write_sample_client (const char *program_name, version_list * vp)
for (proc = vp->procs; proc != NULL; proc = proc->next) for (proc = vp->procs; proc != NULL; proc = proc->next)
{ {
f_print (fout, "\t"); f_print (fout, "\t");
ptype (proc->res_prefix, proc->res_type, 1); ++i;
f_print (fout, " *result_%d;\n", ++i); if (mtflag)
{
f_print (fout, "enum clnt_stat retval_%d;\n\t", i);
ptype (proc->res_prefix, proc->res_type, 1);
if (!streq (proc->res_type, "void"))
f_print (fout, "result_%d;\n", i);
else
fprintf (fout, "*result_%d;\n", i);
}
else
{
ptype (proc->res_prefix, proc->res_type, 1);
f_print (fout, " *result_%d;\n", i);
}
/* print out declarations for arguments */ /* print out declarations for arguments */
if (proc->arg_num < 2 && !newstyle) if (proc->arg_num < 2 && !newstyle)
{ {
f_print (fout, "\t"); f_print (fout, "\t");
if (!streq (proc->args.decls->decl.type, "void")) if (!streq (proc->args.decls->decl.type, "void"))
ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1); {
ptype (proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 1);
f_print (fout, " ");
}
else else
f_print (fout, "char* "); /* cannot have "void" type */ f_print (fout, "char *"); /* cannot have "void" type */
f_print (fout, " ");
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_arg;\n"); f_print (fout, "_arg;\n");
} }
@ -119,39 +135,50 @@ write_sample_client (const char *program_name, version_list * vp)
{ {
f_print (fout, "\t"); f_print (fout, "\t");
ptype (l->decl.prefix, l->decl.type, 1); ptype (l->decl.prefix, l->decl.type, 1);
f_print (fout, " "); if (strcmp (l->decl.type, "string") == 1)
f_print (fout, " ");
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_%s;\n", l->decl.name); f_print (fout, "_%s;\n", l->decl.name);
/* pdeclaration(proc->args.argname, &l->decl, 1, ";\n" ); */
} }
} }
} }
/* generate creation of client handle */ /* generate creation of client handle */
f_print (fout, "\tclnt = clnt_create(host, %s, %s, \"%s\");\n", f_print(fout, "\n#ifndef\tDEBUG\n");
f_print (fout, "\tclnt = clnt_create (host, %s, %s, \"%s\");\n",
program_name, vp->vers_name, tirpcflag ? "netpath" : "udp"); program_name, vp->vers_name, tirpcflag ? "netpath" : "udp");
f_print (fout, "\tif (clnt == NULL) {\n"); f_print (fout, "\tif (clnt == NULL) {\n");
f_print (fout, "\t\tclnt_pcreateerror(host);\n"); f_print (fout, "\t\tclnt_pcreateerror (host);\n");
f_print (fout, "\t\texit(1);\n\t}\n"); f_print (fout, "\t\texit (1);\n\t}\n");
f_print(fout, "#endif\t/* DEBUG */\n\n");
/* generate calls to procedures */ /* generate calls to procedures */
i = 0; i = 0;
for (proc = vp->procs; proc != NULL; proc = proc->next) for (proc = vp->procs; proc != NULL; proc = proc->next)
{ {
f_print (fout, "\tresult_%d = ", ++i); if (mtflag)
f_print(fout, "\tretval_%d = ",++i);
else
f_print (fout, "\tresult_%d = ", ++i);
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
if (proc->arg_num < 2 && !newstyle) if (proc->arg_num < 2 && !newstyle)
{ {
f_print (fout, "("); f_print (fout, "(");
if (streq (proc->args.decls->decl.type, "void")) /* cast to void* */ if (streq (proc->args.decls->decl.type, "void"))/* cast to void* */
f_print (fout, "(void*)"); f_print (fout, "(void*)");
f_print (fout, "&"); f_print (fout, "&");
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_arg, clnt);\n"); if (mtflag)
f_print(fout, "_arg, &result_%d, clnt);\n", i);
else
f_print (fout, "_arg, clnt);\n");
} }
else if (streq (proc->args.decls->decl.type, "void")) else if (streq (proc->args.decls->decl.type, "void"))
{ {
f_print (fout, "(clnt);\n"); if (mtflag)
f_print (fout, "(&result_%d, clnt);\n", i);
else
f_print (fout, "(clnt);\n");
} }
else else
{ {
@ -161,14 +188,27 @@ write_sample_client (const char *program_name, version_list * vp)
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_%s, ", l->decl.name); f_print (fout, "_%s, ", l->decl.name);
} }
if (mtflag)
f_print(fout, "&result_%d, ", i);
f_print (fout, "clnt);\n"); f_print (fout, "clnt);\n");
} }
f_print (fout, "\tif (result_%d == NULL) {\n", i); if (mtflag)
f_print (fout, "\t\tclnt_perror(clnt, \"call failed:\");\n"); {
f_print (fout, "\t}\n"); f_print(fout, "\tif (retval_%d != RPC_SUCCESS) {\n", i);
}
else
{
f_print(fout, "\tif (result_%d == (", i);
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*) NULL) {\n");
}
f_print(fout, "\t\tclnt_perror (clnt, \"call failed\");\n");
f_print(fout, "\t}\n");
} }
f_print (fout, "\tclnt_destroy( clnt );\n"); f_print (fout, "#ifndef\tDEBUG\n");
f_print (fout, "\tclnt_destroy (clnt);\n");
f_print (fout, "#endif\t /* DEBUG */\n");
f_print (fout, "}\n"); f_print (fout, "}\n");
} }
@ -183,34 +223,62 @@ write_sample_server (definition * def)
for (proc = vp->procs; proc != NULL; proc = proc->next) for (proc = vp->procs; proc != NULL; proc = proc->next)
{ {
f_print (fout, "\n"); f_print (fout, "\n");
/* if( Cflag ) if (!mtflag)
f_print( fout, "extern \"C\"{\n"); {
*/ return_type (proc);
return_type (proc); f_print (fout, "*\n");
f_print (fout, "* \n"); }
if (Cflag) else
f_print (fout, "bool_t\n");
if (Cflag || mtflag)
pvname_svc (proc->proc_name, vp->vers_num); pvname_svc (proc->proc_name, vp->vers_num);
else else
pvname (proc->proc_name, vp->vers_num); pvname(proc->proc_name, vp->vers_num);
printarglist (proc, RQSTP, "struct svc_req *"); printarglist(proc, "result", RQSTP, "struct svc_req *");
f_print(fout, "{\n");
f_print (fout, "{\n"); if (!mtflag)
f_print (fout, "\n\tstatic "); {
if (!streq (proc->res_type, "void")) f_print(fout, "\tstatic ");
return_type (proc); if(!streq(proc->res_type, "void"))
return_type(proc);
else
f_print(fout, "char *");
/* cannot have void type */
/* f_print(fout, " result;\n", proc->res_type); */
f_print(fout, " result;\n");
}
else else
f_print (fout, "char*"); /* cannot have void type */ f_print(fout, "\tbool_t retval;\n");
f_print (fout, " result;\n" /*, proc->res_type *//*? */ ); fprintf (fout, "\n\t/*\n\t * insert server code here\n\t */\n\n");
f_print (fout,
"\n\t/*\n\t * insert server code here\n\t */\n\n");
if (!streq (proc->res_type, "void"))
f_print (fout, "\treturn(&result);\n}\n");
else /* cast back to void * */
f_print (fout, "\treturn((void*) &result);\n}\n");
/* if( Cflag)
f_print( fout, "};\n");
*/
if (!mtflag)
if(!streq(proc->res_type, "void"))
f_print(fout, "\treturn &result;\n}\n");
else /* cast back to void * */
f_print(fout, "\treturn (void *) &result;\n}\n");
else
f_print(fout, "\treturn retval;\n}\n");
}
/* put in sample freeing routine */
if (mtflag)
{
f_print(fout, "\nint\n");
pvname(def->def_name, vp->vers_num);
if (Cflag)
f_print(fout,"_freeresult (SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)\n");
else
{
f_print(fout,"_freeresult (transp, xdr_result, result)\n");
f_print(fout,"\tSVCXPRT *transp;\n");
f_print(fout,"\txdrproc_t xdr_result;\n");
f_print(fout,"\tcaddr_t result;\n");
}
f_print(fout, "{\n");
f_print(fout, "\txdr_free (xdr_result, result);\n");
f_print(fout,
"\n\t/*\n\t * Insert additional freeing code here, if needed\n\t */\n");
f_print(fout, "\n\treturn 0;\n}\n");
} }
} }
} }
@ -242,14 +310,14 @@ write_sample_clnt_main (void)
f_print (fout, "\n\n"); f_print (fout, "\n\n");
if (Cflag) if (Cflag)
f_print (fout, "main( int argc, char* argv[] )\n{\n"); f_print (fout, "int\nmain (int argc, char *argv[])\n{\n");
else else
f_print (fout, "main(argc, argv)\nint argc;\nchar *argv[];\n{\n"); f_print (fout, "int\nmain (argc, argv)\nint argc;\nchar *argv[];\n{\n");
f_print (fout, "\tchar *host;"); f_print (fout, "\tchar *host;");
f_print (fout, "\n\n\tif(argc < 2) {"); f_print (fout, "\n\n\tif (argc < 2) {");
f_print (fout, "\n\t\tprintf(\"usage: %%s server_host\\n\", argv[0]);\n"); f_print (fout, "\n\t\tprintf (\"usage: %%s server_host\\n\", argv[0]);\n");
f_print (fout, "\t\texit(1);\n\t}"); f_print (fout, "\t\texit (1);\n\t}");
f_print (fout, "\n\thost = argv[1];\n"); f_print (fout, "\n\thost = argv[1];\n");
for (l = defined; l != NULL; l = l->next) for (l = defined; l != NULL; l = l->next)
@ -263,8 +331,8 @@ write_sample_clnt_main (void)
{ {
f_print (fout, "\t"); f_print (fout, "\t");
pvname (def->def_name, vp->vers_num); pvname (def->def_name, vp->vers_num);
f_print (fout, "( host );\n"); f_print (fout, " (host);\n");
} }
} }
f_print (fout, "}\n"); f_print (fout, "exit (0);\n}\n");
} }

View File

@ -70,9 +70,7 @@ scan (tok_kind expect, token * tokp)
{ {
get_token (tokp); get_token (tokp);
if (tokp->kind != expect) if (tokp->kind != expect)
{ expected1 (expect);
expected1 (expect);
}
} }
/* /*
@ -106,7 +104,7 @@ scan3 (tok_kind expect1, tok_kind expect2, tok_kind expect3, token * tokp)
* scan expecting a constant, possibly symbolic * scan expecting a constant, possibly symbolic
*/ */
void void
scan_num (token * tokp) scan_num (token *tokp)
{ {
get_token (tokp); get_token (tokp);
switch (tokp->kind) switch (tokp->kind)
@ -114,7 +112,7 @@ scan_num (token * tokp)
case TOK_IDENT: case TOK_IDENT:
break; break;
default: default:
error ("constant or identifier expected"); error (_("constant or identifier expected"));
} }
} }
@ -122,7 +120,7 @@ scan_num (token * tokp)
* Peek at the next token * Peek at the next token
*/ */
void void
peek (token * tokp) peek (token *tokp)
{ {
get_token (tokp); get_token (tokp);
unget_token (tokp); unget_token (tokp);
@ -132,22 +130,22 @@ peek (token * tokp)
* Peek at the next token and scan it if it matches what you expect * Peek at the next token and scan it if it matches what you expect
*/ */
int int
peekscan (tok_kind expect, token * tokp) peekscan (tok_kind expect, token *tokp)
{ {
peek (tokp); peek (tokp);
if (tokp->kind == expect) if (tokp->kind == expect)
{ {
get_token (tokp); get_token (tokp);
return (1); return 1;
} }
return (0); return 0;
} }
/* /*
* Get the next token, printing out any directive that are encountered. * Get the next token, printing out any directive that are encountered.
*/ */
void void
get_token (token * tokp) get_token (token *tokp)
{ {
int commenting; int commenting;

View File

@ -48,6 +48,7 @@ static const char TRANSP[] = "transp";
static const char ARG[] = "argument"; static const char ARG[] = "argument";
static const char RESULT[] = "result"; static const char RESULT[] = "result";
static const char ROUTINE[] = "local"; static const char ROUTINE[] = "local";
static char RETVAL[] = "retval";
char _errbuf[256]; /* For all messages */ char _errbuf[256]; /* For all messages */
@ -103,12 +104,31 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
#endif #endif
f_print (fout, "%s int _rpcpmstart;", var_type); f_print (fout, "%s int _rpcpmstart;", var_type);
f_print (fout, "\t\t/* Started by a port monitor ? */\n"); f_print (fout, "\t\t/* Started by a port monitor ? */\n");
f_print (fout, "%s int _rpcfdtype;", var_type); if (!tirpcflag)
f_print (fout, "\t\t/* Whether Stream or Datagram ? */\n"); {
f_print (fout, "%s int _rpcfdtype;", var_type);
f_print (fout, "\t\t/* Whether Stream or Datagram ? */\n");
}
if (timerflag) if (timerflag)
{ {
#if 0
f_print (fout, "%s int _rpcsvcdirty;", var_type); f_print (fout, "%s int _rpcsvcdirty;", var_type);
f_print (fout, "\t/* Still serving ? */\n"); f_print (fout, "\t/* Still serving ? */\n");
#else
f_print(fout, " /* States a server can be in wrt request */\n\n");
f_print(fout, "#define\t_IDLE 0\n");
f_print(fout, "#define\t_SERVED 1\n");
f_print(fout, "#define\t_SERVING 2\n\n");
f_print(fout, "static int _rpcsvcstate = _IDLE;");
f_print(fout, "\t /* Set when a request is serviced */\n");
if (mtflag)
{
f_print (fout, "mutex_t _svcstate_lock;");
f_print (fout,
"\t\t\t/* Mutex lock for variable_rpcsvcstate */\n");
}
#endif
} }
write_svc_aux (nomain); write_svc_aux (nomain);
} }
@ -120,10 +140,10 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
#ifdef __GNU_LIBRARY__ #ifdef __GNU_LIBRARY__
if (Cflag) if (Cflag)
f_print (fout, "\nint\nmain(int argc, char **argv)\n"); f_print (fout, "\nint\nmain (int argc, char **argv)\n");
else else
{ {
f_print (fout, "\nint\nmain(argc, argv)\n"); f_print (fout, "\nint\nmain (argc, argv)\n");
f_print (fout, "\tint argc;\n"); f_print (fout, "\tint argc;\n");
f_print (fout, "\tchar **argv;\n"); f_print (fout, "\tchar **argv;\n");
} }
@ -147,7 +167,12 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
f_print (fout, "\tpid_t pid;\n"); f_print (fout, "\tpid_t pid;\n");
f_print (fout, "\tint i;\n"); f_print (fout, "\tint i;\n");
f_print (fout, "\tchar mname[FMNAMESZ + 1];\n\n"); f_print (fout, "\tchar mname[FMNAMESZ + 1];\n\n");
write_pm_most (infile, netflag);
if (mtflag & timerflag)
f_print (fout,
"\tmutex_init (&_svcstate_lock, USYNC_THREAD, NULL);\n");
write_pm_most (infile, netflag);
f_print (fout, "\telse {\n"); f_print (fout, "\telse {\n");
write_rpc_svc_fg (infile, "\t\t"); write_rpc_svc_fg (infile, "\t\t");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
@ -180,19 +205,19 @@ write_netid_register (const char *transp)
sp = ""; sp = "";
f_print (fout, "\n"); f_print (fout, "\n");
f_print (fout, "%s\tnconf = getnetconfigent(\"%s\");\n", sp, transp); f_print (fout, "%s\tnconf = getnetconfigent (\"%s\");\n", sp, transp);
f_print (fout, "%s\tif (nconf == NULL) {\n", sp); f_print (fout, "%s\tif (nconf == NULL) {\n", sp);
(void) sprintf (_errbuf, "cannot find %s netid.", transp); (void) sprintf (_errbuf, "cannot find %s netid.", transp);
sprintf (tmpbuf, "%s\t\t", sp); sprintf (tmpbuf, "%s\t\t", sp);
print_err_message (tmpbuf); print_err_message (tmpbuf);
f_print (fout, "%s\t\texit(1);\n", sp); f_print (fout, "%s\t\texit (1);\n", sp);
f_print (fout, "%s\t}\n", sp); f_print (fout, "%s\t}\n", sp);
f_print (fout, "%s\t%s = svc_tli_create(RPC_ANYFD, nconf, 0, 0, 0);\n", f_print (fout, "%s\t%s = svc_tli_create (RPC_ANYFD, nconf, 0, 0, 0);\n",
sp, TRANSP /*, transp *//* ?!?... */ ); sp, TRANSP /*, transp *//* ?!?... */ );
f_print (fout, "%s\tif (%s == NULL) {\n", sp, TRANSP); f_print (fout, "%s\tif (%s == NULL) {\n", sp, TRANSP);
(void) sprintf (_errbuf, "cannot create %s service.", transp); sprintf (_errbuf, "cannot create %s service.", transp);
print_err_message (tmpbuf); print_err_message (tmpbuf);
f_print (fout, "%s\t\texit(1);\n", sp); f_print (fout, "%s\t\texit (1);\n", sp);
f_print (fout, "%s\t}\n", sp); f_print (fout, "%s\t}\n", sp);
for (l = defined; l != NULL; l = l->next) for (l = defined; l != NULL; l = l->next)
@ -204,22 +229,20 @@ write_netid_register (const char *transp)
} }
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{ {
f_print (fout, f_print (fout, "%s\t(void) rpcb_unset (%s, %s, nconf);\n",
"%s\t(void) rpcb_unset(%s, %s, nconf);\n",
sp, def->def_name, vp->vers_name); sp, def->def_name, vp->vers_name);
f_print (fout, f_print (fout, "%s\tif (!svc_reg (%s, %s, %s, ",
"%s\tif (!svc_reg(%s, %s, %s, ",
sp, TRANSP, def->def_name, vp->vers_name); sp, TRANSP, def->def_name, vp->vers_name);
pvname (def->def_name, vp->vers_num); pvname (def->def_name, vp->vers_num);
f_print (fout, ", nconf)) {\n"); f_print (fout, ", nconf)) {\n");
(void) sprintf (_errbuf, "unable to register (%s, %s, %s).", (void) sprintf (_errbuf, "unable to register (%s, %s, %s).",
def->def_name, vp->vers_name, transp); def->def_name, vp->vers_name, transp);
print_err_message (tmpbuf); print_err_message (tmpbuf);
f_print (fout, "%s\t\texit(1);\n", sp); f_print (fout, "%s\t\texit (1);\n", sp);
f_print (fout, "%s\t}\n", sp); f_print (fout, "%s\t}\n", sp);
} }
} }
f_print (fout, "%s\tfreenetconfigent(nconf);\n", sp); f_print (fout, "%s\tfreenetconfigent (nconf);\n", sp);
} }
/* /*
@ -241,7 +264,7 @@ write_nettype_register (const char *transp)
} }
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{ {
f_print (fout, "\tif (!svc_create("); f_print (fout, "\tif (!svc_create (");
pvname (def->def_name, vp->vers_num); pvname (def->def_name, vp->vers_num);
f_print (fout, ", %s, %s, \"%s\")) {\n ", f_print (fout, ", %s, %s, \"%s\")) {\n ",
def->def_name, vp->vers_name, transp); def->def_name, vp->vers_name, transp);
@ -249,7 +272,7 @@ write_nettype_register (const char *transp)
"unable to create (%s, %s) for %s.", "unable to create (%s, %s) for %s.",
def->def_name, vp->vers_name, transp); def->def_name, vp->vers_name, transp);
print_err_message ("\t\t"); print_err_message ("\t\t");
f_print (fout, "\t\texit(1);\n"); f_print (fout, "\t\texit (1);\n");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
} }
} }
@ -267,22 +290,22 @@ write_rest (void)
f_print (fout, "\tif (%s == (SVCXPRT *)NULL) {\n", TRANSP); f_print (fout, "\tif (%s == (SVCXPRT *)NULL) {\n", TRANSP);
(void) sprintf (_errbuf, "could not create a handle"); (void) sprintf (_errbuf, "could not create a handle");
print_err_message ("\t\t"); print_err_message ("\t\t");
f_print (fout, "\t\texit(1);\n"); f_print (fout, "\t\texit (1);\n");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
if (timerflag) if (timerflag)
{ {
f_print (fout, "\tif (_rpcpmstart) {\n"); f_print (fout, "\tif (_rpcpmstart) {\n");
f_print (fout, f_print (fout,
"\t\t(void) signal(SIGALRM, %s closedown);\n", "\t\t(void) signal (SIGALRM, %s closedown);\n",
Cflag ? "(SIG_PF)" : "(void(*)())"); Cflag ? "(SIG_PF)" : "(void(*)())");
f_print (fout, "\t\t(void) alarm(_RPCSVC_CLOSEDOWN);\n"); f_print (fout, "\t\t(void) alarm (_RPCSVC_CLOSEDOWN);\n");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
} }
} }
f_print (fout, "\tsvc_run();\n"); f_print (fout, "\tsvc_run ();\n");
(void) sprintf (_errbuf, "svc_run returned"); (void) sprintf (_errbuf, "svc_run returned");
print_err_message ("\t"); print_err_message ("\t");
f_print (fout, "\texit(1);\n"); f_print (fout, "\texit (1);\n");
f_print (fout, "\t/* NOTREACHED */\n"); f_print (fout, "\t/* NOTREACHED */\n");
f_print (fout, "}\n"); f_print (fout, "}\n");
} }
@ -312,8 +335,6 @@ write_programs (const char *storage)
write_program (def, storage); write_program (def, storage);
} }
} }
} }
/* write out definition of internal function (e.g. _printmsg_1(...)) /* write out definition of internal function (e.g. _printmsg_1(...))
@ -333,25 +354,37 @@ write_real_program (const definition * def)
{ {
for (proc = vp->procs; proc != NULL; proc = proc->next) for (proc = vp->procs; proc != NULL; proc = proc->next)
{ {
f_print (fout, "\n"); fprintf (fout, "\n");
internal_proctype (proc); if (!mtflag)
internal_proctype (proc);
else
f_print (fout, "int");
f_print (fout, "\n_"); f_print (fout, "\n_");
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
if (Cflag) if (Cflag)
{ {
f_print (fout, "("); f_print (fout, " (");
/* arg name */ /* arg name */
if (proc->arg_num > 1) if (proc->arg_num > 1)
f_print (fout, proc->args.argname); f_print (fout, proc->args.argname);
else else
ptype (proc->args.decls->decl.prefix, ptype (proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0); proc->args.decls->decl.type, 0);
f_print (fout, " *argp, struct svc_req *%s)\n", if (mtflag)
RQSTP); {
f_print(fout, " *argp, void *%s, struct svc_req *%s)\n",
RESULT, RQSTP);
}
else
f_print (fout, " *argp, struct svc_req *%s)\n",
RQSTP);
} }
else else
{ {
f_print (fout, "(argp, %s)\n", RQSTP); if (mtflag)
f_print(fout, " (argp, %s, %s)\n", RESULT, RQSTP);
else
f_print (fout, " (argp, %s)\n", RQSTP);
/* arg name */ /* arg name */
if (proc->arg_num > 1) if (proc->arg_num > 1)
f_print (fout, "\t%s *argp;\n", proc->args.argname); f_print (fout, "\t%s *argp;\n", proc->args.argname);
@ -366,8 +399,8 @@ write_real_program (const definition * def)
} }
f_print (fout, "{\n"); f_print (fout, "{\n");
f_print (fout, "\treturn("); f_print (fout, "\treturn (");
if (Cflag) if (Cflag || mtflag)
pvname_svc (proc->proc_name, vp->vers_num); pvname_svc (proc->proc_name, vp->vers_num);
else else
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
@ -451,33 +484,65 @@ write_program (const definition * def, const char *storage)
f_print (fout, "\t\tint fill;\n"); f_print (fout, "\t\tint fill;\n");
} }
f_print (fout, "\t} %s;\n", ARG); f_print (fout, "\t} %s;\n", ARG);
f_print (fout, "\tchar *%s;\n", RESULT); if (mtflag)
{
f_print(fout, "\tunion {\n");
for (proc = vp->procs; proc != NULL; proc = proc->next)
if (!streq (proc->res_type, "void"))
{
f_print(fout, "\t\t");
ptype(proc->res_prefix, proc->res_type, 0);
pvname(proc->proc_name, vp->vers_num);
f_print(fout, "_res;\n");
}
f_print(fout, "\t} %s;\n", RESULT);
f_print(fout, "\tbool_t %s;\n", RETVAL);
} else
f_print (fout, "\tchar *%s;\n", RESULT);
if (Cflag) if (Cflag)
{ {
f_print (fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT); f_print (fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
f_print (fout, if (mtflag)
"\tchar *(*%s)(char *, struct svc_req *);\n", f_print(fout,
ROUTINE); "\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
ROUTINE);
else
f_print (fout, "\tchar *(*%s)(char *, struct svc_req *);\n",
ROUTINE);
} }
else else
{ {
f_print (fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT); f_print (fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT);
f_print (fout, "\tchar *(*%s)();\n", ROUTINE); if (mtflag)
f_print(fout, "\tbool_t (*%s)();\n", ROUTINE);
else
f_print (fout, "\tchar *(*%s)();\n", ROUTINE);
} }
f_print (fout, "\n"); f_print (fout, "\n");
if (timerflag) if (timerflag)
#if 0
f_print (fout, "\t_rpcsvcdirty = 1;\n"); f_print (fout, "\t_rpcsvcdirty = 1;\n");
#else
{
if (mtflag)
f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
f_print(fout, "\t_rpcsvcstate = _SERVING;\n");
if (mtflag)
f_print(fout, "\tmutex_unlock(&_svcstate_lock);\n");
}
#endif
f_print (fout, "\tswitch (%s->rq_proc) {\n", RQSTP); f_print (fout, "\tswitch (%s->rq_proc) {\n", RQSTP);
if (!nullproc (vp->procs)) if (!nullproc (vp->procs))
{ {
f_print (fout, "\tcase NULLPROC:\n"); f_print (fout, "\tcase NULLPROC:\n");
f_print (fout, f_print (fout,
Cflag Cflag
? "\t\t(void) svc_sendreply(%s, (xdrproc_t) xdr_void, (char *)NULL);\n" ? "\t\t(void) svc_sendreply (%s, (xdrproc_t) xdr_void, (char *)NULL);\n"
: "\t\t(void) svc_sendreply(%s, xdr_void, (char *)NULL);\n", : "\t\t(void) svc_sendreply (%s, xdr_void, (char *)NULL);\n",
TRANSP); TRANSP);
print_return ("\t\t"); print_return ("\t\t");
f_print (fout, "\n"); f_print (fout, "\n");
@ -495,17 +560,27 @@ write_program (const definition * def, const char *storage)
} }
p_xdrfunc (RESULT, proc->res_type); p_xdrfunc (RESULT, proc->res_type);
if (Cflag) if (Cflag)
f_print (fout, {
"\t\t%s = (char *(*)(char *, struct svc_req *)) ", if (mtflag)
ROUTINE); f_print(fout,
"\t\t%s = (bool_t (*) (char *, void *, struct svc_req *))",
ROUTINE);
else
f_print (fout,
"\t\t%s = (char *(*)(char *, struct svc_req *)) ",
ROUTINE);
}
else else
f_print (fout, "\t\t%s = (char *(*)()) ", ROUTINE); if (mtflag)
f_print(fout, "\t\t%s = (bool_t (*)()) ", ROUTINE);
else
f_print (fout, "\t\t%s = (char *(*)()) ", ROUTINE);
if (newstyle) if (newstyle)
{ /* new style: calls internal routine */ { /* new style: calls internal routine */
f_print (fout, "_"); f_print (fout, "_");
} }
if (Cflag && !newstyle) if ((Cflag || mtflag) && !newstyle)
pvname_svc (proc->proc_name, vp->vers_num); pvname_svc (proc->proc_name, vp->vers_num);
else else
pvname (proc->proc_name, vp->vers_num); pvname (proc->proc_name, vp->vers_num);
@ -517,7 +592,7 @@ write_program (const definition * def, const char *storage)
print_return ("\t\t"); print_return ("\t\t");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
f_print (fout, "\t(void) memset((char *)&%s, 0, sizeof (%s));\n", ARG, ARG); f_print (fout, "\tmemset ((char *)&%s, 0, sizeof (%s));\n", ARG, ARG);
if (Cflag) if (Cflag)
printif ("getargs", TRANSP, "(caddr_t) &", ARG); printif ("getargs", TRANSP, "(caddr_t) &", ARG);
else else
@ -526,15 +601,29 @@ write_program (const definition * def, const char *storage)
print_return ("\t\t"); print_return ("\t\t");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
if (Cflag) if (!mtflag)
f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n", if (Cflag)
RESULT, ROUTINE, ARG, RQSTP); f_print (fout, "\t%s = (*%s)((char *)&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
else
f_print (fout, "\t%s = (*%s)(&%s, %s);\n",
RESULT, ROUTINE, ARG, RQSTP);
else else
f_print (fout, "\t%s = (*%s)(&%s, %s);\n", if (Cflag)
RESULT, ROUTINE, ARG, RQSTP); f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
f_print (fout, RETVAL, ROUTINE, ARG, RESULT, RQSTP);
"\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n", else
RESULT, TRANSP, RESULT, RESULT); f_print(fout, "\t%s = (bool_t) (*%s)(&%s, &%s, %s);\n",
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
if (mtflag)
f_print(fout,
"\tif (%s > 0 && !svc_sendreply(%s, xdr_%s, (char *)&%s)) {\n",
RETVAL, TRANSP, RESULT, RESULT);
else
f_print(fout,
"\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n",
RESULT, TRANSP, RESULT, RESULT);
printerr ("systemerr", TRANSP); printerr ("systemerr", TRANSP);
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
@ -542,10 +631,22 @@ write_program (const definition * def, const char *storage)
printif ("freeargs", TRANSP, "(caddr_t) &", ARG); printif ("freeargs", TRANSP, "(caddr_t) &", ARG);
else else
printif ("freeargs", TRANSP, "&", ARG); printif ("freeargs", TRANSP, "&", ARG);
(void) sprintf (_errbuf, "unable to free arguments");
sprintf (_errbuf, "unable to free arguments");
print_err_message ("\t\t"); print_err_message ("\t\t");
f_print (fout, "\t\texit(1);\n"); f_print (fout, "\t\texit (1);\n");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
/* print out free routine */
if (mtflag)
{
f_print(fout,"\tif (!");
pvname(def->def_name, vp->vers_num);
f_print(fout,"_freeresult (%s, xdr_%s, (caddr_t) &%s))\n",
TRANSP, RESULT, RESULT);
(void) sprintf(_errbuf, "unable to free results");
print_err_message("\t\t");
f_print(fout, "\n");
}
print_return ("\t"); print_return ("\t");
f_print (fout, "}\n"); f_print (fout, "}\n");
} }
@ -554,14 +655,14 @@ write_program (const definition * def, const char *storage)
static void static void
printerr (const char *err, const char *transp) printerr (const char *err, const char *transp)
{ {
f_print (fout, "\t\tsvcerr_%s(%s);\n", err, transp); f_print (fout, "\t\tsvcerr_%s (%s);\n", err, transp);
} }
static void static void
printif (const char *proc, const char *transp, const char *prefix, printif (const char *proc, const char *transp, const char *prefix,
const char *arg) const char *arg)
{ {
f_print (fout, "\tif (!svc_%s(%s, xdr_%s, %s%s)) {\n", f_print (fout, "\tif (!svc_%s (%s, xdr_%s, %s%s)) {\n",
proc, transp, arg, prefix, arg); proc, transp, arg, prefix, arg);
} }
@ -572,10 +673,10 @@ nullproc (const proc_list * proc)
{ {
if (streq (proc->proc_num, "0")) if (streq (proc->proc_num, "0"))
{ {
return (1); return 1;
} }
} }
return (0); return 0;
} }
static void static void
@ -588,13 +689,13 @@ write_inetmost (const char *infile)
f_print (fout, "\tint asize = sizeof (saddr);\n"); f_print (fout, "\tint asize = sizeof (saddr);\n");
f_print (fout, "\n"); f_print (fout, "\n");
f_print (fout, f_print (fout,
"\tif (getsockname(0, (struct sockaddr *)&saddr, &asize) == 0) {\n"); "\tif (getsockname (0, (struct sockaddr *)&saddr, &asize) == 0) {\n");
f_print (fout, "\t\tint ssize = sizeof (int);\n\n"); f_print (fout, "\t\tint ssize = sizeof (int);\n\n");
f_print (fout, "\t\tif (saddr.sin_family != AF_INET)\n"); f_print (fout, "\t\tif (saddr.sin_family != AF_INET)\n");
f_print (fout, "\t\t\texit(1);\n"); f_print (fout, "\t\t\texit (1);\n");
f_print (fout, "\t\tif (getsockopt(0, SOL_SOCKET, SO_TYPE,\n"); f_print (fout, "\t\tif (getsockopt (0, SOL_SOCKET, SO_TYPE,\n");
f_print (fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n"); f_print (fout, "\t\t\t\t(char *)&_rpcfdtype, &ssize) == -1)\n");
f_print (fout, "\t\t\texit(1);\n"); f_print (fout, "\t\t\texit (1);\n");
f_print (fout, "\t\tsock = 0;\n"); f_print (fout, "\t\tsock = 0;\n");
f_print (fout, "\t\t_rpcpmstart = 1;\n"); f_print (fout, "\t\t_rpcpmstart = 1;\n");
f_print (fout, "\t\tproto = 0;\n"); f_print (fout, "\t\tproto = 0;\n");
@ -610,11 +711,21 @@ static void
print_return (const char *space) print_return (const char *space)
{ {
if (exitnow) if (exitnow)
f_print (fout, "%sexit(0);\n", space); f_print (fout, "%sexit (0);\n", space);
else else
{ {
if (timerflag) if (timerflag)
f_print (fout, "%s_rpcsvcdirty = 0;\n", space); {
#if 0
f_print (fout, "%s_rpcsvcdirty = 0;\n", space);
#else
if (mtflag)
f_print(fout, "%smutex_lock(&_svcstate_lock);\n", space);
f_print(fout, "%s_rpcsvcstate = _SERVED;\n", space);
if (mtflag)
f_print(fout, "%smutex_unlock(&_svcstate_lock);\n", space);
#endif
}
f_print (fout, "%sreturn;\n", space); f_print (fout, "%sreturn;\n", space);
} }
} }
@ -634,7 +745,7 @@ print_pmapunset (const char *space)
for (vp = def->def.pr.versions; vp != NULL; for (vp = def->def.pr.versions; vp != NULL;
vp = vp->next) vp = vp->next)
{ {
f_print (fout, "%s(void) pmap_unset(%s, %s);\n", f_print (fout, "%spmap_unset (%s, %s);\n",
space, def->def_name, vp->vers_name); space, def->def_name, vp->vers_name);
} }
} }
@ -645,11 +756,11 @@ static void
print_err_message (const char *space) print_err_message (const char *space)
{ {
if (logflag) if (logflag)
f_print (fout, "%ssyslog(LOG_ERR, \"%s\");\n", space, _errbuf); f_print (fout, "%ssyslog (LOG_ERR, \"%s\");\n", space, _errbuf);
else if (inetdflag || pmflag) else if (inetdflag || pmflag)
f_print (fout, "%s_msgout(\"%s\");\n", space, _errbuf); f_print (fout, "%s_msgout (\"%s\");\n", space, _errbuf);
else else
f_print (fout, "%sfprintf(stderr, \"%s\");\n", space, _errbuf); f_print (fout, "%sfprintf (stderr, \"%s\");\n", space, _errbuf);
} }
/* /*
@ -675,22 +786,22 @@ write_msg_out (void)
f_print (fout, "static\n"); f_print (fout, "static\n");
if (!Cflag) if (!Cflag)
{ {
f_print (fout, "void _msgout(msg)\n"); f_print (fout, "void _msgout (msg)\n");
f_print (fout, "\tchar *msg;\n"); f_print (fout, "\tchar *msg;\n");
} }
else else
{ {
f_print (fout, "void _msgout(char* msg)\n"); f_print (fout, "void _msgout (char* msg)\n");
} }
f_print (fout, "{\n"); f_print (fout, "{\n");
f_print (fout, "#ifdef RPC_SVC_FG\n"); f_print (fout, "#ifdef RPC_SVC_FG\n");
if (inetdflag || pmflag) if (inetdflag || pmflag)
f_print (fout, "\tif (_rpcpmstart)\n"); f_print (fout, "\tif (_rpcpmstart)\n");
f_print (fout, "\t\tsyslog(LOG_ERR, msg);\n"); f_print (fout, "\t\tsyslog (LOG_ERR, msg);\n");
f_print (fout, "\telse\n"); f_print (fout, "\telse\n");
f_print (fout, "\t\t(void) fprintf(stderr, \"%%s\\n\", msg);\n"); f_print (fout, "\t\tfprintf (stderr, \"%%s\\n\", msg);\n");
f_print (fout, "#else\n"); f_print (fout, "#else\n");
f_print (fout, "\tsyslog(LOG_ERR, msg);\n"); f_print (fout, "\tsyslog (LOG_ERR, msg);\n");
f_print (fout, "#endif\n"); f_print (fout, "#endif\n");
f_print (fout, "}\n"); f_print (fout, "}\n");
} }
@ -705,20 +816,23 @@ write_timeout_func (void)
return; return;
f_print (fout, "\n"); f_print (fout, "\n");
f_print (fout, "static void\n"); f_print (fout, "static void\n");
#ifdef __GNU_LIBRARY__
if (Cflag) if (Cflag)
f_print (fout, "closedown(int sig)\n"); f_print (fout, "closedown (int sig)\n");
else else
f_print (fout, "closedown(sig)\n\tint sig;\n"); f_print (fout, "closedown (sig)\n\tint sig;\n");
#else
f_print (fout, "closedown()\n");
#endif
f_print (fout, "{\n"); f_print (fout, "{\n");
#ifdef __GNU_LIBRARY__
f_print (fout, "\t(void) signal(sig, %s closedown);\n", #if defined (__GNU_LIBRARY__) && 0
f_print (fout, "\t(void) signal (sig, %s closedown);\n",
Cflag ? "(SIG_PF)" : "(void(*)())"); Cflag ? "(SIG_PF)" : "(void(*)())");
#endif #endif
if (mtflag)
f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
#if 0
f_print (fout, "\tif (_rpcsvcdirty == 0) {\n"); f_print (fout, "\tif (_rpcsvcdirty == 0) {\n");
#else
f_print(fout, "\tif (_rpcsvcstate == _IDLE) {\n");
#endif
f_print (fout, "\t\textern fd_set svc_fdset;\n"); f_print (fout, "\t\textern fd_set svc_fdset;\n");
f_print (fout, "\t\tstatic int size;\n"); f_print (fout, "\t\tstatic int size;\n");
f_print (fout, "\t\tint i, openfd;\n"); f_print (fout, "\t\tint i, openfd;\n");
@ -731,15 +845,17 @@ write_timeout_func (void)
{ {
f_print (fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n"); f_print (fout, "\n\t\tif (_rpcfdtype == SOCK_DGRAM)\n");
} }
f_print (fout, "\t\t\texit(0);\n"); f_print (fout, "\t\t\texit (0);\n");
f_print (fout, "\t\tif (size == 0) {\n"); f_print (fout, "\t\tif (size == 0) {\n");
if (tirpcflag) if (tirpcflag)
{ {
f_print (fout, "\t\t\tstruct rlimit rl;\n\n"); f_print (fout, "\t\t\tstruct rlimit rl;\n\n");
f_print (fout, "\t\t\trl.rlim_max = 0;\n"); f_print (fout, "\t\t\trl.rlim_max = 0;\n");
f_print (fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n"); f_print (fout, "\t\t\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0)\n"); f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\n");
f_print (fout, "\t\t\t\treturn;\n"); if (mtflag)
f_print(fout, "\t\t\t\tmutex_unlock(&_svcstate_lock);\n");
f_print (fout, "\t\t\t\treturn;\n\t\t\t}\n");
} }
else else
{ {
@ -750,9 +866,15 @@ write_timeout_func (void)
f_print (fout, "\t\t\tif (FD_ISSET(i, &svc_fdset))\n"); f_print (fout, "\t\t\tif (FD_ISSET(i, &svc_fdset))\n");
f_print (fout, "\t\t\t\topenfd++;\n"); f_print (fout, "\t\t\t\topenfd++;\n");
f_print (fout, "\t\tif (openfd <= 1)\n"); f_print (fout, "\t\tif (openfd <= 1)\n");
f_print (fout, "\t\t\texit(0);\n"); f_print (fout, "\t\t\texit (0);\n");
f_print (fout, "\t}\n"); f_print (fout, "\t}\n");
f_print (fout, "\t(void) alarm(_RPCSVC_CLOSEDOWN);\n"); f_print(fout, "\tif (_rpcsvcstate == _SERVED)\n");
f_print(fout, "\t\t_rpcsvcstate = _IDLE;\n\n");
if (mtflag)
f_print(fout, "\tmutex_unlock(&_svcstate_lock);\n");
f_print(fout, "\t(void) signal(SIGALRM, %s closedown);\n",
Cflag? "(SIG_PF)" : "(void(*)())");
f_print (fout, "\talarm (_RPCSVC_CLOSEDOWN);\n");
f_print (fout, "}\n"); f_print (fout, "}\n");
} }
@ -915,9 +1037,6 @@ open_log_file (const char *infile, const char *sp)
*s = '.'; *s = '.';
} }
/* /*
* write a registration for the given transport for Inetd * write a registration for the given transport for Inetd
*/ */

View File

@ -95,7 +95,7 @@ streq (const char *a, const char *b)
* find a value in a list * find a value in a list
*/ */
definition * definition *
findval (list * lst, const char *val, findval (list *lst, const char *val,
int (*cmp) (const definition *, const char *)) int (*cmp) (const definition *, const char *))
{ {
@ -113,7 +113,7 @@ findval (list * lst, const char *val,
* store a value in a list * store a value in a list
*/ */
void void
storeval (list ** lstp, definition * val) storeval (list **lstp, definition *val)
{ {
list **l; list **l;
list *lst; list *lst;
@ -145,7 +145,10 @@ fixit (const char *type, const char *orig)
switch (def->def.ty.rel) switch (def->def.ty.rel)
{ {
case REL_VECTOR: case REL_VECTOR:
return (def->def.ty.old_type); if (streq (def->def.ty.old_type, "opaque"))
return ("char");
else
return (def->def.ty.old_type);
case REL_ALIAS: case REL_ALIAS:
return (fixit (def->def.ty.old_type, orig)); return (fixit (def->def.ty.old_type, orig));
default: default:
@ -227,7 +230,7 @@ isvectordef (const char *type, relation rel)
case REL_ARRAY: case REL_ARRAY:
return 0; return 0;
case REL_POINTER: case REL_POINTER:
return (0); return 0;
case REL_ALIAS: case REL_ALIAS:
def = findval (defined, type, typedefed); def = findval (defined, type, typedefed);
if (def == NULL) if (def == NULL)
@ -290,7 +293,7 @@ crash (void)
for (i = 0; i < nfiles; i++) for (i = 0; i < nfiles; i++)
{ {
(void) unlink (outfiles[i]); unlink (outfiles[i]);
} }
exit (1); exit (1);
} }

View File

@ -31,7 +31,7 @@
/* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */ /* @(#)rpc_util.h 1.5 90/08/29 (C) 1987 SMI */
/* /*
* rpc_util.h, Useful definitions for the RPC protocol compiler * rpc_util.h, Useful definitions for the RPC protocol compiler
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -48,11 +48,18 @@ struct list {
}; };
typedef struct list list; typedef struct list list;
struct xdrfunc {
char *name;
int pointerp;
struct xdrfunc *next;
};
typedef struct xdrfunc xdrfunc;
#define PUT 1 #define PUT 1
#define GET 2 #define GET 2
/* /*
* Global variables * Global variables
*/ */
#define MAXLINESIZE 1024 #define MAXLINESIZE 1024
extern char curline[MAXLINESIZE]; extern char curline[MAXLINESIZE];
@ -65,21 +72,23 @@ extern FILE *fin;
extern list *defined; extern list *defined;
extern bas_type *typ_list_h; extern bas_type *typ_list_h;
extern bas_type *typ_list_t; extern bas_type *typ_list_t;
extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
/* /*
* All the option flags * All the option flags
*/ */
extern int inetdflag; extern int inetdflag;
extern int pmflag; extern int pmflag;
extern int tblflag; extern int tblflag;
extern int logflag; extern int logflag;
extern int newstyle; extern int newstyle;
extern int Cflag; /* C++ flag */ extern int Cflag; /* C++ flag */
extern int tirpcflag; /* flag for generating tirpc code */ extern int CCflag; /* C++ flag */
extern int tirpcflag; /* flag for generating tirpc code */
extern int inlineflag; /* if this is 0, then do not generate inline code */ extern int inlineflag; /* if this is 0, then do not generate inline code */
extern int mtflag;
/* /*
* Other flags related with inetd jumpstart. * Other flags related with inetd jumpstart.
@ -91,12 +100,12 @@ extern int timerflag;
extern int nonfatalerrors; extern int nonfatalerrors;
/* /*
* rpc_util routines * rpc_util routines
*/ */
void storeval(list **lstp, definition *val); void storeval(list **lstp, definition *val);
#define STOREVAL(list,item) storeval(list,item) #define STOREVAL(list,item) storeval(list,item)
definition *findval(list *lst, const char *val, definition *findval(list *lst, const char *val,
int (*cmp)(const definition *, const char *)); int (*cmp)(const definition *, const char *));
#define FINDVAL(list,item,finder) findval(list, item, finder) #define FINDVAL(list,item,finder) findval(list, item, finder)
@ -115,18 +124,18 @@ bas_type *find_type(const char *type);
/* /*
* rpc_cout routines * rpc_cout routines
*/ */
void emit(definition *def); void emit(definition *def);
/* /*
* rpc_hout routines * rpc_hout routines
*/ */
void print_datadef(definition *def); void print_datadef(definition *def);
void print_funcdef(definition *def); void print_funcdef(definition *def);
/* /*
* rpc_svcout routines * rpc_svcout routines
*/ */
void write_most(const char *infile, int netflag, int nomain); void write_most(const char *infile, int netflag, int nomain);
void write_register(void); void write_register(void);

View File

@ -1,4 +1,4 @@
# Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. # Copyright (C) 1993, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -91,8 +91,10 @@ $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
# Make it unwritable so noone will edit it by mistake. # Make it unwritable so noone will edit it by mistake.
-chmod a-w $(hurd)/errnos.h-tmp -chmod a-w $(hurd)/errnos.h-tmp
./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h ./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
ifeq ($(with-cvs),yes)
test ! -d CVS || \ test ! -d CVS || \
(cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h) (cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
endif
touch $@ touch $@
common-generated += errnos.d stamp-errnos common-generated += errnos.d stamp-errnos

View File

@ -1,4 +1,4 @@
# Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. # Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
# This file is part of the GNU C Library. # This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or # The GNU C Library is free software; you can redistribute it and/or
@ -46,6 +46,8 @@ $(divrem:%=$(sysdep_dir)/sparc/sparc32/%.S): $(sysdep_dir)/sparc/sparc32/divrem.
# Make it unwritable so noone will edit it by mistake. # Make it unwritable so noone will edit it by mistake.
-chmod a-w $@-tmp -chmod a-w $@-tmp
mv -f $@-tmp $@ mv -f $@-tmp $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs commit -m'Regenerated from $<' $@ test ! -d CVS || cvs commit -m'Regenerated from $<' $@
endif
sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S) sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S)