* locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and
	_NL_CTYPE_MAP_NAMES field to stringlist.
	Change name of _NL_CTYPE_CODESET_NAME to "charmap".
	* locale/localeinfo.h (enum value_type): Add stringlist.
	* locale/programs/locale.c (show_info): Handle stringlist.

	* locale/programs/charmap.c (charmap_read): If charmap file is not
	using the given name try to find it by looking through all available
	charmap files and compare the code set name.
	* locale/programs/locale.c (write_charmaps): Also print names of
	charset in <code_set_name> fields in the files.

	* elf/ldd.bash.in: Correct translatable strings.

	* posix/TESTS: Add some more tests for character class matching.
	* posix/regex.c: Merge with GNU awk version.
	(regex_compile): Use ISO C/amend 1 functions for character class
	handling.
	* posix/regex.h: Merge with GNU awk version.

	* posix/getopt.c: Declare as master copies.
	* posix/getopt1.c: Likewise.
	* posix/getopt.h: Likewise.

	* sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option
	value to mount functions.
	Patch by a sun <asun@zoology.washington.edu>.

	* stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency
	with other tests.
	* sunrpc/svc_run.c (svc_exit): New, defined.
	(svc_run): Test for svc_stop variable.
	* sysdeps/m68k/s_cexp.c: Rewritten.
	* sysdeps/m68k/s_cexpf.c: Likewise.
	* sysdeps/m68k/s_cexpl.c: Likewise.
This commit is contained in:
Ulrich Drepper 1997-05-07 15:31:21 +00:00
parent 1f07e61775
commit 51702635af
71 changed files with 2884 additions and 811 deletions

View File

@ -1,5 +1,33 @@
1997-05-07 16:31 Ulrich Drepper <drepper@cygnus.com>
* locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and
_NL_CTYPE_MAP_NAMES field to stringlist.
Change name of _NL_CTYPE_CODESET_NAME to "charmap".
* locale/localeinfo.h (enum value_type): Add stringlist.
* locale/programs/locale.c (show_info): Handle stringlist.
* locale/programs/charmap.c (charmap_read): If charmap file is not
using the given name try to find it by looking through all available
charmap files and compare the code set name.
* locale/programs/locale.c (write_charmaps): Also print names of
charset in <code_set_name> fields in the files.
* elf/ldd.bash.in: Correct translatable strings.
* posix/TESTS: Add some more tests for character class matching.
* posix/regex.c: Merge with GNU awk version.
(regex_compile): Use ISO C/amend 1 functions for character class
handling.
* posix/regex.h: Merge with GNU awk version.
* posix/getopt.c: Declare as master copies.
* posix/getopt1.c: Likewise.
* posix/getopt.h: Likewise.
* sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option
value to mount functions.
Patch by a sun <asun@zoology.washington.edu>.
* sysdeps/i386/dl-machine.h (elf_machine_rel): Check for mismatch
in size for copy relocation.
* sysdeps/m68k/dl-machine.h (elf_machine_rela): Likewise.
@ -9,13 +37,13 @@
1997-05-06 13:25 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency
with other tests.
* stdio-common/bug3.c (main): Use /tmp/bug3.test for concurrency
with other tests.
* stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency
with other tests.
* sunrpc/svc_run.c: svc_exit): New, defined. (svc_run): Test for
svc_stop variable.
* sunrpc/svc_run.c (svc_exit): New, defined.
(svc_run): Test for svc_stop variable.
* sunrpc/rpc/svc.h (svc_exit): New, declared.
1997-05-03 08:47 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
@ -40,10 +68,13 @@
* sysdeps/m68k/s_ccosh.c: Rewritten.
* sysdeps/m68k/s_csinh.c: Rewritten.
* sysdeps/m68k/s_cexp.c: Rewritten.
* sysdeps/m68k/s_ccoshf.c: Don't define huge_val.
* sysdeps/m68k/s_ccoshl.c: Likewise.
* sysdeps/m68k/s_csinhf.c: Likewise.
* sysdeps/m68k/s_csinhl.c: Likewise.
* sysdeps/m68k/s_cexpf.c: Likewise.
* sysdeps/m68k/s_cexpl.c: Likewise.
* sysdeps/m68k/s_ccos.c: New file.
* sysdeps/m68k/s_ccosf.c: New file.

View File

@ -477,8 +477,8 @@ others: $(addprefix $(objpfx),$(install-lib))
ifndef objects
# Create the stamp$o files to keep the parent makefile happy.
subdir_lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir))
$(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir)):
subdir_lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o)
$(foreach o,$(object-suffixes),$(objpfx)stamp$o):
$(make-target-directory)
rm -f $@; > $@
else
@ -490,19 +490,19 @@ else
define o-iterator-doit
$(common-objpfx)$(patsubst %,$(libtype$o),c)(\
$(addsuffix .%,$(filter-out $(elide-routines$o),$(notdir $(objects:.o=))))): \
$(objpfx)stamp.%-$(subdir) ;
$(objpfx)stamp.% ;
endef
object-suffixes-left := $(object-suffixes)
include $(o-iterator)
# The pattern rule tells Make to remake $(objpfx)stamp.%-$(subdir) as
# The pattern rule tells Make to remake $(objpfx)stamp.% as
# the way to update all the foo.% object files in $(objects). Now we
# define explicit rules to update each $(objpfx)stamp.SUFFIX-$(subdir)
# define explicit rules to update each $(objpfx)stamp.SUFFIX
# timestamp file; these rules (one explicit rule is generated for each
# object suffix) will update the parent archive with ar. Use a static
# pattern rule so $* is set to the object type during the commands.
define o-iterator-doit
$(objpfx)stamp$o-$(subdir): $(objpfx)stamp%-$(subdir): $(o-objects); $$(do-ar)
$(objpfx)stamp$o: $(objpfx)stamp%: $(o-objects); $$(do-ar)
endef
object-suffixes-left := $(object-suffixes)
include $(o-iterator)
@ -529,7 +529,7 @@ $(common-objpfx)$(patsubst %,$(libtype$o),c)($(ar-symtab-name)): \
$$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c)
endef
ifndef subdir
subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%-$d)
subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
$(subdirs-stamps): subdir_lib;
endif
@ -866,7 +866,7 @@ common-mostlyclean:
$(rmobjs)
define rmobjs
$(foreach o,$(object-suffixes),
-rm -f $(addprefix $(objpfx),stamp$o-$(subdir)) $(o-objects))
-rm -f $(objpfx)stamp$o $(o-objects))
endef
# Also remove the dependencies and generated source files.

3
config.guess vendored
View File

@ -168,6 +168,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;;
2020:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >dummy.c
int main (argc, argv) int argc; char **argv; {

View File

@ -81,6 +81,10 @@ $(objpfx)defs.h: $(objpfx)initfini.s
endif
ifeq (yes,$(elf))
extra-objs += abi-note.o
endif
include ../Rules
define link-relocatable

View File

@ -32,18 +32,18 @@
#define ELF_NOTE_BEGIN(sectname, sectflags, type, name) \
.section sectname, sectflags; \
.align ALIGNARG(2); /* Notes are 4-byte aligned. */ \
.align 4; /* Notes are 4-byte aligned. */ \
.long 1f - 0f; /* 32-bit word: length of name field */ \
.long 3f - 2f; /* 32-bit word: length of desc field */ \
.long (type); /* 32-bit word: vendor-defined type field */ \
0: .asciz name; /* null-terminated string, any length: name */\
1: .align ALIGNARG(2); /* Name data padded to 4-byte alignment. */ \
1: .align 4; /* Name data padded to 4-byte alignment. */ \
2: /* Here follows the "note descriptor" data, whose format \
is not specified by ELF. The vendor name and type field \
indicate what sort of data is found here. */
#define ELF_NOTE_END \
3: .align ALIGNARG(2) /* Pad to 4-byte align the next note. */
3: .align 4 /* Pad to 4-byte align the next note. */
/* The linker (GNU ld 2.8 and later) recognize an allocated section whose

View File

@ -35,8 +35,8 @@ bind_now=
while test $# -gt 0; do
case "$1" in
--v | --ve | --ver | --vers | --versi | --versio | --version)
echo $"ldd (GNU libc) @VERSION@
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
echo '"ldd (GNU libc) @VERSION@'
echo $"Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
exit 0 ;;
@ -61,7 +61,7 @@ Report bugs using the \`glibcbug' script to <bugs@gnu.ai.mit.edu>."
--) # Stop option processing.
shift; break ;;
-*)
echo >&2 $"ldd: unrecognized option" "\`$1'"
echo >&2 'ldd:' $"unrecognized option" "\`$1'"
echo >&2 $"Try \`ldd --help' for more information."
exit 1 ;;
*)
@ -72,7 +72,7 @@ done
add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
case $# in
0)
echo >&2 $"ldd: missing file arguments"
echo >&2 'ldd:' $"missing file arguments"
echo >&2 $"Try \`ldd --help' for more information."
exit 1 ;;
1)
@ -86,7 +86,7 @@ case $# in
exit 1
elif test -r "$file"; then
test -x "$file" ||
echo $"ldd: warning: you do not have execution permission for" "\`$file'"
echo 'ldd:' $"warning: you do not have execution permission for" "\`$file'"
${RTLD} --verify "$file"
case $? in
0)
@ -100,12 +100,12 @@ case $# in
eval $add_env exec \${RTLD} '"$file"' || exit 1
;;
*)
echo $"ldd: ${RTLD} exited with unknown exit code ($?)" >&2
echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($?)" >&2
exit 1
;;
esac
else
echo $"ldd: error: you do not have read permission for" "\`$file'"
echo 'ldd:' $"error: you do not have read permission for" "\`$file'"
exit 1
fi
exit ;;
@ -121,8 +121,8 @@ case $# in
echo "ldd: ${file}:" $"no such file"
result=1
elif test -r "$file"; then
test -x "$file" || echo $"\
ldd: warning: you do not have execution permission for" "\`$file'"
test -x "$file" || echo 'ldd:' $"\
warning: you do not have execution permission for" "\`$file'"
${RTLD} --verify "$file"
case $? in
0)
@ -136,12 +136,12 @@ ldd: warning: you do not have execution permission for" "\`$file'"
eval $add_env ${RTLD} '"$file"' || result=1
;;
*)
echo $"ldd: ${RTLD} exited with unknown exit code ($?)" >&2
echo 'ldd:' ${RTLD} $"exited with unknown exit code" "($?)" >&2
exit 1
;;
esac
else
echo $"ldd: error: you do not have read permission for" "\`$file'"
echo 'ldd:' $"error: you do not have read permission for" "\`$file'"
result=1
fi
done

View File

@ -84,11 +84,11 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (_NL_CTYPE_NAMES_EL, "ctype-names-el", std, string)
DEFINE_ELEMENT (_NL_CTYPE_HASH_SIZE, "ctype-hash-size", std, word)
DEFINE_ELEMENT (_NL_CTYPE_HASH_LAYERS, "ctype-hash-layers", std, word)
DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, string)
DEFINE_ELEMENT (_NL_CTYPE_CLASS_NAMES, "ctype-class-names", std, stringlist)
DEFINE_ELEMENT (_NL_CTYPE_MAP_NAMES, "ctype-map-names", std, stringlist)
DEFINE_ELEMENT (_NL_CTYPE_WIDTH, "ctype-width", std, bytearray)
DEFINE_ELEMENT (_NL_CTYPE_MB_CUR_MAX, "ctype-mb-cur-max", std, word)
DEFINE_ELEMENT (_NL_CTYPE_CODESET_NAME, "ctype-codeset-name", std, string)
DEFINE_ELEMENT (_NL_CTYPE_CODESET_NAME, "charmap", std, string)
), _nl_postload_ctype, ctype_input, ctype_check, ctype_output)

View File

@ -81,7 +81,8 @@ enum value_type
stringarray,
byte,
bytearray,
word
word,
stringlist
};

View File

@ -22,6 +22,7 @@
#endif
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <libintl.h>
#include <obstack.h>
@ -76,6 +77,73 @@ charmap_read (const char *filename)
error (0, errno, _("character map file `%s' not found"), filename);
}
if (result == NULL)
{
/* OK, one more try. We also accept the names given to the
character sets in the files. Sometimes they differ from the
file name. */
DIR *dir;
struct dirent *dirent;
dir = opendir (CHARMAP_PATH);
if (dir == NULL)
{
while ((dirent = readdir (dir)) != NULL)
if (strcmp (dirent->d_name, ".") != 0
&& strcmp (dirent->d_name, "..") != 0)
{
char buf[sizeof (CHARMAP_PATH)
+ strlen (dirent->d_name) + 1];
FILE *fp;
#ifdef _DIRENT_HAVE_D_TYPE
if (dirent->d_type != DT_UNKNOWN && dirent->d_type != DT_REG)
continue;
#endif
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"),
dirent->d_name);
fp = fopen (buf, "r");
if (fp != NULL)
{
char *name = NULL;
while (!feof (fp))
{
char junk[BUFSIZ];
if (fscanf (fp, " <code_set_name> %as", &name) == 1)
break;
do
fgets (junk, sizeof junk, fp);
while (strchr (junk, '\n') == NULL);
}
fclose (fp);
if (name != NULL)
{
if (strcmp (name, filename) == 0)
{
result = parse_charmap (buf);
free (buf);
if (result)
return result;
break;
}
free (name);
}
}
}
closedir (dir);
}
}
if (result == NULL)
{
pathnfile = CHARMAP_PATH "/" DEFAULT_CHARMAP;

View File

@ -456,7 +456,9 @@ write_charmaps (void)
if (strcmp (dirent->d_name, ".") != 0
&& strcmp (dirent->d_name, "..") != 0)
{
char *buf = NULL;
mode_t mode;
#ifdef _DIRENT_HAVE_D_TYPE
if (dirent->d_type != DT_UNKNOWN)
mode = DTTOIF (dirent->d_type);
@ -464,7 +466,8 @@ write_charmaps (void)
#endif
{
struct stat st;
char buf[sizeof (CHARMAP_PATH) + strlen (dirent->d_name) + 1];
buf = alloca (sizeof (CHARMAP_PATH) + strlen (dirent->d_name) + 1);
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"), dirent->d_name);
@ -474,7 +477,44 @@ write_charmaps (void)
}
if (S_ISREG (mode))
PUT (strdup (dirent->d_name));
{
FILE *fp;
PUT (strdup (dirent->d_name));
/* Read the file and learn about the code set name. */
if (buf == NULL)
{
buf = alloca (sizeof (CHARMAP_PATH)
+ strlen (dirent->d_name) + 1);
stpcpy (stpcpy (stpcpy (buf, CHARMAP_PATH), "/"),
dirent->d_name);
}
fp = fopen (buf, "r");
if (fp != NULL)
{
char *name = NULL;
while (!feof (fp))
{
char junk[BUFSIZ];
if (fscanf (fp, " <code_set_name> %as", &name) == 1)
break;
do
fgets (junk, sizeof junk, fp);
while (strchr (junk, '\n') == NULL);
}
fclose (fp);
if (name != NULL)
PUT (name);
}
}
}
closedir (dir);
@ -496,8 +536,8 @@ show_locale_vars (void)
{
char *val = getenv (name);
if (lcall != NULL || val == NULL)
printf ("%s=\"%s\"\n", name, lcall ? : lang);
if ((lcall ?: "")[0] != '\0' || val == NULL)
printf ("%s=\"%s\"\n", name, (lcall ?: "")[0] ? lcall : lang);
else
printf ("%s=%s\n", name, val);
}
@ -553,6 +593,21 @@ show_info (const char *name)
putchar ('"');
}
break;
case stringlist:
{
int first = 1;
const char *val = nl_langinfo (item->item_id) ? : "";
while (*val != '\0')
{
printf ("%s%s%s%s", first ? "" : ";",
show_keyword_name ? "\"" : "", val,
show_keyword_name ? "\"" : "");
val = strchr (val, '\0') + 1;
first = 0;
}
}
break;
case byte:
{
const char *val = nl_langinfo (item->item_id);

View File

@ -174,9 +174,9 @@ $(glibc-targets):
# Create stamp files if they don't exist, so the parent makefile's rules for
# updating the library archives are happy with us, and never think we have
# changed the library.
lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o-$(subdir))
lib: $(foreach o,$(object-suffixes),$(objpfx)stamp$o)
stubs: $(common-objpfx)stub-manual
$(common-objpfx)stub-manual ../po/manual.pot $(objpfx)stamp%-$(subdir):
$(common-objpfx)stub-manual ../po/manual.pot $(objpfx)stamp%:
$(make-target-directory)
cp /dev/null $@

