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>
* 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)
ifeq ($(with-cvs),yes)
define autoconf-it
autoconf $(ACFLAGS) $< > $@.new
mv -f $@.new $@
test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
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)
@ -225,7 +232,9 @@ README: README.template version.h
sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
# Make it unwritable so I won't change it by mistake.
chmod 444 $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
endif
endif # Subdirectory vs. parent makefile

View File

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

View File

@ -467,8 +467,9 @@ $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
$(filter -Wl$(comma)-rpath-link=%,\
$(sysdep-LDFLAGS)))))
define built-program-cmd
LD_LIBRARY_PATH=$(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(elf-objpfx)$(rtld-installed-name) $(built-program-file)
$(elf-objpfx)$(rtld-installed-name) \
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
$(built-program-file)
endef
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
# interpreter and operating independent of libc.
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 \
dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \
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?
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))
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))
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)#' \
-e 's#@@rtld-arch@@#$(rtld-arch)#' \
-e 's#@@rtld-entry@@#$(rtld-entry)#' \
-e 's#@@rtld-base@@#$(rtld-base)#' $< >$@
endif
$(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
$(rtld-link) -Wl,-soname=$(rtld-installed-name)
@ -111,18 +112,9 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(objpfx)rtld-ldscript
define rtld-link
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
-Wl,-rpath=$(default-rpath) $(LDFLAGS-rtld) \
$(filter-out $(objpfx)rtld-ldscript,$^) \
$(RTLD-VERSIONS)
$(filter-out $(rtld-ldscript) $($(@F:.so=)-map),$^) \
$(load-map-file:%=-Wl,--version-script=%)
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.
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.
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.
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
_dl_init_paths (void)
_dl_init_paths (const char *llp)
{
static const char *trusted_dirs[] =
{
@ -325,10 +325,15 @@ _dl_init_paths (void)
variable. */
struct link_map *l;
/* First determine how many elements the LD_LIBRARY_PATH contents has. */
const char *llp = getenv ("LD_LIBRARY_PATH");
/* Number of elements in the library path. */
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')
{
/* Simply count the number of colons. */

View File

@ -1,5 +1,5 @@
/* 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.
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
objects. */
_dl_init_paths ();
_dl_init_paths (NULL);
#ifdef DL_PLATFORM_INIT
DL_PLATFORM_INIT;

View File

@ -1,5 +1,5 @@
/* 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.
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);
/* 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
the timers. */

View File

@ -264,6 +264,7 @@ dl_main (const ElfW(Phdr) *phdr,
size_t file_size;
char *file;
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
up from the kernel. */
@ -343,6 +344,15 @@ dl_main (const ElfW(Phdr) *phdr,
--_dl_argc;
++_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
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
objects. */
_dl_init_paths ();
_dl_init_paths (library_path);
preloadlist = getenv ("LD_PRELOAD");
if (preloadlist)

View File

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

View File

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

View File

@ -239,9 +239,13 @@ collate_finish (struct localedef_t *locale, struct charset_t *charset)
else
value = 0;
if (value == 0 && !be_quiet)
if (value == 0)
{
if (!be_quiet)
error_at_line (0, 0, patch->fname, patch->lineno,
_("no weight defined for symbol `%s'"), patch->token);
_("no weight defined for symbol `%s'"),
patch->token);
}
else
*patch->where.pos = value;
}
@ -1477,7 +1481,7 @@ line after ellipsis must contain character definition"));
pelem->ordering
= (unsigned int *) obstack_copy (&collate->element_mem, data,
(collate->nrules
* pelem->ordering_len)
+ pelem->ordering_len)
* sizeof (unsigned int));
/* `...' weights need to be adjusted. */
@ -1490,13 +1494,16 @@ line after ellipsis must contain character definition"));
(void *) &pelem->next) >= 0)
{
if (set_entry (&collate->result, name, sizeof (wchar_t),
(void *) pelem->next) < 0)
(void *) pelem) < 0)
error (4, 0, _("cannot insert into result table"));
}
else
{
pelem->next = NULL;
if (insert_entry (&collate->result, name, sizeof (wchar_t),
(void *) pelem->next) < 0)
(void *) pelem) < 0)
error (4, 0, _("cannot insert into result table"));
}
/* Increment counter. */
++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.
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. */
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)
{
if (!be_quiet)
error (0, 0, _("character <SP> not defined in character map"));
}
else if (((cnt = BITPOS (tok_space),
(ELEM (ctype, class_collection, , space_value)
& BIT (tok_space)) == 0)
|| (cnt = BITPOS (tok_blank),
(ELEM (ctype, class_collection, , space_value)
& BIT (tok_blank)) == 0))
&& !be_quiet)
& BIT (tok_blank)) == 0)))
{
if (!be_quiet)
error (0, 0, _("<SP> character not in class `%s'"),
valid_table[cnt].name);
}
else if (((cnt = BITPOS (tok_punct),
(ELEM (ctype, class_collection, , space_value)
& BIT (tok_punct)) != 0)
|| (cnt = BITPOS (tok_graph),
(ELEM (ctype, class_collection, , space_value)
& BIT (tok_graph))
!= 0))
&& !be_quiet)
!= 0)))
{
if (!be_quiet)
error (0, 0, _("<SP> character must not be in class `%s'"),
valid_table[cnt].name);
}
else
ELEM (ctype, class_collection, , space_value) |= BIT (tok_print);
@ -651,8 +658,10 @@ ctype_class_to (struct linereader *lr, struct localedef_t *locale,
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. */
if ((wchar_t) ctype->last_class_char != ILLEGAL_CHAR_VALUE
&& (wchar_t) value != ILLEGAL_CHAR_VALUE)
for (cnt = ctype->last_class_char + 1; cnt <= value; ++cnt)
*find_idx (ctype, &ctype->class_collection, &ctype->class_collection_max,
&ctype->class_collection_act, cnt)
@ -940,8 +949,9 @@ set_class_defaults (struct locale_ctype_t *ctype, struct charset_t *charset)
tmp[0] = ch;
value = charset_find_value (charset, tmp, 1);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
tmp);
@ -1004,50 +1014,68 @@ character `%s' not defined while needed as default value"),
unsigned int value;
value = charset_find_value (charset, "space", 5);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<space>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "form-feed", 9);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<form-feed>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "newline", 7);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<newline>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "carriage-return", 15);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<carriage-return>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "tab", 3);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<tab>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
value = charset_find_value (charset, "vertical-tab", 12);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<vertical-tab>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_space);
}
@ -1070,18 +1098,24 @@ character `%s' not defined while needed as default value"),
unsigned int value;
value = charset_find_value (charset, "space", 5);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<space>");
}
else
ELEM (ctype, class_collection, , value) |= BIT (tok_blank);
value = charset_find_value (charset, "tab", 3);
if ((wchar_t) value == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<tab>");
}
else
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);
space = charset_find_value (charset, "space", 5);
if (space == ILLEGAL_CHAR_VALUE && !be_quiet)
if (space == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
"<space>");
}
else
ELEM (ctype, class_collection, , space) |= BIT (tok_print);
}
@ -1142,8 +1179,9 @@ character `%s' not defined while needed as default value"),
tmp[1] = (char) ch;
value_from = charset_find_value (charset, &tmp[1], 1);
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value_from == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
tmp);
@ -1153,8 +1191,9 @@ character `%s' not defined while needed as default value"),
/* This conversion is implementation defined. */
tmp[1] = (char) (ch + ('A' - 'a'));
value_to = charset_find_value (charset, &tmp[1], 1);
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE && !be_quiet)
if ((wchar_t) value_to == ILLEGAL_CHAR_VALUE)
{
if (!be_quiet)
error (0, 0, _("\
character `%s' not defined while needed as default value"),
tmp);

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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -41,7 +41,7 @@
#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. */
@ -77,9 +77,12 @@ messages_finish (struct localedef_t *locale)
= locale->categories[LC_MESSAGES].messages;
/* The fields YESSTR and NOSTR are optional. */
if (messages->yesexpr == NULL && !be_quiet)
if (messages->yesexpr == NULL)
{
if (!be_quiet)
error (0, 0, _("field `%s' in category `%s' undefined"),
"yesexpr", "LC_MESSAGES");
}
else
{
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)
{
if (!be_quiet)
error (0, 0, _("field `%s' in category `%s' undefined"),
"noexpr", "LC_MESSAGES");
}
else
{
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -35,8 +35,8 @@
#include "localeinfo.h"
#include "stringtrans.h"
void *xmalloc (size_t __n);
void *xrealloc (void *__ptr, size_t __n);
extern void *xmalloc (size_t __n);
extern void *xrealloc (void *__ptr, size_t __n);
/* 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. */
if (monetary->int_curr_symbol != NULL)
{
if (strlen (monetary->int_curr_symbol) != 4 && !be_quiet)
if (strlen (monetary->int_curr_symbol) != 4)
{
if (!be_quiet)
error (0, 0, _("\
value of field `int_curr_symbol' in category `LC_MONETARY' has wrong length"));
}
else if (bsearch (monetary->int_curr_symbol, valid_int_curr,
NR_VALID_INT_CURR, sizeof (const char *),
(comparison_fn_t) curr_strcmp) == NULL

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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -37,8 +37,8 @@
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
void *xmalloc (size_t __n);
void *xrealloc (void *__p, size_t __n);
extern void *xmalloc (size_t __n);
extern void *xrealloc (void *__p, size_t __n);
/* Entry describing an entry of the era specification. */
@ -154,8 +154,9 @@ time_finish (struct localedef_t *locale)
memcpy (str, time->era[idx], era_len + 1);
/* First character must be + or - for the direction. */
if (*str != '+' && *str != '-' && !be_quiet)
if (*str != '+' && *str != '-')
{
if (!be_quiet)
error (0, 0, _("direction flag in string %d in `era' field"
" in category `%s' is not '+' nor '-'"),
idx + 1, "LC_TIME");
@ -164,8 +165,9 @@ time_finish (struct localedef_t *locale)
}
else
time->era_entries[idx].direction = *str;
if (*++str != ':' && !be_quiet)
if (*++str != ':')
{
if (!be_quiet)
error (0, 0, _("direction flag in string %d in `era' field"
" in category `%s' is not a single character"),
idx + 1, "LC_TIME");
@ -176,15 +178,17 @@ time_finish (struct localedef_t *locale)
/* Now the offset year. */
time->era_entries[idx].offset = strtol (str, &endp, 10);
if (endp == str && !be_quiet)
if (endp == str)
{
if (!be_quiet)
error (0, 0, _("illegal number for offset in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':' && !be_quiet)
else if (*endp != ':')
{
if (!be_quiet)
error (0, 0, _("garbage at end of offset value in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
@ -229,19 +233,22 @@ time_finish (struct localedef_t *locale)
time->era_entries[idx].start_date[1] -= 1;
time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
if (endp == str && !be_quiet)
if (endp == str)
{
invalid_start_date:
if (!be_quiet)
error (0, 0, _("illegal starting date in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':' && !be_quiet)
else if (*endp != ':')
{
garbage_start_date:
error (0, 0, _("garbage at end of starting date in string %d"
" in `era' field in category `%s'"),
if (!be_quiet)
error (0, 0, _("garbage at end of starting date "
"in string %d in `era' field "
"in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
@ -302,19 +309,22 @@ time_finish (struct localedef_t *locale)
time->era_entries[idx].stop_date[1] -= 1;
time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
if (endp == str && !be_quiet)
if (endp == str)
{
invalid_stop_date:
if (!be_quiet)
error (0, 0, _("illegal stopping date in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':' && !be_quiet)
else if (*endp != ':')
{
garbage_stop_date:
error (0, 0, _("garbage at end of stopping date in string %d"
" in `era' field in category `%s'"),
if (!be_quiet)
error (0, 0, _("garbage at end of stopping date "
"in string %d in `era' field "
"in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
@ -339,8 +349,9 @@ time_finish (struct localedef_t *locale)
}
}
if ((str == NULL || *str == '\0') && !be_quiet)
if (str == NULL || *str == '\0')
{
if (!be_quiet)
error (0, 0, _("missing era name in string %d in `era' field"
" in category `%s'"), idx + 1, "LC_TIME");
time->era_entries[idx].name =
@ -350,8 +361,9 @@ time_finish (struct localedef_t *locale)
{
time->era_entries[idx].name = strsep (&str, ":");
if ((str == NULL || *str == '\0') && !be_quiet)
if (str == NULL || *str == '\0')
{
if (!be_quiet)
error (0, 0, _("missing era format in string %d in `era'"
" field in category `%s'"),
idx + 1, "LC_TIME");

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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
@ -1015,8 +1015,9 @@ write_locale_data (const char *output_path, const char *category,
save_err = errno;
}
if (fd == -1 && !be_quiet)
if (fd == -1)
{
if (!be_quiet)
error (0, save_err, _("\
cannot open output file `%s' for category `%s'"),
fname, category);
@ -1039,8 +1040,9 @@ cannot open output file `%s' for category `%s'"),
if (maxiov > 0)
step = MIN (maxiov, step);
if (writev (fd, &vec[cnt], step) < 0 && !be_quiet)
if (writev (fd, &vec[cnt], step) < 0)
{
if (!be_quiet)
error (0, errno, _("failure while writing data for category `%s'"),
category);
break;

View File

@ -37,9 +37,13 @@ test-output := $(foreach s, .out .xout, \
generated := $(test-input) $(test-output)
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 \
README mnemonic.ds fr_CA,2.13.in de_DE.in da_DK.in \
$(charmaps) $(locales)
$(charmaps) $(locales) $(test-srcs)
# Get $(inst_i18ndir) defined.
include ../Makeconfig
@ -58,4 +62,5 @@ ifeq (no,$(cross-compiling))
tests: $(objpfx)collate-test $(objpfx)xfrm-test $(objpfx)tst-fmon
$(SHELL) -e sort-test.sh $(common-objpfx) $(test-input)
$(SHELL) -e tst-fmon.sh $(common-objpfx) tst-fmon.data
$(SHELL) -e tst-locale.sh $(common-objpfx)
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.
* Parsing of Numbers:: Functions for ``reading'' numbers
from strings.
* Old-style number conversion:: Low-level number to string conversion.
@end menu
@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
@code{strtod} is more robust.
@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.
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
{
strncpy (buffer, NISENTRYVAL (entry, 1, result),
cp = __stpncpy (buffer, NISENTRYVAL (entry, 1, result),
NISENTRYLEN (entry, 1, result));
buffer[NISENTRYLEN (entry, 1, result)] = '\0';
*cp = '\0';
}
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;
*first_unused = '\0';
++first_unused;
strcpy (first_unused, NISENTRYVAL (entry, 0, result));
first_unused[NISENTRYLEN (entry, 0, result)] = '\0';
cp = __stpncpy (first_unused, NISENTRYVAL (entry, 0, result),
NISENTRYLEN (entry, 0, result));
*cp = '\0';
alias->alias_name = first_unused;
/* 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.
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;
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)
{
@ -121,8 +121,9 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
room_left -= (NISENTRYLEN (i, 1, result) + 1);
}
}
++p;
*p++ = '\0';
first_unused = p;
/* Adjust the pointer so it is aligned for
storing pointers. */
first_unused += __alignof__ (char *) - 1;
@ -142,7 +143,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
{
/* Skip leading blanks. */
while (isspace (*line))
line++;
++line;
if (*line == '\0')
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.
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;
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)
{
@ -93,7 +93,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
room_left -= (NISENTRYLEN (i, 1, result) + 1);
}
}
++p;
*p++ = '\0';
first_unused = p;
/* Adjust the pointer so it is aligned for
@ -125,17 +125,14 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
while (*line != '\0' && *line != ' ')
++line;
if (line != network->n_aliases[i])
{
if (*line != '\0')
if (*line == ' ')
{
*line = '\0';
++line;
}
++i;
}
else
network->n_aliases[i] = NULL;
network->n_aliases[i+1] = NULL;
}
return 1;
@ -385,15 +382,32 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
nis_result *result;
char buf[1024 + tablename_len];
struct in_addr in;
char buf2[256];
int b2len;
in = inet_makeaddr (addr, 0);
sprintf (buf, "[addr=%s],%s", inet_ntoa (in), tablename_val);
strcpy (buf2, inet_ntoa (in));
b2len = strlen (buf2);
while (1)
{
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)
{
if (buf2[b2len -2] == '.' && buf2[b2len -1] == '0')
{
/* 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;
@ -403,8 +417,8 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
return retval;
}
parse_res = _nss_nisplus_parse_netent (result, network, buffer, buflen,
errnop);
parse_res = _nss_nisplus_parse_netent (result, network, buffer,
buflen, errnop);
nis_freeresult (result);
@ -421,3 +435,4 @@ _nss_nisplus_getnetbyaddr_r (const unsigned long addr, const int type,
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.
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;
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)
{
@ -92,7 +92,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
room_left -= (NISENTRYLEN (i, 1, result) + 1);
}
}
++p;
*p++ = '\0';
first_unused = p;
/* 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.
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));
first_unused[NISENTRYLEN (0, 0, result)] = '\0';
rpc->r_name = first_unused;
room_left -= strlen (first_unused) + 1;
room_left -= (strlen (first_unused) + 1);
first_unused += strlen (first_unused) + 1;
rpc->r_number = atoi (NISENTRYVAL (0, 2, result));
p = first_unused;
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)
{
@ -106,7 +106,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
{
/* Skip leading blanks. */
while (isspace (*line))
line++;
++line;
if (*line == '\0')
break;
@ -120,17 +120,14 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
while (*line != '\0' && *line != ' ')
++line;
if (line != rpc->r_aliases[i])
{
if (*line != '\0')
if (*line == ' ')
{
*line = '\0';
++line;
}
++i;
}
else
rpc->r_aliases[i] = NULL;
rpc->r_aliases[i+1] = NULL;
}
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.
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;
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)
{
@ -97,7 +97,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
room_left -= (NISENTRYLEN (i, 1, result) + 1);
}
}
++p;
*p++ = '\0';
first_unused = p;
/* Adjust the pointer so it is aligned for

View File

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

View File

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

View File

@ -113,7 +113,9 @@ $(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
.PHONY: copy-mpn clean-mpn mpn-stuff
mpn-stuff: $(mpn-stuff)
copy-mpn: $(mpn-stuff)
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs $(CVSOPTS) commit -m'Updated from $(gmp-srcdir)' $+
endif
clean-mpn:
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
# 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
# a shorter name. But if the filesystem can handle it, we want to

View File

@ -1,14 +1,12 @@
/****** rpc_clntout.c ******/
void write_stubs(void);
void printarglist(proc_list *proc,
void printarglist(proc_list *proc, const char *result,
const char *addargname, const char *addargtype);
/****** rpc_cout.c ******/
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 ******/
@ -19,6 +17,7 @@ void pprocdef(proc_list *proc, version_list *vp,
const char *addargtype, int server_p, int mode);
void pdeclaration(const char *name, declaration *dec, int tab,
const char *separator);
void print_xdr_func_def (char* name, int pointerp, int i);
/****** rpc_main.c ******/
/* nil */

View File

@ -60,9 +60,9 @@ write_stubs (void)
list *l;
definition *def;
f_print (fout,
fprintf (fout,
"\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);
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)
{
f_print (fout, "\n");
fprintf (fout, "\n");
if (mtflag == 0)
{
ptype (proc->res_prefix, proc->res_type, 1);
f_print (fout, "*\n");
fprintf (fout, "*\n");
pvname (proc->proc_name, vp->vers_num);
printarglist (proc, "clnt", "CLIENT *");
f_print (fout, "{\n");
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);
f_print (fout, "}\n");
fprintf (fout, "}\n");
}
}
}
@ -104,7 +113,7 @@ write_program (definition * def)
/* sample addargname = "clnt"; sample addargtype = "CLIENT * " */
void
printarglist (proc_list * proc,
printarglist (proc_list * proc, const char *result,
const char *addargname, const char *addargtype)
{
@ -114,57 +123,99 @@ printarglist (proc_list * proc,
{ /* old style: always pass argument by reference */
if (Cflag)
{ /* C++ style heading */
f_print (fout, "(");
ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
f_print (fout, "*argp, %s%s)\n", addargtype, addargname);
fprintf (fout, "(");
ptype (proc->args.decls->decl.prefix,
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
{
f_print (fout, "(argp, %s)\n", addargname);
f_print (fout, "\t");
ptype (proc->args.decls->decl.prefix, proc->args.decls->decl.type, 1);
f_print (fout, "*argp;\n");
if (!mtflag)
fprintf (fout, "(argp, %s)\n", addargname);
else
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"))
{
/* newstyle, 0 argument */
if (mtflag)
{
fprintf (fout, "(");
if (Cflag)
f_print (fout, "(%s%s)\n", addargtype, addargname);
{
ptype(proc->res_prefix, proc->res_type, 1);
fprintf (fout, "*%s, %s%s)\n", result, addargtype, addargname);
}
else
f_print (fout, "(%s)\n", addargname);
fprintf (fout, "(%s)\n", addargname);
}
else if (Cflag)
fprintf (fout, "(%s%s)\n", addargtype, addargname);
else
fprintf (fout, "(%s)\n", addargname);
}
else
{
/* new style, 1 or multiple arguments */
if (!Cflag)
{
f_print (fout, "(");
fprintf (fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next)
f_print (fout, "%s, ", l->decl.name);
f_print (fout, "%s)\n", addargname);
fprintf (fout, "%s, ", l->decl.name);
if (mtflag)
fprintf (fout, "%s, ", result);
fprintf (fout, "%s)\n", addargname);
for (l = proc->args.decls; l != NULL; l = l->next)
{
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
{ /* C++ style header */
f_print (fout, "(");
fprintf (fout, "(");
for (l = proc->args.decls; l != NULL; l = l->next)
{
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)
f_print (fout, "\t%s%s;\n", addargtype, addargname);
fprintf (fout, "\t%s%s;\n", addargtype, addargname);
}
static
const char *
ampr (const char *type)
@ -190,66 +241,102 @@ printbody (proc_list * proc)
to stuff the arguments. */
if (newstyle && args2)
{
f_print (fout, "\t%s", proc->args.argname);
f_print (fout, " arg;\n");
fprintf (fout, "\t%s", proc->args.argname);
fprintf (fout, " arg;\n");
}
f_print (fout, "\tstatic ");
if (!mtflag)
{
fprintf (fout, "\tstatic ");
if (streq (proc->res_type, "void"))
{
f_print (fout, "char ");
fprintf (fout, "char ");
}
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",
fprintf (fout, "%s;\n", RESULT);
fprintf (fout, "\n");
fprintf (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")))
{
/* newstyle, 0 arguments */
f_print (fout,
"\tif (clnt_call(clnt, %s, xdr_void", proc->proc_name);
f_print (fout,
", NULL, xdr_%s, %s,%s, TIMEOUT) != RPC_SUCCESS) {\n",
stringfix (proc->res_type), ampr (proc->res_type), RESULT);
if (mtflag)
fprintf (fout, "\t return ");
else
fprintf (fout, "\t if ");
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)
{
/* newstyle, multiple arguments: stuff arguments into structure */
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);
}
f_print (fout,
"\tif (clnt_call(clnt, %s, xdr_%s", proc->proc_name,
if (mtflag)
fprintf (fout, "\treturn ");
else
fprintf (fout, "\tif ");
fprintf (fout,
"(clnt_call (clnt, %s, (xdrproc_t) xdr_%s", proc->proc_name,
proc->args.argname);
f_print (fout,
", &arg, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n",
stringfix (proc->res_type), ampr (proc->res_type), RESULT);
fprintf (fout,
", (caddr_t) &arg,\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");
else
fprintf (fout, "\n\t\tTIMEOUT) != RPC_SUCCESS) {\n");
}
else
{ /* single argument, new or old style */
f_print (fout,
"\tif (clnt_call(clnt, %s, xdr_%s, %s%s, xdr_%s, %s%s, TIMEOUT) != RPC_SUCCESS) {\n",
if (!mtflag)
fprintf (fout,
"\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",
proc->proc_name,
stringfix (proc->args.decls->decl.type),
(newstyle ? "&" : ""),
(newstyle ? proc->args.decls->decl.name : "argp"),
stringfix (proc->res_type), ampr (proc->res_type), RESULT);
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");
f_print (fout, "\t}\n");
if (!mtflag)
{
fprintf (fout, "\t\treturn (NULL);\n");
fprintf (fout, "\t}\n");
if (streq (proc->res_type, "void"))
{
f_print (fout, "\treturn ((void *)%s%s);\n",
fprintf (fout, "\treturn ((void *)%s%s);\n",
ampr (proc->res_type), RESULT);
}
else
{
f_print (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT);
fprintf (fout, "\treturn (%s%s);\n", ampr (proc->res_type), RESULT);
}
}
}

View File

@ -49,12 +49,15 @@ static void emit_program(const definition *def);
static void emit_union (const definition * def);
static void emit_struct (definition * def);
static void emit_typedef (const definition * def);
static void emit_inline (int indent, declaration * decl, int flag);
static void emit_single_in_line (int indent, declaration *decl, int flag,
relation rel);
static int findtype (const definition * def, const char *type);
static int undefined (const char *type);
static void print_generic_header (const char *procname, int pointerp);
static void print_ifopen (int indent, const char *name);
static void print_ifarg (const char *arg);
static void print_ifsizeof(const char *prefix, const char *type);
static void print_ifsizeof (int indent, const char *prefix, const char *type);
static void print_ifclose (int indent);
static void print_ifstat (int indent, const char *prefix, const char *type,
relation rel, const char *amax,
@ -70,10 +73,12 @@ static char *upcase(const char *str);
void
emit (definition * def)
{
if (def->def_kind == DEF_CONST) {
if (def->def_kind == DEF_CONST)
{
return;
}
if (def->def_kind == DEF_PROGRAM) {
if (def->def_kind == DEF_PROGRAM)
{
emit_program (def);
return;
}
@ -89,7 +94,8 @@ emit(definition *def)
};
print_header (def);
switch (def->def_kind) {
switch (def->def_kind)
{
case DEF_UNION:
emit_union (def);
break;
@ -112,9 +118,12 @@ emit(definition *def)
static int
findtype (const definition * def, const char *type)
{
if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST) {
return (0);
} else {
if (def->def_kind == DEF_PROGRAM || def->def_kind == DEF_CONST)
{
return 0;
}
else
{
return (streq (def->def_name, type));
}
}
@ -133,20 +142,23 @@ print_generic_header(const char *procname, int pointerp)
{
f_print (fout, "\n");
f_print (fout, "bool_t\n");
if (Cflag) {
if (Cflag)
{
f_print (fout, "xdr_%s (", procname);
f_print (fout, "XDR *xdrs, ");
f_print (fout, "%s ", procname);
if (pointerp)
f_print (fout, "*");
f_print(fout, "objp)\n{\n\n");
} else {
f_print (fout, "objp)\n{\n");
}
else
{
f_print (fout, "xdr_%s (xdrs, objp)\n", procname);
f_print (fout, "\tXDR *xdrs;\n");
f_print (fout, "\t%s ", procname);
if (pointerp)
f_print (fout, "*");
f_print(fout, "objp;\n{\n\n");
f_print (fout, "objp;\n{\n");
}
}
@ -194,28 +206,35 @@ print_ifarg(const char *arg)
}
static void
print_ifsizeof(const char *prefix, const char *type)
print_ifsizeof (int indent, const char *prefix, const char *type)
{
if (streq(type, "bool")) {
f_print(fout, ", sizeof(bool_t), (xdrproc_t)xdr_bool");
if (indent)
{
fprintf (fout, ",\n");
tabify (fout, indent);
}
else {
f_print(fout, ", sizeof(");
if (undefined(type) && prefix) {
else
fprintf (fout, ", ");
if (streq (type, "bool"))
fprintf (fout, "sizeof (bool_t), (xdrproc_t) xdr_bool");
else
{
fprintf (fout, "sizeof (");
if (undefined (type) && prefix)
{
f_print (fout, "%s ", prefix);
}
f_print(fout, "%s), (xdrproc_t)xdr_%s", type, type);
fprintf (fout, "%s), (xdrproc_t) xdr_%s", type, type);
}
}
static void
print_ifclose (int indent)
{
f_print(fout, ")) {\n");
f_print (fout, "))\n");
tabify (fout, indent);
f_print (fout, "\t return FALSE;\n");
tabify(fout, indent);
f_print(fout, " }\n");
}
static void
@ -224,59 +243,80 @@ print_ifstat(int indent, const char *prefix, const char *type, relation rel,
{
const char *alt = NULL;
switch (rel) {
switch (rel)
{
case REL_POINTER:
print_ifopen (indent, "pointer");
print_ifarg ("(char **)");
f_print (fout, "%s", objname);
print_ifsizeof(prefix, type);
print_ifsizeof (0, prefix, type);
break;
case REL_VECTOR:
if (streq(type, "string")) {
if (streq (type, "string"))
{
alt = "string";
} else if (streq(type, "opaque")) {
}
else if (streq (type, "opaque"))
{
alt = "opaque";
}
if (alt) {
if (alt)
{
print_ifopen (indent, alt);
print_ifarg (objname);
} else {
}
else
{
print_ifopen (indent, "vector");
print_ifarg ("(char *)");
f_print (fout, "%s", objname);
}
print_ifarg (amax);
if (!alt) {
print_ifsizeof(prefix, type);
if (!alt)
{
print_ifsizeof (indent + 1, prefix, type);
}
break;
case REL_ARRAY:
if (streq(type, "string")) {
if (streq (type, "string"))
{
alt = "string";
} else if (streq(type, "opaque")) {
}
else if (streq (type, "opaque"))
{
alt = "bytes";
}
if (streq(type, "string")) {
if (streq (type, "string"))
{
print_ifopen (indent, alt);
print_ifarg (objname);
} else {
if (alt) {
}
else
{
if (alt)
{
print_ifopen (indent, alt);
} else {
}
else
{
print_ifopen (indent, "array");
}
print_ifarg ("(char **)");
if (*objname == '&') {
if (*objname == '&')
{
f_print (fout, "%s.%s_val, (u_int *) %s.%s_len",
objname, name, objname, name);
} else {
}
else
{
f_print (fout, "&%s->%s_val, (u_int *) &%s->%s_len",
objname, name, objname, name);
}
}
print_ifarg (amax);
if (!alt) {
print_ifsizeof(prefix, type);
if (!alt)
{
print_ifsizeof (indent + 1, prefix, type);
}
break;
case REL_ALIAS:
@ -305,7 +345,8 @@ emit_program(const definition *def)
proc_list *plist;
for (vlist = def->def.pr.versions; vlist != NULL; vlist = vlist->next)
for(plist = vlist->procs; plist != NULL; plist = plist->next) {
for (plist = vlist->procs; plist != NULL; plist = plist->next)
{
if (!newstyle || plist->arg_num < 2)
continue; /* old style, or single argument */
print_prog_header (plist);
@ -328,19 +369,24 @@ emit_union(const definition *def)
print_stat (1, &def->def.un.enum_decl);
f_print (fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);
for (cl = def->def.un.cases; cl != NULL; cl = cl->next) {
for (cl = def->def.un.cases; cl != NULL; cl = cl->next)
{
f_print (fout, "\tcase %s:\n", cl->case_name);
if (cl->contflag == 1) /* a continued case statement */
continue;
cs = &cl->case_decl;
if (!streq(cs->type, "void")) {
if (!streq (cs->type, "void"))
{
object = alloc (strlen (def->def_name) + strlen (format) +
strlen (cs->name) + 1);
if (isvectordef(cs->type, cs->rel)) {
if (isvectordef (cs->type, cs->rel))
{
s_print (object, vecformat, def->def_name,
cs->name);
} else {
}
else
{
s_print (object, format, def->def_name,
cs->name);
}
@ -351,15 +397,20 @@ emit_union(const definition *def)
f_print (fout, "\t\tbreak;\n");
}
dflt = def->def.un.default_decl;
if (dflt != NULL) {
if (!streq(dflt->type, "void")) {
if (dflt != NULL)
{
if (!streq (dflt->type, "void"))
{
f_print (fout, "\tdefault:\n");
object = alloc (strlen (def->def_name) + strlen (format) +
strlen (dflt->name) + 1);
if (isvectordef(dflt->type, dflt->rel)) {
if (isvectordef (dflt->type, dflt->rel))
{
s_print (object, vecformat, def->def_name,
dflt->name);
} else {
}
else
{
s_print (object, format, def->def_name,
dflt->name);
}
@ -370,12 +421,15 @@ emit_union(const definition *def)
f_print (fout, "\t\tbreak;\n");
}
#ifdef __GNU_LIBRARY__
else {
else
{
f_print (fout, "\tdefault:\n");
f_print (fout, "\t\tbreak;\n");
}
#endif
} else {
}
else
{
f_print (fout, "\tdefault:\n");
f_print (fout, "\t\treturn FALSE;\n");
}
@ -383,47 +437,213 @@ emit_union(const definition *def)
f_print (fout, "\t}\n");
}
static void
inline_struct (definition *def, int flag)
{
decl_list *dl;
int i, size;
decl_list *cur, *psav;
bas_type *ptr;
char *sizestr, *plus;
char ptemp[256];
int indent = 1;
if (flag == PUT)
f_print (fout, "\n\tif (xdrs->x_op == XDR_ENCODE) {\n");
else
f_print(fout,
"\t\treturn TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
i = 0;
size = 0;
sizestr = NULL;
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
{ /* xxx */
/* now walk down the list and check for basic types */
if ((dl->decl.prefix == NULL) &&
((ptr = find_type (dl->decl.type)) != NULL) &&
((dl->decl.rel == REL_ALIAS) || (dl->decl.rel == REL_VECTOR)))
{
if (i == 0)
cur = dl;
++i;
if (dl->decl.rel == REL_ALIAS)
size += ptr->length;
else
{
/* this is required to handle arrays */
if (sizestr == NULL)
plus = "";
else
plus = "+ ";
if (ptr->length != 1)
s_print (ptemp, " %s %s * %d", plus, dl->decl.array_max,
ptr->length);
else
s_print (ptemp, " %s%s ", plus, dl->decl.array_max);
/*now concatenate to sizestr !!!! */
if (sizestr == NULL)
sizestr = strdup (ptemp);
else
{
sizestr = realloc (sizestr, strlen (sizestr) +
strlen (ptemp) + 1);
if (sizestr == NULL)
{
f_print (stderr, "Fatal error : no memory \n");
crash ();
};
sizestr = strcat (sizestr, ptemp);
/*build up length of array */
}
}
}
else
{
if (i > 0)
if (sizestr == NULL && size < inlineflag)
{
/* don't expand into inline code if size < inlineflag */
while (cur != dl)
{
print_stat (indent + 1, &cur->decl);
cur = cur->next;
}
}
else
{
/* were already looking at a xdr_inlineable structure */
tabify (fout, indent + 1);
if (sizestr == NULL)
f_print (fout, "buf = XDR_INLINE (xdrs, %d * BYTES_PER_XDR_UNIT);", size);
else if (size == 0)
f_print (fout,
"buf = XDR_INLINE (xdrs, %s * BYTES_PER_XDR_UNIT);",
sizestr);
else
f_print (fout,
"buf = XDR_INLINE(xdrs, (%d + (%s)) * BYTES_PER_XDR_UNIT);",
size, sizestr);
f_print (fout, "\n");
tabify (fout, indent + 1);
fprintf (fout, "if (buf == NULL) {\n");
psav = cur;
while (cur != dl)
{
print_stat (indent + 2, &cur->decl);
cur = cur->next;
}
f_print (fout, "\n\t\t} else {\n");
cur = psav;
while (cur != dl)
{
emit_inline (indent + 1, &cur->decl, flag);
cur = cur->next;
}
tabify (fout, indent + 1);
f_print (fout, "}\n");
}
size = 0;
i = 0;
sizestr = NULL;
print_stat (indent + 1, &dl->decl);
}
}
if (i > 0)
if (sizestr == NULL && size < inlineflag)
{
/* don't expand into inline code if size < inlineflag */
while (cur != dl)
{
print_stat (indent + 1, &cur->decl);
cur = cur->next;
}
}
else
{
/* were already looking at a xdr_inlineable structure */
if (sizestr == NULL)
f_print (fout, "\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
size);
else if (size == 0)
f_print (fout,
"\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
sizestr);
else
f_print (fout,
"\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
size, sizestr);
f_print (fout, "\n\t\tif (buf == NULL) {\n");
psav = cur;
while (cur != NULL)
{
print_stat (indent + 2, &cur->decl);
cur = cur->next;
}
f_print (fout, "\t\t} else {\n");
cur = psav;
while (cur != dl)
{
emit_inline (indent + 2, &cur->decl, flag);
cur = cur->next;
}
f_print (fout, "\t\t}\n");
}
}
/* this may be const. i haven't traced this one through yet. */
static void
emit_struct (definition * def)
{
decl_list *dl;
int i,j,size,flag;
decl_list *cur = NULL,*psav;
int j, size, flag;
bas_type *ptr;
char *sizestr;
const char *plus;
char ptemp[256];
int can_inline;
if(inlineflag == 0) {
if (inlineflag == 0)
{
/* No xdr_inlining at all */
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
print_stat (1, &dl->decl);
return;
}
else {
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
if(dl->decl.rel == REL_VECTOR){
if (dl->decl.rel == REL_VECTOR)
{
f_print (fout, "\tint i;\n");
break;
}
size=0;can_inline=0;
size = 0;
can_inline = 0;
/*
* Make a first pass and see if inling is possible.
*/
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
if((dl->decl.prefix == NULL) && ((ptr=find_type(dl->decl.type))!= NULL) && ((dl->decl.rel == REL_ALIAS)||(dl->decl.rel == REL_VECTOR))){
if ((dl->decl.prefix == NULL) &&
((ptr = find_type (dl->decl.type)) != NULL) &&
((dl->decl.rel == REL_ALIAS) || (dl->decl.rel == REL_VECTOR)))
{
if (dl->decl.rel == REL_ALIAS)
size += ptr->length;
else {
else
{
can_inline = 1;
break; /* can be inlined */
};
}
else {
if(size >= inlineflag){
}
else
{
if (size >= inlineflag)
{
can_inline = 1;
break; /* can be inlined */
}
@ -432,157 +652,21 @@ emit_struct(definition *def)
if (size > inlineflag)
can_inline = 1;
if(can_inline == 0){ /* can not inline, drop back to old mode */
if (can_inline == 0)
{ /* can not inline, drop back to old mode */
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
print_stat (1, &dl->decl);
return;
};
flag = PUT;
for(j=0; j<2; j++){
for (j = 0; j < 2; j++)
{
inline_struct (def, flag);
if (flag == PUT)
f_print(fout,"\n\t if (xdrs->x_op == XDR_ENCODE) {\n");
else
f_print(fout,"\n \t return TRUE;\n\t} else if (xdrs->x_op == XDR_DECODE) {\n");
i=0;
size=0;
sizestr=NULL;
for (dl = def->def.st.decls; dl != NULL; dl = dl->next) { /* xxx */
/* now walk down the list and check for basic types */
if((dl->decl.prefix == NULL) && ((ptr=find_type(dl->decl.type))!= NULL) && ((dl->decl.rel == REL_ALIAS)||(dl->decl.rel == REL_VECTOR))){
if(i ==0 )
cur=dl;
i++;
if(dl->decl.rel == REL_ALIAS)
size+=ptr->length;
else {
/* this is required to handle arrays */
if(sizestr == NULL)
plus = " ";
else
plus = "+";
if(ptr->length != 1)
s_print(ptemp," %s %s * %d",plus,dl->decl.array_max,ptr->length);
else
s_print(ptemp," %s %s ",plus,dl->decl.array_max);
/*now concatenate to sizestr !!!! */
if (sizestr == NULL)
sizestr=strdup(ptemp);
else{
sizestr=realloc(sizestr,strlen(sizestr)+strlen(ptemp)+1);
if(sizestr == NULL){
f_print(stderr, "Fatal error : no memory \n");
crash();
};
sizestr=strcat(sizestr,ptemp); /*build up length of array */
}
}
}
else{
if(i > 0 )
if(sizestr == NULL && size < inlineflag){
/* don't expand into inline code if size < inlineflag */
while(cur != dl){
print_stat(1,&cur->decl);
cur=cur->next;
}
}
else{
/* were already looking at a xdr_inlineable structure */
if(sizestr == NULL)
f_print(fout,"\t buf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
size);
else
if(size == 0)
f_print(fout,
"\t buf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
sizestr);
else
f_print(fout,
"\t buf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
size,sizestr);
f_print(fout,"\n\t if (buf == NULL) {\n");
psav=cur;
while(cur != dl){
print_stat(2,&cur->decl);
cur=cur->next;
}
f_print(fout,"\n\t }\n\t else {\n");
cur=psav;
while(cur != dl){
emit_inline(&cur->decl,flag);
cur=cur->next;
}
f_print(fout,"\t }\n");
}
size=0;i=0;sizestr=NULL;
print_stat(1,&dl->decl);
}
}
if(i > 0 )
if(sizestr == NULL && size < inlineflag){
/* don't expand into inline code if size < inlineflag */
while(cur != dl){
print_stat(1,&cur->decl);
cur=cur->next;
}
}
else{
/* were already looking at a xdr_inlineable structure */
if(sizestr == NULL)
f_print(fout,"\t\tbuf = XDR_INLINE(xdrs,%d * BYTES_PER_XDR_UNIT);",
size);
else
if(size == 0)
f_print(fout,
"\t\tbuf = XDR_INLINE(xdrs,%s * BYTES_PER_XDR_UNIT);",
sizestr);
else
f_print(fout,
"\t\tbuf = XDR_INLINE(xdrs,(%d + %s)* BYTES_PER_XDR_UNIT);",
size,sizestr);
f_print(fout,"\n\t\tif (buf == NULL) {\n");
psav=cur;
while(cur != NULL){
print_stat(2,&cur->decl);
cur=cur->next;
}
f_print(fout,"\n\t }\n\t else {\n");
cur=psav;
while(cur != dl){
emit_inline(&cur->decl,flag);
cur=cur->next;
}
f_print(fout,"\t }\n");
}
flag = GET;
}
f_print (fout, "\t return TRUE;\n\t}\n\n");
/* now take care of XDR_FREE case */
@ -590,8 +674,6 @@ emit_struct(definition *def)
for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
print_stat (1, &dl->decl);
}
}
static void
emit_typedef (const definition * def)
@ -601,7 +683,6 @@ emit_typedef(const definition *def)
const char *amax = def->def.ty.array_max;
relation rel = def->def.ty.rel;
print_ifstat (1, prefix, type, rel, amax, "objp", def->def_name);
}
@ -614,90 +695,112 @@ print_stat(int indent, const declaration *dec)
relation rel = dec->rel;
char name[256];
if (isvectordef(type, rel)) {
if (isvectordef (type, rel))
{
s_print (name, "objp->%s", dec->name);
} else {
}
else
{
s_print (name, "&objp->%s", dec->name);
}
print_ifstat (indent, prefix, type, rel, amax, name, dec->name);
}
void
emit_inline(declaration *decl, int flag)
static void
emit_inline (int indent, declaration * decl, int flag)
{
/*check whether an array or not */
switch (decl->rel)
{
case REL_ALIAS:
emit_single_in_line(decl,flag,REL_ALIAS);
emit_single_in_line (indent, decl, flag, REL_ALIAS);
break;
case REL_VECTOR:
f_print(fout,"\t\t{ register %s *genp; \n",decl->type);
f_print(fout,"\t\t for ( i = 0,genp=objp->%s;\n \t\t\ti < %s; i++){\n\t\t",
decl->name,decl->array_max);
emit_single_in_line(decl,flag,REL_VECTOR);
f_print(fout,"\t\t }\n\t\t };\n");
tabify (fout, indent);
f_print (fout, "{\n");
tabify (fout, indent + 1);
f_print (fout, "register %s *genp;\n\n", decl->type);
tabify (fout, indent + 1);
f_print (fout,
"for (i = 0, genp = objp->%s;\n", decl->name);
tabify (fout, indent + 2);
f_print (fout, "i < %s; ++i) {\n", decl->array_max);
emit_single_in_line (indent + 2, decl, flag, REL_VECTOR);
tabify (fout, indent + 1);
f_print (fout, "}\n");
tabify (fout, indent);
f_print (fout, "}\n");
break;
default:
/* ?... do nothing I guess */
}
}
void
emit_single_in_line(declaration *decl, int flag, relation rel)
static void
emit_single_in_line (int indent, declaration *decl, int flag, relation rel)
{
char *upp_case1;
const char *upp_case;
char *upp_case;
int freed = 0;
if (flag == PUT) {
f_print(fout,"\t\t IXDR_PUT_");
}
else {
if(rel== REL_ALIAS) {
f_print(fout, "\t\t objp->%s = IXDR_GET_", decl->name);
}
else {
f_print(fout,"\t\t *genp++ = IXDR_GET_");
}
tabify (fout, indent);
if (flag == PUT)
f_print (fout, "IXDR_PUT_");
else
{
if (rel == REL_ALIAS)
f_print (fout, "objp->%s = IXDR_GET_", decl->name);
else
f_print (fout, "*genp++ = IXDR_GET_");
}
upp_case1 = upcase(decl->type);
upp_case = upp_case1;
upp_case = upcase (decl->type);
/* hack - XX */
if (!strcmp(upp_case, "INT")) upp_case="LONG";
if (!strcmp(upp_case, "U_INT")) upp_case="U_LONG";
if (flag == PUT) {
if (rel==REL_ALIAS) {
f_print(fout,"%s(buf,objp->%s);\n",upp_case,decl->name);
if (!strcmp (upp_case, "INT"))
{
free (upp_case);
freed = 1;
upp_case = "LONG";
}
else {
if (!strcmp (upp_case, "U_INT"))
{
free (upp_case);
freed = 1;
upp_case = "U_LONG";
}
if (flag == PUT)
{
if (rel == REL_ALIAS)
f_print (fout, "%s(buf, objp->%s);\n", upp_case, decl->name);
else
f_print (fout, "%s(buf, *genp++);\n", upp_case);
}
}
else {
else
{
f_print (fout, "%s(buf);\n", upp_case);
}
free(upp_case1);
if (!freed)
free (upp_case);
}
static char *upcase(const char *str) {
static char *
upcase (const char *str)
{
char *ptr, *hptr;
ptr = malloc (strlen (str));
if (ptr == NULL) {
if (ptr == NULL)
{
f_print (stderr, "malloc failed\n");
exit (1);
}
hptr = ptr;
while (*str != 0) {
while (*str != '\0')
*ptr++ = toupper (*str++);
}
*ptr=0;
*ptr = '\0';
return hptr;
}

View File

@ -56,6 +56,32 @@ static void penumdef(definition *def);
static void ptypedef (definition * def);
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
*/
@ -66,10 +92,12 @@ print_datadef(definition *def)
if (def->def_kind == DEF_PROGRAM) /* handle data only */
return;
if (def->def_kind != DEF_CONST) {
if (def->def_kind != DEF_CONST)
{
f_print (fout, "\n");
}
switch (def->def_kind) {
switch (def->def_kind)
{
case DEF_STRUCT:
pstructdef (def);
break;
@ -89,11 +117,12 @@ print_datadef(definition *def)
pconstdef (def);
break;
}
if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST) {
pxdrfuncdecl( def->def_name,
if (def->def_kind != DEF_PROGRAM && def->def_kind != DEF_CONST)
{
storexdrfuncdecl(def->def_name,
def->def_kind != DEF_TYPEDEF ||
!isvectordef(def->def.ty.old_type, def->def.ty.rel));
!isvectordef(def->def.ty.old_type,
def->def.ty.rel));
}
}
@ -101,7 +130,8 @@ print_datadef(definition *def)
void
print_funcdef (definition *def)
{
switch (def->def_kind) {
switch (def->def_kind)
{
case DEF_PROGRAM:
f_print (fout, "\n");
pprogramdef (def);
@ -112,18 +142,17 @@ print_funcdef(definition *def)
}
void
pxdrfuncdecl(const char *name, int pointerp)
print_xdr_func_def (char *name, int pointerp, int i)
{
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,"#elif __STDC__ \n");
f_print(fout, "extern bool_t xdr_%s(XDR *, %s%s);\n", name, name, pointerp ? "*" : "");
f_print(fout,"#else /* Old Style C */ \n");
f_print(fout, "bool_t xdr_%s();\n", name);
f_print(fout,"#endif /* Old Style C */ \n\n");
if (i == 2)
{
f_print (fout, "extern bool_t xdr_%s ();\n", name);
return;
}
else
f_print(fout, "extern bool_t xdr_%s (XDR *, %s%s);\n", name,
name, pointerp ? "*" : "");
}
static void
pconstdef (definition *def)
@ -142,30 +171,32 @@ pargdef(definition *def)
const char *name;
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;
plist = plist->next) {
plist = plist->next)
{
if (!newstyle || plist->arg_num < 2) {
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) {
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);
storexdrfuncdecl (name, 0);
f_print (fout, "\n");
}
}
}
static void
pstructdef (definition *def)
{
@ -173,7 +204,8 @@ pstructdef(definition *def)
const char *name = def->def_name;
f_print (fout, "struct %s {\n", name);
for (l = def->def.st.decls; l != NULL; l = l->next) {
for (l = def->def.st.decls; l != NULL; l = l->next)
{
pdeclaration (name, &l->decl, 1, ";\n");
}
f_print (fout, "};\n");
@ -189,18 +221,23 @@ puniondef(definition *def)
f_print (fout, "struct %s {\n", name);
decl = &def->def.un.enum_decl;
if (streq(decl->type, "bool")) {
if (streq (decl->type, "bool"))
{
f_print (fout, "\tbool_t %s;\n", decl->name);
} else {
}
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) {
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")) {
if (decl && !streq (decl->type, "void"))
{
pdeclaration (name, decl, 2, ";\n");
}
f_print (fout, "\t} %s_u;\n", name);
@ -226,12 +263,17 @@ define_printed(proc_list *stop, version_list *start)
version_list *vers;
proc_list *proc;
for (vers = start; vers != NULL; vers = vers->next) {
for (proc = vers->procs; proc != NULL; proc = proc->next) {
if (proc == stop) {
return (0);
} else if (streq(proc->proc_name, stop->proc_name)) {
return (1);
for (vers = start; vers != NULL; vers = vers->next)
{
for (proc = vers->procs; proc != NULL; proc = proc->next)
{
if (proc == stop)
{
return 0;
}
else if (streq (proc->proc_name, stop->proc_name))
{
return 1;
}
}
}
@ -239,6 +281,17 @@ define_printed(proc_list *stop, version_list *start)
/* NOTREACHED */
}
static void
pfreeprocdef (const char *name, const char *vers, int mode)
{
f_print (fout, "extern int ");
pvname (name, vers);
if (mode == 1)
f_print (fout,"_freeresult (SVCXPRT *, xdrproc_t, caddr_t);\n");
else
f_print (fout,"_freeresult ();\n");
}
static void
pprogramdef (definition *def)
{
@ -250,8 +303,10 @@ pprogramdef(definition *def)
pargdef (def);
puldefine (def->def_name, def->def.pr.prog_num);
for (vers = def->def.pr.versions; vers != NULL; vers = vers->next) {
if (tblflag) {
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",
@ -260,38 +315,61 @@ pprogramdef(definition *def)
puldefine (vers->vers_name, vers->vers_num);
/*
* Print out 3 definitions, one for ANSI-C, another for C++,
* a third for old style C
* Print out 2 definitions, one for ANSI-C, another for
* old K & R C
*/
for (i=0;i<3;i++) {
if (i==0) {
f_print(fout,"\n#ifdef __cplusplus\n");
ext="extern \"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);
}
else if (i==1) {
f_print(fout,"\n#elif __STDC__\n");
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 /* Old Style C */ \n");
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)) {
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");
}
f_print(fout,"#endif /* Old Style C */ \n");
}
}
@ -299,31 +377,32 @@ void
pprocdef (proc_list * proc, version_list * vp,
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 0 == cplusplus, mode 1 = ANSI-C, mode 2 = old style C
* mode 1 = ANSI-C, mode 2 = K&R C
*/
if(mode == 0 || mode ==1)
if (mode == 1)
parglist (proc, addargtype);
else
f_print (fout, "();\n");
}
/* print out argument list of procedure */
static void
parglist (proc_list *proc, const char *addargtype)
@ -331,12 +410,15 @@ parglist(proc_list *proc, const char *addargtype)
decl_list *dl;
f_print(fout,"(");
if (proc->arg_num < 2 && newstyle &&
streq( proc->args.decls->decl.type, "void")) {
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) {
}
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 */
@ -344,9 +426,13 @@ parglist(proc_list *proc, const char *addargtype)
f_print (fout, ", ");
}
}
if (mtflag)
{
ptype(proc->res_prefix, proc->res_type, 1);
f_print(fout, "*, ");
}
f_print (fout, "%s);\n", addargtype);
}
static void
@ -358,16 +444,23 @@ penumdef(definition *def)
int count = 0;
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) {
if (l->assignment)
{
f_print (fout, " = %s", l->assignment);
last = l->assignment;
count = 1;
} else {
if (last == NULL) {
}
else
{
if (last == NULL)
{
f_print (fout, " = %d", count++);
} else {
}
else
{
f_print (fout, " = %s + %d", last, count++);
}
}
@ -385,23 +478,32 @@ ptypedef(definition *def)
char prefix[8]; /* enough to contain "struct ", including NUL */
relation rel = def->def.ty.rel;
if (!streq(name, old)) {
if (streq(old, "string")) {
if (!streq (name, old))
{
if (streq (old, "string"))
{
old = "char";
rel = REL_POINTER;
} else if (streq(old, "opaque")) {
}
else if (streq (old, "opaque"))
{
old = "char";
} else if (streq(old, "bool")) {
}
else if (streq (old, "bool"))
{
old = "bool_t";
}
if (undefined2(old, name) && def->def.ty.old_prefix) {
if (undefined2 (old, name) && def->def.ty.old_prefix)
{
s_print (prefix, "%s ", def->def.ty.old_prefix);
} else {
}
else
{
prefix[0] = 0;
}
f_print (fout, "typedef ");
switch (rel) {
switch (rel)
{
case REL_ARRAY:
f_print (fout, "struct {\n");
f_print (fout, "\tu_int %s_len;\n", name);
@ -431,29 +533,41 @@ pdeclaration(const char *name, declaration *dec, int tab,
const char *prefix;
const char *type;
if (streq(dec->type, "void")) {
if (streq (dec->type, "void"))
{
return;
}
tabify (fout, tab);
if (streq(dec->type, name) && !dec->prefix) {
if (streq (dec->type, name) && !dec->prefix)
{
f_print (fout, "struct ");
}
if (streq(dec->type, "string")) {
if (streq (dec->type, "string"))
{
f_print (fout, "char *%s", dec->name);
} else {
}
else
{
prefix = "";
if (streq(dec->type, "bool")) {
if (streq (dec->type, "bool"))
{
type = "bool_t";
} else if (streq(dec->type, "opaque")) {
}
else if (streq (dec->type, "opaque"))
{
type = "char";
} else {
if (dec->prefix) {
}
else
{
if (dec->prefix)
{
s_print (buf, "%s ", dec->prefix);
prefix = buf;
}
type = dec->type;
}
switch (dec->rel) {
switch (dec->rel)
{
case REL_ALIAS:
f_print (fout, "%s%s %s", prefix, type, dec->name);
break;
@ -484,15 +598,20 @@ undefined2(const char *type, const char *stop)
list *l;
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) {
if (streq(def->def_name, stop)) {
return (1);
} else if (streq(def->def_name, type)) {
return (0);
if (def->def_kind != DEF_PROGRAM)
{
if (streq (def->def_name, stop))
{
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

View File

@ -31,7 +31,7 @@
/*
* From: @(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI
*/
char parse_rcsid[] =
const char parse_rcsid[] =
"$Id$";
/*
@ -72,7 +72,8 @@ get_definition(void)
defp = ALLOC (definition);
get_token (&tok);
switch (tok.kind) {
switch (tok.kind)
{
case TOK_STRUCT:
def_struct (defp);
break;
@ -121,7 +122,8 @@ def_struct(definition *defp)
defp->def_name = tok.str;
scan (TOK_LBRACE, &tok);
tailp = &defp->def.st.decls;
do {
do
{
get_declaration (&dec, DEF_STRUCT);
decls = ALLOC (decl_list);
decls->decl = dec;
@ -129,7 +131,8 @@ def_struct(definition *defp)
tailp = &decls->next;
scan (TOK_SEMICOLON, &tok);
peek (&tok);
} while (tok.kind != TOK_RBRACE);
}
while (tok.kind != TOK_RBRACE);
get_token (&tok);
*tailp = NULL;
}
@ -154,18 +157,21 @@ def_program(definition *defp)
vtailp = &defp->def.pr.versions;
tailp = &defp->def.st.decls;
scan (TOK_VERSION, &tok);
do {
do
{
scan (TOK_IDENT, &tok);
vlist = ALLOC (version_list);
vlist->vers_name = tok.str;
scan (TOK_LBRACE, &tok);
ptailp = &vlist->procs;
do {
do
{
/* get result type */
plist = ALLOC (proc_list);
get_type (&plist->res_prefix, &plist->res_type,
DEF_PROGRAM);
if (streq(plist->res_type, "opaque")) {
if (streq (plist->res_type, "opaque"))
{
error ("illegal result type");
}
scan (TOK_IDENT, &tok);
@ -186,7 +192,8 @@ def_program(definition *defp)
decls->decl = dec;
tailp = &decls->next;
/* get args */
while(peekscan(TOK_COMMA, &tok)) {
while (peekscan (TOK_COMMA, &tok))
{
num_args++;
get_prog_declaration (&dec, DEF_STRUCT,
num_args);
@ -198,10 +205,12 @@ def_program(definition *defp)
tailp = &decls->next;
}
/* multiple arguments are only allowed in newstyle */
if( !newstyle && num_args > 1 ) {
if (!newstyle && num_args > 1)
{
error ("only one argument is allowed");
}
if (isvoid && num_args > 1) {
if (isvoid && num_args > 1)
{
error ("illegal use of void in program definition");
}
*tailp = NULL;
@ -214,7 +223,8 @@ def_program(definition *defp)
*ptailp = plist;
ptailp = &plist->next;
peek (&tok);
} while (tok.kind != TOK_RBRACE);
}
while (tok.kind != TOK_RBRACE);
*ptailp = NULL;
*vtailp = vlist;
vtailp = &vlist->next;
@ -224,14 +234,16 @@ def_program(definition *defp)
vlist->vers_num = tok.str;
/* make the argument structure name for each arg */
for (plist = vlist->procs; plist != NULL;
plist = plist->next) {
plist = plist->next)
{
plist->args.argname = make_argname (plist->proc_name,
vlist->vers_num);
/* free the memory ?? */
}
scan (TOK_SEMICOLON, &tok);
scan2 (TOK_VERSION, TOK_RBRACE, &tok);
} while (tok.kind == TOK_VERSION);
}
while (tok.kind == TOK_VERSION);
scan (TOK_EQUAL, &tok);
scan_num (&tok);
defp->def.pr.prog_num = tok.str;
@ -251,20 +263,23 @@ def_enum(definition *defp)
defp->def_name = tok.str;
scan (TOK_LBRACE, &tok);
tailp = &defp->def.en.vals;
do {
do
{
scan (TOK_IDENT, &tok);
elist = ALLOC (enumval_list);
elist->name = tok.str;
elist->assignment = NULL;
scan3 (TOK_COMMA, TOK_RBRACE, TOK_EQUAL, &tok);
if (tok.kind == TOK_EQUAL) {
if (tok.kind == TOK_EQUAL)
{
scan_num (&tok);
elist->assignment = tok.str;
scan2 (TOK_COMMA, TOK_RBRACE, &tok);
}
*tailp = elist;
tailp = &elist->next;
} while (tok.kind != TOK_RBRACE);
}
while (tok.kind != TOK_RBRACE);
*tailp = NULL;
}
@ -302,7 +317,8 @@ def_union(definition *defp)
scan (TOK_RPAREN, &tok);
scan (TOK_LBRACE, &tok);
scan (TOK_CASE, &tok);
while (tok.kind == TOK_CASE) {
while (tok.kind == TOK_CASE)
{
scan2 (TOK_IDENT, TOK_CHARCONST, &tok);
cases = ALLOC (case_list);
cases->case_name = tok.str;
@ -322,10 +338,10 @@ def_union(definition *defp)
cases->case_name = tok.str;
scan (TOK_COLON, &tok);
}while(peekscan(TOK_CASE,&tok));
}
else
if(flag)
while (peekscan (TOK_CASE, &tok));
}
else if (flag)
{
*tailp = cases;
@ -343,14 +359,17 @@ def_union(definition *defp)
scan3 (TOK_CASE, TOK_DEFAULT, TOK_RBRACE, &tok);
}
*tailp = NULL;
if (tok.kind == TOK_DEFAULT) {
if (tok.kind == TOK_DEFAULT)
{
scan (TOK_COLON, &tok);
get_declaration (&dec, DEF_UNION);
defp->def.un.default_decl = ALLOC (declaration);
*defp->def.un.default_decl = dec;
scan (TOK_SEMICOLON, &tok);
scan (TOK_RBRACE, &tok);
} else {
}
else
{
defp->def.un.default_decl = NULL;
}
}
@ -383,21 +402,27 @@ static const char *reserved_types[] =
* check that the given name is not one that would eventually result in
* xdr routines that would conflict with internal XDR routines.
*/
static void check_type_name(const char *name, int new_type)
static void
check_type_name (const char *name, int new_type)
{
int i;
char tmp[100];
for( i = 0; reserved_words[i] != NULL; i++ ) {
if( strcmp( name, reserved_words[i] ) == 0 ) {
for (i = 0; reserved_words[i] != NULL; i++)
{
if (strcmp (name, reserved_words[i]) == 0)
{
sprintf (tmp,
"illegal (reserved) name :\'%s\' in type definition", name);
error (tmp);
}
}
if( new_type ) {
for( i = 0; reserved_types[i] != NULL; i++ ) {
if( strcmp( name, reserved_types[i] ) == 0 ) {
if (new_type)
{
for (i = 0; reserved_types[i] != NULL; i++)
{
if (strcmp (name, reserved_types[i]) == 0)
{
sprintf (tmp,
"illegal (reserved) name :\'%s\' in type definition", name);
error (tmp);
@ -430,60 +455,76 @@ get_declaration(declaration *dec, defkind dkind)
get_type (&dec->prefix, &dec->type, dkind);
dec->rel = REL_ALIAS;
if (streq(dec->type, "void")) {
if (streq (dec->type, "void"))
{
return;
}
check_type_name (dec->type, 0);
scan2 (TOK_STAR, TOK_IDENT, &tok);
if (tok.kind == TOK_STAR) {
if (tok.kind == TOK_STAR)
{
dec->rel = REL_POINTER;
scan (TOK_IDENT, &tok);
}
dec->name = tok.str;
if (peekscan(TOK_LBRACKET, &tok)) {
if (dec->rel == REL_POINTER) {
if (peekscan (TOK_LBRACKET, &tok))
{
if (dec->rel == REL_POINTER)
{
error ("no array-of-pointer declarations -- use typedef");
}
dec->rel = REL_VECTOR;
scan_num (&tok);
dec->array_max = tok.str;
scan (TOK_RBRACKET, &tok);
} else if (peekscan(TOK_LANGLE, &tok)) {
if (dec->rel == REL_POINTER) {
}
else if (peekscan (TOK_LANGLE, &tok))
{
if (dec->rel == REL_POINTER)
{
error ("no array-of-pointer declarations -- use typedef");
}
dec->rel = REL_ARRAY;
if (peekscan(TOK_RANGLE, &tok)) {
if (peekscan (TOK_RANGLE, &tok))
{
dec->array_max = "~0"; /* unspecified size, use max */
} else {
}
else
{
scan_num (&tok);
dec->array_max = tok.str;
scan (TOK_RANGLE, &tok);
}
}
if (streq(dec->type, "opaque")) {
if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR) {
if (streq (dec->type, "opaque"))
{
if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR)
{
error ("array declaration expected");
}
} else if (streq(dec->type, "string")) {
if (dec->rel != REL_ARRAY) {
}
else if (streq (dec->type, "string"))
{
if (dec->rel != REL_ARRAY)
{
error ("variable-length array declaration expected");
}
}
}
static void
get_prog_declaration (declaration * dec, defkind dkind, int num /* arg number */ )
{
token tok;
char name[10]; /* argument name */
if (dkind == DEF_PROGRAM) {
if (dkind == DEF_PROGRAM)
{
peek (&tok);
if (tok.kind == TOK_RPAREN) { /* no arguments */
if (tok.kind == TOK_RPAREN)
{ /* no arguments */
dec->rel = REL_ALIAS;
dec->type = "void";
dec->prefix = NULL;
@ -500,36 +541,47 @@ get_prog_declaration(declaration *dec, defkind dkind, int num /* arg number */)
dec->name = (char *) strdup (name);
if (streq(dec->type, "void")) {
if (streq (dec->type, "void"))
{
return;
}
if (streq(dec->type, "opaque")) {
if (streq (dec->type, "opaque"))
{
error ("opaque -- illegal argument type");
}
if (peekscan(TOK_STAR, &tok)) {
if (streq(dec->type, "string")) {
if (peekscan (TOK_STAR, &tok))
{
if (streq (dec->type, "string"))
{
error ("pointer to string not allowed in program arguments\n");
}
dec->rel = REL_POINTER;
if (peekscan (TOK_IDENT, &tok)) /* optional name of argument */
dec->name = strdup (tok.str);
}
if (peekscan(TOK_LANGLE, &tok)) {
if (!streq(dec->type, "string")) {
if (peekscan (TOK_LANGLE, &tok))
{
if (!streq (dec->type, "string"))
{
error ("arrays cannot be declared as arguments to procedures -- use typedef");
}
dec->rel = REL_ARRAY;
if (peekscan(TOK_RANGLE, &tok)) {
if (peekscan (TOK_RANGLE, &tok))
{
dec->array_max = "~0"; /* unspecified size, use max */
} else {
}
else
{
scan_num (&tok);
dec->array_max = tok.str;
scan (TOK_RANGLE, &tok);
}
}
if (streq(dec->type, "string")) {
if (dec->rel != REL_ARRAY) { /* .x specifies just string as
if (streq (dec->type, "string"))
{
if (dec->rel != REL_ARRAY)
{ /* .x specifies just string as
* type of argument
* - make it string<>
*/
@ -539,8 +591,6 @@ get_prog_declaration(declaration *dec, defkind dkind, int num /* arg number */)
}
}
static void
get_type (const char **prefixp, const char **typep, defkind dkind)
{
@ -548,7 +598,8 @@ get_type(const char **prefixp, const char **typep, defkind dkind)
*prefixp = NULL;
get_token (&tok);
switch (tok.kind) {
switch (tok.kind)
{
case TOK_IDENT:
*typep = tok.str;
break;
@ -571,7 +622,8 @@ get_type(const char **prefixp, const char **typep, defkind dkind)
(void) peekscan (TOK_INT, &tok);
break;
case TOK_VOID:
if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
if (dkind != DEF_UNION && dkind != DEF_PROGRAM)
{
error ("voids allowed only inside union and program definitions with one argument");
}
*typep = tok.str;
@ -596,7 +648,8 @@ unsigned_dec(const char **typep)
token tok;
peek (&tok);
switch (tok.kind) {
switch (tok.kind)
{
case TOK_CHAR:
get_token (&tok);
*typep = "u_char";

View File

@ -69,14 +69,14 @@ write_sample_clnt (definition * def)
int count = 0;
if (def->def_kind != DEF_PROGRAM)
return (0);
return 0;
/* generate sample code for each version */
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{
write_sample_client (def->def_name, vp);
++count;
}
return (count);
return count;
}
@ -99,17 +99,33 @@ write_sample_client (const char *program_name, version_list * vp)
for (proc = vp->procs; proc != NULL; proc = proc->next)
{
f_print (fout, "\t");
++i;
if (mtflag)
{
f_print (fout, "enum clnt_stat retval_%d;\n\t", i);
ptype (proc->res_prefix, proc->res_type, 1);
f_print (fout, " *result_%d;\n", ++i);
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 */
if (proc->arg_num < 2 && !newstyle)
{
f_print (fout, "\t");
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
f_print (fout, "char *"); /* cannot have "void" type */
f_print (fout, " ");
pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_arg;\n");
}
@ -119,25 +135,30 @@ write_sample_client (const char *program_name, version_list * vp)
{
f_print (fout, "\t");
ptype (l->decl.prefix, l->decl.type, 1);
if (strcmp (l->decl.type, "string") == 1)
f_print (fout, " ");
pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_%s;\n", l->decl.name);
/* pdeclaration(proc->args.argname, &l->decl, 1, ";\n" ); */
}
}
}
/* generate creation of client handle */
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");
f_print (fout, "\tif (clnt == NULL) {\n");
f_print (fout, "\t\tclnt_pcreateerror (host);\n");
f_print (fout, "\t\texit (1);\n\t}\n");
f_print(fout, "#endif\t/* DEBUG */\n\n");
/* generate calls to procedures */
i = 0;
for (proc = vp->procs; proc != NULL; proc = proc->next)
{
if (mtflag)
f_print(fout, "\tretval_%d = ",++i);
else
f_print (fout, "\tresult_%d = ", ++i);
pvname (proc->proc_name, vp->vers_num);
if (proc->arg_num < 2 && !newstyle)
@ -147,10 +168,16 @@ write_sample_client (const char *program_name, version_list * vp)
f_print (fout, "(void*)");
f_print (fout, "&");
pvname (proc->proc_name, vp->vers_num);
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"))
{
if (mtflag)
f_print (fout, "(&result_%d, clnt);\n", i);
else
f_print (fout, "(clnt);\n");
}
else
@ -161,14 +188,27 @@ write_sample_client (const char *program_name, version_list * vp)
pvname (proc->proc_name, vp->vers_num);
f_print (fout, "_%s, ", l->decl.name);
}
if (mtflag)
f_print(fout, "&result_%d, ", i);
f_print (fout, "clnt);\n");
}
f_print (fout, "\tif (result_%d == NULL) {\n", i);
f_print (fout, "\t\tclnt_perror(clnt, \"call failed:\");\n");
if (mtflag)
{
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, "#ifndef\tDEBUG\n");
f_print (fout, "\tclnt_destroy (clnt);\n");
f_print (fout, "#endif\t /* DEBUG */\n");
f_print (fout, "}\n");
}
@ -183,34 +223,62 @@ write_sample_server (definition * def)
for (proc = vp->procs; proc != NULL; proc = proc->next)
{
f_print (fout, "\n");
/* if( Cflag )
f_print( fout, "extern \"C\"{\n");
*/
if (!mtflag)
{
return_type (proc);
f_print (fout, "*\n");
if (Cflag)
}
else
f_print (fout, "bool_t\n");
if (Cflag || mtflag)
pvname_svc (proc->proc_name, vp->vers_num);
else
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\tstatic ");
if (!mtflag)
{
f_print(fout, "\tstatic ");
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,
"\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");
*/
f_print(fout, "char *");
/* cannot have void type */
/* f_print(fout, " result;\n", proc->res_type); */
f_print(fout, " result;\n");
}
else
f_print(fout, "\tbool_t retval;\n");
fprintf (fout, "\n\t/*\n\t * insert server code here\n\t */\n\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,9 +310,9 @@ write_sample_clnt_main (void)
f_print (fout, "\n\n");
if (Cflag)
f_print (fout, "main( int argc, char* argv[] )\n{\n");
f_print (fout, "int\nmain (int argc, char *argv[])\n{\n");
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, "\n\n\tif (argc < 2) {");
@ -266,5 +334,5 @@ write_sample_clnt_main (void)
f_print (fout, " (host);\n");
}
}
f_print (fout, "}\n");
f_print (fout, "exit (0);\n}\n");
}

View File

@ -70,10 +70,8 @@ scan (tok_kind expect, token * tokp)
{
get_token (tokp);
if (tokp->kind != expect)
{
expected1 (expect);
}
}
/*
* scan expecting any of the 2 given tokens
@ -114,7 +112,7 @@ scan_num (token * tokp)
case TOK_IDENT:
break;
default:
error ("constant or identifier expected");
error (_("constant or identifier expected"));
}
}
@ -138,9 +136,9 @@ peekscan (tok_kind expect, token * tokp)
if (tokp->kind == expect)
{
get_token (tokp);
return (1);
return 1;
}
return (0);
return 0;
}
/*

View File

@ -48,6 +48,7 @@ static const char TRANSP[] = "transp";
static const char ARG[] = "argument";
static const char RESULT[] = "result";
static const char ROUTINE[] = "local";
static char RETVAL[] = "retval";
char _errbuf[256]; /* For all messages */
@ -103,12 +104,31 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
#endif
f_print (fout, "%s int _rpcpmstart;", var_type);
f_print (fout, "\t\t/* Started by a port monitor ? */\n");
if (!tirpcflag)
{
f_print (fout, "%s int _rpcfdtype;", var_type);
f_print (fout, "\t\t/* Whether Stream or Datagram ? */\n");
}
if (timerflag)
{
#if 0
f_print (fout, "%s int _rpcsvcdirty;", var_type);
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);
}
@ -147,6 +167,11 @@ write_most (const char *infile /* our name */ , int netflag, int nomain)
f_print (fout, "\tpid_t pid;\n");
f_print (fout, "\tint i;\n");
f_print (fout, "\tchar mname[FMNAMESZ + 1];\n\n");
if (mtflag & timerflag)
f_print (fout,
"\tmutex_init (&_svcstate_lock, USYNC_THREAD, NULL);\n");
write_pm_most (infile, netflag);
f_print (fout, "\telse {\n");
write_rpc_svc_fg (infile, "\t\t");
@ -190,7 +215,7 @@ write_netid_register (const char *transp)
f_print (fout, "%s\t%s = svc_tli_create (RPC_ANYFD, nconf, 0, 0, 0);\n",
sp, TRANSP /*, 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);
f_print (fout, "%s\t\texit (1);\n", sp);
f_print (fout, "%s\t}\n", sp);
@ -204,11 +229,9 @@ write_netid_register (const char *transp)
}
for (vp = def->def.pr.versions; vp != NULL; vp = vp->next)
{
f_print (fout,
"%s\t(void) rpcb_unset(%s, %s, nconf);\n",
f_print (fout, "%s\t(void) rpcb_unset (%s, %s, nconf);\n",
sp, def->def_name, vp->vers_name);
f_print (fout,
"%s\tif (!svc_reg(%s, %s, %s, ",
f_print (fout, "%s\tif (!svc_reg (%s, %s, %s, ",
sp, TRANSP, def->def_name, vp->vers_name);
pvname (def->def_name, vp->vers_num);
f_print (fout, ", nconf)) {\n");
@ -312,8 +335,6 @@ write_programs (const char *storage)
write_program (def, storage);
}
}
}
/* write out definition of internal function (e.g. _printmsg_1(...))
@ -333,8 +354,11 @@ write_real_program (const definition * def)
{
for (proc = vp->procs; proc != NULL; proc = proc->next)
{
f_print (fout, "\n");
fprintf (fout, "\n");
if (!mtflag)
internal_proctype (proc);
else
f_print (fout, "int");
f_print (fout, "\n_");
pvname (proc->proc_name, vp->vers_num);
if (Cflag)
@ -346,11 +370,20 @@ write_real_program (const definition * def)
else
ptype (proc->args.decls->decl.prefix,
proc->args.decls->decl.type, 0);
if (mtflag)
{
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
{
if (mtflag)
f_print(fout, " (argp, %s, %s)\n", RESULT, RQSTP);
else
f_print (fout, " (argp, %s)\n", RQSTP);
/* arg name */
if (proc->arg_num > 1)
@ -367,7 +400,7 @@ write_real_program (const definition * def)
f_print (fout, "{\n");
f_print (fout, "\treturn (");
if (Cflag)
if (Cflag || mtflag)
pvname_svc (proc->proc_name, vp->vers_num);
else
pvname (proc->proc_name, vp->vers_num);
@ -451,25 +484,57 @@ write_program (const definition * def, const char *storage)
f_print (fout, "\t\tint fill;\n");
}
f_print (fout, "\t} %s;\n", ARG);
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)
{
f_print (fout, "\txdrproc_t xdr_%s, xdr_%s;\n", ARG, RESULT);
if (mtflag)
f_print(fout,
"\tchar *(*%s)(char *, struct svc_req *);\n",
"\tbool_t (*%s)(char *, void *, struct svc_req *);\n",
ROUTINE);
else
f_print (fout, "\tchar *(*%s)(char *, struct svc_req *);\n",
ROUTINE);
}
else
{
f_print (fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT);
if (mtflag)
f_print(fout, "\tbool_t (*%s)();\n", ROUTINE);
else
f_print (fout, "\tchar *(*%s)();\n", ROUTINE);
}
f_print (fout, "\n");
if (timerflag)
#if 0
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);
if (!nullproc (vp->procs))
{
@ -495,9 +560,19 @@ write_program (const definition * def, const char *storage)
}
p_xdrfunc (RESULT, proc->res_type);
if (Cflag)
{
if (mtflag)
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
if (mtflag)
f_print(fout, "\t\t%s = (bool_t (*)()) ", ROUTINE);
else
f_print (fout, "\t\t%s = (char *(*)()) ", ROUTINE);
@ -505,7 +580,7 @@ write_program (const definition * def, const char *storage)
{ /* new style: calls internal routine */
f_print (fout, "_");
}
if (Cflag && !newstyle)
if ((Cflag || mtflag) && !newstyle)
pvname_svc (proc->proc_name, vp->vers_num);
else
pvname (proc->proc_name, vp->vers_num);
@ -517,7 +592,7 @@ write_program (const definition * def, const char *storage)
print_return ("\t\t");
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)
printif ("getargs", TRANSP, "(caddr_t) &", ARG);
else
@ -526,15 +601,29 @@ write_program (const definition * def, const char *storage)
print_return ("\t\t");
f_print (fout, "\t}\n");
if (!mtflag)
if (Cflag)
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
if (Cflag)
f_print(fout, "\t%s = (bool_t) (*%s)((char *)&%s, (void *)&%s, %s);\n",
RETVAL, ROUTINE, ARG, RESULT, RQSTP);
else
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);
f_print (fout, "\t}\n");
@ -542,10 +631,22 @@ write_program (const definition * def, const char *storage)
printif ("freeargs", TRANSP, "(caddr_t) &", ARG);
else
printif ("freeargs", TRANSP, "&", ARG);
(void) sprintf (_errbuf, "unable to free arguments");
sprintf (_errbuf, "unable to free arguments");
print_err_message ("\t\t");
f_print (fout, "\t\texit (1);\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");
f_print (fout, "}\n");
}
@ -572,10 +673,10 @@ nullproc (const proc_list * proc)
{
if (streq (proc->proc_num, "0"))
{
return (1);
return 1;
}
}
return (0);
return 0;
}
static void
@ -614,7 +715,17 @@ print_return (const char *space)
else
{
if (timerflag)
{
#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);
}
}
@ -634,7 +745,7 @@ print_pmapunset (const char *space)
for (vp = def->def.pr.versions; vp != NULL;
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);
}
}
@ -688,7 +799,7 @@ write_msg_out (void)
f_print (fout, "\tif (_rpcpmstart)\n");
f_print (fout, "\t\tsyslog (LOG_ERR, msg);\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, "\tsyslog (LOG_ERR, msg);\n");
f_print (fout, "#endif\n");
@ -705,20 +816,23 @@ write_timeout_func (void)
return;
f_print (fout, "\n");
f_print (fout, "static void\n");
#ifdef __GNU_LIBRARY__
if (Cflag)
f_print (fout, "closedown (int sig)\n");
else
f_print (fout, "closedown (sig)\n\tint sig;\n");
#else
f_print (fout, "closedown()\n");
#endif
f_print (fout, "{\n");
#ifdef __GNU_LIBRARY__
#if defined (__GNU_LIBRARY__) && 0
f_print (fout, "\t(void) signal (sig, %s closedown);\n",
Cflag ? "(SIG_PF)" : "(void(*)())");
#endif
if (mtflag)
f_print(fout, "\tmutex_lock(&_svcstate_lock);\n");
#if 0
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\tstatic int size;\n");
f_print (fout, "\t\tint i, openfd;\n");
@ -738,8 +852,10 @@ write_timeout_func (void)
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\tgetrlimit(RLIMIT_NOFILE, &rl);\n");
f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0)\n");
f_print (fout, "\t\t\t\treturn;\n");
f_print (fout, "\t\t\tif ((size = rl.rlim_max) == 0) {\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
{
@ -752,7 +868,13 @@ write_timeout_func (void)
f_print (fout, "\t\tif (openfd <= 1)\n");
f_print (fout, "\t\t\texit (0);\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");
}
@ -915,9 +1037,6 @@ open_log_file (const char *infile, const char *sp)
*s = '.';
}
/*
* write a registration for the given transport for Inetd
*/

View File

@ -145,6 +145,9 @@ fixit (const char *type, const char *orig)
switch (def->def.ty.rel)
{
case REL_VECTOR:
if (streq (def->def.ty.old_type, "opaque"))
return ("char");
else
return (def->def.ty.old_type);
case REL_ALIAS:
return (fixit (def->def.ty.old_type, orig));
@ -227,7 +230,7 @@ isvectordef (const char *type, relation rel)
case REL_ARRAY:
return 0;
case REL_POINTER:
return (0);
return 0;
case REL_ALIAS:
def = findval (defined, type, typedefed);
if (def == NULL)
@ -290,7 +293,7 @@ crash (void)
for (i = 0; i < nfiles; i++)
{
(void) unlink (outfiles[i]);
unlink (outfiles[i]);
}
exit (1);
}

View File

@ -48,6 +48,13 @@ struct list {
};
typedef struct list list;
struct xdrfunc {
char *name;
int pointerp;
struct xdrfunc *next;
};
typedef struct xdrfunc xdrfunc;
#define PUT 1
#define GET 2
@ -65,9 +72,9 @@ extern FILE *fin;
extern list *defined;
extern bas_type *typ_list_h;
extern bas_type *typ_list_t;
extern xdrfunc *xdrfunc_head, *xdrfunc_tail;
/*
* All the option flags
@ -78,8 +85,10 @@ extern int tblflag;
extern int logflag;
extern int newstyle;
extern int Cflag; /* C++ flag */
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 mtflag;
/*
* Other flags related with inetd jumpstart.

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.
# 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.
-chmod a-w $(hurd)/errnos.h-tmp
./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
ifeq ($(with-cvs),yes)
test ! -d CVS || \
(cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
endif
touch $@
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.
# 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.
-chmod a-w $@-tmp
mv -f $@-tmp $@
ifeq ($(with-cvs),yes)
test ! -d CVS || cvs commit -m'Regenerated from $<' $@
endif
sysdep-realclean := $(sysdep-realclean) $(divrem:%=sysdeps/sparc/sparc32/%.S)