View File

@ -1,5 +1,5 @@
%% TeX macros to handle Texinfo files.
%% $Id: texinfo.tex,v 2.197 1997/04/30 15:34:30 drepper Exp $
%% $Id: texinfo.tex,v 2.198 1997/05/07 15:16:03 drepper Exp $
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 96, 97 Free Software Foundation, Inc.
@ -36,7 +36,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
\deftexinfoversion$Revision: 2.197 $
\deftexinfoversion$Revision: 2.198 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number
@ -147,11 +147,7 @@
% \onepageout takes a vbox as an argument. Note that \pagecontents
% does insertions, but you have to call it yourself.
\def\onepageout#1{%
\ifcropmarks
\hoffset = 0pt
\else
\hoffset = \normaloffset
\fi
\ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
%
\ifodd\pageno \advance\hoffset by \bindingoffset
\else \advance\hoffset by -\bindingoffset\fi
@ -171,17 +167,20 @@
\normalturnoffactive % \ in index entries must not stay \, e.g., if
% the page break happens to be in the middle of an example.
\shipout\vbox{%
\ifcropmarks
\vbox to \outervsize\bgroup
\hsize = \outerhsize
\vbox{\line{\ewtop\hfill\ewtop}}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vskip\topandbottommargin
\ifcropmarks \vbox to \outervsize\bgroup
\hsize = \outerhsize
\line{\ewtop\hfil\ewtop}%
\nointerlineskip
\line{%
\vbox{\moveleft\cornerthick\nstop}%
\hfill
\vbox{\moveright\cornerthick\nstop}%
}%
\vskip\topandbottommargin
\line\bgroup
\hfil % center the page within the outer (page) hsize.
\ifodd\pageno\hskip\bindingoffset\fi
\vbox\bgroup
\fi
%
\unvbox\headlinebox
@ -189,19 +188,21 @@
\unvbox\footlinebox
%
\ifcropmarks
\vskip\topandbottommargin plus1fill minus1fill
\boxmaxdepth = \cornerthick
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
}%
\nointerlineskip
\vbox{\line{\ewbot\hfill\ewbot}}%
\egroup % \vbox from first cropmarks clause
\egroup % end of \vbox\bgroup
\hfil\egroup % end of (centering) \line\bgroup
\vskip\topandbottommargin plus1fill minus1fill
\boxmaxdepth = \cornerthick
\line{%
\vbox{\moveleft\cornerthick\nsbot}%
\hfill
\vbox{\moveright\cornerthick\nsbot}%
}%
\nointerlineskip
\line{\ewbot\hfil\ewbot}%
\egroup % \vbox from first cropmarks clause
\fi
}%
}%
}% end of \shipout\vbox
}% end of group with \turnoffactive
\advancepageno
\ifnum\outputpenalty>-20000 \else\dosupereject\fi
}
@ -219,7 +220,6 @@
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
}
%
% Here are the rules for the cropmarks. Note that they are
% offset so that the space between them is truly \outerhsize or \outervsize
% (P. A. MacKay, 12 November, 1986)
@ -2408,27 +2408,16 @@ width0pt\relax} \fi
% Define the macros used in formatting output of the sorted index material.
% This is what you call to cause a particular index to get printed.
% Write
% @unnumbered Function Index
% @printindex fn
% @printindex causes a particular index (the ??s file) to get printed.
% It does not print any chapter heading (usually an @unnumbered).
%
\def\printindex{\parsearg\doprintindex}
\def\doprintindex#1{\begingroup
\dobreak \chapheadingskip{10000}%
%
\indexfonts \rm
\tolerance = 9500
\indexbreaks
\def\indexbackslash{\rawbackslashxx}%
% Index files are almost Texinfo source, but we use \ as the escape
% character. It would be better to use @, but that's too big a change
% to make right now.
\catcode`\\ = 0
\catcode`\@ = 11
\escapechar = `\\
\begindoublecolumns
%
% See if the index file exists and is nonempty.
\openin 1 \jobname.#1s
@ -2447,11 +2436,19 @@ width0pt\relax} \fi
\ifeof 1
(Index is empty)
\else
% Index files are almost Texinfo source, but we use \ as the escape
% character. It would be better to use @, but that's too big a change
% to make right now.
\def\indexbackslash{\rawbackslashxx}%
\catcode`\\ = 0
\catcode`\@ = 11
\escapechar = `\\
\begindoublecolumns
\input \jobname.#1s
\enddoublecolumns
\fi
\fi
\closein 1
\enddoublecolumns
\endgroup}
% These macros are used by the sorted index file itself.
@ -2553,24 +2550,39 @@ width0pt\relax} \fi
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
% Grab any single-column material above us.
\output = {\global\setbox\partialpage
=\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
\output = {\global\setbox\partialpage = \vbox{%
%
% Here is a possibility not foreseen in manmac: if we accumulate a
% whole lot of material, we might end up calling this \output
% routine twice in a row (see the doublecol-lose test, which is
% essentially a couple of indexes with @setchapternewpage off). In
% that case, we must prevent the second \partialpage from
% simply overwriting the first, causing us to lose the page.
% This will preserve it until a real output routine can ship it
% out. Generally, \partialpage will be empty when this runs and
% this will be a no-op.
\unvbox\partialpage
%
% Unvbox the main output page.
\unvbox255
\kern-\topskip \kern\baselineskip
}}%
\eject
%
% Now switch to the double-column output routine.
\output={\doublecolumnout}%
% Use the double-column output routine for subsequent pages.
\output = {\doublecolumnout}%
%
% Change the page size parameters. We could do this once outside this
% routine, in each of @smallbook, @afourpaper, and the default 8.5x11
% format, but then we repeat the same computation. Repeating a couple
% of assignments once per index is clearly meaningless for the
% execution time, so we may as well do it once.
% execution time, so we may as well do it in one place.
%
% First we halve the line length, less a little for the gutter between
% the columns. We compute the gutter based on the line length, so it
% changes automatically with the paper format. The magic constant
% below is chosen so that the gutter has the same value (well, +- <
% 1pt) as it did when we hard-coded it.
% below is chosen so that the gutter has the same value (well, +-<1pt)
% as it did when we hard-coded it.
%
% We put the result in a separate register, \doublecolumhsize, so we
% can restore it in \pagesofar, after \hsize itself has (potentially)
@ -2591,100 +2603,103 @@ width0pt\relax} \fi
% (undoubled) page height minus any material left over from the
% previous page.
\dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
% box0 will be the left-hand column, box1 the right.
% box0 will be the left-hand column, box2 the right.
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
\onepageout\pagesofar
\unvbox255 \penalty\outputpenalty
\unvbox255
\penalty\outputpenalty
}
\def\pagesofar{%
% The contents of the output page -- any previous material,
% Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split.
\unvbox\partialpage
\hsize = \doublecolumnhsize
\wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
}
\def\enddoublecolumns{%
\output={\balancecolumns}\eject % split what we have
\endgroup
\output = {\balancecolumns}\eject % split what we have
\endgroup % started in \begindoublecolumns
%
% Back to normal single-column typesetting, but take account of the
% fact that we just accumulated some stuff on the output page.
\pagegoal=\vsize
\pagegoal = \vsize
}
\def\balancecolumns{%
% Called on the last page of the double column material.
\setbox0=\vbox{\unvbox255}%
% Called at the end of the double column material.
\setbox0 = \vbox{\unvbox255}%
\dimen@ = \ht0
\advance\dimen@ by \topskip
\advance\dimen@ by-\baselineskip
\divide\dimen@ by 2
\splittopskip = \topskip
% Loop until we get a decent breakpoint.
{\vbadness=10000 \loop \global\setbox3=\copy0
{\vbadness=10000 \loop
\global\setbox3=\copy0
\global\setbox1=\vsplit3 to\dimen@
\ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}%
\ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
\repeat}%
\setbox0=\vbox to\dimen@{\unvbox1}%
\setbox2=\vbox to\dimen@{\unvbox3}%
\pagesofar
}
\catcode `\@=\other
\catcode`\@ = \other
\message{sectioning,}
% Define chapters, sections, etc.
\newcount \chapno
\newcount \secno \secno=0
\newcount \subsecno \subsecno=0
\newcount \subsubsecno \subsubsecno=0
\newcount\chapno
\newcount\secno \secno=0
\newcount\subsecno \subsecno=0
\newcount\subsubsecno \subsubsecno=0
% This counter is funny since it counts through charcodes of letters A, B, ...
\newcount \appendixno \appendixno = `\@
\newcount\appendixno \appendixno = `\@
\def\appendixletter{\char\the\appendixno}
\newwrite \contentsfile
\newwrite\contentsfile
% This is called from \setfilename.
\def\opencontents{\openout \contentsfile = \jobname.toc}
\def\opencontents{\openout\contentsfile = \jobname.toc }
% Each @chapter defines this as the name of the chapter.
% page headings and footings can use it. @section does likewise
\def\thischapter{} \def\thissection{}
\def\seccheck#1{\if \pageno<0 %
\errmessage{@#1 not allowed after generating table of contents}\fi
%
}
\def\seccheck#1{\ifnum \pageno<0
\errmessage{@#1 not allowed after generating table of contents}%
\fi}
\def\chapternofonts{%
\let\rawbackslash=\relax%
\let\frenchspacing=\relax%
\def\result{\realbackslash result}
\def\equiv{\realbackslash equiv}
\def\expansion{\realbackslash expansion}
\def\print{\realbackslash print}
\def\TeX{\realbackslash TeX}
\def\dots{\realbackslash dots}
\def\copyright{\realbackslash copyright}
\def\tt{\realbackslash tt}
\def\bf{\realbackslash bf }
\def\w{\realbackslash w}
\def\less{\realbackslash less}
\def\gtr{\realbackslash gtr}
\def\hat{\realbackslash hat}
\def\char{\realbackslash char}
\def\tclose##1{\realbackslash tclose {##1}}
\def\code##1{\realbackslash code {##1}}
\def\samp##1{\realbackslash samp {##1}}
\def\r##1{\realbackslash r {##1}}
\def\b##1{\realbackslash b {##1}}
\def\key##1{\realbackslash key {##1}}
\def\file##1{\realbackslash file {##1}}
\def\kbd##1{\realbackslash kbd {##1}}
% These are redefined because @smartitalic wouldn't work inside xdef.
\def\i##1{\realbackslash i {##1}}
\def\cite##1{\realbackslash cite {##1}}
\def\var##1{\realbackslash var {##1}}
\def\emph##1{\realbackslash emph {##1}}
\def\dfn##1{\realbackslash dfn {##1}}
\let\rawbackslash=\relax
\let\frenchspacing=\relax
\def\result{\realbackslash result}%
\def\equiv{\realbackslash equiv}%
\def\expansion{\realbackslash expansion}%
\def\print{\realbackslash print}%
\def\TeX{\realbackslash TeX}%
\def\dots{\realbackslash dots}%
\def\copyright{\realbackslash copyright}%
\def\tt{\realbackslash tt}%
\def\bf{\realbackslash bf}%
\def\w{\realbackslash w}%
\def\less{\realbackslash less}%
\def\gtr{\realbackslash gtr}%
\def\hat{\realbackslash hat}%
\def\char{\realbackslash char}%
\def\tclose##1{\realbackslash tclose{##1}}%
\def\code##1{\realbackslash code{##1}}%
\def\samp##1{\realbackslash samp{##1}}%
\def\r##1{\realbackslash r{##1}}%
\def\b##1{\realbackslash b{##1}}%
\def\key##1{\realbackslash key{##1}}%
\def\file##1{\realbackslash file{##1}}%
\def\kbd##1{\realbackslash kbd{##1}}%
% These are redefined because @smartitalic wouldn't work inside xdef.
\def\i##1{\realbackslash i{##1}}%
\def\cite##1{\realbackslash cite{##1}}%
\def\var##1{\realbackslash var{##1}}%
\def\emph##1{\realbackslash emph{##1}}%
\def\dfn##1{\realbackslash dfn{##1}}%
}
\newcount\absseclevel % used to calculate proper heading level

View File

@ -221,13 +221,13 @@ static void
test_not_exception (const char *test_name, short int exception)
{
#ifdef FE_DIVBYZERO
if ((exception & FE_DIVBYZERO) == 0)
if ((exception & DIVIDE_BY_ZERO_EXCEPTION) == 0)
test_single_exception (test_name, exception,
DIVIDE_BY_ZERO_EXCEPTION, FE_DIVBYZERO,
"Divide by zero");
#endif
#ifdef FE_INVALID
if ((exception & FE_INVALID) == 0)
if ((exception & INVALID_EXCEPTION) == 0)
test_single_exception (test_name, exception, INVALID_EXCEPTION, FE_INVALID,
"Invalid operation");
#endif
@ -1743,43 +1743,43 @@ cexp_test (void)
result = FUNC(cexp) (BUILD_COMPLEX (0.0, plus_infty));
check_isnan_exc ("real(cexp(0 + i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(0 + i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, plus_infty));
check_isnan_exc ("real(cexp(-0 + i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(-0 + i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (0.0, minus_infty));
check_isnan_exc ("real(cexp(0 - i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(0 - i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (minus_zero, minus_infty));
check_isnan_exc ("real(cexp(-0 - i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(-0 - i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (100.0, plus_infty));
check_isnan_exc ("real(cexp(100.0 + i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(100.0 + i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (-100.0, plus_infty));
check_isnan_exc ("real(cexp(-100.0 + i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(-100.0 + i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (100.0, minus_infty));
check_isnan_exc ("real(cexp(100.0 - i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(100.0 - i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (-100.0, minus_infty));
check_isnan_exc ("real(cexp(-100.0 - i inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(-100.0 - i inf)) = NaN", __imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (minus_infty, 2.0));
@ -1798,12 +1798,12 @@ cexp_test (void)
result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, plus_infty));
check_isinfp_exc ("real(cexp(+inf + i inf)) = +inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(+inf + i inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (plus_infty, minus_infty));
check_isinfp_exc ("real(cexp(+inf - i inf)) = +inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(+inf - i inf)) = NaN plus invalid exception",
__imag__ result);
@ -1824,28 +1824,28 @@ cexp_test (void)
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 0.0));
check_isnan_maybe_exc ("real(cexp(NaN + i0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(NaN + i0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, 1.0));
check_isnan_maybe_exc ("real(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(NaN + 1i)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (nan_value, plus_infty));
check_isnan_maybe_exc ("real(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(NaN + i inf)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (0, nan_value));
check_isnan_maybe_exc ("real(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cexp) (BUILD_COMPLEX (1, nan_value));
check_isnan_maybe_exc ("real(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cexp(1 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -1888,64 +1888,64 @@ csin_test (void)
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 0.0));
check_isnan_exc ("real(csin(+Inf + 0i)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(csin(+Inf + 0i)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 0.0));
check_isnan_exc ("real(csin(-Inf + 0i)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(csin(-Inf + 0i)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_zero));
check_isnan_exc ("real(csin(+Inf - 0i)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(csin(+Inf - 0i)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0.0);
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_zero));
check_isnan_exc ("real(csin(-Inf - 0i)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(csin(-Inf - 0i)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0.0);
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, plus_infty));
check_isnan_exc ("real(csin(+Inf + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isinfp ("imag(csin(+Inf + i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__imag__ result));
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, plus_infty));
check_isnan_exc ("real(csin(-Inf + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isinfp ("imag(csin(-Inf + i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__imag__ result));
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, minus_infty));
check_isnan_exc ("real(csin(Inf - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isinfp ("imag(csin(Inf - i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__imag__ result));
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, minus_infty));
check_isnan_exc ("real(csin(-Inf - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isinfp ("imag(csin(-Inf - i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__imag__ result));
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, 6.75));
check_isnan_exc ("real(csin(+Inf + i 6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(+Inf + i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, -6.75));
check_isnan_exc ("real(csin(+Inf - i 6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(+Inf - i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, 6.75));
check_isnan_exc ("real(csin(-Inf + i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(-Inf + i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, -6.75));
check_isnan_exc ("real(csin(-Inf - i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(-Inf - i6.75)) = NaN plus invalid exception",
__imag__ result);
@ -1979,14 +1979,14 @@ csin_test (void)
FUNC(fabs) (__imag__ result));
result = FUNC(csin) (BUILD_COMPLEX (nan_value, 9.0));
check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybeinvalid exception",
__real__ result, FE_INVALID);
check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybeinvalid exception",
check_isnan_maybe_exc ("real(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(NaN + i9.0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (nan_value, -9.0));
check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybeinvalid exception",
__real__ result, FE_INVALID);
check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybeinvalid exception",
check_isnan_maybe_exc ("real(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(NaN - i9.0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (0.0, nan_value));
@ -1997,22 +1997,26 @@ csin_test (void)
check_isnan ("imag(csin(-0 + NaN)) = NaN", __imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (10.0, nan_value));
check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybeinvalid exception",
__real__ result, FE_INVALID);
check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybeinvalid exception",
check_isnan_maybe_exc ("real(csin(10 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(10 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (nan_value, -10.0));
check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybeinvalid exception",
__real__ result, FE_INVALID);
check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybeinvalid exception",
check_isnan_maybe_exc ("real(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(-10 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (plus_infty, nan_value));
check_isnan ("real(csin(+Inf + i NaN)) = NaN", __real__ result);
check_isnan ("imag(csin(+Inf + i NaN)) = NaN", __imag__ result);
check_isnan_maybe_exc ("real(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(+Inf + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (minus_infty, nan_value));
check_isnan ("real(csin(-Inf + i NaN)) = NaN", __real__ result);
check_isnan ("imag(csin(-Inf + i NaN)) = NaN", __imag__ result);
check_isnan_maybe_exc ("real(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csin(-Inf + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csin) (BUILD_COMPLEX (nan_value, nan_value));
check_isnan ("real(csin(NaN + i NaN)) = NaN", __real__ result);
@ -2040,22 +2044,22 @@ csinh_test (void)
result = FUNC(csinh) (BUILD_COMPLEX (0.0, plus_infty));
check_exc ("real(csinh(0 + i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__real__ result), 0, FE_INVALID);
FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
check_isnan ("imag(csinh(0 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, plus_infty));
check_exc ("real(csinh(-0 + i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__real__ result), 0, FE_INVALID);
FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
check_isnan ("imag(csinh(-0 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (0.0, minus_infty));
check_exc ("real(csinh(0 - i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__real__ result), 0, FE_INVALID);
FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
check_isnan ("imag(csinh(0 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (minus_zero, minus_infty));
check_exc ("real(csinh(-0 - i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__real__ result), 0, FE_INVALID);
FUNC(fabs) (__real__ result), 0, INVALID_EXCEPTION);
check_isnan ("imag(csinh(-0 - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2074,22 +2078,22 @@ csinh_test (void)
result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, plus_infty));
check_isinfp_exc ("real(csinh(+Inf + i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__real__ result), FE_INVALID);
FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
check_isnan ("imag(csinh(+Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, plus_infty));
check_isinfp_exc ("real(csinh(-Inf + i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__real__ result), FE_INVALID);
FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
check_isnan ("imag(csinh(-Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (plus_infty, minus_infty));
check_isinfp_exc ("real(csinh(Inf - i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__real__ result), FE_INVALID);
FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
check_isnan ("imag(csinh(Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (minus_infty, minus_infty));
check_isinfp_exc ("real(csinh(-Inf - i Inf)) = +-Inf plus invalid exception",
FUNC(fabs) (__real__ result), FE_INVALID);
FUNC(fabs) (__real__ result), INVALID_EXCEPTION);
check_isnan ("imag(csinh(-Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2108,22 +2112,22 @@ csinh_test (void)
result = FUNC(csinh) (BUILD_COMPLEX (6.75, plus_infty));
check_isnan_exc ("real(csinh(6.75 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(6.75 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (-6.75, plus_infty));
check_isnan_exc ("real(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(-6.75 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (6.75, minus_infty));
check_isnan_exc ("real(csinh(6.75 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(6.75 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (-6.75, minus_infty));
check_isnan_exc ("real(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(-6.75 - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2145,12 +2149,12 @@ csinh_test (void)
result = FUNC(csinh) (BUILD_COMPLEX (9.0, nan_value));
check_isnan_maybe_exc ("real(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(9.0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (-9.0, nan_value));
check_isnan_maybe_exc ("real(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2163,21 +2167,25 @@ csinh_test (void)
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, 10.0));
check_isnan_maybe_exc ("real(csinh(NaN + i10)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(NaN + i10)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, -10.0));
check_isnan_maybe_exc ("real(csinh(NaN - i10)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(NaN - i10)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, plus_infty));
check_isnan ("real(csinh(NaN + i Inf)) = NaN", __real__ result);
check_isnan ("imag(csinh(NaN + i Inf)) = NaN", __imag__ result);
check_isnan_maybe_exc ("real(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(NaN + i Inf)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, minus_infty));
check_isnan ("real(csinh(NaN - i Inf)) = NaN", __real__ result);
check_isnan ("imag(csinh(NaN - i Inf)) = NaN", __imag__ result);
check_isnan_maybe_exc ("real(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csinh(NaN - i Inf)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csinh) (BUILD_COMPLEX (nan_value, nan_value));
check_isnan ("real(csinh(NaN + i NaN)) = NaN", __real__ result);
@ -2205,22 +2213,22 @@ ccos_test (void)
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 0.0));
check_isnan_exc ("real(ccos(+Inf + i0)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccos(Inf + i0)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_zero));
check_isnan_exc ("real(ccos(Inf - i0)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccos(Inf - i0)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 0.0));
check_isnan_exc ("real(ccos(-Inf + i0)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccos(-Inf + i0)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_zero));
check_isnan_exc ("real(ccos(-Inf - i0)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccos(-Inf - i0)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
@ -2239,22 +2247,22 @@ ccos_test (void)
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, plus_infty));
check_isinfp_exc ("real(ccos(+Inf + i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(+Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, plus_infty));
check_isinfp_exc ("real(ccos(-Inf + i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, minus_infty));
check_isinfp_exc ("real(ccos(Inf - i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, minus_infty));
check_isinfp_exc ("real(ccos(-Inf - i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2273,22 +2281,22 @@ ccos_test (void)
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, 6.75));
check_isnan_exc ("real(ccos(+Inf + i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(+Inf + i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, -6.75));
check_isnan_exc ("real(ccos(+Inf - i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(+Inf - i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, 6.75));
check_isnan_exc ("real(ccos(-Inf + i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-Inf + i6.75)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, -6.75));
check_isnan_exc ("real(ccos(-Inf - i6.75)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-Inf - i6.75)) = NaN plus invalid exception",
__imag__ result);
@ -2308,12 +2316,12 @@ ccos_test (void)
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, 9.0));
check_isnan_maybe_exc ("real(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(NaN + i9.0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (nan_value, -9.0));
check_isnan_maybe_exc ("real(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(NaN - i9.0)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2326,23 +2334,23 @@ ccos_test (void)
result = FUNC(ccos) (BUILD_COMPLEX (10.0, nan_value));
check_isnan_maybe_exc ("real(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(10 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (-10.0, nan_value));
check_isnan_maybe_exc ("real(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-10 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (plus_infty, nan_value));
check_isnan_maybe_exc ("real(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(+Inf + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccos) (BUILD_COMPLEX (minus_infty, nan_value));
check_isnan_maybe_exc ("real(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccos(-Inf + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2372,22 +2380,22 @@ ccosh_test (void)
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, plus_infty));
check_isnan_exc ("real(ccosh(0 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccosh(0 + i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, plus_infty));
check_isnan_exc ("real(ccosh(-0 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccosh(-0 + i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccosh) (BUILD_COMPLEX (0.0, minus_infty));
check_isnan_exc ("real(ccosh(0 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccosh(0 - i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
result = FUNC(ccosh) (BUILD_COMPLEX (minus_zero, minus_infty));
check_isnan_exc ("real(ccosh(-0 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check ("imag(ccosh(-0 - i Inf)) = +-0 plus invalid exception",
FUNC(fabs) (__imag__ result), 0);
@ -2406,22 +2414,22 @@ ccosh_test (void)
result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, plus_infty));
check_isinfp_exc ("real(ccosh(+Inf + i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(+Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, plus_infty));
check_isinfp_exc ("real(ccosh(-Inf + i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(-Inf + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (plus_infty, minus_infty));
check_isinfp_exc ("real(ccosh(Inf - i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (minus_infty, minus_infty));
check_isinfp_exc ("real(ccosh(-Inf - i Inf)) = +Inf plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(-Inf - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2440,22 +2448,22 @@ ccosh_test (void)
result = FUNC(ccosh) (BUILD_COMPLEX (6.75, plus_infty));
check_isnan_exc ("real(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(6.75 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, plus_infty));
check_isnan_exc ("real(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(-6.75 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (6.75, minus_infty));
check_isnan_exc ("real(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(6.75 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (-6.75, minus_infty));
check_isnan_exc ("real(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(-6.75 - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -2475,12 +2483,12 @@ ccosh_test (void)
result = FUNC(ccosh) (BUILD_COMPLEX (9.0, nan_value));
check_isnan_maybe_exc ("real(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(9.0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (-9.0, nan_value));
check_isnan_maybe_exc ("real(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(-9.0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2493,23 +2501,23 @@ ccosh_test (void)
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, 10.0));
check_isnan_maybe_exc ("real(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(NaN + i10)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, -10.0));
check_isnan_maybe_exc ("real(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(NaN - i10)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, plus_infty));
check_isnan_maybe_exc ("real(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(NaN + i Inf)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ccosh) (BUILD_COMPLEX (nan_value, minus_infty));
check_isnan_maybe_exc ("real(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ccosh(NaN - i Inf)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2621,23 +2629,23 @@ cacos_test (void)
result = FUNC(cacos) (BUILD_COMPLEX (10.5, nan_value));
check_isnan_maybe_exc ("real(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacos(10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacos(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacos) (BUILD_COMPLEX (nan_value, 0.75));
check_isnan_maybe_exc ("real(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacos(NaN + i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacos) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacos(NaN - i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2749,23 +2757,23 @@ cacosh_test (void)
result = FUNC(cacosh) (BUILD_COMPLEX (10.5, nan_value));
check_isnan_maybe_exc ("real(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacosh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacosh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacosh) (BUILD_COMPLEX (nan_value, 0.75));
check_isnan_maybe_exc ("real(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacosh(NaN + i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(cacosh) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(cacosh(NaN - i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
@ -2882,23 +2890,23 @@ casin_test (void)
result = FUNC(casin) (BUILD_COMPLEX (nan_value, 10.5));
check_isnan_maybe_exc ("real(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casin(NaN + i10.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casin) (BUILD_COMPLEX (nan_value, -10.5));
check_isnan_maybe_exc ("real(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casin(NaN - i10.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casin) (BUILD_COMPLEX (0.75, nan_value));
check_isnan_maybe_exc ("real(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casin(0.75 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casin) (BUILD_COMPLEX (-0.75, nan_value));
check_isnan_maybe_exc ("real(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casin(-0.75 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3015,23 +3023,23 @@ casinh_test (void)
result = FUNC(casinh) (BUILD_COMPLEX (10.5, nan_value));
check_isnan_maybe_exc ("real(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casinh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casinh) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casinh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casinh) (BUILD_COMPLEX (nan_value, 0.75));
check_isnan_maybe_exc ("real(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casinh(NaN + i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(casinh) (BUILD_COMPLEX (-0.75, nan_value));
check_isnan_maybe_exc ("real(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(casinh(NaN - i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3153,23 +3161,23 @@ catan_test (void)
result = FUNC(catan) (BUILD_COMPLEX (nan_value, 10.5));
check_isnan_maybe_exc ("real(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catan(NaN + i10.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catan) (BUILD_COMPLEX (nan_value, -10.5));
check_isnan_maybe_exc ("real(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catan(NaN - i10.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catan) (BUILD_COMPLEX (0.75, nan_value));
check_isnan_maybe_exc ("real(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catan(0.75 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catan) (BUILD_COMPLEX (-0.75, nan_value));
check_isnan_maybe_exc ("real(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catan(-0.75 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3291,23 +3299,23 @@ catanh_test (void)
result = FUNC(catanh) (BUILD_COMPLEX (10.5, nan_value));
check_isnan_maybe_exc ("real(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catanh(10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catanh) (BUILD_COMPLEX (-10.5, nan_value));
check_isnan_maybe_exc ("real(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catanh(-10.5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, 0.75));
check_isnan_maybe_exc ("real(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catanh(NaN + i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(catanh) (BUILD_COMPLEX (nan_value, -0.75));
check_isnan_maybe_exc ("real(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(catanh(NaN - i0.75)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3362,42 +3370,42 @@ ctanh_test (void)
result = FUNC(ctanh) (BUILD_COMPLEX (0, plus_infty));
check_isnan_exc ("real(ctanh(0 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(0 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (2, plus_infty));
check_isnan_exc ("real(ctanh(2 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(2 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (0, minus_infty));
check_isnan_exc ("real(ctanh(0 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(0 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (2, minus_infty));
check_isnan_exc ("real(ctanh(2 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(2 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, plus_infty));
check_isnan_exc ("real(ctanh(-0 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-0 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (-2, plus_infty));
check_isnan_exc ("real(ctanh(-2 + i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-2 + i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, minus_infty));
check_isnan_exc ("real(ctanh(-0 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-0 - i Inf)) = NaN plus invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (-2, minus_infty));
check_isnan_exc ("real(ctanh(-2 - i Inf)) = NaN plus invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-2 - i Inf)) = NaN plus invalid exception",
__imag__ result);
@ -3417,33 +3425,33 @@ ctanh_test (void)
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, 0.5));
check_isnan_maybe_exc ("real(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(NaN + i0.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (nan_value, -4.5));
check_isnan_maybe_exc ("real(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(NaN - i4.5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (0, nan_value));
check_isnan_maybe_exc ("real(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (5, nan_value));
check_isnan_maybe_exc ("real(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(5 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (minus_zero, nan_value));
check_isnan_maybe_exc ("real(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(ctanh) (BUILD_COMPLEX (-0.25, nan_value));
check_isnan_maybe_exc ("real(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(ctanh(-0.25 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3561,43 +3569,43 @@ clog_test (void)
result = FUNC(clog) (BUILD_COMPLEX (0, nan_value));
check_isnan_maybe_exc ("real(clog(0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (3, nan_value));
check_isnan_maybe_exc ("real(clog(3 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(3 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (minus_zero, nan_value));
check_isnan_maybe_exc ("real(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(-0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (-3, nan_value));
check_isnan_maybe_exc ("real(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(-3 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (nan_value, 0));
check_isnan_maybe_exc ("real(clog(NaN + i0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(NaN + i0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (nan_value, 5));
check_isnan_maybe_exc ("real(clog(NaN + i5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(NaN + i5)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (nan_value, minus_zero));
check_isnan_maybe_exc ("real(clog(NaN - i0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(NaN - i0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(clog) (BUILD_COMPLEX (nan_value, -5));
check_isnan_maybe_exc ("real(clog(NaN - i5)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(clog(NaN - i5)) = NaN plus maybe invalid exception",
__imag__ result);
@ -3699,43 +3707,43 @@ csqrt_test (void)
result = FUNC(csqrt) (BUILD_COMPLEX (0, nan_value));
check_isnan_maybe_exc ("real(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (1, nan_value));
check_isnan_maybe_exc ("real(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(1 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (minus_zero, nan_value));
check_isnan_maybe_exc ("real(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(-0 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (-1, nan_value));
check_isnan_maybe_exc ("real(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(-1 + i NaN)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 0));
check_isnan_maybe_exc ("real(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(NaN + i0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, 8));
check_isnan_maybe_exc ("real(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(NaN + i8)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, minus_zero));
check_isnan_maybe_exc ("real(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(NaN - i0)) = NaN plus maybe invalid exception",
__imag__ result);
result = FUNC(csqrt) (BUILD_COMPLEX (nan_value, -8));
check_isnan_maybe_exc ("real(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
__real__ result, FE_INVALID);
__real__ result, INVALID_EXCEPTION);
check_isnan ("imag(csqrt(NaN - i8)) = NaN plus maybe invalid exception",
__imag__ result);

View File

@ -1 +1 @@
NIS(YP)/NIS+ NSS modules 0.10 by Thorsten Kukuk
NIS(YP)/NIS+ NSS modules 0.11 by Thorsten Kukuk

View File

@ -43,8 +43,13 @@ vpath %.c $(subdir-dirs)
libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
nis_subr nis_local_names nis_free nis_file \
nis_print nis_error nis_call nis_names nis_clone\
nis_table nis_xdr nis_intern nis_server
nis_print nis_error nis_call nis_lookup nis_clone\
nis_table nis_xdr nis_intern nis_server nis_ping\
nis_checkpoint nis_mkdir nis_rmdir nis_getservlist\
nis_verifygroup nis_ismember nis_addmember \
nis_removemember nis_creategroup nis_destroygroup\
nis_print_group_entry nis_domain_of nis_domain_of_r\
nis_modify nis_remove nis_add nis_defaults
libnss_compat-routines := $(addprefix compat-,grp pwd spwd)
libnss_compat-inhibit-o = $(filter-out .so,$(object-suffixes))

View File

@ -4,15 +4,6 @@
* nss_nisplus: Search the data in the complete NIS+ namespace
specified by NIS_PATH
* nis_server: implement nis_getservlist, nis_stats, nis_servstate
* nis_groups: implement it
* nis_ping: implement it
* __start_clock(), __stop_clock(): Test the interface and
implement it
* What does nis_list give back, if rpc.nisd is not running or
if /var/nis/NIS_START_FILE does not exist ?
@ -20,21 +11,7 @@
Missing flags: FOLLOW_PATH, ALL_RESULTS
callback: Don't simulate it, use server callback thread
* Possible flags:
- FOLLOW_LINKS (nis_list, nis_lookup)
* Missing flags:
- FOLLOW_PATH (nis_list, not supported)
- HARD_LOOKUP (__do_niscall)
- ALL_RESULTS (nis_list, not supported, needs server callback)
- NO_CACHE (__do_niscall, cache not supported yet)
- MASTER_ONLY (__do_niscall)
- EXPAND_NAME (nis_lookup, nis_list)
- RETURN_RESULT (nis_table.c)
- ADD_OVERWRITE (nis_table.c)
- REM_MULTIPLE (nis_table.c)
- MOD_SAMEOBJ (nis_table.c)
- ADD_RESERVED (nis_table.c)
- REM_RESERVED (nis_table.c)
- MOD_EXCLUSIVE (nis_table.c)
- USE_DGRAM (__do_niscall)
- NO_AUTHINFO (__do_niscall)

71
nis/nis_add.c Normal file
View File

@ -0,0 +1,71 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
nis_add (const_nis_name name, const nis_object *obj)
{
nis_result *res;
nis_error status;
struct ns_request req;
char *p1, *p2, *p3, *p4;
char buf1 [strlen (name) + 20];
char buf4 [strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
req.ns_name = (char *)name;
req.ns_object.ns_object_len = 1;
req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
p1 = req.ns_object.ns_object_val[0].zo_name;
req.ns_object.ns_object_val[0].zo_name =
nis_name_of_r (name, buf1, sizeof (buf1));
p2 = req.ns_object.ns_object_val[0].zo_owner;
if (p2 == NULL || strlen (p2) == 0)
req.ns_object.ns_object_val[0].zo_owner = nis_local_principal ();
p3 = req.ns_object.ns_object_val[0].zo_group;
if (p3 == NULL || strlen (p3) == 0)
req.ns_object.ns_object_val[0].zo_group = nis_local_group ();
p4 = req.ns_object.ns_object_val[0].zo_domain;
req.ns_object.ns_object_val[0].zo_domain =
nis_domain_of_r (name, buf4, sizeof (buf4));
if ((status = __do_niscall (NULL, 0, NIS_ADD, (xdrproc_t) xdr_ns_request,
(caddr_t) &req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
res->status = status;
req.ns_object.ns_object_val[0].zo_name = p1;
req.ns_object.ns_object_val[0].zo_owner = p2;
req.ns_object.ns_object_val[0].zo_group = p3;
req.ns_object.ns_object_val[0].zo_domain = p4;
nis_destroy_object (req.ns_object.ns_object_val);
return res;
}

69
nis/nis_addmember.c Normal file
View File

@ -0,0 +1,69 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_error
nis_addmember (const_nis_name member, const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 2];
char domainbuf[strlen (group) + 2];
nis_result *res, *res2;
nis_error status;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
if (res->status != NIS_SUCCESS)
{
status = res->status;
nis_freeresult (res);
return status;
}
if ((res->objects.objects_len != 1) ||
(res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
return NIS_INVALIDOBJ;
res->objects.objects_val[0].GR_data.gr_members.gr_members_val
= realloc (res->objects.objects_val[0].GR_data.gr_members.gr_members_val, res->objects.objects_val[0].GR_data.gr_members.gr_members_len + 1);
++res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
res->objects.objects_val[0].GR_data.gr_members.gr_members_val[res->objects.objects_val[0].GR_data.gr_members.gr_members_len] = strdup (member);
res2 = nis_modify (buf, res->objects.objects_val);
status = res2->status;
nis_freeresult (res);
nis_freeresult (res2);
return status;
}
else
return NIS_FAIL;
}

View File

@ -134,7 +134,7 @@ __nis_dobind (const nis_server *server, u_long flags)
if ((flags & NO_AUTHINFO) != NO_AUTHINFO)
{
#if defined(HAVE_SECURE_RPC)
if (server->key_type == NIS_PK_DH)
if (server->key_type == NIS_PK_DH && getenv ("NO_SECURE_RPC") == NULL)
{
char netname[MAXNETNAMELEN+1];
char *p;
@ -173,11 +173,8 @@ __do_niscall (const nis_server *serv, int serv_len, u_long prog,
if (serv == NULL || serv_len == 0)
{
dir = readColdStartFile ();
if (dir == NULL)
{
fputs (_("Error: could not find a NIS_COLD_START file\n"), stderr);
return NIS_UNAVAIL;
}
if (dir == NULL) /* No /var/nis/NIS_COLD_START -> no NIS+ installed */
return NIS_UNAVAIL;
server = dir->do_servers.do_servers_val;
server_len = dir->do_servers.do_servers_len;
}

71
nis/nis_checkpoint.c Normal file
View File

@ -0,0 +1,71 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
nis_checkpoint(const_nis_name dirname)
{
nis_result *res;
res = calloc (1, sizeof (nis_result));
if (dirname != NULL)
{
cp_result *cpres = NULL;
nis_result *res2;
u_int i;
res2 = nis_lookup (dirname, EXPAND_NAME);
if (res2->status != NIS_SUCCESS && res2->status != NIS_S_SUCCESS)
return res2;
/* Check if obj is really a diryectory object */
if (res2->objects.objects_val[0].zo_data.zo_type != DIRECTORY_OBJ)
{
nis_freeresult (res);
res->status = NIS_INVALIDOBJ;
return res;
}
for (i = 0;
i < res2->objects.objects_val[0].DI_data.do_servers.do_servers_len;
++i)
{
if (__do_niscall (&res2->objects.objects_val[0].DI_data.do_servers.do_servers_val[i],
1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
(caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
(caddr_t) &cpres, 0) != RPC_SUCCESS)
res->status = NIS_RPCERROR;
else
{
res->status += cpres->cp_status;
res->zticks += cpres->cp_zticks;
res->dticks += cpres->cp_dticks;
}
}
nis_freeresult (res2);
}
else
res->status = NIS_NOSUCHNAME;
return res;
}

66
nis/nis_creategroup.c Normal file
View File

@ -0,0 +1,66 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_error
nis_creategroup (const_nis_name group, u_long flags)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 2];
char domainbuf[strlen (group) + 2];
nis_error status;
nis_result *res;
char *cp, *cp2;
nis_object *obj;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
else
return NIS_BADNAME;
obj = calloc (1, sizeof (nis_object));
obj->zo_owner = strdup (__nis_default_owner (NULL));
obj->zo_group = strdup (__nis_default_group (NULL));
obj->zo_access = __nis_default_access (NULL, 0);
obj->zo_ttl = __nis_default_ttl (0);
obj->zo_data.zo_type = GROUP_OBJ;
obj->zo_data.objdata_u.gr_data.gr_flags = flags;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_len = 0;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_val = NULL;
res = nis_add (buf, obj);
status = res->status;
nis_freeresult (res);
nis_free_object (obj);
return status;
}
return NIS_FAIL;
}

466
nis/nis_defaults.c Normal file
View File

@ -0,0 +1,466 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#define DEFAULT_TTL 43200
/*
** Some functions for parsing the -D param and NIS_DEFAULTS Environ
*/
static nis_name
searchgroup (char *str)
{
static char default_group[NIS_MAXNAMELEN];
char *cptr;
int i;
cptr = strstr (str, "group=");
if (cptr == NULL)
return NULL;
cptr += 6; /* points to the begin of the group string */
i = 0;
while (cptr[i] != '\0' && cptr[i] != ':')
i++;
if (i == 0) /* only "group=" ? */
return (nis_name)"";
strncpy (default_group, cptr, i);
return default_group;
}
static nis_name
searchowner (char *str)
{
static char default_owner[NIS_MAXNAMELEN];
char *cptr;
int i;
cptr = strstr (str, "owner=");
if (cptr == NULL)
return NULL;
cptr += 6; /* points to the begin of the owner string */
i = 0;
while (cptr[i] != '\0' && cptr[i] != ':')
i++;
if (i == 0) /* only "owner=" ? */
return (nis_name)"";
strncpy (default_owner, cptr, i);
return default_owner;
}
static u_long
searchttl (char *str)
{
char buf[1024];
char *cptr, *dptr;
u_long time;
int i;
dptr = strstr (str, "ttl=");
if (dptr == NULL) /* should (could) not happen */
return DEFAULT_TTL;;
dptr += 4; /* points to the begin of the new ttl */
i = 0;
while (dptr[i] != '\0' && dptr[i] != ':')
i++;
if (i == 0) /* only "ttl=" ? */
return DEFAULT_TTL;
strncpy (buf, dptr, i);
time = 0;
dptr = buf;
cptr = strchr (dptr, 'd');
if (cptr != NULL)
{
*cptr = '\0';
cptr++;
time += atoi (dptr) * 60 * 60 * 24;
dptr = cptr;
}
cptr = strchr (dptr, 'h');
if (cptr != NULL)
{
*cptr = '\0';
cptr++;
time += atoi (dptr) * 60 * 60;
dptr = cptr;
}
cptr = strchr (dptr, 'm');
if (cptr != NULL)
{
*cptr = '\0';
cptr++;
time += atoi (dptr) * 60;
dptr = cptr;
}
cptr = strchr (dptr, 's');
if (cptr != NULL)
*cptr = '\0';
time += atoi (dptr);
return time;
}
static u_long
searchaccess (char *str, u_long access)
{
static char buf[NIS_MAXNAMELEN];
char *cptr;
u_long result;
int i;
int n, o, g, w;
cptr = strstr (str, "access=");
if (cptr == NULL)
return 0;
cptr += 7; /* points to the begin of the access string */
i = 0;
while (cptr[i] != '\0' && cptr[i] != ':')
i++;
if (i == 0) /* only "access=" ? */
return 0;
strncpy (buf, cptr, i);
result = n = o = g = w = 0;
cptr = buf;
while (*cptr != '\0')
{
switch (*cptr)
{
case 'n':
n = 1;
break;
case 'o':
o = 1;
break;
case 'g':
g = 1;
break;
case 'w':
w = 1;
break;
case 'a':
o = g = w = 1;
break;
case '-':
cptr++; /* Remove "=" from beginning */
while (*cptr != '\0' && *cptr != ',')
{
switch (*cptr)
{
case 'r':
if (n)
result = result & ~(NIS_READ_ACC << 24);
if (o)
result = result & ~(NIS_READ_ACC << 16);
if (g)
result = result & ~(NIS_READ_ACC << 8);
if (w)
result = result & ~(NIS_READ_ACC);
break;
case 'm':
if (n)
result = result & ~(NIS_MODIFY_ACC << 24);
if (o)
result = result & ~(NIS_MODIFY_ACC << 16);
if (g)
result = result & ~(NIS_MODIFY_ACC << 8);
if (w)
result = result & ~(NIS_MODIFY_ACC);
break;
case 'c':
if (n)
result = result & ~(NIS_CREATE_ACC << 24);
if (o)
result = result & ~(NIS_CREATE_ACC << 16);
if (g)
result = result & ~(NIS_CREATE_ACC << 8);
if (w)
result = result & ~(NIS_CREATE_ACC);
break;
case 'd':
if (n)
result = result & ~(NIS_DESTROY_ACC << 24);
if (o)
result = result & ~(NIS_DESTROY_ACC << 16);
if (g)
result = result & ~(NIS_DESTROY_ACC << 8);
if (w)
result = result & ~(NIS_DESTROY_ACC);
break;
default:
fprintf (stderr, "Parse error in \"%s\"\n", buf);
return 0;
}
cptr++;
}
break;
case '+':
cptr++; /* Remove "=" from beginning */
while (*cptr != '\0' && *cptr != ',')
{
switch (*cptr)
{
case 'r':
if (n)
result = result | (NIS_READ_ACC << 24);
if (o)
result = result | (NIS_READ_ACC << 16);
if (g)
result = result | (NIS_READ_ACC << 8);
if (w)
result = result | (NIS_READ_ACC);
break;
case 'm':
if (n)
result = result | (NIS_MODIFY_ACC << 24);
if (o)
result = result | (NIS_MODIFY_ACC << 16);
if (g)
result = result | (NIS_MODIFY_ACC << 8);
if (w)
result = result | (NIS_MODIFY_ACC);
break;
case 'c':
if (n)
result = result | (NIS_CREATE_ACC << 24);
if (o)
result = result | (NIS_CREATE_ACC << 16);
if (g)
result = result | (NIS_CREATE_ACC << 8);
if (w)
result = result | (NIS_CREATE_ACC);
break;
case 'd':
if (n)
result = result | (NIS_DESTROY_ACC << 24);
if (o)
result = result | (NIS_DESTROY_ACC << 16);
if (g)
result = result | (NIS_DESTROY_ACC << 8);
if (w)
result = result | (NIS_DESTROY_ACC);
break;
default:
fprintf (stderr, "Parse error in \"%s\"\n", buf);
return 0;
}
cptr++;
}
break;
case '=':
cptr++; /* Remove "=" from beginning */
/* Clear */
if (n)
result = result & ~((NIS_READ_ACC + NIS_MODIFY_ACC +
NIS_CREATE_ACC + NIS_DESTROY_ACC) << 24);
if (o)
result = result & ~((NIS_READ_ACC + NIS_MODIFY_ACC +
NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16);
if (g)
result = result & ~((NIS_READ_ACC + NIS_MODIFY_ACC +
NIS_CREATE_ACC + NIS_DESTROY_ACC) << 8);
if (w)
result = result & ~(NIS_READ_ACC + NIS_MODIFY_ACC +
NIS_CREATE_ACC + NIS_DESTROY_ACC);
while (*cptr != '\0' && *cptr != ',')
{
switch (*cptr)
{
case 'r':
if (n)
result = result | (NIS_READ_ACC << 24);
if (o)
result = result | (NIS_READ_ACC << 16);
if (g)
result = result | (NIS_READ_ACC << 8);
if (w)
result = result | (NIS_READ_ACC);
break;
case 'm':
if (n)
result = result | (NIS_MODIFY_ACC << 24);
if (o)
result = result | (NIS_MODIFY_ACC << 16);
if (g)
result = result | (NIS_MODIFY_ACC << 8);
if (w)
result = result | (NIS_MODIFY_ACC);
break;
case 'c':
if (n)
result = result | (NIS_CREATE_ACC << 24);
if (o)
result = result | (NIS_CREATE_ACC << 16);
if (g)
result = result | (NIS_CREATE_ACC << 8);
if (w)
result = result | (NIS_CREATE_ACC);
break;
case 'd':
if (n)
result = result | (NIS_DESTROY_ACC << 24);
if (o)
result = result | (NIS_DESTROY_ACC << 16);
if (g)
result = result | (NIS_DESTROY_ACC << 8);
if (w)
result = result | (NIS_DESTROY_ACC);
break;
default:
fprintf (stderr, "Parse error in \"%s\"\n", buf);
return 0;
}
cptr++;
}
break;
default:
fprintf (stderr, "Parse error in \"%s\"\n", buf);
return 0;
}
cptr++;
}
return 0;
}
nis_name
__nis_default_owner (char *defaults)
{
static char default_owner[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_owner, nis_local_principal ());
if (defaults != NULL)
{
dptr = strstr (defaults, "owner=");
if (dptr != NULL)
strcpy (default_owner, searchowner (defaults));
}
else
{
cptr = getenv ("NIS_DEFAULTS");
if (cptr != NULL)
{
dptr = strstr (cptr, "owner=");
if (dptr != NULL)
strcpy (default_owner, searchowner (cptr));
}
}
return default_owner;
}
nis_name
__nis_default_group (char *defaults)
{
static char default_group[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_group, nis_local_group ());
if (defaults != NULL)
{
dptr = strstr (defaults, "group=");
if (dptr != NULL)
strcpy (default_group, searchgroup (defaults));
}
else
{
cptr = getenv ("NIS_DEFAULTS");
if (cptr != NULL)
{
dptr = strstr (cptr, "group=");
if (dptr != NULL)
strcpy (default_group, searchgroup (cptr));
}
}
return default_group;
}
u_long
__nis_default_ttl (char *defaults)
{
char *cptr, *dptr;
if (defaults != NULL)
{
dptr = strstr (defaults, "ttl=");
if (dptr != NULL)
return searchttl (defaults);
}
cptr = getenv ("NIS_DEFAULTS");
if (cptr == NULL)
return DEFAULT_TTL;
dptr = strstr (cptr, "ttl=");
if (dptr == NULL)
return DEFAULT_TTL;
return searchttl (cptr);
}
/* Default access rights are ----rmcdr---r---, but we could change
this with the NIS_DEFAULTS variable. */
u_long
__nis_default_access (char *param, u_long defaults)
{
u_long result;
char *cptr;
if (defaults == 0)
result = 0 | OWNER_DEFAULT | GROUP_DEFAULT | WORLD_DEFAULT;
else
result = defaults;
if (param != NULL && strstr (param, "access=") != NULL)
result = searchaccess (param, result);
else
{
cptr = getenv ("NIS_DEFAULTS");
if (cptr != NULL && strstr (cptr, "access=") != NULL)
result = searchaccess (getenv ("NIS_DEFAULTS"), result);
}
return result;
}

52
nis/nis_destroygroup.c Normal file
View File

@ -0,0 +1,52 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_error
nis_destroygroup (const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 3];
char domainbuf[strlen (group) + 3];
nis_error status;
nis_result *res;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_remove (buf, NULL);
status = res->status;
nis_freeresult (res);
return status;
}
else
return NIS_FAIL;
}

29
nis/nis_domain_of.c Normal file
View File

@ -0,0 +1,29 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_name
nis_domain_of (const_nis_name name)
{
static char result[NIS_MAXNAMELEN + 1];
return nis_domain_of_r (name, result, NIS_MAXNAMELEN);
}

58
nis/nis_domain_of_r.c Normal file
View File

@ -0,0 +1,58 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_name
nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
{
char *cptr;
size_t cptr_len;
if (buffer == NULL)
{
errno = ERANGE;
return NULL;
}
buffer[0] = '\0';
cptr = strchr (name, '.');
if (cptr == NULL)
return buffer;
++cptr;
cptr_len = strlen (cptr);
if (cptr_len == 0)
strcpy (buffer, ".");
else if (cptr_len >= buflen)
{
errno = ERANGE;
return NULL;
}
else
memcpy (buffer, cptr, cptr_len + 1);
return buffer;
}

115
nis/nis_getservlist.c Normal file
View File

@ -0,0 +1,115 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_server **
nis_getservlist (const_nis_name dir)
{
nis_result *res;
nis_server **serv;
res = nis_lookup (dir, FOLLOW_LINKS);
if (res->status == NIS_SUCCESS || res->status == NIS_S_SUCCESS)
{
unsigned long i;
nis_server *server;
serv = malloc (sizeof (nis_server *) *
(res->objects.objects_val->DI_data.do_servers.do_servers_len + 1));
if (serv == NULL)
return NULL;
for (i = 0; i < res->objects.objects_val->DI_data.do_servers.do_servers_len; ++i)
{
server =
&res->objects.objects_val->DI_data.do_servers.do_servers_val[i];
if (server->name != NULL)
serv[i]->name = strdup (server->name);
else
serv[i]->name = NULL;
serv[i]->ep.ep_len = server->ep.ep_len;
if (serv[i]->ep.ep_len > 0)
{
unsigned long j;
serv[i]->ep.ep_val =
malloc (server->ep.ep_len * sizeof (endpoint));
for (j = 0; j < serv[i]->ep.ep_len; ++j)
{
if (server->ep.ep_val[j].uaddr)
serv[i]->ep.ep_val[j].uaddr =
strdup (server->ep.ep_val[j].uaddr);
else
serv[i]->ep.ep_val[j].uaddr = NULL;
if (server->ep.ep_val[j].family)
serv[i]->ep.ep_val[j].family =
strdup (server->ep.ep_val[j].family);
else
serv[i]->ep.ep_val[j].family = NULL;
if (server->ep.ep_val[j].proto)
serv[i]->ep.ep_val[j].proto =
strdup (server->ep.ep_val[j].proto);
else
serv[i]->ep.ep_val[j].proto = NULL;
}
}
else
serv[i]->ep.ep_val = NULL;
serv[i]->key_type = server->key_type;
serv[i]->pkey.n_len = server->pkey.n_len;
if (server->pkey.n_len > 0)
{
serv[i]->pkey.n_bytes =
malloc (server->pkey.n_len);
if (serv[i]->pkey.n_bytes == NULL)
return NULL;
memcpy (serv[i]->pkey.n_bytes, server->pkey.n_bytes,
server->pkey.n_len);
}
else
serv[i]->pkey.n_bytes = NULL;
}
}
else
{
serv = malloc (sizeof (nis_server *));
if (serv != NULL)
serv[0] = NULL;
}
return serv;
}
void
nis_freeservlist (nis_server **serv)
{
int i;
if (serv == NULL)
return;
i = 0;
while (serv[i] != NULL)
nis_free_servers (serv[i], 1);
free (serv);
}

View File

@ -143,27 +143,3 @@ __nis_expandname (const char *name)
return getnames;
}
fd_result *
__nis_finddirectoy (const_nis_name name)
{
fd_args args;
nis_error status;
fd_result *res;
args.dir_name = (char *) name;
args.requester = nis_local_principal ();
res = calloc (1, sizeof (fd_result));
if (res == NULL)
return NULL;
if ((status = __do_niscall (NULL, 0, NIS_FINDDIRECTORY,
(xdrproc_t) xdr_fd_args,
(caddr_t) &args,
(xdrproc_t) xdr_fd_result,
(caddr_t) res, 0)) != RPC_SUCCESS)
res->status = status;
return res;
}

142
nis/nis_ismember.c Normal file
View File

@ -0,0 +1,142 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
/* internal_nis_ismember ()
return codes: -1 principal is in -group
0 principal isn't in any group
1 pirncipal is in group */
static int
internal_ismember (const_nis_name principal, const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 2];
char domainbuf[strlen (group) + 2];
nis_result *res;
char *cp, *cp2;
u_int i;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
return 0;
if ((res->objects.objects_len != 1) ||
(res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
return 0;
/* We search twice in the list, at first, if we have the name
with a "-", then if without. "-member" has priority */
for (i = 0;
i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
++i)
{
cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
if (cp[0] == '-')
{
if (strcmp (&cp[1], principal) == 0)
return -1;
if (cp[1] == '@')
switch (internal_ismember (principal, &cp[2]))
{
case -1:
return -1;
case 1:
return -1;
default:
break;
}
else
if (cp[1] == '*')
{
char buf1[strlen (principal) + 2];
char buf2[strlen (cp) + 2];
strcpy (buf1, nis_domain_of (principal));
strcpy (buf2, nis_domain_of (cp));
if (strcmp (buf1, buf2) == 0)
return -1;
}
}
}
for (i = 0;
i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
++i)
{
cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
if (cp[0] != '-')
{
if (strcmp (cp, principal) == 0)
return 1;
if (cp[0] == '@')
switch (internal_ismember (principal, &cp[1]))
{
case -1:
return -1;
case 1:
return 1;
default:
break;
}
else
if (cp[0] == '*')
{
char buf1[strlen (principal) + 2];
char buf2[strlen (cp) + 2];
strcpy (buf1, nis_domain_of (principal));
strcpy (buf2, nis_domain_of (cp));
if (strcmp (buf1, buf2) == 0)
return 1;
}
}
}
}
return 0;
}
bool_t
nis_ismember (const_nis_name principal, const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
int status;
status = internal_ismember (principal, group);
if (status == 1)
return TRUE;
else
return FALSE;
}
else
return FALSE;
}

157
nis/nis_lookup.c Normal file
View File

@ -0,0 +1,157 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
nis_lookup (const_nis_name name, const u_long flags)
{
nis_result *res;
struct ns_request req;
nis_name *names;
nis_error status;
int is_link = 1; /* We should go at least once in the while loop */
int count_links = 0; /* We will follow only 16 links in the deep */
int i;
res = calloc (1, sizeof (nis_result));
if (flags & EXPAND_NAME)
{
names = __nis_expandname (name);
if (names == NULL)
{
res->status = NIS_NAMEUNREACHABLE;
return res;
}
i = 0;
while (names[i] != NULL && (i == 0 || res->status > 1))
{
req.ns_name = names[i];
while (is_link)
{
req.ns_object.ns_object_len = 0;
req.ns_object.ns_object_val = NULL;
memset (res, '\0', sizeof (nis_result));
if ((status = __do_niscall (NULL, 0, NIS_LOOKUP,
(xdrproc_t) xdr_ns_request,
(caddr_t) & req,
(xdrproc_t) xdr_nis_result,
(caddr_t) res, flags)) != RPC_SUCCESS)
{
res->status = status;
nis_freenames (names);
return res;
}
if ((res->status == NIS_SUCCESS || res->status == NIS_S_SUCCESS)
&& (res->objects.objects_len > 0 &&
res->objects.objects_val->zo_data.zo_type == LINK_OBJ))
is_link = 1;
else
is_link = 0;
if (is_link)
{
if ((flags & FOLLOW_LINKS) == FOLLOW_LINKS)
{
if (count_links == 16)
{
res->status = NIS_LINKNAMEERROR;
return res;
}
else
++count_links;
req.ns_name = res->objects.objects_val->LI_data.li_name;
}
else
{
res->status = NIS_NOTSEARCHABLE;
return res;
}
}
}
++i;
if (res->status == NIS_NOT_ME)
res->status = NIS_NOSUCHNAME;
}
nis_freenames (names);
}
else
{
req.ns_name = (char *)name;
while (is_link)
{
req.ns_object.ns_object_len = 0;
req.ns_object.ns_object_val = NULL;
memset (res, '\0', sizeof (nis_result));
if ((status = __do_niscall (NULL, 0, NIS_LOOKUP,
(xdrproc_t) xdr_ns_request,
(caddr_t) &req,
(xdrproc_t) xdr_nis_result,
(caddr_t) res, flags)) != RPC_SUCCESS)
{
res->status = status;
return res;
}
if ((res->status == NIS_SUCCESS || res->status == NIS_S_SUCCESS) &&
(res->objects.objects_len > 0 &&
res->objects.objects_val->zo_data.zo_type == LINK_OBJ))
is_link = 1;
else
is_link = 0;
if (is_link)
{
if ((flags & FOLLOW_LINKS) == FOLLOW_LINKS)
{
if (count_links == 16)
{
res->status = NIS_LINKNAMEERROR;
return res;
}
else
++count_links;
req.ns_name = res->objects.objects_val->LI_data.li_name;
}
else
{
res->status = NIS_NOTSEARCHABLE;
return res;
}
}
}
}
return res;
}

46
nis/nis_mkdir.c Normal file
View File

@ -0,0 +1,46 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
nis_mkdir (const_nis_name dir, const nis_server *server)
{
nis_error res;
if (server == NULL)
{
if (__do_niscall (NULL, 0, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
else
{
if (__do_niscall (server, 1, NIS_MKDIR,
(xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
return res;
}

47
nis/nis_modify.c Normal file
View File

@ -0,0 +1,47 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
nis_modify (const_nis_name name, const nis_object *obj)
{
nis_result *res;
nis_error status;
struct ns_request req;
res = calloc (1, sizeof (nis_result));
req.ns_name = (char *)name;
req.ns_object.ns_object_len = 1;
req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
if ((status = __do_niscall (NULL, 0, NIS_MODIFY, (xdrproc_t) xdr_ns_request,
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
res->status = status;
nis_destroy_object (req.ns_object.ns_object_val);
return res;
}

63
nis/nis_ping.c Normal file
View File

@ -0,0 +1,63 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
void
nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
{
nis_result *res = NULL;
nis_object *obj;
ping_args args;
u_int i;
if (dirname == NULL && dirobj == NULL)
abort ();
if (dirobj == NULL)
{
res = nis_lookup (dirname, EXPAND_NAME + FOLLOW_LINKS);
if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
return;
obj = res->objects.objects_val;
}
else
obj = (nis_object *)dirobj;
/* Check if obj is really a diryectory object */
if (obj->zo_data.zo_type != DIRECTORY_OBJ)
abort ();
if (dirname == NULL)
args.dir = obj->DI_data.do_name;
else
args.dir = (char *)dirname;
args.stamp = utime;
for (i = 0; i < obj->DI_data.do_servers.do_servers_len; ++i)
__do_niscall (&obj->DI_data.do_servers.do_servers_val[i], 1,
NIS_PING, (xdrproc_t) xdr_ping_args,
(caddr_t) &args, (xdrproc_t) xdr_void,
(caddr_t) NULL, 0);
if (res)
nis_freeresult (res);
}

View File

@ -0,0 +1,59 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
void
nis_print_group_entry (const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 3];
char domainbuf[strlen (group) + 3];
nis_result *res;
char *cp, *cp2;
u_int i;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
return;
if ((res->objects.objects_len != 1) ||
(res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
return;
for (i = 0;
i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
++i)
fprintf (stdout, " %s\n",
res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i]);
}
}

55
nis/nis_remove.c Normal file
View File

@ -0,0 +1,55 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
nis_remove (const_nis_name name, const nis_object *obj)
{
nis_result *res;
nis_error status;
struct ns_request req;
res = calloc (1, sizeof (nis_result));
req.ns_name = (char *)name;
if (obj != NULL)
{
req.ns_object.ns_object_len = 1;
req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
}
else
{
req.ns_object.ns_object_len = 0;
req.ns_object.ns_object_val = NULL;
}
if ((status = __do_niscall (NULL, 0, NIS_REMOVE, (xdrproc_t) xdr_ns_request,
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY)) != RPC_SUCCESS)
res->status = status;
nis_destroy_object (req.ns_object.ns_object_val);
return res;
}

80
nis/nis_removemember.c Normal file
View File

@ -0,0 +1,80 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_error
nis_removemember (const_nis_name member, const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 2];
char domainbuf[strlen (group) + 2];
nis_name *newmem;
nis_result *res, *res2;
nis_error status;
char *cp, *cp2;
u_int i, j;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
if (res->status != NIS_SUCCESS)
{
status = res->status;
nis_freeresult (res);
return status;
}
if ((res->objects.objects_len != 1) ||
(res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
return NIS_INVALIDOBJ;
newmem = malloc (res->objects.objects_val[0].GR_data.gr_members.gr_members_len);
j = 0;
for (i = 0; i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len - 1; ++i)
{
if (strcmp (res->objects.objects_val[0].GR_data.gr_members.gr_members_val[j], member) != 0)
{
newmem[j] = res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
++j;
}
}
--res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
free (res->objects.objects_val[0].GR_data.gr_members.gr_members_val);
res->objects.objects_val[0].GR_data.gr_members.gr_members_val = newmem;
res2 = nis_modify (buf, res->objects.objects_val);
status = res2->status;
nis_freeresult (res);
nis_freeresult (res2);
return status;
}
else
return NIS_FAIL;
}

46
nis/nis_rmdir.c Normal file
View File

@ -0,0 +1,46 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
nis_rmdir (const_nis_name dir, const nis_server *server)
{
nis_error res;
if (server == NULL)
{
if (__do_niscall (NULL, 0, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
else
{
if (__do_niscall (server, 1, NIS_RMDIR,
(xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
return res;
}

View File

@ -17,93 +17,104 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
nis_mkdir (const_nis_name dir, const nis_server *server)
{
nis_error res;
if (server == NULL)
{
int result;
if ((result = __do_niscall (NULL, 0, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0)) != RPC_SUCCESS)
{
fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
return NIS_RPCERROR;
}
}
else
{
int result;
if ((result = __do_niscall (server, 1, NIS_MKDIR,
(xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0)) != RPC_SUCCESS)
{
fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
return NIS_RPCERROR;
}
}
return res;
}
nis_error
nis_rmdir (const_nis_name dir, const nis_server *server)
{
nis_error res;
if (server == NULL)
{
int result;
if ((result = __do_niscall (NULL, 0, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0)) != RPC_SUCCESS)
{
fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
return NIS_RPCERROR;
}
}
else
{
int result;
if ((result = __do_niscall (server, 1, NIS_RMDIR,
(xdrproc_t) xdr_nis_name,
(caddr_t) &dir, (xdrproc_t) xdr_nis_error,
(caddr_t) &res, 0)) != RPC_SUCCESS)
{
fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
return NIS_RPCERROR;
}
}
return res;
}
nis_error
nis_servstate (const nis_server *serv, const nis_tag *tags,
const int numtags, nis_tag **result)
{
nis_taglist taglist;
nis_taglist tagres;
tagres.tags.tags_len = 0;
tagres.tags.tags_val = NULL;
*result = NULL;
return NIS_FAIL;
taglist.tags.tags_len = numtags;
taglist.tags.tags_val = (nis_tag *)tags;
if (serv == NULL)
{
if (__do_niscall (NULL, 0, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &tagres, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
else
{
if (__do_niscall (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &tagres, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
if (tagres.tags.tags_len > 0)
{
u_long i;
result = malloc (sizeof (nis_tag *) * tagres.tags.tags_len);
if (result == NULL)
return NIS_NOMEMORY;
for (i = 0; i < tagres.tags.tags_len; ++i)
{
result[i] = malloc (sizeof (nis_tag));
if (result[i] == NULL)
return NIS_NOMEMORY;
result[i]->tag_val = strdup (tagres.tags.tags_val[i].tag_val);
result[i]->tag_type = tagres.tags.tags_val[i].tag_type;
}
}
return NIS_SUCCESS;
}
stub_warning (nis_servstate)
nis_error
nis_stats (const nis_server *serv, const nis_tag *tags,
const int numtags, nis_tag **result)
{
result = malloc (sizeof (nis_tag *));
if (result != NULL)
result[0] = NULL;
return NIS_FAIL;
nis_taglist taglist;
nis_taglist tagres;
tagres.tags.tags_len = 0;
tagres.tags.tags_val = NULL;
*result = NULL;
taglist.tags.tags_len = numtags;
taglist.tags.tags_val = (nis_tag *)tags;
if (serv == NULL)
{
if (__do_niscall (NULL, 0, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &tagres, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
else
{
if (__do_niscall (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist,
(caddr_t) &tagres, 0) != RPC_SUCCESS)
return NIS_RPCERROR;
}
if (tagres.tags.tags_len > 0)
{
u_long i;
result = malloc (sizeof (nis_tag *) * tagres.tags.tags_len);
if (result == NULL)
return NIS_NOMEMORY;
for (i = 0; i < tagres.tags.tags_len; ++i)
{
result[i] = malloc (sizeof (nis_tag));
if (result[i] == NULL)
return NIS_NOMEMORY;
result[i]->tag_val = strdup (tagres.tags.tags_val[i].tag_val);
result[i]->tag_type = tagres.tags.tags_val[i].tag_type;
}
}
return NIS_SUCCESS;
}
stub_warning (nis_stats);
void
nis_freetags (nis_tag *tags, const int numtags)
@ -114,30 +125,3 @@ nis_freetags (nis_tag *tags, const int numtags)
free (tags->tag_val);
free (tags);
}
nis_server **
nis_getservlist (const_nis_name dir)
{
nis_server **serv;
serv = malloc (sizeof (nis_server *));
if (serv != NULL)
serv[0] = NULL;
return serv;
}
stub_warning (nis_getservlist);
void
nis_freeservlist (nis_server **serv)
{
int i;
if (serv == NULL)
return;
i = 0;
while (serv[i] != NULL)
nis_free_servers (serv[i], 1);
free (serv);
}

View File

@ -46,8 +46,16 @@ nis_leaf_of_r (const_nis_name name, char *buffer, size_t buflen)
return NULL;
}
if (i > 1)
strncpy (buffer, name, i - 1);
if (i > 0)
{
if ((size_t)i >= buflen)
{
errno = ERANGE;
return NULL;
}
strncpy (buffer, name, i);
buffer[i] = 0;
}
return buffer;
}
@ -89,38 +97,6 @@ nis_name_of_r (const_nis_name name, char *buffer, size_t buflen)
return buffer;
}
nis_name
nis_domain_of (const_nis_name name)
{
static char result[NIS_MAXNAMELEN + 1];
return nis_domain_of_r (name, result, NIS_MAXNAMELEN);
}
nis_name
nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
{
char *cptr;
size_t cptr_len;
cptr = strchr (name, '.'); /* XXX What happens if the NIS name
does not contain a `.'? */
++cptr;
cptr_len = strlen (cptr);
if (cptr_len == 0)
strcpy (buffer, ".");
else if (cptr_len >= buflen)
{
errno = ERANGE;
return NULL;
}
else
memcpy (buffer, cptr, cptr_len + 1);
return buffer;
}
static int
count_dots (const_nis_name str)
{

51
nis/nis_verifygroup.c Normal file
View File

@ -0,0 +1,51 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <rpcsvc/nis.h>
#include <rpcsvc/nislib.h>
nis_error
nis_verifygroup (const_nis_name group)
{
if (group != NULL && strlen (group) > 0)
{
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 2];
char domainbuf[strlen (group) + 2];
nis_result *res;
nis_error status;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
if (cp2 != NULL && strlen (cp2) > 0)
{
cp = stpcpy (cp, ".");
strcpy (cp, cp2);
}
res = nis_lookup (buf, 0);
status = res->status;
nis_freeresult (res);
return status;
}
else
return NIS_FAIL;
}

View File

@ -29,58 +29,58 @@ typedef const char *const_nis_name;
/* nis_names: These functions are used to locate and manipulate all NIS+
* objects except the NIS+ entry objects.
*
* nis_lookup (name, flags) resolves a NIS+ name and returns a copy of
* nis_lookup (name, flags) resolves a NIS+ name and returns a copy of
* that object from a NIS+ server.
* const nis_name name: name of the object to be resolved
* u_long flags: logically ORing zero or more flags (FOLLOW_LINKS,
* HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME)
*
* u_long flags: logically ORing zero or more flags (FOLLOW_LINKS,
* HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME)
*
* nis_add (name, obj) adds objects to the NIS+ namespace.
* const nis_name name: fully qualified NIS+ name.
* const nis_object *obj: object members zo_name and zo_domain will be
* const nis_object *obj: object members zo_name and zo_domain will be
* constructed from name.
*
* nis_remove (name, obj) removes objects from the NIS+ namespace.
* const nis_name name: fully qualified NIS+ name.
* const nis_object *obj: if not NULL, it is assumed to point to a copy
* of the object being removed. In this case, if
* const nis_object *obj: if not NULL, it is assumed to point to a copy
* of the object being removed. In this case, if
* the object on the server does not have the same
* object identifier as the object being passed,
* the operation will fail with the NIS_NOTSAMEOBJ
* the operation will fail with the NIS_NOTSAMEOBJ
* error.
*
* nis_modify (name, obj) can change specific attributes of an object
* nis_modify (name, obj) can change specific attributes of an object
* that already exists in the namespace.
*/
extern nis_result *nis_lookup __P ((const_nis_name name, u_long flags));
extern nis_result *nis_add __P ((const_nis_name name, const nis_object *obj));
extern nis_result *nis_remove __P ((const_nis_name name,
const nis_object *obj));
extern nis_result *nis_modify __P ((const_nis_name name,
extern nis_result *nis_modify __P ((const_nis_name name,
const nis_object *obj));
/* nis_tables: These functions are used to search and modify NIS+ tables.
*
* nis_list (table_name, flags, callback(table_name, obj, userdata), userdata)
* nis_list (table_name, flags, callback(table_name, obj, userdata), userdata)
* search a table in the NIS+ namespace.
* const nis_name table_name: indexed name ([xx=yy],table.dir)
* u_long flags: logically ORing one or more flags (FOLLOW_LINKS,
* [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE],
* MASTER_ONLY, EXPAND_NAME, RETURN_RESULT)
* callback(): callback is an optional pointer to a function that will
* process the ENTRY type objects that are returned from the
* callback(): callback is an optional pointer to a function that will
* process the ENTRY type objects that are returned from the
* search. If this pointer is NULL, then all entries that match
* the search criteria are returned in the nis_result structure,
* otherwise this function will be called once for each
* otherwise this function will be called once for each
* entry returned.
* void *userdata: passed to callback function along with the returned
* void *userdata: passed to callback function along with the returned
* entry object.
*
* nis_add_entry (table_name, obj, flags) will add the NIS+ object to the
* NIS+ table_name.
* const nis_name table_name
* const nis_object *obj
* u_long flags: 0, ADD_OVERWRITE, RETURN_RESULT
* u_long flags: 0, ADD_OVERWRITE, RETURN_RESULT
*
* nis_modify_entry (name, obj, flags) modifies an object identified by name.
* const nis_name name: object identifier
@ -95,15 +95,15 @@ extern nis_result *nis_modify __P ((const_nis_name name,
* const nis_object *obj: if obj is non-null, it is presumed to point to
* a cached copy of the entry. When the removal is
* attempted, and the object that would be removed
* is not the same as the cached object pointed to
* by object then the operation will fail with an
* is not the same as the cached object pointed to
* by object then the operation will fail with an
* NIS_NOTSAMEOBJ error
* u_long flags: 0, REM_MULTIPLE
*
* nis_first_entry (table_name) fetches entries from a table one at a time.
* const nis_name table_name
*
* nis_next_entry (table_name, cookie) retrieves the "next" entry from a
* nis_next_entry (table_name, cookie) retrieves the "next" entry from a
* table specified by table_name.
* const nis_name table_name:
* const netobj *cookie: The value of cookie from the nis_result structure
@ -117,25 +117,25 @@ extern nis_result *nis_list __P ((const_nis_name name, u_long flags,
extern nis_result *nis_add_entry __P ((const_nis_name table_name,
const nis_object *obj, u_long flags));
extern nis_result *nis_modify_entry __P ((const_nis_name name,
const nis_object *obj,
const nis_object *obj,
u_long flags));
extern nis_result *nis_remove_entry __P ((const_nis_name table_name,
const nis_object *obj,
u_long flags));
extern nis_result *nis_first_entry __P ((const_nis_name table_name));
extern nis_result *nis_next_entry __P ((const_nis_name table_name,
extern nis_result *nis_next_entry __P ((const_nis_name table_name,
const netobj *cookie));
/*
** nis_server
*/
extern nis_error nis_mkdir __P ((const_nis_name dirname,
extern nis_error nis_mkdir __P ((const_nis_name dirname,
const nis_server *machine));
extern nis_error nis_rmdir __P ((const_nis_name dirname,
extern nis_error nis_rmdir __P ((const_nis_name dirname,
const nis_server *machine));
extern nis_error nis_servstate __P ((const nis_server *machine,
const nis_tag *tags, int numtags,
extern nis_error nis_servstate __P ((const nis_server *machine,
const nis_tag *tags, int numtags,
nis_tag **result));
extern nis_error nis_stats __P ((const nis_server *machine,
extern nis_error nis_stats __P ((const nis_server *machine,
const nis_tag *tags, int numtags,
nis_tag **result));
extern void nis_freetags __P ((nis_tag *tags, int numtags));
@ -146,7 +146,7 @@ extern void nis_freeservlist __P ((nis_server **machines));
** nis_subr
*/
extern nis_name nis_leaf_of __P ((const_nis_name name));
extern nis_name nis_leaf_of_r __P ((const_nis_name name, char *buffer,
extern nis_name nis_leaf_of_r __P ((const_nis_name name, char *buffer,
size_t buflen));
extern nis_name nis_name_of __P ((const_nis_name name));
extern nis_name nis_name_of_r __P ((const_nis_name name, char *buffer,
@ -157,7 +157,7 @@ extern nis_name nis_domain_of_r __P ((const_nis_name name, char *buffer,
extern nis_name *nis_getnames __P ((const_nis_name name));
extern void nis_freenames __P ((nis_name *namelist));
extern name_pos nis_dir_cmp __P ((const_nis_name n1, const_nis_name n2));
extern nis_object *nis_clone_object __P ((const nis_object *src,
extern nis_object *nis_clone_object __P ((const nis_object *src,
nis_object *dest));
extern void nis_destroy_object __P ((nis_object *obj));
extern void nis_print_object __P ((const nis_object *obj));
@ -182,11 +182,11 @@ extern char *nis_sperror_r __P ((const nis_error status, const char *label,
/*
** nis_groups
*/
extern bool_t nis_ismember __P ((const_nis_name principal,
extern bool_t nis_ismember __P ((const_nis_name principal,
const_nis_name group));
extern nis_error nis_addmember __P ((const_nis_name member,
extern nis_error nis_addmember __P ((const_nis_name member,
const_nis_name group));
extern nis_error nis_removemember __P ((const_nis_name member,
extern nis_error nis_removemember __P ((const_nis_name member,
const_nis_name group));
extern nis_error nis_creategroup __P ((const_nis_name group, u_long flags));
extern nis_error nis_destroygroup __P ((const_nis_name group));
@ -224,20 +224,18 @@ extern bool_t nis_write_obj __P ((const char *file, const nis_object *obj));
*/
extern directory_obj *nis_clone_directory __P ((const directory_obj *src,
directory_obj *dest));
extern group_obj *nis_clone_group __P ((const group_obj *src,
extern group_obj *nis_clone_group __P ((const group_obj *src,
group_obj *dest));
extern table_obj *nis_clone_table __P ((const table_obj *src,
extern table_obj *nis_clone_table __P ((const table_obj *src,
table_obj *dest));
extern entry_obj *nis_clone_entry __P ((const entry_obj *src,
extern entry_obj *nis_clone_entry __P ((const entry_obj *src,
entry_obj *dest));
extern link_obj *nis_clone_link __P ((const link_obj *src, link_obj *dest));
extern objdata *nis_clone_objdata __P ((const objdata *src, objdata *dest));
extern nis_result *nis_clone_result __P ((const nis_result *src,
extern nis_result *nis_clone_result __P ((const nis_result *src,
nis_result *dest));
/*
** nis_free - nis_freeresult
*/
/* nis_free - nis_freeresult */
extern void nis_freeresult __P ((nis_result *result));
/* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
extern void nis_free_attr __P ((nis_attr *attr));
@ -251,12 +249,15 @@ extern void nis_free_entry __P ((entry_obj *enobj));
extern void nis_free_link __P ((link_obj *lnkobj));
extern void nis_free_object __P ((nis_object *obj));
/* This is the SUN definition, but I don't know for what we need
the directory_obj parameter */
/* extern fd_result *nis_finddirectory __P ((directory_obj *, nis_name)); */
extern fd_result *__nis_finddirectory __P ((const_nis_name name));
extern int __start_clock(int);
extern u_long __stop_clock(int);
/* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
extern nis_name __nis_default_owner __P ((char *));
extern nis_name __nis_default_group __P ((char *));
extern u_long __nis_default_ttl __P ((char *));
extern u_long __nis_default_access __P ((char *, u_long));
extern fd_result *__nis_finddirectory __P ((directory_obj *, nis_name));
extern log_result *__nis_dumplog __P ((nis_server *,nis_name, u_long));
extern log_result *__nis_dump __P ((nis_server *, nis_name,
int (*)(nis_name, nis_object *, void *)));
__END_DECLS

View File

@ -157,3 +157,11 @@
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Moammar Qudhafi
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mu'ammar al-Qaddafi
0:M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy]:Mulazim Awwal Mu'ammar Muhammad Abu Minyar al-Qadhafi
0:[[:digit:]]+:01234
1:[[:alpha:]]+:01234
0:^[[:digit:]]*$:01234
1:^[[:digit:]]*$:01234a
0:^[[:alnum:]]*$:01234a
0:^[[:xdigit:]]*$:01234a
1:^[[:xdigit:]]*$:01234g
0:^[[:alnum:][:space:]]*$:Hello world

View File

@ -6,9 +6,6 @@
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
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

View File

@ -1,8 +1,6 @@
/* Declarations for getopt.
Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as

View File

@ -1,8 +1,6 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
This file is part of the GNU C Library.
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

View File

@ -1,6 +1,6 @@
/* Extended regular expression matching and search library,
version 0.12.
(Implements POSIX draft P10003.2/D11.2, except for
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
@ -42,6 +42,13 @@
#include <sys/types.h>
#endif
/* For platform which support the ISO C amendement 1 functionality we
support user defined character classes. */
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
# include <wctype.h>
# include <wchar.h>
#endif
/* This is for other GNU distributions with internationalized messages. */
#if HAVE_LIBINTL_H || defined (_LIBC)
# include <libintl.h>
@ -946,6 +953,12 @@ re_set_syntax (syntax)
reg_syntax_t ret = re_syntax_options;
re_syntax_options = syntax;
#ifdef DEBUG
if (syntax & RE_DEBUG)
debug = 1;
else if (debug) /* was on but now is not */
debug = 0;
#endif /* DEBUG */
return ret;
}
@ -1026,22 +1039,24 @@ static const char *re_error_msgid[] =
#endif
/* Roughly the maximum number of failure points on the stack. Would be
exactly that if always used MAX_FAILURE_SPACE each time we failed.
exactly that if always used MAX_FAILURE_ITEMS items each time we failed.
This is a variable only so users of regex can assign to it; we never
change it ourselves. */
#ifdef INT_IS_16BIT
#if defined (MATCH_MAY_ALLOCATE)
long re_max_failures = 4000;
/* 4400 was enough to cause a crash on Alpha OSF/1,
whose default stack limit is 2mb. */
long int re_max_failures = 4000;
#else
long re_max_failures = 2000;
long int re_max_failures = 2000;
#endif
union fail_stack_elt
{
unsigned char *pointer;
long integer;
long int integer;
};
typedef union fail_stack_elt fail_stack_elt_t;
@ -1049,8 +1064,8 @@ typedef union fail_stack_elt fail_stack_elt_t;
typedef struct
{
fail_stack_elt_t *stack;
unsigned long size;
unsigned long avail; /* Offset of next open position. */
unsigned long int size;
unsigned long int avail; /* Offset of next open position. */
} fail_stack_type;
#else /* not INT_IS_16BIT */
@ -1058,7 +1073,7 @@ typedef struct
#if defined (MATCH_MAY_ALLOCATE)
/* 4400 was enough to cause a crash on Alpha OSF/1,
whose default stack limit is 2mb. */
int re_max_failures = 4000;
int re_max_failures = 20000;
#else
int re_max_failures = 2000;
#endif
@ -1661,15 +1676,29 @@ typedef struct
} \
}
#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
/* The GNU C library provides support for user-defined character classes
and the functions from ISO C amendement 1. */
# ifdef CHARCLASS_NAME_MAX
# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
# else
/* This shouldn't happen but some implementation might still have this
problem. Use a reasonable default value. */
# define CHAR_CLASS_MAX_LENGTH 256
# endif
#define IS_CHAR_CLASS(string) \
# define IS_CHAR_CLASS(string) wctype (string)
#else
# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
# define IS_CHAR_CLASS(string) \
(STREQ (string, "alpha") || STREQ (string, "upper") \
|| STREQ (string, "lower") || STREQ (string, "digit") \
|| STREQ (string, "alnum") || STREQ (string, "xdigit") \
|| STREQ (string, "space") || STREQ (string, "print") \
|| STREQ (string, "punct") || STREQ (string, "graph") \
|| STREQ (string, "cntrl") || STREQ (string, "blank"))
#endif
#ifndef MATCH_MAY_ALLOCATE
@ -2147,6 +2176,34 @@ regex_compile (pattern, size, syntax, bufp)
the leading `:' and `[' (but set bits for them). */
if (c == ':' && *p == ']')
{
#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
boolean is_lower = STREQ (str, "lower");
boolean is_upper = STREQ (str, "upper");
wctype_t wt;
int ch;
wt = wctype (str);
if (wt == 0)
FREE_STACK_RETURN (REG_ECTYPE);
/* Throw away the ] at the end of the character
class. */
PATFETCH (c);
if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
{
if (iswctype (btowc (ch), wt))
SET_LIST_BIT (ch);
if (translate && (is_upper || is_lower)
&& (ISUPPER (ch) || ISLOWER (ch)))
SET_LIST_BIT (ch);
}
had_char_class = true;
#else
int ch;
boolean is_alnum = STREQ (str, "alnum");
boolean is_alpha = STREQ (str, "alpha");
@ -2194,6 +2251,7 @@ regex_compile (pattern, size, syntax, bufp)
SET_LIST_BIT (ch);
}
had_char_class = true;
#endif /* libc || wctype.h */
}
else
{
@ -3551,12 +3609,14 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop)
: (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
== Sword)
/* Disabled due to a compiler bug -- see comment at case wordbound */
#if 0
/* Test if the character before D and the one at D differ with respect
to being word-constituent. */
#define AT_WORD_BOUNDARY(d) \
(AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \
|| WORDCHAR_P (d - 1) != WORDCHAR_P (d))
#endif
/* Free everything we malloc. */
#ifdef MATCH_MAY_ALLOCATE
@ -4725,6 +4785,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
dummy_low_reg, dummy_high_reg,
reg_dummy, reg_dummy, reg_info_dummy);
}
/* Note fall through. */
unconditional_jump:
#ifdef _LIBC
@ -5355,7 +5416,13 @@ re_compile_pattern (pattern, length, bufp)
/* BSD has one and only one pattern buffer. */
static struct re_pattern_buffer re_comp_buf;
char * weak_function
char *
#ifdef _LIBC
/* Make these definitions weak in libc, so POSIX programs can redefine
these names if they don't use our functions, and still use
regcomp/regexec below without link errors. */
weak_function
#endif
re_comp (s)
const char *s;
{
@ -5396,7 +5463,10 @@ re_comp (s)
}
int weak_function
int
#ifdef _LIBC
weak_function
#endif
re_exec (s)
const char *s;
{

View File

@ -152,6 +152,14 @@ typedef unsigned long int reg_syntax_t;
If not set, then the GNU regex operators are recognized. */
#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
/* If this bit is set, turn on internal regex debugging.
If not set, and debugging was on, turn it off.
This only works if regex.c is compiled -DDEBUG.
We define this bit always, so that all that's needed to turn on
debugging is to recompile regex.c; the calling code can always have
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
@ -168,15 +176,16 @@ extern reg_syntax_t re_syntax_options;
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
#define RE_SYNTAX_GNU_AWK \
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS))
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
#define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_NO_GNU_OPS)
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
| RE_INTERVALS | RE_NO_GNU_OPS)
#define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
@ -316,10 +325,10 @@ struct re_pattern_buffer
unsigned char *buffer;
/* Number of bytes to which `buffer' points. */
unsigned long allocated;
unsigned long int allocated;
/* Number of bytes actually used in `buffer'. */
unsigned long used;
unsigned long int used;
/* Syntax setting with which the pattern was compiled. */
reg_syntax_t syntax;

View File

@ -53,7 +53,7 @@ ln2 = 6.931471805599453094287e-01L; /* 0x3FFE, 0xB17217F7, 0xD1CF79AC */
long double t;
u_int32_t se,i0,i1;
GET_LDOUBLE_WORDS(se,i0,i1,x);
if(se<0x3fff) { /* x < 1 */
if(se<0x3fff || se & 0x8000) { /* x < 1 */
return (x-x)/(x-x);
} else if(se >=0x401b) { /* x > 2**28 */
if(se >=0x7fff) { /* x is inf of NaN */

View File

@ -73,10 +73,10 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
EXTRACT_LDOUBLE_WORDS(sx,hx,lx,x);
ix = sx&0x7fff;
lx |= hx ^ 0x80000000;
lx |= hx & 0x7fffffff;
EXTRACT_LDOUBLE_WORDS(sy,hy,ly,y);
iy = sy&0x7fff;
ly |= hy ^ 0x80000000;
ly |= hy & 0x7fffffff;
if(((2*ix|((lx|-lx)>>31))>0xfffe)||
((2*iy|((ly|-ly)>>31))>0xfffe)) /* x or y is NaN */
return x+y;
@ -114,7 +114,7 @@ pi_lo = -5.01655761266833202345176e-20L;/* 0xBFBE, 0xECE675D1, 0xFC8F8CBB */
}
}
/* when y is INF */
if(iy==0x7fff) return (hy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
if(iy==0x7fff) return (sy>=0x8000)? -pi_o_2-tiny: pi_o_2+tiny;
/* compute y/x */
k = sy-sx;

View File

@ -75,5 +75,5 @@ static double long zero = 0.0;
t = 0.5*__log1pl(t+t*x/(one-x));
} else
t = 0.5*__log1pl((x+x)/(one-x));
if(se>0x7fff) return t; else return -t;
if(se<=0x7fff) return t; else return -t;
}

View File

@ -63,7 +63,7 @@ static long double one = 1.0, shuge = 1.0e4931L;
if(ix==0x7fff) return x+x;
h = 0.5;
if (jx<0) h = -h;
if (jx & 0x8000) h = -h;
/* |x| in [0,25], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x4003 || (ix == 0x4003 && i0 <= 0xc8000000)) { /* |x|<25 */
if (ix<0x3fe3) /* |x|<2**-28 */

View File

@ -153,6 +153,21 @@ __internal_inline_functions (float,f)
__internal_inline_functions (long double,l)
#undef __internal_inline_functions
/* Get the m68881 condition codes, to quickly check multiple conditions. */
static __inline__ unsigned long
__m81_test (long double __val)
{
unsigned long __fpsr;
__asm ("ftst%.x %1; fmove%.l %/fpsr,%0" : "=dm" (__fpsr) : "f" (__val));
return __fpsr;
}
/* Bit values returned by __m81_test. */
#define __M81_COND_NAN (1 << 24)
#define __M81_COND_INF (2 << 24)
#define __M81_COND_ZERO (4 << 24)
#define __M81_COND_NEG (8 << 24)
#endif /* __LIBC_M81_MATH_INLINES */
/* The rest of the functions are available to the user. */
@ -163,8 +178,12 @@ __m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \
{ \
float_type __mantissa, __exponent; \
int __iexponent; \
if (__value == 0.0) \
unsigned long __fpsr; \
__asm("ftst%.x %1\n" \
"fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
if (__fpsr & (7 << 24)) \
{ \
/* Not finite or zero. */ \
*__expptr = 0; \
return __value; \
} \

View File

@ -36,29 +36,33 @@ s(__ieee754_pow) (float_type x, float_type y)
{
float_type z;
float_type ax;
unsigned long x_cond, y_cond;
if (y == 0.0)
y_cond = __m81_test (y);
if (y_cond & __M81_COND_ZERO)
return 1.0;
if (x != x || y != y)
x_cond = __m81_test (x);
if ((x_cond | y_cond) & __M81_COND_NAN)
return x + y;
if (m81(__isinf) (y))
if (y_cond & __M81_COND_INF)
{
ax = s(fabs) (x);
if (ax == 1)
return 0.0/0.0;
return y - y;
if (ax > 1)
return y > 0 ? y : 0;
return y_cond & __M81_COND_NEG ? 0 : y;
else
return y < 0 ? -y : 0;
return y_cond & __M81_COND_NEG ? -y : 0;
}
if (s(fabs) (y) == 1)
return y > 0 ? x : 1 / x;
return y_cond & __M81_COND_NEG ? 1 / x : x;
if (y == 2)
return x * x;
if (y == 0.5 && x >= 0)
if (y == 0.5 && !(x_cond & __M81_COND_NEG))
return m81(__ieee754_sqrt) (x);
if (x == 10.0)
@ -73,17 +77,17 @@ s(__ieee754_pow) (float_type x, float_type y)
}
ax = s(fabs) (x);
if (m81(__isinf) (x) || x == 0 || ax == 1)
if (x_cond & (__M81_COND_INF | __M81_COND_ZERO) || ax == 1)
{
z = ax;
if (y < 0)
if (y_cond & __M81_COND_NEG)
z = 1 / z;
if (m81(__signbit) (x))
if (x_cond & __M81_COND_NEG)
{
if (y != m81(__rint) (y))
{
if (x == -1)
z = 0.0/0.0;
z = (z - z) / (z - z);
}
else
goto maybe_negate;
@ -91,7 +95,7 @@ s(__ieee754_pow) (float_type x, float_type y)
return z;
}
if (x < 0.0)
if (x_cond & __M81_COND_NEG)
{
if (y == m81(__rint) (y))
{
@ -112,7 +116,7 @@ s(__ieee754_pow) (float_type x, float_type y)
}
}
else
z = 0.0/0.0;
z = (y - y) / (y - y);
}
else
z = m81(__ieee754_exp) (y * m81(__ieee754_log) (x));

73
sysdeps/m68k/fpu/s_ccos.c Normal file
View File

@ -0,0 +1,73 @@
/* Complex cosine function. m68k fpu version
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define __LIBC_M81_MATH_INLINES
#include <complex.h>
#include <math.h>
#ifndef SUFF
#define SUFF
#endif
#ifndef float_type
#define float_type double
#endif
#define CONCATX(a,b) __CONCAT(a,b)
#define s(name) CONCATX(name,SUFF)
#define m81(func) __m81_u(s(func))
__complex__ float_type
s(__ccos) (__complex__ float_type x)
{
__complex__ float_type retval;
unsigned long rx_cond = __m81_test (__real__ x);
if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
/* Real part is finite. */
float_type sin_rx, cos_rx;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
: "f" (__real__ x));
__real__ retval = cos_rx * m81(__ieee754_cosh) (__imag__ x);
if (rx_cond & __M81_COND_ZERO)
__imag__ retval = (m81(__signbit) (__imag__ x)
? __real__ x : -__real__ x);
else
__imag__ retval = -sin_rx * m81(__ieee754_sinh) (__imag__ x);
}
else
{
unsigned long ix_cond = __m81_test (__imag__ x);
if (ix_cond & __M81_COND_INF)
__real__ retval = s(fabs) (__imag__ x);
else
__real__ retval = __real__ x - __real__ x;
if (ix_cond & __M81_COND_ZERO)
__imag__ retval = __imag__ x;
else
__imag__ retval = __real__ x - __real__ x;
}
return retval;
}
#define weak_aliasx(a,b) weak_alias(a,b)
weak_aliasx (s(__ccos), s(ccos))

View File

@ -0,0 +1,3 @@
#define SUFF f
#define float_type float
#include <s_ccos.c>

View File

@ -25,9 +25,6 @@
#ifndef SUFF
#define SUFF
#endif
#ifndef huge_val
#define huge_val HUGE_VAL
#endif
#ifndef float_type
#define float_type double
#endif
@ -40,78 +37,40 @@ __complex__ float_type
s(__ccosh) (__complex__ float_type x)
{
__complex__ float_type retval;
unsigned long ix_cond = __m81_test (__imag__ x);
__real__ x = s(fabs) (__real__ x);
if (m81(__finite) (__real__ x))
if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
if (m81(__finite) (__imag__ x))
{
float_type cosh_val;
float_type sin_ix, cos_ix;
/* Imaginary part is finite. */
float_type sin_ix, cos_ix;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
cosh_val = m81(__ieee754_cosh) (__real__ x);
__real__ retval = cos_ix * cosh_val;
__imag__ retval = sin_ix * cosh_val;
}
else if (__real__ x == 0)
{
__imag__ retval = 0.0;
__real__ retval = huge_val - huge_val;
}
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
__real__ retval = cos_ix * m81(__ieee754_cosh) (__real__ x);
if (ix_cond & __M81_COND_ZERO)
__imag__ retval = (m81(__signbit) (__real__ x)
? -__imag__ x : __imag__ x);
else
__real__ retval = __imag__ retval = huge_val - huge_val;
}
else if (m81(__isinf) (__real__ x))
{
if (__imag__ x == 0)
{
__real__ retval = huge_val;
__imag__ retval = __imag__ x;
}
else if (m81(__finite) (__imag__ x))
{
float_type remainder, pi_2;
int quadrant;
__real__ retval = __imag__ retval = huge_val;
__asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
__asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
: "=f" (remainder), "=dm" (quadrant)
: "f" (pi_2), "0" (__imag__ x));
quadrant = (quadrant >> 16) & 0x83;
if (quadrant & 0x80)
quadrant ^= 0x83;
switch (quadrant)
{
default:
break;
case 1:
__real__ retval = -__real__ retval;
break;
case 2:
__real__ retval = -__real__ retval;
case 3:
__imag__ retval = -__imag__ retval;
break;
}
}
else
{
/* The subtraction raises the invalid exception. */
__real__ retval = huge_val;
__imag__ retval = huge_val - huge_val;
}
}
else if (__imag__ x == 0)
{
__real__ retval = 0.0/0.0;
__imag__ retval = __imag__ x;
__imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x);
}
else
__real__ retval = __imag__ retval = 0.0/0.0;
{
unsigned long rx_cond = __m81_test (__real__ x);
if (rx_cond & __M81_COND_ZERO)
{
__real__ retval = __imag__ x - __imag__ x;
__imag__ retval = __real__ x;
}
else
{
if (rx_cond & __M81_COND_INF)
__real__ retval = s(fabs) (__real__ x);
else
__real__ retval = 0.0/0.0;
__imag__ retval = __imag__ x - __imag__ x;
}
}
return retval;
}

View File

@ -1,4 +1,3 @@
#define SUFF f
#define float_type float
#define huge_val HUGE_VALF
#include <s_ccosh.c>

View File

@ -1,4 +1,3 @@
#define SUFF l
#define float_type long double
#define huge_val HUGE_VALL
#include <s_ccosh.c>

View File

@ -0,0 +1,3 @@
#define SUFF l
#define float_type long double
#include <s_ccos.c>

View File

@ -25,9 +25,6 @@
#ifndef SUFF
#define SUFF
#endif
#ifndef huge_val
#define huge_val HUGE_VAL
#endif
#ifndef float_type
#define float_type double
#endif
@ -40,85 +37,79 @@ __complex__ float_type
s(__cexp) (__complex__ float_type x)
{
__complex__ float_type retval;
unsigned long ix_cond;
if (m81(__finite) (__real__ x))
ix_cond = __m81_test (__imag__ x);
if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
{
if (m81(__finite) (__imag__ x))
{
float_type exp_val = m81(__ieee754_exp) (__real__ x);
/* Imaginary part is finite. */
float_type exp_val = m81(__ieee754_exp) (__real__ x);
__real__ retval = __imag__ retval = exp_val;
if (m81(__finite) (exp_val))
{
float_type sin_ix, cos_ix;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
__real__ retval *= cos_ix;
__imag__ retval *= sin_ix;
}
__real__ retval = __imag__ retval = exp_val;
if (m81(__finite) (exp_val))
{
float_type sin_ix, cos_ix;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
__real__ retval *= cos_ix;
if (ix_cond & __M81_COND_ZERO)
__imag__ retval = __imag__ x;
else
goto fix_sign;
}
else
/* If the imaginary part is +-inf or NaN and the real part is
not +-inf the result is NaN + iNaN. */
__real__ retval = __imag__ retval = 0.0/0.0;
}
else if (m81(__isinf) (__real__ x))
{
if (m81(__finite) (__imag__ x))
{
float_type value = m81(__signbit) (__real__ x) ? 0.0 : huge_val;
if (__imag__ x == 0.0)
{
__real__ retval = value;
__imag__ retval = __imag__ x;
}
else
{
float_type remainder, pi_2;
int quadrant;
__real__ retval = value;
__imag__ retval = value;
fix_sign:
__asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
__asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
: "=f" (remainder), "=dm" (quadrant)
: "f" (pi_2), "0" (__imag__ x));
quadrant = (quadrant >> 16) & 0x83;
if (quadrant & 0x80)
quadrant ^= 0x83;
switch (quadrant)
{
default:
break;
case 1:
__real__ retval = -__real__ retval;
break;
case 2:
__real__ retval = -__real__ retval;
case 3:
__imag__ retval = -__imag__ retval;
break;
}
}
}
else if (m81(__signbit) (__real__ x) == 0)
{
__real__ retval = huge_val;
__imag__ retval = 0.0/0.0;
__imag__ retval *= sin_ix;
}
else
{
__real__ retval = 0.0;
__imag__ retval = s(__copysign) (0.0, __imag__ x);
/* Compute the sign of the result. */
float_type remainder, pi_2;
int quadrant;
__asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
__asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
: "=f" (remainder), "=dm" (quadrant)
: "f" (pi_2), "0" (__imag__ x));
quadrant = (quadrant >> 16) & 0x83;
if (quadrant & 0x80)
quadrant ^= 0x83;
switch (quadrant)
{
default:
break;
case 1:
__real__ retval = -__real__ retval;
break;
case 2:
__real__ retval = -__real__ retval;
case 3:
__imag__ retval = -__imag__ retval;
break;
}
if (ix_cond & __M81_COND_ZERO && !m81(__isnan) (exp_val))
__imag__ retval = __imag__ x;
}
}
else
/* If the real part is NaN the result is NaN + iNaN. */
__real__ retval = __imag__ retval = 0.0/0.0;
{
unsigned long rx_cond = __m81_test (__real__ x);
if (rx_cond & __M81_COND_INF)
{
/* Real part is infinite. */
if (rx_cond & __M81_COND_NEG)
{
__real__ retval = __imag__ retval = 0.0;
if (ix_cond & __M81_COND_NEG)
__imag__ retval = -__imag__ retval;
}
else
{
__real__ retval = __real__ x;
__imag__ retval = __imag__ x - __imag__ x;
}
}
else
__real__ retval = __imag__ retval = __imag__ x - __imag__ x;
}
return retval;
}

View File

@ -1,4 +1,3 @@
#define SUFF f
#define huge_val HUGE_VALF
#define float_type float
#include <s_cexp.c>

View File

@ -1,4 +1,3 @@
#define SUFF l
#define huge_val HUGE_VALL
#define float_type long double
#include <s_cexp.c>

69
sysdeps/m68k/fpu/s_csin.c Normal file
View File

@ -0,0 +1,69 @@
/* Complex sine function. m68k fpu version
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#define __LIBC_M81_MATH_INLINES
#include <complex.h>
#include <math.h>
#ifndef SUFF
#define SUFF
#endif
#ifndef float_type
#define float_type double
#endif
#define CONCATX(a,b) __CONCAT(a,b)
#define s(name) CONCATX(name,SUFF)
#define m81(func) __m81_u(s(func))
__complex__ float_type
s(__csin) (__complex__ float_type x)
{
__complex__ float_type retval;
unsigned long rx_cond = __m81_test (__real__ x);
if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
/* Real part is finite. */
float_type sin_rx, cos_rx;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
: "f" (__real__ x));
if (rx_cond & __M81_COND_ZERO)
__real__ retval = __real__ x;
else
__real__ retval = sin_rx * m81(__ieee754_cosh) (__imag__ x);
__imag__ retval = cos_rx * m81(__ieee754_sinh) (__imag__ x);
}
else
{
unsigned long ix_cond = __m81_test (__imag__ x);
__real__ retval = __real__ x - __real__ x;
if (ix_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN))
__imag__ retval = __imag__ x;
else
__imag__ retval = __real__ retval;
}
return retval;
}
#define weak_aliasx(a,b) weak_alias(a,b)
weak_aliasx (s(__csin), s(csin))

View File

@ -0,0 +1,3 @@
#define SUFF f
#define float_type float
#include <s_csin.c>

View File

@ -25,9 +25,6 @@
#ifndef SUFF
#define SUFF
#endif
#ifndef huge_val
#define huge_val HUGE_VAL
#endif
#ifndef float_type
#define float_type double
#endif
@ -40,87 +37,33 @@ __complex__ float_type
s(__csinh) (__complex__ float_type x)
{
__complex__ float_type retval;
int negate = m81(__signbit) (__real__ x);
unsigned long ix_cond;
__real__ x = s(fabs) (__real__ x);
ix_cond = __m81_test (__imag__ x);
if (m81(__finite) (__real__ x))
if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
if (m81(__finite) (__imag__ x))
{
float_type sinh_val;
float_type sin_ix, cos_ix;
/* Imaginary part is finite. */
float_type sin_ix, cos_ix;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
sinh_val = m81(__ieee754_sinh) (__real__ x);
__real__ retval = cos_ix * sinh_val;
__imag__ retval = sin_ix * sinh_val;
if (negate)
__real__ retval = -__real__ retval;
}
else if (__real__ x == 0)
{
__real__ retval = 0.0;
__imag__ retval = 0.0/0.0;
if (negate)
__real__ retval = -__real__ retval;
}
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
__real__ retval = cos_ix * m81(__ieee754_sinh) (__real__ x);
if (ix_cond & __M81_COND_ZERO)
__imag__ retval = __imag__ x;
else
__real__ retval = __imag__ retval = 0.0/0.0;
}
else if (m81(__isinf) (__real__ x))
{
if (__imag__ x == 0.0)
{
__real__ retval = negate ? -huge_val : huge_val;
__imag__ retval = __imag__ x;
}
else if (m81(__finite) (__imag__ x))
{
float_type remainder, pi_2;
int quadrant;
__real__ retval = __imag__ retval = huge_val;
__asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
__asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
: "=f" (remainder), "=dm" (quadrant)
: "f" (pi_2), "0" (__imag__ x));
quadrant = (quadrant >> 16) & 0x83;
if (quadrant & 0x80)
quadrant ^= 0x83;
if (negate)
quadrant ^= 1;
switch (quadrant)
{
default:
break;
case 1:
__real__ retval = -__real__ retval;
break;
case 2:
__real__ retval = -__real__ retval;
case 3:
__imag__ retval = -__imag__ retval;
break;
}
}
else
{
/* The subtraction raises the invalid exception. */
__real__ retval = huge_val;
__imag__ retval = huge_val - huge_val;
}
}
else if (__imag__ x == 0.0)
{
__real__ retval = 0.0/0.0;
__imag__ retval = __imag__ x;
__imag__ retval = sin_ix * m81(__ieee754_cosh) (__real__ x);
}
else
__real__ retval = __imag__ retval = 0.0/0.0;
{
unsigned long rx_cond = __m81_test (__real__ x);
__imag__ retval = __imag__ x - __imag__ x;
if (rx_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN))
__real__ retval = __real__ x;
else
__real__ retval = __imag__ retval;
}
return retval;
}

View File

@ -1,4 +1,3 @@
#define SUFF f
#define float_type float
#define huge_val HUGE_VALF
#include <s_csinh.c>

View File

@ -1,4 +1,3 @@
#define SUFF l
#define float_type long double
#define huge_val HUGE_VALL
#include <s_csinh.c>

View File

@ -0,0 +1,3 @@
#define SUFF l
#define float_type long double
#include <s_csin.c>

View File

@ -10,7 +10,9 @@
#define ABI_LINUX_MINOR 0
#define ABI_LINUX_PATCH 0
#define ABI_TAG ((ABI_LINUX_TAG << 24) | \
(ABI_LINUX_MAJOR << 16) | \
(ABI_LINUX_MINOR << 8) | \
/* Don't use `|' in this expression, it is a comment character in the
assembler. */
#define ABI_TAG ((ABI_LINUX_TAG << 24) + \
(ABI_LINUX_MAJOR << 16) + \
(ABI_LINUX_MINOR << 8) + \
(ABI_LINUX_PATCH << 0))

View File

@ -37,8 +37,9 @@ __curbrk: .skip 8
#endif
.text
LEAF(__brk, 0)
LEAF(__brk, 8)
ldgp gp, 0(t12)
subq sp, 8, sp
#ifdef PROF
.set noat
lda AT, _mcount
@ -47,9 +48,14 @@ LEAF(__brk, 0)
#endif
.prologue 1
/* Save the requested brk across the system call. */
stq a0, 0(sp)
ldiq v0, __NR_brk
call_pal PAL_callsys
ldq a0, 0(sp)
/* Be prepared for an OSF-style brk. */
bne a3, $err1
beq v0, $ok
@ -62,11 +68,13 @@ LEAF(__brk, 0)
/* Update __curbrk and return cleanly. */
mov zero, v0
$ok: stq a0, __curbrk
addq sp, 8, sp
ret
/* What a horrible way to die. */
$err0: ldi v0, ENOMEM
$err1: jmp zero, __syscall_error
$err1: addq sp, 8, sp
jmp zero, __syscall_error
END(__brk)

View File

@ -42,9 +42,12 @@ ENTRY(__clone)
beq a0,$error /* no NULL function pointers */
beq a1,$error /* no NULL stack pointers */
/* Save the fn ptr and arg on the new stack. */
subq a1,16,a1
stq a0,0(a1)
stq a3,8(a1)
/* Do the system call */
mov a0,pv /* get fn ptr out of the way */
mov a3,t0 /* get fn arg out of the way */
mov a2,a0
ldiq v0,__NR_clone
call_pal PAL_callsys
@ -73,8 +76,12 @@ thread_start:
mov zero,fp
.prologue 0
/* Load up the arguments. */
ldq pv,0(sp)
ldq a0,8(sp)
addq sp,16,sp
/* Call the user's function */
mov t0,a0
jsr ra,(pv)
ldgp gp,0(ra)

View File

@ -1,5 +1,5 @@
/* Header file for mounting/unmount Linux filesystems.
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -17,13 +17,81 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This is taken from /usr/include/linux/fs.h. */
#ifndef _SYS_MOUNT_H
#define _SYS_MOUNT_H 1
#include <features.h>
#include <sys/ioctl.h>
__BEGIN_DECLS
#define BLOCK_SIZE 1024
#define BLOCK_SIZE_BITS 10
/* These are the fs-independent mount-flags: up to 16 flags are
supported */
#define MS_RDONLY 1 /* Mount read-only. */
#define MS_NOSUID 2 /* Ignore suid and sgid bits. */
#define MS_NODEV 4 /* Disallow access to device special files. */
#define MS_NOEXEC 8 /* Disallow program execution. */
#define MS_SYNCHRONOUS 16 /* Writes are synced at once. */
#define MS_REMOUNT 32 /* Alter flags of a mounted FS. */
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS. */
#define S_WRITE 128 /* Write on file/directory/symlink. */
#define S_APPEND 256 /* Append-only file. */
#define S_IMMUTABLE 512 /* Immutable file. */
#define MS_NOATIME 1024 /* Do not update access times. */
/* Flags that can be altered by MS_REMOUNT */
#define MS_RMT_MASK (MS_RDONLY | MS_MANDLOCK)
/* Magic mount flag number. Has to be or-ed to the flag values. */
#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number to indicate "new" flags */
#define MS_MGC_MSK 0xffff0000 /* Magic flag number mask */
/* Note that read-only etc flags are inode-specific: setting some
file-system flags just means all the inodes inherit those flags by
default. It might be possible to override it selectively if you
really wanted to with some ioctl() that is not currently
implemented.
Exception: MS_RDONLY is always applied to the entire file system. */
#define IS_RDONLY(inode) \
(((inode)->i_sb) && ((inode)->i_sb->s_flags & MS_RDONLY))
#define DO_UPDATE_ATIME(inode) \
(!((inode)->i_flags & MS_NOATIME) && !IS_RDONLY (inode))
#define IS_NOSUID(inode) ((inode)->i_flags & MS_NOSUID)
#define IS_NODEV(inode) ((inode)->i_flags & MS_NODEV)
#define IS_NOEXEC(inode) ((inode)->i_flags & MS_NOEXEC)
#define IS_SYNC(inode) ((inode)->i_flags & MS_SYNCHRONOUS)
#define IS_MANDLOCK(inode) ((inode)->i_flags & MS_MANDLOCK)
#define IS_WRITABLE(inode) ((inode)->i_flags & S_WRITE)
#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
/* The read-only stuff doesn't really belong here, but any other place
is probably as bad and I don't want to create yet another include
file. */
#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */
#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */
#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */
#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */
#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */
/* Mount a filesystem. */
extern int mount __P ((__const char *__special_file, __const char *__dir,
__const char *__fstype, unsigned long int __rwflag,