1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

update from main archive

Mon Sep 23 15:31:04 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>

	* hurd/Makefile ($(includedir)/rpc/netdb.h): There is no make
	variable `top_srcdir' in libc; use $(..) instead.

	* sysdeps/mach/hurd/Makefile (rtld-installed-name): Delete special
	definition.  It was a *Mistake*.  (With a capital M.)

	* sysdeps/mach/getsysstats.c (__get_nprocs): Renamed from
	__get_nproc.
	(__get_nprocs_conf): Renamed from __get_nproc_conf.

Fri Sep 27 03:49:56 1996  Ulrich Drepper  <drepper@cygnus.com>

	Add support for cancelable system calls.

	* csu/initfini.c: Make in crti.o reference to symbol
 	__libc_force_cancel_wrapper when compiling reentrant version.
	* misc/Makefile (routines): Add force-wrapper.
	* misc/force-wrapper.c: New file.

	* posix/system.c: Rename function to __libc_system and make system
 	a weak alias.
	* sysdeps/stub/system.c: Likewise.
	* posix/wait.c: Rename function to __libc_wait and make __wait a
	weak alias.  De-ANSI-fy.
	* sysdeps/standalone/read.c: Rename function to __libc_read and
	make __read a weak alias.
	* sysdeps/stub/read.c: Likewise.
	* sysdeps/standalone/write.c: Rename function to __libc_write and
	make __write a weak alias.
	* sysdeps/stub/write.c: Likewise.
	* sysdeps/stub/tcdrain.c: Rename function to __libc_tcdrain and
 	make tcdrain a weak alias.
	* sysdeps/unix/bsd/tcdrain.c: Likewise.
	* sysdeps/unix/bsd/bsd4.4/tcdrain.c: Likewise.
	* sysdeps/unix/sysv/tcdrain.c: Likewise.
	* sysdeps/unix/sysv/linux/tcdrain.c: Likewise.
	* sysdeps/unix/bsd/bsd4.4/wait.c: Rename function to __libc_wait
	and make __wait a weak alias.
	* sysdeps/stub/waitpid.c: Rename function to __libc_waitpid and
	make __waitpid a weak alias.
	* sysdeps/unix/bsd/bsd4.4/waitpid.c: Likewise.
	* sysdeps/unix/sysv/linux/waitpid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/waitpid.c: Likewise.
	* sysdeps/unix/common/pause.c: Rename function to __libc_pause
	and make pause a weak alias.  De-ANSI-fy.

	* sysdeps/unix/syscalls.list: Change name for close, fcntl, fsync,
 	lseek, open, read, and write to have __libc_ prefix and make old
 	names a weak alias.
	* sysdeps/unix/mman/syscalls.list: Likewise for msync.
	* sysdeps/unix/sysv/linux/syscalls.list: Likewise for nanosleep.

	* io/creat.c: De-ANSI-fy.

	* sysdeps/unix/sysv/linux/syscalls.list: Add pause.

Thu Sep 26 19:15:55 1996  Ulrich Drepper  <drepper@cygnus.com>

	* misc/mntent.h: Add MNTTYPE_* and MNTOPT_* macros.
	Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>.

Thu Sep 26 14:40:10 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/posix/pathconf.c: Pass descriptor for just opened file
 	to fpathconf.
	Reported by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.

Thu Sep 26 04:02:43 1996  Ulrich Drepper  <drepper@cygnus.com>

	* locale/programs/locfile.c (write_locale_data): Allocate room
	even for file name for LC_MESSAGES locale.
	(locafile_read): `tok_era' must be handled as a string list.
	* locale/programs/ld-time.c: Finish correction of handling `era'.
	* locale/C-time.c (_nl_C_LC_TIME): Add initializer for new fields.
	* locale/categories.def: Add postload function for LC_TIME.
	* locale/setlocale.c: Make lock global and rename to
 	__libc_setlocale_lock.
	* locale/localeinfo.h (struct era_entry): New type.  Used in strftime.
	Add prototypes for _nl_get_era_entry and _nl_get_alt_digit.
	* locale/lc-time.c (_nl_postload_time): New function.  Initialize
	lazy intialization.
	(_nl_get_era_entry): New function.  Return era entry which corresponds
	to given year.
	(_nl_get_alt_digit): New function.  Return string with alternate
	digit representation for given number.

	* time/strftime.c (strftime): Use _nl_get_alt_digit to get
	string representing alternate digit notation.

Wed Sep 25 17:31:55 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/generic/waitstatus.h (union wait): Add w_status field.
	Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>.

	* elf/rtld.c (dl_main): Process LD_PRELOAD before loading
 	ld.so.preload.  Suggested by David Engel <david@elo.ods.com>.

Wed Sep 25 13:10:57 1996  Ulrich Drepper  <drepper@cygnus.com>

	* catgets/gencat.c (main): Change --version again because RMS wants
	the package name in parentheses.
	* db/makedb.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.

Tue Sep 24 01:28:05 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makefile ($(objpfx)sysd-dirs): Depend on Subdirs files, command
	rewritten.
	($(objpfx)version-info.h): Depend on Banner files, command
	rewritten.

Wed Sep 25 02:44:41 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/sleep.c: New file.  Based on nanosleep.

Tue Sep 24 21:46:02 1996  Ulrich Drepper  <drepper@cygnus.com>

	* shadow/lckpwdf.c (PWD_LOCKFILE): Change to /etc/lock.pwd to be
 	on the same device as the password file.
	* shadow/shadow.h (struct spwd): Change type of numeric fields
	to `long int' since there value are days, not seconds.
	* shadow/putspent.c: Change casts from time_t to `long int'.
	* shadow/sgetspent_r.c (LINE_READER): Likewise.

Mon Sep 23 23:05:24 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/errnos.h: Define __set_errno to make
	sure the thread specific variable is set as well as the global
	variable.
	* sysdeps/mach/hurd/errnos.awk: Define macro for source code
	compatibility.
	* sysdeps/stub/errnos.h: Likewise.
	* sysdeps/unix/bsd/bsd4.4/errnos.h: Likewise.

	* shadow/putspent.c: Don't include <errno.h>.

	* dirent/scandir.c (scandir): Use __set_errno to set errno
 	variable.
	* elf/dl-load.c (open_path): Likewise.
	* inet/rcmd.c (rcmd): Likewise.
	(rresvport): Likewise.
	* intl/dcgettext.c [!__set_errno]: Define __set_errno.
	(DCGETTEXT): Use __set_errno to set errno variable.
	* io/fts.c (fts_open): Likewise.
	(fts_close): Likewise.
	(fts_read): Likewise.
	(fts_set): Likewise.
	(fts_children): Likewise.
	(fts_build): Likewise.
	(fts_stat): Likewise.
	* io/ftw.c (ftw_dir): Likewise.
	(ftw): Likewise.
	* io/getwd.c (getwd): Likewise.
	* io/lockf.c (lockf): Likewise.
	* libio/libioP.h [EINVAL]: Use __set_errno to define MAYBE_SET_EINVAL.
	* libio/iofdopen.c (_IO_fdopen): Use MAYBE_SET_EINVAL to errno.
	* libio/iogetdelim.c (_IO_getdelim): Likewise.
	* libio/fileops.c (_IO_file_open): Use __set_errno to set errno
	variable.
	* libio/iofgetpos.c (_IO_fgetpos): Likewise.
	* libio/iofsetpos.c (_IO_fsetpos): Likewise.
	* libio/ioftell.c (_IO_ftell): Likewise.
	* locale/loadlocale.c (_nl_load_locale): Likewise.
	* locale/nl_langinfo.c (nl_langinfo): Likewise.
	* locale/setlocale.c (ERROR_RETURN): Likewise.
	* login/getutid_r (__getutid_r): Likewise.
	* login/getutline_r (__getutline_r): Likewise.
	* login/login.c (tty_name): Likewise.
	* login/oututline_r.c (__pututline_r): Likewise.
	* malloc/malloc.c (morecore): Likewise.
	* misc/efgcvt_r.c (fcvt_r): Likewise.
	* misc/hsearch_r.c (hcreate_r): Likewise.
	(hdestroy_r): Likewise.
	(hsearch_r): Likewise.
	* nss/nsswitch.c (__nss_configure_lookup): Likewise.
	* nss/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Likewise.
	(_nss_dns_gethostbyaddr_r): Likewise.
	* nss/nss_files/files-XXX.c (internal_getent): Likewise.
	* nss/nss_files/files-parse.c (parse_list): Likewise.
	* posix/confstr.c (confstr): Likewise.  De-ANSI-fy.
	* posix/execvp.c (execvp): Likewise.
	* posix/glob.c: Define __set_errno.
	(glob): Use __set_errno to set errno variable.
	(glob_in_dir): Likewise.
	* pwd/getpw.c: Likewise. De-ANSI-fy.
	* pwd/putpwent.c: Likewise.
	* resolv/inet_net_ntop.c: Likewise.
	* resolv/inet_net_pton.c: Likewise.
	* resolv/inet_neta.c: Likewise.
	* resolv/inet_ntop.c: Likewise.
	* resolv/inet_pton.c: Likewise.
	* resolv/res_query.c (res_search): Likewise.
	* resolv/res_send.c (Aerror): Likewise.
	(Perror): Likewise.
	(res_send): Likewise.
	* signal/sigaddset.c: Likewise.  De-ANSI-fy.
	* signal/sigdelset.c: Likewise.
	* signal/sigempty.c: Likewise.
	* signal/sigfillset.c: Likewise.
	* signal/sigismem.c: Likewise.
	* stdio/fclose.c: Likewise.
	* stdio/feof.c: Likewise.
	* stdio/ferror.c: Likewise.
	* stdio/fflush.c: Likewise.
	* stdio/fgetc.c: Likewise.
	* stdio/fgetpos.c: Likewise.
	* stdio/fgets.c: Likewise.
	* stdio/fileno.c: Likewise.
	* stdio/fmemopen.c: Likewise.
	* stdio/fopen.c: Likewise.
	* stdio/fputc.c: Likewise.
	* stdio/fread.c: Likewise.
	* stdio/freopen.c: Likewise.
	* stdio/fseek.c: Likewise.
	* stdio/fsetpos.c: Likewise.
	* stdio/ftell.c: Likewise.
	* stdio/fwrite.c: Likewise.
	* stdio/getdelim.c: Likewise.
	* stdio/gets.c: Likewise.
	* stdio/glue.c: Likewise.
	* stdio/internals.c: Likewise.
	* stdio/memstream.c: Likewise.
	* stdio/setvbuf.c: Likewise.
	* stdio/ungetc.c: Likewise.
	* stdio/vsscanf.c: Likewise.
	* stdio-common/reg-printf.c: Likewise.
	* stdio-common/vfprintf.c: Likewise.
	* stdio-common/vfscanf.c: Likewise.
	* stdlib/canonicalize.c: Likewise.
	* stdlib/msort.c: Likewise.
	* stdlib/random_r.c: Likewise.
	* stdlib/strfmon.c: Likewise.
	* stdlib/strtod.c: Likewise.
	* stdlib/strtol.c: Likewise.
	* sunrpc/bindrsvprt.c: Likewise.
	* time/asctime.c: Likewise.
	* time/localtime.c: Likewise.
	* wcsmbs/mbrtowc.c: Likewise.
	* wcsmbs/mbsnrtowcs.c: Likewise.
	* wcsmbs/mbsrtowcs.c: Likewise.
	* wcsmbs/wcrtomb.c: Likewise.
	* wcsmbs/wcsnrtombs.c: Likewise.
	* wcsmbs/wcsrtombs.c: Likewise.
	* wcsmbs/wcstok.c: Likewise.
	* sysdeps/generic/ftime.c: Likewise.
	* sysdeps/generic/pty.c: Likewise.
	* sysdeps/generic/setenv.c: Likewise.
	* sysdeps/generic/speed.c: Likewise.
	* sysdeps/generic/sysd-stdio.c: Likewise.
	* sysdeps/generic/uname.c: Likewise.
	* sysdeps/generic/vlimit.c: Likewise.
	* sysdeps/libm-ieee754/k_standard.c: Likewise.
	* sysdeps/libm-ieee754/s_ldexp.c: Likewise.
	* sysdeps/libm-ieee754/s_ldexpf.c: Likewise.
	* sysdeps/libm-ieee754/s_ldexpl.c: Likewise.
	* sysdeps/libm-ieee754/w_scalb.c: Likewise.
	* sysdeps/libm-ieee754/w_scalbf.c: Likewise.
	* sysdeps/libm-ieee754/w_scalbl.c: Likewise.
	* sysdeps/posix/dup2.c: Likewise.
	* sysdeps/posix/euidaccess.c: Likewise.
	* sysdeps/posix/fdopen.c: Likewise.
	* sysdeps/posix/flock.c: Likewise.
	* sysdeps/posix/fpathconf.c: Likewise.
	* sysdeps/posix/getcwd.c: Likewise.
	* sysdeps/posix/gettimeofday.c: Likewise.
	* sysdeps/posix/isatty.c: Likewise.
	* sysdeps/posix/isfdtype.c: Likewise.
	* sysdeps/posix/killpg.c: Likewise.
	* sysdeps/posix/mkstemp.c: Likewise.
	* sysdeps/posix/mktemp.c: Likewise.
	* sysdeps/posix/pathconf.c: Likewise.
	* sysdeps/posix/pipestream.c: Likewise.
	* sysdeps/posix/remove.c: Likewise.
	* sysdeps/posix/rename.c: Likewise.
	* sysdeps/posix/sigintr.c: Likewise.
	* sysdeps/posix/signal.c: Likewise.
	* sysdeps/posix/sigsuspend.c: Likewise.
	* sysdeps/posix/sigvec.c: Likewise.
	* sysdeps/posix/sleep.c: Likewise.
	* sysdeps/posix/sysconf.c: Likewise.
	* sysdeps/posix/system.c: Likewise.
	* sysdeps/posix/tempname.c: Likewise.
	* sysdeps/posix/truncate.c: Likewise.
	* sysdeps/posix/ttyname.c: Likewise.
	* sysdeps/posix/ttyname_r.c: Likewise.
	* sysdeps/posix/wait3.c: Likewise.
	* sysdeps/standalone/close.c: Likewise.
	* sysdeps/standalone/open.c: Likewise.
	* sysdeps/standalone/read.c: Likewise.
	* sysdeps/standalone/write.c: Likewise.
	* sysdeps/stub/__longjmp.c: Likewise.
	* sysdeps/stub/accept.c: Likewise.
	* sysdeps/stub/access.c: Likewise.
	* sysdeps/stub/acct.c: Likewise.
	* sysdeps/stub/adjtime.c: Likewise.
	* sysdeps/stub/alarm.c: Likewise.
	* sysdeps/stub/bind.c: Likewise.
	* sysdeps/stub/brk.c: Likewise.
	* sysdeps/stub/chdir.c: Likewise.
	* sysdeps/stub/chflags.c: Likewise.
	* sysdeps/stub/chmod.c: Likewise.
	* sysdeps/stub/chown.c: Likewise.
	* sysdeps/stub/chroot.c: Likewise.
	* sysdeps/stub/clock.c: Likewise.
	* sysdeps/stub/close.c: Likewise.
	* sysdeps/stub/closedir.c: Likewise.
	* sysdeps/stub/connect.c: Likewise.
	* sysdeps/stub/ctermid.c: Likewise.
	* sysdeps/stub/cuserid.c: Likewise.
	* sysdeps/stub/dirfd.c: Likewise.
	* sysdeps/stub/dup.c: Likewise.
	* sysdeps/stub/dup2.c: Likewise.
	* sysdeps/stub/euidaccess.c: Likewise.
	* sysdeps/stub/execve.c: Likewise.
	* sysdeps/stub/fchdir.c: Likewise.
	* sysdeps/stub/fchflags.c: Likewise.
	* sysdeps/stub/fchmod.c: Likewise.
	* sysdeps/stub/fchown.c: Likewise.
	* sysdeps/stub/fcntl.c: Likewise.
	* sysdeps/stub/fdopen.c: Likewise.
	* sysdeps/stub/fexecve.c: Likewise.
	* sysdeps/stub/flock.c: Likewise.
	* sysdeps/stub/fork.c: Likewise.
	* sysdeps/stub/fpathconf.c: Likewise.
	* sysdeps/stub/fstatfs.c: Likewise.
	* sysdeps/stub/fsync.c: Likewise.
	* sysdeps/stub/ftruncate.c: Likewise.
	* sysdeps/stub/fxstat.c: Likewise.
	* sysdeps/stub/getcwd.c: Likewise.
	* sysdeps/stub/getdents.c: Likewise.
	* sysdeps/stub/getdomain.c: Likewise.
	* sysdeps/stub/getdtsz.c: Likewise.
	* sysdeps/stub/getegid.c: Likewise.
	* sysdeps/stub/getenv.c: Likewise.
	* sysdeps/stub/geteuid.c: Likewise.
	* sysdeps/stub/getgid.c: Likewise.
	* sysdeps/stub/getgroups.c: Likewise.
	* sysdeps/stub/gethostid.c: Likewise.
	* sysdeps/stub/gethostname.c: Likewise.
	* sysdeps/stub/getitimer.c: Likewise.
	* sysdeps/stub/getlogin.c: Likewise.
	* sysdeps/stub/getlogin_r.c: Likewise.
	* sysdeps/stub/getpagesize.c: Likewise.
	* sysdeps/stub/getpeername.c: Likewise.
	* sysdeps/stub/getpid.c: Likewise.
	* sysdeps/stub/getppid.c: Likewise.
	* sysdeps/stub/getpriority.c: Likewise.
	* sysdeps/stub/getrlimit.c: Likewise.
	* sysdeps/stub/getrusage.c: Likewise.
	* sysdeps/stub/getsid.c: Likewise.
	* sysdeps/stub/getsockname.c: Likewise.
	* sysdeps/stub/getsockopt.c: Likewise.
	* sysdeps/stub/getsysstats.c: Likewise.
	* sysdeps/stub/gettimeofday.c: Likewise.
	* sysdeps/stub/getuid.c: Likewise.
	* sysdeps/stub/gtty.c: Likewise.
	* sysdeps/stub/ioctl.c: Likewise.
	* sysdeps/stub/isatty.c: Likewise.
	* sysdeps/stub/isfdtype.c: Likewise.
	* sysdeps/stub/kill.c: Likewise.
	* sysdeps/stub/killpg.c: Likewise.
	* sysdeps/stub/link.c: Likewise.
	* sysdeps/stub/listen.c: Likewise.
	* sysdeps/stub/lseek.c: Likewise.
	* sysdeps/stub/lxstat.c: Likewise.
	* sysdeps/stub/madvice.c: Likewise.
	* sysdeps/stub/mkdir.c: Likewise.
	* sysdeps/stub/mkfifo.c: Likewise.
	* sysdeps/stub/mkstemp.c: Likewise.
	* sysdeps/stub/mktemp.c: Likewise.
	* sysdeps/stub/mmap.c: Likewise.
	* sysdeps/stub/morecore.c: Likewise.
	* sysdeps/stub/mprotect.c: Likewise.
	* sysdeps/stub/msgctl.c: Likewise.
	* sysdeps/stub/msgget.c: Likewise.
	* sysdeps/stub/msgrcv.c: Likewise.
	* sysdeps/stub/msgsnd.c: Likewise.
	* sysdeps/stub/msync.c: Likewise.
	* sysdeps/stub/munmap.c: Likewise.
	* sysdeps/stub/nanosleep.c: Likewise.
	* sysdeps/stub/nice.c: Likewise.
	* sysdeps/stub/nlist.c: Likewise.
	* sysdeps/stub/open.c: Likewise.
	* sysdeps/stub/opendir.c: Likewise.
	* sysdeps/stub/pathconf.c: Likewise.
	* sysdeps/stub/pause.c: Likewise.
	* sysdeps/stub/pipe.c: Likewise.
	* sysdeps/stub/pipestream.c: Likewise.
	* sysdeps/stub/poll.c: Likewise.
	* sysdeps/stub/profil.c: Likewise.
	* sysdeps/stub/ptrace.c: Likewise.
	* sysdeps/stub/putenv.c: Likewise.
	* sysdeps/stub/raise.c: Likewise.
	* sysdeps/stub/read.c: Likewise.
	* sysdeps/stub/readdir.c: Likewise.
	* sysdeps/stub/readlink.c: Likewise.
	* sysdeps/stub/readv.c: Likewise.
	* sysdeps/stub/reboot.c: Likewise.
	* sysdeps/stub/recv.c: Likewise.
	* sysdeps/stub/recvfrom.c: Likewise.
	* sysdeps/stub/recvmsg.c: Likewise.
	* sysdeps/stub/remove.c: Likewise.
	* sysdeps/stub/rename.c: Likewise.
	* sysdeps/stub/revoke.c: Likewise.
	* sysdeps/stub/rewinddir.c: Likewise.
	* sysdeps/stub/rmdir.c: Likewise.
	* sysdeps/stub/sbrk.c: Likewise.
	* sysdeps/stub/sched_getp.c: Likewise.
	* sysdeps/stub/sched_gets.c: Likewise.
	* sysdeps/stub/sched_primax.c: Likewise.
	* sysdeps/stub/sched_primin.c: Likewise.
	* sysdeps/stub/sched_rr_gi.c: Likewise.
	* sysdeps/stub/sched_setp.c: Likewise.
	* sysdeps/stub/sched_sets.c: Likewise.
	* sysdeps/stub/sched_yield.c: Likewise.
	* sysdeps/stub/seekdir.c: Likewise.
	* sysdeps/stub/select.c: Likewise.
	* sysdeps/stub/semctl.c: Likewise.
	* sysdeps/stub/semget.c: Likewise.
	* sysdeps/stub/semop.c: Likewise.
	* sysdeps/stub/send.c: Likewise.
	* sysdeps/stub/sendmsg.c: Likewise.
	* sysdeps/stub/sendto.c: Likewise.
	* sysdeps/stub/setdomain.c: Likewise.
	* sysdeps/stub/setegid.c: Likewise.
	* sysdeps/stub/setenv.c: Likewise.
	* sysdeps/stub/seteuid.c: Likewise.
	* sysdeps/stub/setgid.c: Likewise.
	* sysdeps/stub/setgroups.c: Likewise.
	* sysdeps/stub/sethostid.c: Likewise.
	* sysdeps/stub/sethostname.c: Likewise.
	* sysdeps/stub/setitimer.c: Likewise.
	* sysdeps/stub/setjmp.c: Likewise.
	* sysdeps/stub/setlogin.c: Likewise.
	* sysdeps/stub/setpgid.c: Likewise.
	* sysdeps/stub/setpriority.c: Likewise.
	* sysdeps/stub/setregid.c: Likewise.
	* sysdeps/stub/setreuid.c: Likewise.
	* sysdeps/stub/setrlimit.c: Likewise.
	* sysdeps/stub/setsid.c: Likewise.
	* sysdeps/stub/setsockopt.c: Likewise.
	* sysdeps/stub/settimeofday.c: Likewise.
	* sysdeps/stub/setuid.c: Likewise.
	* sysdeps/stub/shmat.c: Likewise.
	* sysdeps/stub/shmctl.c: Likewise.
	* sysdeps/stub/shmdt.c: Likewise.
	* sysdeps/stub/shmget.c: Likewise.
	* sysdeps/stub/shutdown.c: Likewise.
	* sysdeps/stub/sigaction.c: Likewise.
	* sysdeps/stub/sigaltstack.c: Likewise.
	* sysdeps/stub/sigblock.c: Likewise.
	* sysdeps/stub/sigintr.c: Likewise.
	* sysdeps/stub/signal.c: Likewise.
	* sysdeps/stub/sigpause.c: Likewise.
	* sysdeps/stub/sigpending.c: Likewise.
	* sysdeps/stub/sigprocmask.c: Likewise.
	* sysdeps/stub/sigreturn.c: Likewise.
	* sysdeps/stub/sigsetmask.c: Likewise.
	* sysdeps/stub/sigstack.c: Likewise.
	* sysdeps/stub/sigsuspend.c: Likewise.
	* sysdeps/stub/sigvec.c: Likewise.
	* sysdeps/stub/sleep.c: Likewise.
	* sysdeps/stub/socket.c: Likewise.
	* sysdeps/stub/socketpair.c: Likewise.
	* sysdeps/stub/sstk.c: Likewise.
	* sysdeps/stub/statfs.c: Likewise.
	* sysdeps/stub/stime.c: Likewise.
	* sysdeps/stub/stty.c: Likewise.
	* sysdeps/stub/swapoff.c: Likewise.
	* sysdeps/stub/swapon.c: Likewise.
	* sysdeps/stub/symlink.c: Likewise.
	* sysdeps/stub/sync.c: Likewise.
	* sysdeps/stub/syscall.c: Likewise.
	* sysdeps/stub/sysconf.c: Likewise.
	* sysdeps/stub/sysd-stdio.c: Likewise.
	* sysdeps/stub/system.c: Likewise.
	* sysdeps/stub/tcdrain.c: Likewise.
	* sysdeps/stub/tcflow.c: Likewise.
	* sysdeps/stub/tcflush.c: Likewise.
	* sysdeps/stub/tcgetattr.c: Likewise.
	* sysdeps/stub/tcgetpgrp.c: Likewise.
	* sysdeps/stub/tcsendbrk.c: Likewise.
	* sysdeps/stub/tcsetattr.c: Likewise.
	* sysdeps/stub/tcsetpgrp.c: Likewise.
	* sysdeps/stub/telldir.c: Likewise.
	* sysdeps/stub/tempname.c: Likewise.
	* sysdeps/stub/time.c: Likewise.
	* sysdeps/stub/times.c: Likewise.
	* sysdeps/stub/truncate.c: Likewise.
	* sysdeps/stub/ttyname.c: Likewise.
	* sysdeps/stub/ttyname_r.c: Likewise.
	* sysdeps/stub/ualarm.c: Likewise.
	* sysdeps/stub/ulimit.c: Likewise.
	* sysdeps/stub/umask.c: Likewise.
	* sysdeps/stub/unlink.c: Likewise.
	* sysdeps/stub/usleep.c: Likewise.
	* sysdeps/stub/ustat.c: Likewise.
	* sysdeps/stub/utime.c: Likewise.
	* sysdeps/stub/utimes.c: Likewise.
	* sysdeps/stub/vhangup.c: Likewise.
	* sysdeps/stub/wait.c: Likewise.
	* sysdeps/stub/wait3.c: Likewise.
	* sysdeps/stub/wait4.c: Likewise.
	* sysdeps/stub/waitpid.c: Likewise.
	* sysdeps/stub/write.c: Likewise.
	* sysdeps/stub/writev.c: Likewise.
	* sysdeps/stub/xmknod.c: Likewise.
	* sysdeps/stub/xstat.c: Likewise.
	* sysdeps/unix/closedir.c: Likewise.
	* sysdeps/unix/fxstat.c: Likewise.
	* sysdeps/unix/getlogin.c: Likewise.
	* sysdeps/unix/getlogin_r.c: Likewise.
	* sysdeps/unix/mkdir.c: Likewise.
	* sysdeps/unix/nice.c: Likewise.
	* sysdeps/unix/nlist.c: Likewise.
	* sysdeps/unix/opendir.c: Likewise.
	* sysdeps/unix/readdir.c: Likewise.
	* sysdeps/unix/rmdir.c: Likewise.
	* sysdeps/unix/stime.c: Likewise.
	* sysdeps/unix/xmknod.c: Likewise.
	* sysdeps/unix/xstat.c: Likewise.
	* sysdeps/unix/bsd/isatty.c: Likewise.
	* sysdeps/unix/bsd/setegid.c: Likewise.
	* sysdeps/unix/bsd/seteuid.c: Likewise.
	* sysdeps/unix/bsd/setsid.c: Likewise.
	* sysdeps/unix/bsd/sigaction.c: Likewise.
	* sysdeps/unix/bsd/sigprocmask.c: Likewise.
	* sysdeps/unix/bsd/sigsuspend.c: Likewise.
	* sysdeps/unix/bsd/tcflow.c: Likewise.
	* sysdeps/unix/bsd/tcflush.c: Likewise.
	* sysdeps/unix/bsd/tcgetattr.c: Likewise.
	* sysdeps/unix/bsd/tcsetattr.c: Likewise.
	* sysdeps/unix/bsd/times.c: Likewise.
	* sysdeps/unix/bsd/ulimit.c: Likewise.
	* sysdeps/unix/common/lxstat.c: Likewise.
	* sysdeps/unix/common/tcsendbrk.c: Likewise.
	* sysdeps/unix/sysv/setrlimit.c: Likewise.
	* sysdeps/unix/sysv/settimeofday.c: Likewise.
	* sysdeps/unix/sysv/sigaction.c: Likewise.
	* sysdeps/unix/sysv/tcflow.c: Likewise.
	* sysdeps/unix/sysv/tcflush.c: Likewise.
	* sysdeps/unix/sysv/tcgetattr.c: Likewise.
	* sysdeps/unix/sysv/tcsendbrk.c: Likewise.
	* sysdeps/unix/sysv/tcsetattr.c: Likewise.
	* sysdeps/unix/bsd/ultrix4/sysconf.c: Likewise.
	* sysdeps/unix/sysv/irix4/getpriority.c: Likewise.
	* sysdeps/unix/sysv/irix4/setpriority.c: Likewise.
	* sysdeps/unix/sysv/linux/adjtime.c: Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
	* sysdeps/unix/sysv/linux/gethostname.c: Likewise.
	* sysdeps/unix/sysv/linux/getsysstats.c: Likewise.
	* sysdeps/unix/sysv/linux/ptrace.c: Likewise.
	* sysdeps/unix/sysv/linux/speed.c: Likewise.
	* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
	* sysdeps/unix/sysv/sysv4/sigaction.c: Likewise.
	* sysdeps/unix/sysv/sysv4/sysconf.c: Likewise.
	* sysdeps/unix/bsd/sun/m68k/sigtramp.c: Likewise.
	* sysdeps/unix/bsd/sun/sparc/sigtramp.c: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/speed.c: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/tcsetattr.c: Likewise.
	* sysdeps/unix/sysv/linux/alpha/ioperm.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/brk.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/m68k/brk.c: Likewise.

	* sunrpc/clnt_tcp.c: Protect declaration of errno by #ifndef.
	* sunrpc/clnt_udp.c: Likewise.
	* sunrpc/bindrsvprt.c: Likewise.
	* sunrpc/pm_getmaps.c: Likewise.
	* sunrpc/pmap_rmt.c: Likewise.
	* sunrpc/svc.c: Likewise.
	* sunrpc/svc_run.c: Likewise.
	* sunrpc/svc_tcp.c: Likewise.
	* sunrpc/svc_udp.c: Likewise.

	* sysdeps/generic/strtok.c: Don't check argument, just crash.
	* sysdeps/generic/strtok_r.c: Likewise.

	* sysdeps/stub/start.c: Make __errno a strong alias of errno.
	* sysdeps/unix/start.c: Likewise.  De-ANSI-fy.
	* sysdeps/unix/sparc/start.c: Likewise.
	* sysdeps/standalone/m68k/m68020/start.S: Likewise.
	* sysdeps/unix/sysv/irix4/start.c: Likewise.
	* sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.

Mon Sep 23 17:54:57 1996  Ulrich Drepper  <drepper@cygnus.com>

	* catgets/gencat.c (main): Put package name in --version message
	in parantheses.  Reported by Jim Meyering.
	* db/makedb.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.

	* sysdeps/i386/fpu/__math.h (tan): Make sure gcc knows we use
	two registers.  Patch by John Bowman.

Sat Sep 21 15:08:25 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/mach/libc-lock.h: Fix comment.
	* sysdeps/stubs/libc-lock.h: Likewise.

Sat Sep 21 13:50:40 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libio/genops.c (_IO_init) [_IO_MTSAFE_IO]: Dereference pointer
 	to lock when passing it to __libc_lock_init macro.
	(_IO_default_finish) [_IO_MTSAFE_IO]: Dereference pointer to lock
	when passing it to __libc_lock_fini macro.

Sat Sep 21 14:35:40 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER)
	[_LIBC_REENTRANT]: Add missing semicolon.

	* sysdeps/unix/sysv/linux/m68k/sysdep.S: Move inclusion of
 	sysdep.h to the top outside of #ifndef PIC.  Don't include errnos.h.
  	Use the ENTRY macro.

Sat Sep 21 14:33:41 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* libio/Makefile: Make `all' the default target.
	* po/Makefile: Likewise.

Mon Sep 23 15:49:47 1996  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/test-canon.c: Correct patch from Thu Sep 12 23:01:16 1996.
	I applied it incorrectly.
	* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
	* sysdeps/m68k/fpu/s_scalbnf.c: Likewise.
	* sysdeps/m68k/fpu/s_scalbnl.c: Likewise.

Mon Sep 23 03:00:10 1996  Ulrich Drepper  <drepper@cygnus.com>

	* shadow/sgetspent_r.c (LINE_PARSER): Accept empty 9th field.
	Patch by NIIBE Yutaka <gniibe@mri.co.jp>.

	* shadow/sgetspent_r.c (LINE_PARSER): Don't accept any chars after
 	9th field.

	* sysdeps/unix/sysv/linux/Makefile [$(subdir)==misc]
	(sysdep_headers): Add sys/debugreg.h, sys/kd.h, sys/soundcard.h,
 	and sys/vt.h.
	* sysdeps/unix/sysv/linux/sys/debugreg.h: New file.
	* sysdeps/unix/sysv/linux/sys/kd.h: New file.
	* sysdeps/unix/sysv/linux/sys/soundcard.h: New file.
	* sysdeps/unix/sysv/linux/sys/vt.h: New file.
	Reported by NIIBE Yutaka <gniibe@mri.co.jp>.
This commit is contained in:
Ulrich Drepper
1996-09-27 03:45:24 +00:00
parent d022f6ab9f
commit c40298232a
491 changed files with 3971 additions and 2363 deletions

652
ChangeLog
View File

@ -1,3 +1,655 @@
Mon Sep 23 15:31:04 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* hurd/Makefile ($(includedir)/rpc/netdb.h): There is no make
variable `top_srcdir' in libc; use $(..) instead.
* sysdeps/mach/hurd/Makefile (rtld-installed-name): Delete special
definition. It was a *Mistake*. (With a capital M.)
* sysdeps/mach/getsysstats.c (__get_nprocs): Renamed from
__get_nproc.
(__get_nprocs_conf): Renamed from __get_nproc_conf.
Fri Sep 27 03:49:56 1996 Ulrich Drepper <drepper@cygnus.com>
Add support for cancelable system calls.
* csu/initfini.c: Make in crti.o reference to symbol
__libc_force_cancel_wrapper when compiling reentrant version.
* misc/Makefile (routines): Add force-wrapper.
* misc/force-wrapper.c: New file.
* posix/system.c: Rename function to __libc_system and make system
a weak alias.
* sysdeps/stub/system.c: Likewise.
* posix/wait.c: Rename function to __libc_wait and make __wait a
weak alias. De-ANSI-fy.
* sysdeps/standalone/read.c: Rename function to __libc_read and
make __read a weak alias.
* sysdeps/stub/read.c: Likewise.
* sysdeps/standalone/write.c: Rename function to __libc_write and
make __write a weak alias.
* sysdeps/stub/write.c: Likewise.
* sysdeps/stub/tcdrain.c: Rename function to __libc_tcdrain and
make tcdrain a weak alias.
* sysdeps/unix/bsd/tcdrain.c: Likewise.
* sysdeps/unix/bsd/bsd4.4/tcdrain.c: Likewise.
* sysdeps/unix/sysv/tcdrain.c: Likewise.
* sysdeps/unix/sysv/linux/tcdrain.c: Likewise.
* sysdeps/unix/bsd/bsd4.4/wait.c: Rename function to __libc_wait
and make __wait a weak alias.
* sysdeps/stub/waitpid.c: Rename function to __libc_waitpid and
make __waitpid a weak alias.
* sysdeps/unix/bsd/bsd4.4/waitpid.c: Likewise.
* sysdeps/unix/sysv/linux/waitpid.c: Likewise.
* sysdeps/unix/sysv/sysv4/waitpid.c: Likewise.
* sysdeps/unix/common/pause.c: Rename function to __libc_pause
and make pause a weak alias. De-ANSI-fy.
* sysdeps/unix/syscalls.list: Change name for close, fcntl, fsync,
lseek, open, read, and write to have __libc_ prefix and make old
names a weak alias.
* sysdeps/unix/mman/syscalls.list: Likewise for msync.
* sysdeps/unix/sysv/linux/syscalls.list: Likewise for nanosleep.
* io/creat.c: De-ANSI-fy.
* sysdeps/unix/sysv/linux/syscalls.list: Add pause.
Thu Sep 26 19:15:55 1996 Ulrich Drepper <drepper@cygnus.com>
* misc/mntent.h: Add MNTTYPE_* and MNTOPT_* macros.
Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>.
Thu Sep 26 14:40:10 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/posix/pathconf.c: Pass descriptor for just opened file
to fpathconf.
Reported by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
Thu Sep 26 04:02:43 1996 Ulrich Drepper <drepper@cygnus.com>
* locale/programs/locfile.c (write_locale_data): Allocate room
even for file name for LC_MESSAGES locale.
(locafile_read): `tok_era' must be handled as a string list.
* locale/programs/ld-time.c: Finish correction of handling `era'.
* locale/C-time.c (_nl_C_LC_TIME): Add initializer for new fields.
* locale/categories.def: Add postload function for LC_TIME.
* locale/setlocale.c: Make lock global and rename to
__libc_setlocale_lock.
* locale/localeinfo.h (struct era_entry): New type. Used in strftime.
Add prototypes for _nl_get_era_entry and _nl_get_alt_digit.
* locale/lc-time.c (_nl_postload_time): New function. Initialize
lazy intialization.
(_nl_get_era_entry): New function. Return era entry which corresponds
to given year.
(_nl_get_alt_digit): New function. Return string with alternate
digit representation for given number.
* time/strftime.c (strftime): Use _nl_get_alt_digit to get
string representing alternate digit notation.
Wed Sep 25 17:31:55 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/waitstatus.h (union wait): Add w_status field.
Reported by Hans Grobler <grobh@nolian.ee.sun.ac.za>.
* elf/rtld.c (dl_main): Process LD_PRELOAD before loading
ld.so.preload. Suggested by David Engel <david@elo.ods.com>.
Wed Sep 25 13:10:57 1996 Ulrich Drepper <drepper@cygnus.com>
* catgets/gencat.c (main): Change --version again because RMS wants
the package name in parentheses.
* db/makedb.c: Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
Tue Sep 24 01:28:05 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile ($(objpfx)sysd-dirs): Depend on Subdirs files, command
rewritten.
($(objpfx)version-info.h): Depend on Banner files, command
rewritten.
Wed Sep 25 02:44:41 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/sleep.c: New file. Based on nanosleep.
Tue Sep 24 21:46:02 1996 Ulrich Drepper <drepper@cygnus.com>
* shadow/lckpwdf.c (PWD_LOCKFILE): Change to /etc/lock.pwd to be
on the same device as the password file.
* shadow/shadow.h (struct spwd): Change type of numeric fields
to `long int' since there value are days, not seconds.
* shadow/putspent.c: Change casts from time_t to `long int'.
* shadow/sgetspent_r.c (LINE_READER): Likewise.
Mon Sep 23 23:05:24 1996 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/errnos.h: Define __set_errno to make
sure the thread specific variable is set as well as the global
variable.
* sysdeps/mach/hurd/errnos.awk: Define macro for source code
compatibility.
* sysdeps/stub/errnos.h: Likewise.
* sysdeps/unix/bsd/bsd4.4/errnos.h: Likewise.
* shadow/putspent.c: Don't include <errno.h>.
* dirent/scandir.c (scandir): Use __set_errno to set errno
variable.
* elf/dl-load.c (open_path): Likewise.
* inet/rcmd.c (rcmd): Likewise.
(rresvport): Likewise.
* intl/dcgettext.c [!__set_errno]: Define __set_errno.
(DCGETTEXT): Use __set_errno to set errno variable.
* io/fts.c (fts_open): Likewise.
(fts_close): Likewise.
(fts_read): Likewise.
(fts_set): Likewise.
(fts_children): Likewise.
(fts_build): Likewise.
(fts_stat): Likewise.
* io/ftw.c (ftw_dir): Likewise.
(ftw): Likewise.
* io/getwd.c (getwd): Likewise.
* io/lockf.c (lockf): Likewise.
* libio/libioP.h [EINVAL]: Use __set_errno to define MAYBE_SET_EINVAL.
* libio/iofdopen.c (_IO_fdopen): Use MAYBE_SET_EINVAL to errno.
* libio/iogetdelim.c (_IO_getdelim): Likewise.
* libio/fileops.c (_IO_file_open): Use __set_errno to set errno
variable.
* libio/iofgetpos.c (_IO_fgetpos): Likewise.
* libio/iofsetpos.c (_IO_fsetpos): Likewise.
* libio/ioftell.c (_IO_ftell): Likewise.
* locale/loadlocale.c (_nl_load_locale): Likewise.
* locale/nl_langinfo.c (nl_langinfo): Likewise.
* locale/setlocale.c (ERROR_RETURN): Likewise.
* login/getutid_r (__getutid_r): Likewise.
* login/getutline_r (__getutline_r): Likewise.
* login/login.c (tty_name): Likewise.
* login/oututline_r.c (__pututline_r): Likewise.
* malloc/malloc.c (morecore): Likewise.
* misc/efgcvt_r.c (fcvt_r): Likewise.
* misc/hsearch_r.c (hcreate_r): Likewise.
(hdestroy_r): Likewise.
(hsearch_r): Likewise.
* nss/nsswitch.c (__nss_configure_lookup): Likewise.
* nss/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): Likewise.
(_nss_dns_gethostbyaddr_r): Likewise.
* nss/nss_files/files-XXX.c (internal_getent): Likewise.
* nss/nss_files/files-parse.c (parse_list): Likewise.
* posix/confstr.c (confstr): Likewise. De-ANSI-fy.
* posix/execvp.c (execvp): Likewise.
* posix/glob.c: Define __set_errno.
(glob): Use __set_errno to set errno variable.
(glob_in_dir): Likewise.
* pwd/getpw.c: Likewise. De-ANSI-fy.
* pwd/putpwent.c: Likewise.
* resolv/inet_net_ntop.c: Likewise.
* resolv/inet_net_pton.c: Likewise.
* resolv/inet_neta.c: Likewise.
* resolv/inet_ntop.c: Likewise.
* resolv/inet_pton.c: Likewise.
* resolv/res_query.c (res_search): Likewise.
* resolv/res_send.c (Aerror): Likewise.
(Perror): Likewise.
(res_send): Likewise.
* signal/sigaddset.c: Likewise. De-ANSI-fy.
* signal/sigdelset.c: Likewise.
* signal/sigempty.c: Likewise.
* signal/sigfillset.c: Likewise.
* signal/sigismem.c: Likewise.
* stdio/fclose.c: Likewise.
* stdio/feof.c: Likewise.
* stdio/ferror.c: Likewise.
* stdio/fflush.c: Likewise.
* stdio/fgetc.c: Likewise.
* stdio/fgetpos.c: Likewise.
* stdio/fgets.c: Likewise.
* stdio/fileno.c: Likewise.
* stdio/fmemopen.c: Likewise.
* stdio/fopen.c: Likewise.
* stdio/fputc.c: Likewise.
* stdio/fread.c: Likewise.
* stdio/freopen.c: Likewise.
* stdio/fseek.c: Likewise.
* stdio/fsetpos.c: Likewise.
* stdio/ftell.c: Likewise.
* stdio/fwrite.c: Likewise.
* stdio/getdelim.c: Likewise.
* stdio/gets.c: Likewise.
* stdio/glue.c: Likewise.
* stdio/internals.c: Likewise.
* stdio/memstream.c: Likewise.
* stdio/setvbuf.c: Likewise.
* stdio/ungetc.c: Likewise.
* stdio/vsscanf.c: Likewise.
* stdio-common/reg-printf.c: Likewise.
* stdio-common/vfprintf.c: Likewise.
* stdio-common/vfscanf.c: Likewise.
* stdlib/canonicalize.c: Likewise.
* stdlib/msort.c: Likewise.
* stdlib/random_r.c: Likewise.
* stdlib/strfmon.c: Likewise.
* stdlib/strtod.c: Likewise.
* stdlib/strtol.c: Likewise.
* sunrpc/bindrsvprt.c: Likewise.
* time/asctime.c: Likewise.
* time/localtime.c: Likewise.
* wcsmbs/mbrtowc.c: Likewise.
* wcsmbs/mbsnrtowcs.c: Likewise.
* wcsmbs/mbsrtowcs.c: Likewise.
* wcsmbs/wcrtomb.c: Likewise.
* wcsmbs/wcsnrtombs.c: Likewise.
* wcsmbs/wcsrtombs.c: Likewise.
* wcsmbs/wcstok.c: Likewise.
* sysdeps/generic/ftime.c: Likewise.
* sysdeps/generic/pty.c: Likewise.
* sysdeps/generic/setenv.c: Likewise.
* sysdeps/generic/speed.c: Likewise.
* sysdeps/generic/sysd-stdio.c: Likewise.
* sysdeps/generic/uname.c: Likewise.
* sysdeps/generic/vlimit.c: Likewise.
* sysdeps/libm-ieee754/k_standard.c: Likewise.
* sysdeps/libm-ieee754/s_ldexp.c: Likewise.
* sysdeps/libm-ieee754/s_ldexpf.c: Likewise.
* sysdeps/libm-ieee754/s_ldexpl.c: Likewise.
* sysdeps/libm-ieee754/w_scalb.c: Likewise.
* sysdeps/libm-ieee754/w_scalbf.c: Likewise.
* sysdeps/libm-ieee754/w_scalbl.c: Likewise.
* sysdeps/posix/dup2.c: Likewise.
* sysdeps/posix/euidaccess.c: Likewise.
* sysdeps/posix/fdopen.c: Likewise.
* sysdeps/posix/flock.c: Likewise.
* sysdeps/posix/fpathconf.c: Likewise.
* sysdeps/posix/getcwd.c: Likewise.
* sysdeps/posix/gettimeofday.c: Likewise.
* sysdeps/posix/isatty.c: Likewise.
* sysdeps/posix/isfdtype.c: Likewise.
* sysdeps/posix/killpg.c: Likewise.
* sysdeps/posix/mkstemp.c: Likewise.
* sysdeps/posix/mktemp.c: Likewise.
* sysdeps/posix/pathconf.c: Likewise.
* sysdeps/posix/pipestream.c: Likewise.
* sysdeps/posix/remove.c: Likewise.
* sysdeps/posix/rename.c: Likewise.
* sysdeps/posix/sigintr.c: Likewise.
* sysdeps/posix/signal.c: Likewise.
* sysdeps/posix/sigsuspend.c: Likewise.
* sysdeps/posix/sigvec.c: Likewise.
* sysdeps/posix/sleep.c: Likewise.
* sysdeps/posix/sysconf.c: Likewise.
* sysdeps/posix/system.c: Likewise.
* sysdeps/posix/tempname.c: Likewise.
* sysdeps/posix/truncate.c: Likewise.
* sysdeps/posix/ttyname.c: Likewise.
* sysdeps/posix/ttyname_r.c: Likewise.
* sysdeps/posix/wait3.c: Likewise.
* sysdeps/standalone/close.c: Likewise.
* sysdeps/standalone/open.c: Likewise.
* sysdeps/standalone/read.c: Likewise.
* sysdeps/standalone/write.c: Likewise.
* sysdeps/stub/__longjmp.c: Likewise.
* sysdeps/stub/accept.c: Likewise.
* sysdeps/stub/access.c: Likewise.
* sysdeps/stub/acct.c: Likewise.
* sysdeps/stub/adjtime.c: Likewise.
* sysdeps/stub/alarm.c: Likewise.
* sysdeps/stub/bind.c: Likewise.
* sysdeps/stub/brk.c: Likewise.
* sysdeps/stub/chdir.c: Likewise.
* sysdeps/stub/chflags.c: Likewise.
* sysdeps/stub/chmod.c: Likewise.
* sysdeps/stub/chown.c: Likewise.
* sysdeps/stub/chroot.c: Likewise.
* sysdeps/stub/clock.c: Likewise.
* sysdeps/stub/close.c: Likewise.
* sysdeps/stub/closedir.c: Likewise.
* sysdeps/stub/connect.c: Likewise.
* sysdeps/stub/ctermid.c: Likewise.
* sysdeps/stub/cuserid.c: Likewise.
* sysdeps/stub/dirfd.c: Likewise.
* sysdeps/stub/dup.c: Likewise.
* sysdeps/stub/dup2.c: Likewise.
* sysdeps/stub/euidaccess.c: Likewise.
* sysdeps/stub/execve.c: Likewise.
* sysdeps/stub/fchdir.c: Likewise.
* sysdeps/stub/fchflags.c: Likewise.
* sysdeps/stub/fchmod.c: Likewise.
* sysdeps/stub/fchown.c: Likewise.
* sysdeps/stub/fcntl.c: Likewise.
* sysdeps/stub/fdopen.c: Likewise.
* sysdeps/stub/fexecve.c: Likewise.
* sysdeps/stub/flock.c: Likewise.
* sysdeps/stub/fork.c: Likewise.
* sysdeps/stub/fpathconf.c: Likewise.
* sysdeps/stub/fstatfs.c: Likewise.
* sysdeps/stub/fsync.c: Likewise.
* sysdeps/stub/ftruncate.c: Likewise.
* sysdeps/stub/fxstat.c: Likewise.
* sysdeps/stub/getcwd.c: Likewise.
* sysdeps/stub/getdents.c: Likewise.
* sysdeps/stub/getdomain.c: Likewise.
* sysdeps/stub/getdtsz.c: Likewise.
* sysdeps/stub/getegid.c: Likewise.
* sysdeps/stub/getenv.c: Likewise.
* sysdeps/stub/geteuid.c: Likewise.
* sysdeps/stub/getgid.c: Likewise.
* sysdeps/stub/getgroups.c: Likewise.
* sysdeps/stub/gethostid.c: Likewise.
* sysdeps/stub/gethostname.c: Likewise.
* sysdeps/stub/getitimer.c: Likewise.
* sysdeps/stub/getlogin.c: Likewise.
* sysdeps/stub/getlogin_r.c: Likewise.
* sysdeps/stub/getpagesize.c: Likewise.
* sysdeps/stub/getpeername.c: Likewise.
* sysdeps/stub/getpid.c: Likewise.
* sysdeps/stub/getppid.c: Likewise.
* sysdeps/stub/getpriority.c: Likewise.
* sysdeps/stub/getrlimit.c: Likewise.
* sysdeps/stub/getrusage.c: Likewise.
* sysdeps/stub/getsid.c: Likewise.
* sysdeps/stub/getsockname.c: Likewise.
* sysdeps/stub/getsockopt.c: Likewise.
* sysdeps/stub/getsysstats.c: Likewise.
* sysdeps/stub/gettimeofday.c: Likewise.
* sysdeps/stub/getuid.c: Likewise.
* sysdeps/stub/gtty.c: Likewise.
* sysdeps/stub/ioctl.c: Likewise.
* sysdeps/stub/isatty.c: Likewise.
* sysdeps/stub/isfdtype.c: Likewise.
* sysdeps/stub/kill.c: Likewise.
* sysdeps/stub/killpg.c: Likewise.
* sysdeps/stub/link.c: Likewise.
* sysdeps/stub/listen.c: Likewise.
* sysdeps/stub/lseek.c: Likewise.
* sysdeps/stub/lxstat.c: Likewise.
* sysdeps/stub/madvice.c: Likewise.
* sysdeps/stub/mkdir.c: Likewise.
* sysdeps/stub/mkfifo.c: Likewise.
* sysdeps/stub/mkstemp.c: Likewise.
* sysdeps/stub/mktemp.c: Likewise.
* sysdeps/stub/mmap.c: Likewise.
* sysdeps/stub/morecore.c: Likewise.
* sysdeps/stub/mprotect.c: Likewise.
* sysdeps/stub/msgctl.c: Likewise.
* sysdeps/stub/msgget.c: Likewise.
* sysdeps/stub/msgrcv.c: Likewise.
* sysdeps/stub/msgsnd.c: Likewise.
* sysdeps/stub/msync.c: Likewise.
* sysdeps/stub/munmap.c: Likewise.
* sysdeps/stub/nanosleep.c: Likewise.
* sysdeps/stub/nice.c: Likewise.
* sysdeps/stub/nlist.c: Likewise.
* sysdeps/stub/open.c: Likewise.
* sysdeps/stub/opendir.c: Likewise.
* sysdeps/stub/pathconf.c: Likewise.
* sysdeps/stub/pause.c: Likewise.
* sysdeps/stub/pipe.c: Likewise.
* sysdeps/stub/pipestream.c: Likewise.
* sysdeps/stub/poll.c: Likewise.
* sysdeps/stub/profil.c: Likewise.
* sysdeps/stub/ptrace.c: Likewise.
* sysdeps/stub/putenv.c: Likewise.
* sysdeps/stub/raise.c: Likewise.
* sysdeps/stub/read.c: Likewise.
* sysdeps/stub/readdir.c: Likewise.
* sysdeps/stub/readlink.c: Likewise.
* sysdeps/stub/readv.c: Likewise.
* sysdeps/stub/reboot.c: Likewise.
* sysdeps/stub/recv.c: Likewise.
* sysdeps/stub/recvfrom.c: Likewise.
* sysdeps/stub/recvmsg.c: Likewise.
* sysdeps/stub/remove.c: Likewise.
* sysdeps/stub/rename.c: Likewise.
* sysdeps/stub/revoke.c: Likewise.
* sysdeps/stub/rewinddir.c: Likewise.
* sysdeps/stub/rmdir.c: Likewise.
* sysdeps/stub/sbrk.c: Likewise.
* sysdeps/stub/sched_getp.c: Likewise.
* sysdeps/stub/sched_gets.c: Likewise.
* sysdeps/stub/sched_primax.c: Likewise.
* sysdeps/stub/sched_primin.c: Likewise.
* sysdeps/stub/sched_rr_gi.c: Likewise.
* sysdeps/stub/sched_setp.c: Likewise.
* sysdeps/stub/sched_sets.c: Likewise.
* sysdeps/stub/sched_yield.c: Likewise.
* sysdeps/stub/seekdir.c: Likewise.
* sysdeps/stub/select.c: Likewise.
* sysdeps/stub/semctl.c: Likewise.
* sysdeps/stub/semget.c: Likewise.
* sysdeps/stub/semop.c: Likewise.
* sysdeps/stub/send.c: Likewise.
* sysdeps/stub/sendmsg.c: Likewise.
* sysdeps/stub/sendto.c: Likewise.
* sysdeps/stub/setdomain.c: Likewise.
* sysdeps/stub/setegid.c: Likewise.
* sysdeps/stub/setenv.c: Likewise.
* sysdeps/stub/seteuid.c: Likewise.
* sysdeps/stub/setgid.c: Likewise.
* sysdeps/stub/setgroups.c: Likewise.
* sysdeps/stub/sethostid.c: Likewise.
* sysdeps/stub/sethostname.c: Likewise.
* sysdeps/stub/setitimer.c: Likewise.
* sysdeps/stub/setjmp.c: Likewise.
* sysdeps/stub/setlogin.c: Likewise.
* sysdeps/stub/setpgid.c: Likewise.
* sysdeps/stub/setpriority.c: Likewise.
* sysdeps/stub/setregid.c: Likewise.
* sysdeps/stub/setreuid.c: Likewise.
* sysdeps/stub/setrlimit.c: Likewise.
* sysdeps/stub/setsid.c: Likewise.
* sysdeps/stub/setsockopt.c: Likewise.
* sysdeps/stub/settimeofday.c: Likewise.
* sysdeps/stub/setuid.c: Likewise.
* sysdeps/stub/shmat.c: Likewise.
* sysdeps/stub/shmctl.c: Likewise.
* sysdeps/stub/shmdt.c: Likewise.
* sysdeps/stub/shmget.c: Likewise.
* sysdeps/stub/shutdown.c: Likewise.
* sysdeps/stub/sigaction.c: Likewise.
* sysdeps/stub/sigaltstack.c: Likewise.
* sysdeps/stub/sigblock.c: Likewise.
* sysdeps/stub/sigintr.c: Likewise.
* sysdeps/stub/signal.c: Likewise.
* sysdeps/stub/sigpause.c: Likewise.
* sysdeps/stub/sigpending.c: Likewise.
* sysdeps/stub/sigprocmask.c: Likewise.
* sysdeps/stub/sigreturn.c: Likewise.
* sysdeps/stub/sigsetmask.c: Likewise.
* sysdeps/stub/sigstack.c: Likewise.
* sysdeps/stub/sigsuspend.c: Likewise.
* sysdeps/stub/sigvec.c: Likewise.
* sysdeps/stub/sleep.c: Likewise.
* sysdeps/stub/socket.c: Likewise.
* sysdeps/stub/socketpair.c: Likewise.
* sysdeps/stub/sstk.c: Likewise.
* sysdeps/stub/statfs.c: Likewise.
* sysdeps/stub/stime.c: Likewise.
* sysdeps/stub/stty.c: Likewise.
* sysdeps/stub/swapoff.c: Likewise.
* sysdeps/stub/swapon.c: Likewise.
* sysdeps/stub/symlink.c: Likewise.
* sysdeps/stub/sync.c: Likewise.
* sysdeps/stub/syscall.c: Likewise.
* sysdeps/stub/sysconf.c: Likewise.
* sysdeps/stub/sysd-stdio.c: Likewise.
* sysdeps/stub/system.c: Likewise.
* sysdeps/stub/tcdrain.c: Likewise.
* sysdeps/stub/tcflow.c: Likewise.
* sysdeps/stub/tcflush.c: Likewise.
* sysdeps/stub/tcgetattr.c: Likewise.
* sysdeps/stub/tcgetpgrp.c: Likewise.
* sysdeps/stub/tcsendbrk.c: Likewise.
* sysdeps/stub/tcsetattr.c: Likewise.
* sysdeps/stub/tcsetpgrp.c: Likewise.
* sysdeps/stub/telldir.c: Likewise.
* sysdeps/stub/tempname.c: Likewise.
* sysdeps/stub/time.c: Likewise.
* sysdeps/stub/times.c: Likewise.
* sysdeps/stub/truncate.c: Likewise.
* sysdeps/stub/ttyname.c: Likewise.
* sysdeps/stub/ttyname_r.c: Likewise.
* sysdeps/stub/ualarm.c: Likewise.
* sysdeps/stub/ulimit.c: Likewise.
* sysdeps/stub/umask.c: Likewise.
* sysdeps/stub/unlink.c: Likewise.
* sysdeps/stub/usleep.c: Likewise.
* sysdeps/stub/ustat.c: Likewise.
* sysdeps/stub/utime.c: Likewise.
* sysdeps/stub/utimes.c: Likewise.
* sysdeps/stub/vhangup.c: Likewise.
* sysdeps/stub/wait.c: Likewise.
* sysdeps/stub/wait3.c: Likewise.
* sysdeps/stub/wait4.c: Likewise.
* sysdeps/stub/waitpid.c: Likewise.
* sysdeps/stub/write.c: Likewise.
* sysdeps/stub/writev.c: Likewise.
* sysdeps/stub/xmknod.c: Likewise.
* sysdeps/stub/xstat.c: Likewise.
* sysdeps/unix/closedir.c: Likewise.
* sysdeps/unix/fxstat.c: Likewise.
* sysdeps/unix/getlogin.c: Likewise.
* sysdeps/unix/getlogin_r.c: Likewise.
* sysdeps/unix/mkdir.c: Likewise.
* sysdeps/unix/nice.c: Likewise.
* sysdeps/unix/nlist.c: Likewise.
* sysdeps/unix/opendir.c: Likewise.
* sysdeps/unix/readdir.c: Likewise.
* sysdeps/unix/rmdir.c: Likewise.
* sysdeps/unix/stime.c: Likewise.
* sysdeps/unix/xmknod.c: Likewise.
* sysdeps/unix/xstat.c: Likewise.
* sysdeps/unix/bsd/isatty.c: Likewise.
* sysdeps/unix/bsd/setegid.c: Likewise.
* sysdeps/unix/bsd/seteuid.c: Likewise.
* sysdeps/unix/bsd/setsid.c: Likewise.
* sysdeps/unix/bsd/sigaction.c: Likewise.
* sysdeps/unix/bsd/sigprocmask.c: Likewise.
* sysdeps/unix/bsd/sigsuspend.c: Likewise.
* sysdeps/unix/bsd/tcflow.c: Likewise.
* sysdeps/unix/bsd/tcflush.c: Likewise.
* sysdeps/unix/bsd/tcgetattr.c: Likewise.
* sysdeps/unix/bsd/tcsetattr.c: Likewise.
* sysdeps/unix/bsd/times.c: Likewise.
* sysdeps/unix/bsd/ulimit.c: Likewise.
* sysdeps/unix/common/lxstat.c: Likewise.
* sysdeps/unix/common/tcsendbrk.c: Likewise.
* sysdeps/unix/sysv/setrlimit.c: Likewise.
* sysdeps/unix/sysv/settimeofday.c: Likewise.
* sysdeps/unix/sysv/sigaction.c: Likewise.
* sysdeps/unix/sysv/tcflow.c: Likewise.
* sysdeps/unix/sysv/tcflush.c: Likewise.
* sysdeps/unix/sysv/tcgetattr.c: Likewise.
* sysdeps/unix/sysv/tcsendbrk.c: Likewise.
* sysdeps/unix/sysv/tcsetattr.c: Likewise.
* sysdeps/unix/bsd/ultrix4/sysconf.c: Likewise.
* sysdeps/unix/sysv/irix4/getpriority.c: Likewise.
* sysdeps/unix/sysv/irix4/setpriority.c: Likewise.
* sysdeps/unix/sysv/linux/adjtime.c: Likewise.
* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
* sysdeps/unix/sysv/linux/gethostname.c: Likewise.
* sysdeps/unix/sysv/linux/getsysstats.c: Likewise.
* sysdeps/unix/sysv/linux/ptrace.c: Likewise.
* sysdeps/unix/sysv/linux/speed.c: Likewise.
* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
* sysdeps/unix/sysv/sysv4/sigaction.c: Likewise.
* sysdeps/unix/sysv/sysv4/sysconf.c: Likewise.
* sysdeps/unix/bsd/sun/m68k/sigtramp.c: Likewise.
* sysdeps/unix/bsd/sun/sparc/sigtramp.c: Likewise.
* sysdeps/unix/bsd/sun/sunos4/speed.c: Likewise.
* sysdeps/unix/bsd/sun/sunos4/tcsetattr.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/ioperm.c: Likewise.
* sysdeps/unix/sysv/linux/i386/brk.c: Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/brk.c: Likewise.
* sunrpc/clnt_tcp.c: Protect declaration of errno by #ifndef.
* sunrpc/clnt_udp.c: Likewise.
* sunrpc/bindrsvprt.c: Likewise.
* sunrpc/pm_getmaps.c: Likewise.
* sunrpc/pmap_rmt.c: Likewise.
* sunrpc/svc.c: Likewise.
* sunrpc/svc_run.c: Likewise.
* sunrpc/svc_tcp.c: Likewise.
* sunrpc/svc_udp.c: Likewise.
* sysdeps/generic/strtok.c: Don't check argument, just crash.
* sysdeps/generic/strtok_r.c: Likewise.
* sysdeps/stub/start.c: Make __errno a strong alias of errno.
* sysdeps/unix/start.c: Likewise. De-ANSI-fy.
* sysdeps/unix/sparc/start.c: Likewise.
* sysdeps/standalone/m68k/m68020/start.S: Likewise.
* sysdeps/unix/sysv/irix4/start.c: Likewise.
* sysdeps/unix/bsd/ultrix4/mips/start.S: Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.S: Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep.S: Likewise.
Mon Sep 23 17:54:57 1996 Ulrich Drepper <drepper@cygnus.com>
* catgets/gencat.c (main): Put package name in --version message
in parantheses. Reported by Jim Meyering.
* db/makedb.c: Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.
* sysdeps/i386/fpu/__math.h (tan): Make sure gcc knows we use
two registers. Patch by John Bowman.
Sat Sep 21 15:08:25 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/mach/libc-lock.h: Fix comment.
* sysdeps/stubs/libc-lock.h: Likewise.
Sat Sep 21 13:50:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* libio/genops.c (_IO_init) [_IO_MTSAFE_IO]: Dereference pointer
to lock when passing it to __libc_lock_init macro.
(_IO_default_finish) [_IO_MTSAFE_IO]: Dereference pointer to lock
when passing it to __libc_lock_fini macro.
Sat Sep 21 14:35:40 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER)
[_LIBC_REENTRANT]: Add missing semicolon.
* sysdeps/unix/sysv/linux/m68k/sysdep.S: Move inclusion of
sysdep.h to the top outside of #ifndef PIC. Don't include errnos.h.
Use the ENTRY macro.
Sat Sep 21 14:33:41 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* libio/Makefile: Make `all' the default target.
* po/Makefile: Likewise.
Mon Sep 23 15:49:47 1996 Ulrich Drepper <drepper@cygnus.com>
* stdlib/test-canon.c: Correct patch from Thu Sep 12 23:01:16 1996.
I applied it incorrectly.
* sysdeps/m68k/fpu/s_scalbn.c: Likewise.
* sysdeps/m68k/fpu/s_scalbnf.c: Likewise.
* sysdeps/m68k/fpu/s_scalbnl.c: Likewise.
Mon Sep 23 03:00:10 1996 Ulrich Drepper <drepper@cygnus.com>
* shadow/sgetspent_r.c (LINE_PARSER): Accept empty 9th field.
Patch by NIIBE Yutaka <gniibe@mri.co.jp>.
* shadow/sgetspent_r.c (LINE_PARSER): Don't accept any chars after
9th field.
* sysdeps/unix/sysv/linux/Makefile [$(subdir)==misc]
(sysdep_headers): Add sys/debugreg.h, sys/kd.h, sys/soundcard.h,
and sys/vt.h.
* sysdeps/unix/sysv/linux/sys/debugreg.h: New file.
* sysdeps/unix/sysv/linux/sys/kd.h: New file.
* sysdeps/unix/sysv/linux/sys/soundcard.h: New file.
* sysdeps/unix/sysv/linux/sys/vt.h: New file.
Reported by NIIBE Yutaka <gniibe@mri.co.jp>.
Thu Sep 26 13:44:29 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> Thu Sep 26 13:44:29 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* hurd/Makefile (installed-sunrpc-headers): New variable. * hurd/Makefile (installed-sunrpc-headers): New variable.

119
FAQ
View File

@ -55,6 +55,14 @@ please let me know.
libc anymore?'' libc anymore?''
[Q15] ``What are these `add-ons'?'' [Q15] ``What are these `add-ons'?''
[Q16] ``When I use GNU libc on my Linux system by linking against
to libc.so which comes with glibc all I get is a core dump.''
[Q17] ``Looking through the shared libc file I haven't found the
functions `stat', `lstat', `fstat', and `mknod' and while
linking on my Linux system I get error messages. How is
this supposed to work?''
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q1] ``What systems does the GNU C Library run on?'' [Q1] ``What systems does the GNU C Library run on?''
@ -424,13 +432,120 @@ compilation is provided. The GNU libc's sysdeps/ directory shows how
to use this feature. to use this feature.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q16] ``When I use GNU libc on my Linux system by linking against
to libc.so which comes with glibc all I get is a core dump.''
[A16] {UD} It is not enough to simply link against the GNU libc
library itself. The GNU C library comes with its own dynamic linker
which really conforms to the ELF API standard. This dynamic linker
must be used.
Normally this is done by the compiler. The gcc will use
-dynamic-linker /lib/ld-linux.so.1
unless the user specifies her/himself a -dynamic-linker argument. But
this is not the correct name for the GNU dynamic linker. The correct
name is /lib/ld.so.1 which is the name specified in the SVr4 ABi.
To change your environment to use GNU libc for compiling you need to
change the `specs' file of your gcc. This file is normally found at
/usr/lib/gcc-lib/<arch>/<version>/specs
In this file you have to change a few things:
- change `ld-linux.so.1' to `ld.so.1'
- remove all expression `%{...:-lgmon}'; there is no libgmon in glibc
Things are getting a bit more complicated if you have GNU libc
installed in some other place than /usr, i.e., if you do not want to
use it instead of the old libc. In this case the needed startup files
and libraries are not found in the regular places. So the specs file
must tell the compiler and linker exactly what to use. Here is for
example the gcc-2.7.2 specs file when GNU libc is installed at
/home/gnu:
-----------------------------------------------------------------------
*asm:
%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}
*asm_final:
%{pipe:-}
*cpp:
%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} -I/home/gnu/include
*cc1:
*cc1plus:
*endfile:
%{!shared:crtend.o%s} %{shared:crtendS.o%s} /home/gnu/lib/crtn.o%s
*link:
-m elf_i386 -rpath=/home/gnu/lib -L/home/gnu/lib %{shared:-shared} %{!shared: %{!ibcs: %{!static: %{rdynamic:-export-dynamic} %{!dynamic-linker:-dynamic-linker=/home/gnu/lib/ld.so.1}} %{static:-static}}}
*lib:
%{!shared: %{mieee-fp:-lieee} %{p:-lc_p} %{!p:%{pg:-lc_p} %{!pg:-lc}}}
*libgcc:
%{!shared:-lgcc}
*startfile:
%{!shared: %{pg:/home/gnu/lib/gcrt1.o%s} %{!pg:%{p:/home/gnu/lib/gcrt1.o} %{!p:/home/gnu/lib/crt1.o%s}}} /home/gnu/lib/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}
*switches_need_spaces:
*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}
*predefines:
-D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)
*cross_compile:
0
*multilib:
. ;
-----------------------------------------------------------------------
Future versions of GCC will automatically provide the correct specs.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
[Q17] ``Looking through the shared libc file I haven't found the
functions `stat', `lstat', `fstat', and `mknod' and while
linking on my Linux system I get error messages. How is
this supposed to work?''
[A17] {RM} Believe it or not, stat and lstat (and fstat, and mknod)
are supposed to be undefined references in libc.so.6! Your problem is
probably a missing or incorrect /usr/lib/libc.so file; note that this
is a small text file now, not a symlink to libc.so.6. It should look
something like this:
GROUP ( libc.so.6 ld.so.1 libc.a )
{UD} The Linux ldconfig file probably generates a link libc.so ->
libc.so.6 in /lib. This is not correct. There must not be such a
link. The linker script with the above contents is placed in
/usr/lib which is enough for the linker.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Answers were given by: Answers were given by:
{UD} Ulrich Drepper, <drepper@cygnus.com> {UD} Ulrich Drepper, <drepper@cygnus.com>
{DMT} David Mosberger-Tang, <davidm@AZStarNet.com> {DMT} David Mosberger-Tang, <davidm@AZStarNet.com>
Amended by:
{RM} Roland McGrath, <roland@gnu.ai.mit.edu> {RM} Roland McGrath, <roland@gnu.ai.mit.edu>
Local Variables: Local Variables:

View File

@ -115,33 +115,21 @@ ifeq (yes,$(build-shared))
lib: $(common-objpfx)libc.so lib: $(common-objpfx)libc.so
endif endif
$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
$(objpfx)sysd-dirs: $(+sysdir_pfx)config.make $(all-Subdirs-files)
(echo define sysdep-subdirs; \ (echo define sysdep-subdirs; \
for sysdir in $(config-sysdirs); do \ sed 's/#.*$$//' $(all-Subdirs-files) /dev/null; \
case $$sysdir in \
/*) dir=$$sysdir ;; \
*) dir=$(..)$$sysdir ;; \
esac; \
if [ -r $$dir/Subdirs ]; then \
sed 's/#.*$$//' $$dir/Subdirs; \
else true; \
fi; \
done; \
echo endef) > $@-tmp echo endef) > $@-tmp
mv -f $@-tmp $@ mv -f $@-tmp $@
$(objpfx)version-info.h: $(..)Makefile $(+sysdir_pfx)config.make all-Banner-files = $(wildcard $(addsuffix /Banner, $(subdirs)))
(first=yes; \ $(objpfx)version-info.h: $(+sysdir_pfx)config.make $(all-Banner-files)
for dir in $(subdirs); do \ (files="$(all-Banner-files)"; \
if [ -r $$dir/Banner ]; then \ if [ test -n "$$files" ]; then \
if [ $$first = yes ]; then \
echo "\"Available extensions:"; \ echo "\"Available extensions:"; \
first=no; \ sed -e '/^#/d' -e 's/^[[:space:]]*/ /' $$files; \
fi; \ echo "\""; \
sed -e '/^#/d' -e 's/^[[:space:]]*/ /' $$dir/Banner; \ fi) > $@-tmp
fi; \
done; \
[ $$first = yes ] || echo "\"") > $@-tmp
mv -f $@-tmp $@ mv -f $@-tmp $@
version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes)) version.c-objects := $(addprefix $(objpfx)version,$(object-suffixes))

View File

@ -165,14 +165,14 @@ main (int argc, char *argv[])
/* Version information is requested. */ /* Version information is requested. */
if (do_version) if (do_version)
{ {
fprintf (stderr, "gencat - GNU %s %s\n", PACKAGE, VERSION); fprintf (stderr, "gencat (GNU %s) %s\n", PACKAGE, VERSION);
fprintf (stderr, _("\ fprintf (stderr, _("\
Copyright (C) %s Free Software Foundation, Inc.\n\ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\ This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "1996"); "), "1996");
fprintf (stderr, _("Written by %s\n"), fprintf (stderr, _("Written by %s.\n"),
"Ulrich Drepper <drepper@cygnus.com>"); "Ulrich Drepper");
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }
@ -222,7 +222,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
If INPUT-FILE is -, input is read from standard input. If OUTPUT-FILE\n\ If INPUT-FILE is -, input is read from standard input. If OUTPUT-FILE\n\
is -, output is written to standard output.\n"), is -, output is written to standard output.\n"),
program_invocation_name, program_invocation_name); program_invocation_name, program_invocation_name);
printf (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n")); fputs (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n"),
stdout);
} }
exit (status); exit (status);

View File

@ -94,6 +94,18 @@ _init (void)
if (__gmon_start__) if (__gmon_start__)
__gmon_start__ (); __gmon_start__ ();
#ifdef _LIBC_REENTRANT
{
/* This is a trick to generate a reference for the symbol
__libc_force_cancel_wrapper which can be used to force parts of
the thread library to be used where some functions and system
calls are overwritten. The value of this variable is always 0. */
extern const int __libc_force_cancel_wrapper;
if (__libc_force_cancel_wrapper)
_init ();
}
#endif
/* End the here document containing the .init prologue code. /* End the here document containing the .init prologue code.
Then fetch the .section directive just written and append that Then fetch the .section directive just written and append that
to crtn.s-new, followed by the function epilogue. */ to crtn.s-new, followed by the function epilogue. */

View File

@ -115,14 +115,14 @@ main (argc, argv)
/* Version information is requested. */ /* Version information is requested. */
if (do_version) if (do_version)
{ {
fprintf (stderr, "makedb - GNU %s %s\n", PACKAGE, VERSION); fprintf (stderr, "makedb (GNU %s) %s\n", PACKAGE, VERSION);
fprintf (stderr, _("\ fprintf (stderr, _("\
Copyright (C) %s Free Software Foundation, Inc.\n\ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\ This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "1996"); "), "1996");
fprintf (stderr, _("Written by %s\n"), fprintf (stderr, _("Written by %s.\n"),
"Ulrich Drepper <drepper@cygnus.com>"); "Ulrich Drepper");
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }
@ -224,7 +224,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
If INPUT-FILE is -, input is read from standard input.\n"), If INPUT-FILE is -, input is read from standard input.\n"),
program_invocation_name, program_invocation_name, program_invocation_name, program_invocation_name,
program_invocation_name); program_invocation_name);
printf (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n")); fputs (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n"),
stdout);
} }
exit (status); exit (status);

View File

@ -16,18 +16,17 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <dirent.h> #include <dirent.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
int int
DEFUN(scandir, (dir, namelist, select, cmp), scandir (dir, namelist, select, cmp)
CONST char *dir AND const char *dir;
struct dirent ***namelist AND struct dirent ***namelist;
int EXFUN((*select), (struct dirent *)) AND int (*select) __P ((struct dirent *));
int EXFUN((*cmp), (CONST PTR, CONST PTR))) int (*cmp) __P ((const void *, const void *));
{ {
DIR *dp = opendir (dir); DIR *dp = opendir (dir);
struct dirent **v = NULL; struct dirent **v = NULL;
@ -39,7 +38,7 @@ DEFUN(scandir, (dir, namelist, select, cmp),
return -1; return -1;
save = errno; save = errno;
errno = 0; __set_errno (0);
i = 0; i = 0;
while ((d = readdir (dp)) != NULL) while ((d = readdir (dp)) != NULL)
@ -58,7 +57,7 @@ DEFUN(scandir, (dir, namelist, select, cmp),
if (new == NULL) if (new == NULL)
{ {
lose: lose:
errno = ENOMEM; __set_errno (ENOMEM);
break; break;
} }
v = new; v = new;
@ -79,12 +78,12 @@ DEFUN(scandir, (dir, namelist, select, cmp),
while (i > 0) while (i > 0)
free (v[--i]); free (v[--i]);
free (v); free (v);
errno = save; __set_errno (save);
return -1; return -1;
} }
(void) closedir (dp); (void) closedir (dp);
errno = save; __set_errno (save);
/* Sort the list if we have a comparison function to sort with. */ /* Sort the list if we have a comparison function to sort with. */
if (cmp != NULL) if (cmp != NULL)

View File

@ -418,7 +418,7 @@ open_path (const char *name, size_t namelen,
p = dirpath; p = dirpath;
if (p == NULL || *p == '\0') if (p == NULL || *p == '\0')
{ {
errno = ENOENT; __set_errno (ENOENT);
return -1; return -1;
} }

View File

@ -310,6 +310,24 @@ of this helper program; chances are you did not intend to run this program.\n",
preloads = NULL; preloads = NULL;
npreloads = 0; npreloads = 0;
if (! __libc_enable_secure)
{
const char *preloadlist = getenv ("LD_PRELOAD");
if (preloadlist)
{
/* The LD_PRELOAD environment variable gives a colon-separated
list of libraries that are loaded before the executable's
dependencies and prepended to the global scope list. */
char *list = strdupa (preloadlist);
char *p;
while ((p = strsep (&list, ":")) != NULL)
{
(void) _dl_map_object (NULL, p, lt_library);
++npreloads;
}
}
}
/* Read the contents of the file. */ /* Read the contents of the file. */
file = _dl_sysdep_read_whole_file ("/etc/ld.so.preload", &file_size, file = _dl_sysdep_read_whole_file ("/etc/ld.so.preload", &file_size,
PROT_READ | PROT_WRITE); PROT_READ | PROT_WRITE);
@ -375,24 +393,6 @@ of this helper program; chances are you did not intend to run this program.\n",
__munmap (file, file_size); __munmap (file, file_size);
} }
if (! __libc_enable_secure)
{
const char *preloadlist = getenv ("LD_PRELOAD");
if (preloadlist)
{
/* The LD_PRELOAD environment variable gives a colon-separated
list of libraries that are loaded before the executable's
dependencies and prepended to the global scope list. */
char *list = strdupa (preloadlist);
char *p;
while ((p = strsep (&list, ":")) != NULL)
{
(void) _dl_map_object (NULL, p, lt_library);
++npreloads;
}
}
}
if (npreloads != 0) if (npreloads != 0)
{ {
/* Set up PRELOADS with a vector of the preloaded libraries. */ /* Set up PRELOADS with a vector of the preloaded libraries. */

View File

@ -111,7 +111,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
(void)fprintf(stderr, _("connect to address %s: "), (void)fprintf(stderr, _("connect to address %s: "),
inet_ntoa(sin.sin_addr)); inet_ntoa(sin.sin_addr));
errno = oerrno; __set_errno (oerrno);
perror(0); perror(0);
hp->h_addr_list++; hp->h_addr_list++;
bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length); bcopy(hp->h_addr_list[0], &sin.sin_addr, hp->h_length);
@ -146,7 +146,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
FD_ZERO(&reads); FD_ZERO(&reads);
FD_SET(s, &reads); FD_SET(s, &reads);
FD_SET(s2, &reads); FD_SET(s2, &reads);
errno = 0; __set_errno (0);
if (select(1 + (s > s2 ? s : s2), &reads, 0, 0, 0) < 1 || if (select(1 + (s > s2 ? s : s2), &reads, 0, 0, 0) < 1 ||
!FD_ISSET(s2, &reads)) { !FD_ISSET(s2, &reads)) {
if (errno != 0) if (errno != 0)
@ -227,7 +227,7 @@ rresvport(alport)
(*alport)--; (*alport)--;
if (*alport == IPPORT_RESERVED/2) { if (*alport == IPPORT_RESERVED/2) {
(void)close(s); (void)close(s);
errno = EAGAIN; /* close */ __set_errno (EAGAIN); /* close */
return (-1); return (-1);
} }
} }

View File

@ -46,6 +46,9 @@ char *alloca ();
#ifndef errno #ifndef errno
extern int errno; extern int errno;
#endif #endif
#ifndef __set_errno
# define __set_errno(val) errno = (val)
#endif
#if defined STDC_HEADERS || defined _LIBC #if defined STDC_HEADERS || defined _LIBC
# include <stdlib.h> # include <stdlib.h>
@ -277,13 +280,13 @@ DCGETTEXT (domainname, msgid, category)
dirname = (char *) alloca (path_max + dirname_len); dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname); ADD_BLOCK (block_list, dirname);
errno = 0; __set_errno (0);
while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE) while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
{ {
path_max += PATH_INCR; path_max += PATH_INCR;
dirname = (char *) alloca (path_max + dirname_len); dirname = (char *) alloca (path_max + dirname_len);
ADD_BLOCK (block_list, dirname); ADD_BLOCK (block_list, dirname);
errno = 0; __set_errno (0);
} }
if (ret == NULL) if (ret == NULL)
@ -291,7 +294,7 @@ DCGETTEXT (domainname, msgid, category)
/* We cannot get the current working directory. Don't signal an /* We cannot get the current working directory. Don't signal an
error but simply return the default string. */ error but simply return the default string. */
FREE_BLOCKS (block_list); FREE_BLOCKS (block_list);
errno = saved_errno; __set_errno (saved_errno);
return (char *) msgid; return (char *) msgid;
} }
@ -352,7 +355,7 @@ DCGETTEXT (domainname, msgid, category)
|| strcmp (single_locale, "POSIX") == 0) || strcmp (single_locale, "POSIX") == 0)
{ {
FREE_BLOCKS (block_list); FREE_BLOCKS (block_list);
errno = saved_errno; __set_errno (saved_errno);
return (char *) msgid; return (char *) msgid;
} }
@ -381,7 +384,7 @@ DCGETTEXT (domainname, msgid, category)
if (retval != NULL) if (retval != NULL)
{ {
FREE_BLOCKS (block_list); FREE_BLOCKS (block_list);
errno = saved_errno; __set_errno (saved_errno);
return retval; return retval;
} }
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
@ -24,7 +23,9 @@ Cambridge, MA 02139, USA. */
/* Create FILE with protections MODE. */ /* Create FILE with protections MODE. */
int int
DEFUN(creat, (file, mode), CONST char *file AND mode_t mode) creat (file, mode)
const char *file;
mode_t mode;
{ {
return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode); return __open (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
} }

View File

@ -100,7 +100,7 @@ fts_open(argv, options, compar)
/* Options check. */ /* Options check. */
if (options & ~FTS_OPTIONMASK) { if (options & ~FTS_OPTIONMASK) {
errno = EINVAL; __set_errno (EINVAL);
return (NULL); return (NULL);
} }
@ -134,7 +134,7 @@ fts_open(argv, options, compar)
for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) { for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
/* Don't allow zero-length paths. */ /* Don't allow zero-length paths. */
if ((len = strlen(*argv)) == 0) { if ((len = strlen(*argv)) == 0) {
errno = ENOENT; __set_errno (ENOENT);
goto mem3; goto mem3;
} }
@ -262,7 +262,7 @@ fts_close(sp)
/* Set errno and return. */ /* Set errno and return. */
if (!ISSET(FTS_NOCHDIR) && saved_errno) { if (!ISSET(FTS_NOCHDIR) && saved_errno) {
errno = saved_errno; __set_errno (saved_errno);
return (-1); return (-1);
} }
return (0); return (0);
@ -425,7 +425,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
* can distinguish between error and EOF. * can distinguish between error and EOF.
*/ */
free(p); free(p);
errno = 0; __set_errno (0);
return (sp->fts_cur = NULL); return (sp->fts_cur = NULL);
} }
@ -446,7 +446,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
if (FCHDIR(sp, p->fts_symfd)) { if (FCHDIR(sp, p->fts_symfd)) {
saved_errno = errno; saved_errno = errno;
(void)close(p->fts_symfd); (void)close(p->fts_symfd);
errno = saved_errno; __set_errno (saved_errno);
SET(FTS_STOP); SET(FTS_STOP);
return (NULL); return (NULL);
} }
@ -476,7 +476,7 @@ fts_set(sp, p, instr)
{ {
if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW && if (instr && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
instr != FTS_NOINSTR && instr != FTS_SKIP) { instr != FTS_NOINSTR && instr != FTS_SKIP) {
errno = EINVAL; __set_errno (EINVAL);
return (1); return (1);
} }
p->fts_instr = instr; p->fts_instr = instr;
@ -492,7 +492,7 @@ fts_children(sp, instr)
int fd; int fd;
if (instr && instr != FTS_NAMEONLY) { if (instr && instr != FTS_NAMEONLY) {
errno = EINVAL; __set_errno (EINVAL);
return (NULL); return (NULL);
} }
@ -503,7 +503,7 @@ fts_children(sp, instr)
* Errno set to 0 so user can distinguish empty directory from * Errno set to 0 so user can distinguish empty directory from
* an error. * an error.
*/ */
errno = 0; __set_errno (0);
/* Fatal errors stop here. */ /* Fatal errors stop here. */
if (ISSET(FTS_STOP)) if (ISSET(FTS_STOP))
@ -681,7 +681,7 @@ mem1: saved_errno = errno;
free(p); free(p);
fts_lfree(head); fts_lfree(head);
(void)closedir(dirp); (void)closedir(dirp);
errno = saved_errno; __set_errno (saved_errno);
cur->fts_info = FTS_ERR; cur->fts_info = FTS_ERR;
SET(FTS_STOP); SET(FTS_STOP);
return (NULL); return (NULL);
@ -803,7 +803,7 @@ fts_stat(sp, p, follow)
if (stat(p->fts_accpath, sbp)) { if (stat(p->fts_accpath, sbp)) {
saved_errno = errno; saved_errno = errno;
if (!lstat(p->fts_accpath, sbp)) { if (!lstat(p->fts_accpath, sbp)) {
errno = 0; __set_errno (0);
return (FTS_SLNONE); return (FTS_SLNONE);
} }
p->fts_errno = saved_errno; p->fts_errno = saved_errno;

View File

@ -47,7 +47,7 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
got = 0; got = 0;
errno = 0; __set_errno (0);
while ((entry = readdir (dirs[level])) != NULL) while ((entry = readdir (dirs[level])) != NULL)
{ {
@ -61,7 +61,7 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
&& (entry->d_name[1] == '\0' || && (entry->d_name[1] == '\0' ||
(entry->d_name[1] == '.' && entry->d_name[2] == '\0'))) (entry->d_name[1] == '.' && entry->d_name[2] == '\0')))
{ {
errno = 0; __set_errno (0);
continue; continue;
} }
@ -70,9 +70,9 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
if (namlen + len + 1 > PATH_MAX) if (namlen + len + 1 > PATH_MAX)
{ {
#ifdef ENAMETOOLONG #ifdef ENAMETOOLONG
errno = ENAMETOOLONG; __set_errno (ENAMETOOLONG);
#else #else
errno = ENOMEM; __set_errno (ENOMEM);
#endif #endif
return -1; return -1;
} }
@ -120,7 +120,7 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
save = errno; save = errno;
closedir (dirs[newlev]); closedir (dirs[newlev]);
errno = save; __set_errno (save);
dirs[newlev] = NULL; dirs[newlev] = NULL;
} }
} }
@ -139,13 +139,13 @@ DEFUN (ftw_dir, (dirs, level, descriptors, dir, len, func),
skip = got; skip = got;
while (skip-- != 0) while (skip-- != 0)
{ {
errno = 0; __set_errno (0);
if (readdir (dirs[level]) == NULL) if (readdir (dirs[level]) == NULL)
return errno == 0 ? 0 : -1; return errno == 0 ? 0 : -1;
} }
} }
errno = 0; __set_errno (0);
} }
return errno == 0 ? 0 : -1; return errno == 0 ? 0 : -1;
@ -211,7 +211,7 @@ DEFUN(ftw, (dir, func, descriptors),
save = errno; save = errno;
closedir (dirs[0]); closedir (dirs[0]);
errno = save; __set_errno (save);
} }
} }

View File

@ -37,7 +37,7 @@ getwd (buf)
if (buf == NULL) if (buf == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1994 Free Software Foundation, Inc. /* Copyright (C) 1994, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -37,7 +37,7 @@ lockf (int fd, int cmd, off_t len)
return -1; return -1;
if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())
return 0; return 0;
errno = EACCES; __set_errno (EACCES);
return -1; return -1;
case F_ULOCK: case F_ULOCK:
@ -54,7 +54,7 @@ lockf (int fd, int cmd, off_t len)
break; break;
default: default:
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -36,6 +36,8 @@ routines := \
\ \
libc_fatal libc_fatal
all: # Make this the default target; it will be defined in Rules.
include ../Makeconfig include ../Makeconfig
ifneq (,$(filter %REENTRANT, $(defines))) ifneq (,$(filter %REENTRANT, $(defines)))

View File

@ -165,7 +165,7 @@ DEFUN(_IO_file_fopen, (fp, filename, mode),
read_write = _IO_NO_READS|_IO_IS_APPENDING; read_write = _IO_NO_READS|_IO_IS_APPENDING;
break; break;
default: default:
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) { if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) {

View File

@ -466,7 +466,7 @@ DEFUN(_IO_init, (fp, flags),
fp->_markers = NULL; fp->_markers = NULL;
fp->_cur_column = 0; fp->_cur_column = 0;
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
__libc_lock_init (fp->_lock); __libc_lock_init (*fp->_lock);
#endif #endif
} }
@ -501,7 +501,7 @@ DEFUN(_IO_default_finish, (fp),
} }
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
__libc_lock_fini (fp->_lock); __libc_lock_fini (*fp->_lock);
#endif #endif
_IO_un_link(fp); _IO_un_link(fp);

View File

@ -61,9 +61,7 @@ _IO_fdopen (fd, mode)
read_write = _IO_NO_READS|_IO_IS_APPENDING; read_write = _IO_NO_READS|_IO_IS_APPENDING;
break; break;
default: default:
#ifdef EINVAL MAYBE_SET_EINVAL;
errno = EINVAL;
#endif
return NULL; return NULL;
} }
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))

View File

@ -41,7 +41,7 @@ _IO_fgetpos (fp, posp)
{ {
#ifdef EIO #ifdef EIO
if (errno == 0) if (errno == 0)
errno = EIO; __set_errno (EIO);
#endif #endif
return EOF; return EOF;
} }

View File

@ -39,7 +39,7 @@ _IO_fsetpos (fp, posp)
/*ANSI explicily requires setting errno to a positive value on failure.*/ /*ANSI explicily requires setting errno to a positive value on failure.*/
#ifdef EIO #ifdef EIO
if (errno == 0) if (errno == 0)
errno = EIO; __set_errno (EIO);
#endif #endif
result = EOF; result = EOF;
} }

View File

@ -40,7 +40,7 @@ _IO_ftell (fp)
{ {
#ifdef EIO #ifdef EIO
if (errno == 0) if (errno == 0)
errno = EIO; __set_errno (EIO);
#endif #endif
return -1L; return -1L;
} }

View File

@ -48,9 +48,7 @@ _IO_getdelim (lineptr, n, delimiter, fp)
if (lineptr == NULL || n == NULL) if (lineptr == NULL || n == NULL)
{ {
#ifdef EINVAL MAYBE_SET_EINVAL;
errno = EINVAL;
#endif
return -1; return -1;
} }
CHECK_FILE (fp, -1); CHECK_FILE (fp, -1);

View File

@ -397,7 +397,7 @@ extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
#endif #endif
#ifdef EINVAL #ifdef EINVAL
#define MAYBE_SET_EINVAL errno = EINVAL #define MAYBE_SET_EINVAL __set_errno (EINVAL)
#else #else
#define MAYBE_SET_EINVAL /* nothing */ #define MAYBE_SET_EINVAL /* nothing */
#endif #endif

View File

@ -26,7 +26,7 @@ const struct locale_data _nl_C_LC_TIME =
{ {
_nl_C_name, _nl_C_name,
NULL, 0, /* no file mapped */ NULL, 0, /* no file mapped */
45, 53,
{ {
{ string: "Sun" }, { string: "Sun" },
{ string: "Mon" }, { string: "Mon" },
@ -72,6 +72,14 @@ const struct locale_data _nl_C_LC_TIME =
{ string: "%m/%d/%y" }, { string: "%m/%d/%y" },
{ string: "%H:%M:%S" }, { string: "%H:%M:%S" },
{ string: "%I:%M:%S %p" }, { string: "%I:%M:%S %p" },
{ string: NULL } { string: NULL },
{ string: NULL },
{ string: NULL },
{ string: NULL },
{ string: NULL },
{ string: NULL },
{ word: 0 },
{ string: NULL },
{ string: NULL },
} }
}; };

View File

@ -137,16 +137,17 @@ DEFINE_CATEGORY
DEFINE_ELEMENT (D_FMT, "d_fmt", std, string) DEFINE_ELEMENT (D_FMT, "d_fmt", std, string)
DEFINE_ELEMENT (T_FMT, "t_fmt", std, string) DEFINE_ELEMENT (T_FMT, "t_fmt", std, string)
DEFINE_ELEMENT (T_FMT_AMPM, "t_fmt_ampm", std, string) DEFINE_ELEMENT (T_FMT_AMPM, "t_fmt_ampm", std, string)
DEFINE_ELEMENT (ERA, "era", opt, stringarray, 0, 100)/*XXX*/ DEFINE_ELEMENT (ERA, "era", opt, stringarray)
DEFINE_ELEMENT (ERA_YEAR, "era_year", opt, string) DEFINE_ELEMENT (ERA_YEAR, "era_year", opt, string)
DEFINE_ELEMENT (ERA_D_FMT, "era_d_fmt", opt, string) DEFINE_ELEMENT (ERA_D_FMT, "era_d_fmt", opt, string)
DEFINE_ELEMENT (ALT_DIGITS, "alt_digits", opt, stringarray, 0, 100) DEFINE_ELEMENT (ALT_DIGITS, "alt_digits", opt, stringarray, 0, 100)
DEFINE_ELEMENT (ERA_D_T_FMT, "era_d_t_fmt", opt, string) DEFINE_ELEMENT (ERA_D_T_FMT, "era_d_t_fmt", opt, string)
DEFINE_ELEMENT (ERA_T_FMT, "era_t_fmt", opt, string) DEFINE_ELEMENT (ERA_T_FMT, "era_t_fmt", opt, string)
DEFINE_ELEMENT (_NL_TIME_NUM_ALT_DIGITS, "time-num-alt-digits", opt, word)
DEFINE_ELEMENT (_NL_TIME_ERA_NUM_ENTRIES, "time-era-num-entries", opt, word) DEFINE_ELEMENT (_NL_TIME_ERA_NUM_ENTRIES, "time-era-num-entries", opt, word)
DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES_EB, "time-era-entries-eb", opt, string) DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES_EB, "time-era-entries-eb", opt, string)
DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES_EL, "time-era-entries-el", opt, string) DEFINE_ELEMENT (_NL_TIME_ERA_ENTRIES_EL, "time-era-entries-el", opt, string)
), NO_POSTLOAD, NULL, NULL, NULL) ), _nl_postload_time, NULL, NULL, NULL)
DEFINE_CATEGORY DEFINE_CATEGORY

View File

@ -101,6 +101,8 @@ typedef enum
ERA_D_T_FMT, /* Date and time in alternate era format. */ ERA_D_T_FMT, /* Date and time in alternate era format. */
ERA_T_FMT, /* Time in alternate era format. */ ERA_T_FMT, /* Time in alternate era format. */
_NL_TIME_NUM_ALT_DIGITS, /* Number entries in the alt_digits arrays. */
_NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */ _NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */
_NL_TIME_ERA_ENTRIES_EB, /* Structure with era entries in usable form.*/ _NL_TIME_ERA_ENTRIES_EB, /* Structure with era entries in usable form.*/
_NL_TIME_ERA_ENTRIES_EL, _NL_TIME_ERA_ENTRIES_EL,

View File

@ -1,5 +1,5 @@
/* Define current locale data for LC_TIME category. /* Define current locale data for LC_TIME category.
Copyright (C) 1995 Free Software Foundation, Inc. Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -17,6 +17,160 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <libc-lock.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "localeinfo.h" #include "localeinfo.h"
_NL_CURRENT_DEFINE (LC_TIME); _NL_CURRENT_DEFINE (LC_TIME);
/* Some of the functions here must not be used while setlocale is called. */
__libc_lock_define (extern, __libc_setlocale_lock)
static int era_initialized;
static struct era_entry **eras;
static size_t num_eras;
static int alt_digits_initialized;
static const char **alt_digits;
static size_t num_alt_digits;
void
_nl_postload_time (void)
{
/* Prepare lazy initialization of `era' and `alt_digits' array. */
era_initialized = 0;
alt_digits_initialized = 0;
}
struct era_entry *
_nl_get_era_entry (const struct tm *tp)
{
struct era_entry *result;
size_t cnt;
__libc_lock_lock (__libc_setlocale_lock);
if (era_initialized == 0)
{
size_t new_num_eras = _NL_CURRENT_WORD (LC_TIME,
_NL_TIME_ERA_NUM_ENTRIES);
if (eras != NULL && new_num_eras == 0)
{
free (eras);
eras = NULL;
}
else if (new_num_eras != 0)
{
if (num_eras != new_num_eras)
eras = realloc (eras, new_num_eras * sizeof (struct era_entry *));
if (eras == NULL)
num_eras = 0;
else
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
const char *ptr = _NL_CURRENT (LC_TIME, _NL_TIME_ERA_ENTRIES_EL);
#else
const char *ptr = _NL_CURRENT (LC_TIME, _NL_TIME_ERA_ENTRIES_EB);
#endif
num_eras = new_num_eras;
for (cnt = 0; cnt < num_eras; ++cnt)
{
eras[cnt] = (struct era_entry *) ptr;
/* Skip numeric values. */
ptr += sizeof (struct era_entry);
/* Skip era name. */
ptr = strchr (ptr, '\0') + 1;
/* Skip era format. */
ptr = strchr (ptr, '\0') + 1;
ptr += 3 - (((ptr - (const char *) eras[cnt]) + 3) & 3);
}
}
}
era_initialized = 1;
}
/* Now compare date with the available eras. */
for (cnt = 0; cnt < num_eras; ++cnt)
if ((eras[cnt]->start_date[0] < tp->tm_year
|| (eras[cnt]->start_date[0] == tp->tm_year
&& (eras[cnt]->start_date[1] < tp->tm_mon
|| (eras[cnt]->start_date[1] == tp->tm_mon
&& eras[cnt]->start_date[2] <= tp->tm_mday))))
&& (eras[cnt]->stop_date[0] > tp->tm_year
|| (eras[cnt]->stop_date[0] == tp->tm_year
&& (eras[cnt]->stop_date[1] > tp->tm_mon
|| (eras[cnt]->stop_date[1] == tp->tm_mon
&& eras[cnt]->stop_date[2] >= tp->tm_mday)))))
break;
result = cnt < num_eras ? eras[cnt] : NULL;
__libc_lock_unlock (__libc_setlocale_lock);
return result;
}
const char *
_nl_get_alt_digit (unsigned int number)
{
const char *result;
__libc_lock_lock (__libc_setlocale_lock);
if (alt_digits_initialized == 0)
{
size_t new_num_alt_digits = _NL_CURRENT_WORD (LC_TIME,
_NL_TIME_NUM_ALT_DIGITS);
if (alt_digits != NULL && new_num_alt_digits == 0)
{
free (alt_digits);
alt_digits = NULL;
}
else if (new_num_alt_digits != 0)
{
if (num_alt_digits != new_num_alt_digits)
alt_digits = realloc (alt_digits, (new_num_alt_digits
* sizeof (const char *)));
if (alt_digits == NULL)
num_alt_digits = 0;
else
{
const char *ptr = _NL_CURRENT (LC_TIME, ALT_DIGITS);
size_t cnt;
num_alt_digits = new_num_alt_digits;
for (cnt = 0; cnt < num_alt_digits; ++cnt)
{
alt_digits[cnt] = ptr;
/* Skip digit format. */
ptr = strchr (ptr, '\0') + 1;
}
}
}
alt_digits_initialized = 1;
}
result = number < num_alt_digits ? alt_digits[number] : NULL;
__libc_lock_unlock (__libc_setlocale_lock);
return result;
}

View File

@ -144,7 +144,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
{ {
free (filedata); free (filedata);
if (nread == 0) if (nread == 0)
errno = EINVAL; /* Bizarreness going on. */ __set_errno (EINVAL); /* Bizarreness going on. */
goto puntfd; goto puntfd;
} }
p += nread; p += nread;
@ -153,7 +153,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
} }
else else
goto puntfd; goto puntfd;
errno = save_err; __set_errno (save_err);
} }
else else
goto puntfd; goto puntfd;
@ -184,7 +184,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
>= (size_t) st.st_size)) >= (size_t) st.st_size))
{ {
/* Insufficient data. */ /* Insufficient data. */
errno = EINVAL; __set_errno (EINVAL);
goto puntmap; goto puntmap;
} }
@ -204,7 +204,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
if (idx >= newdata->filesize) if (idx >= newdata->filesize)
{ {
free (newdata); free (newdata);
errno = EINVAL; __set_errno (EINVAL);
goto puntmap; goto puntmap;
} }
if (_nl_value_types[category][cnt] == word) if (_nl_value_types[category][cnt] == word)

View File

@ -22,6 +22,7 @@ Cambridge, MA 02139, USA. */
#include <stddef.h> #include <stddef.h>
#include <langinfo.h> #include <langinfo.h>
#include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include "../intl/loadinfo.h" /* For loaded_l10nfile definition. */ #include "../intl/loadinfo.h" /* For loaded_l10nfile definition. */
@ -76,6 +77,17 @@ enum value_type
}; };
/* Structure to access `era' information from LC_TIME. */
struct era_entry
{
u_int32_t direction; /* Contains '+' or '-'. */
int32_t offset;
int32_t start_date[3];
int32_t stop_date[3];
const char name_fmt[0];
};
/* For each category declare the variable for the current locale data. */ /* For each category declare the variable for the current locale data. */
#define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \ #define DEFINE_CATEGORY(category, category_name, items, a, b, c, d) \
extern const struct locale_data *_nl_current_##category; extern const struct locale_data *_nl_current_##category;
@ -114,6 +126,13 @@ extern const struct locale_data *_nl_find_locale (const char *locale_path,
extern void _nl_load_locale (struct loaded_l10nfile *file, int category); extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
/* Return `era' entry which corresponds to TP. Used in strftime. */
struct era_entry *_nl_get_era_entry (const struct tm *tp);
/* Return `alt_digit' which corresponds to NUMBER. Used in strftime. */
const char *_nl_get_alt_digit (unsigned int number);
/* Global variables for LC_COLLATE category data. */ /* Global variables for LC_COLLATE category data. */
extern const u_int32_t *__collate_table; extern const u_int32_t *__collate_table;
extern const u_int32_t *__collate_extra; extern const u_int32_t *__collate_extra;

View File

@ -48,7 +48,7 @@ nl_langinfo (item)
if (category < 0 || category >= LC_ALL) if (category < 0 || category >= LC_ALL)
{ {
/* Bogus category: bogus item. */ /* Bogus category: bogus item. */
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
@ -57,7 +57,7 @@ nl_langinfo (item)
if (index >= data->nstrings) if (index >= data->nstrings)
{ {
/* Bogus index for this category: bogus item. */ /* Bogus index for this category: bogus item. */
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }

View File

@ -27,16 +27,32 @@ Boston, MA 02111-1307, USA. */
/* Undefine following line in production version. */ /* Undefine following line in production version. */
/* #define NDEBUG 1 */ /* #define NDEBUG 1 */
#include <assert.h> #include <assert.h>
#include <stdlib.h>
#include "locales.h" #include "locales.h"
#include "localeinfo.h" #include "localeinfo.h"
#include "stringtrans.h" #include "stringtrans.h"
#define SWAPU32(w) \
(((w) << 24) | (((w) & 0xff00) << 8) | (((w) >> 8) & 0xff00) | ((w) >> 24))
void *xmalloc (size_t __n); void *xmalloc (size_t __n);
void *xrealloc (void *__p, size_t __n); void *xrealloc (void *__p, size_t __n);
/* Entry describing an entry of the era specification. */
struct era_data
{
int32_t direction;
int32_t offset;
int32_t start_date[3];
int32_t stop_date[3];
const char *name;
const char *format;
};
/* The real definition of the struct for the LC_TIME locale. */ /* The real definition of the struct for the LC_TIME locale. */
struct locale_time_t struct locale_time_t
{ {
@ -55,13 +71,16 @@ struct locale_time_t
const char *t_fmt; const char *t_fmt;
const char *t_fmt_ampm; const char *t_fmt_ampm;
const char **era; const char **era;
size_t era_num; u_int32_t cur_num_era;
const char *era_year; const char *era_year;
const char *era_d_t_fmt; const char *era_d_t_fmt;
const char *era_t_fmt; const char *era_t_fmt;
const char *era_d_fmt; const char *era_d_fmt;
const char *alt_digits[100]; const char *alt_digits[100];
size_t cur_num_alt_digits; u_int32_t cur_num_alt_digits;
struct era_data *era_entries;
struct era_data *era_entries_ob;
}; };
@ -109,6 +128,263 @@ time_finish (struct localedef_t *locale)
TEST_ELEM (d_fmt); TEST_ELEM (d_fmt);
TEST_ELEM (t_fmt); TEST_ELEM (t_fmt);
TEST_ELEM (t_fmt_ampm); TEST_ELEM (t_fmt_ampm);
/* Now process the era entries. */
if (time->cur_num_era != 0)
{
const int days_per_month[12] = { 31, 29, 31, 30, 31, 30,
31, 31, 30, 31 ,30, 31 };
size_t idx;
time->era_entries =
(struct era_data *) xmalloc (time->cur_num_era
* sizeof (struct era_data));
for (idx = 0; idx < time->cur_num_era; ++idx)
{
size_t era_len = strlen (time->era[idx]);
char *str = xmalloc ((era_len + 1 + 3) & ~3);
char *endp;
memcpy (str, time->era[idx], era_len + 1);
/* First character must be + or - for the direction. */
if (*str != '+' && *str != '-')
{
error (0, 0, _("direction flag in string %d in `era' field"
" in category `%s' is not '+' nor '-'"),
idx + 1, "LC_TIME");
/* Default arbitrarily to '+'. */
time->era_entries[idx].direction = '+';
}
else
time->era_entries[idx].direction = *str;
if (*++str != ':')
{
error (0, 0, _("direction flag in string %d in `era' field"
" in category `%s' is not a single character"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else
++str;
/* Now the offset year. */
time->era_entries[idx].offset = strtol (str, &endp, 10);
if (endp == str)
{
error (0, 0, _("illegal number for offset in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
error (0, 0, _("garbage at end of offset value in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else
str = endp + 1;
/* Next is the starting date in ISO format. */
if (strncmp (str, "-*", 2) == 0)
{
time->era_entries[idx].start_date[0] =
time->era_entries[idx].start_date[1] =
time->era_entries[idx].start_date[2] = 0x80000000;
if (str[2] != ':')
goto garbage_start_date;
str += 3;
}
else if (strncmp (str, "+*", 2) == 0)
{
time->era_entries[idx].start_date[0] =
time->era_entries[idx].start_date[1] =
time->era_entries[idx].start_date[2] = 0x7fffffff;
if (str[2] != ':')
goto garbage_start_date;
str += 3;
}
else
{
time->era_entries[idx].start_date[0] = strtol (str, &endp, 10);
if (endp == str || *endp != '/')
goto invalid_start_date;
else
str = endp + 1;
time->era_entries[idx].start_date[0] -= 1900;
time->era_entries[idx].start_date[1] = strtol (str, &endp, 10);
if (endp == str || *endp != '/')
goto invalid_start_date;
else
str = endp + 1;
time->era_entries[idx].start_date[1] -= 1;
time->era_entries[idx].start_date[2] = strtol (str, &endp, 10);
if (endp == str)
{
invalid_start_date:
error (0, 0, _("illegal starting date in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
garbage_start_date:
error (0, 0, _("garbage at end of starting date in string %d"
" in `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else
{
str = endp + 1;
/* Check for valid value. */
if (time->era_entries[idx].start_date[1] < 0
|| time->era_entries[idx].start_date[1] >= 12
|| time->era_entries[idx].start_date[2] < 0
|| (time->era_entries[idx].start_date[2]
> days_per_month[time->era_entries[idx].start_date[1]])
|| (time->era_entries[idx].start_date[1] == 2
&& time->era_entries[idx].start_date[2] == 29
&& !__isleap (time->era_entries[idx].start_date[0])))
error (0, 0, _("starting date is illegal in"
" string %d in `era' field in"
" category `%s'"),
idx + 1, "LC_TIME");
}
}
/* Next is the stoping date in ISO format. */
if (strncmp (str, "-*", 2) == 0)
{
time->era_entries[idx].stop_date[0] =
time->era_entries[idx].stop_date[1] =
time->era_entries[idx].stop_date[2] = 0x80000000;
if (str[2] != ':')
goto garbage_stop_date;
str += 3;
}
else if (strncmp (str, "+*", 2) == 0)
{
time->era_entries[idx].stop_date[0] =
time->era_entries[idx].stop_date[1] =
time->era_entries[idx].stop_date[2] = 0x7fffffff;
if (str[2] != ':')
goto garbage_stop_date;
str += 3;
}
else
{
time->era_entries[idx].stop_date[0] = strtol (str, &endp, 10);
if (endp == str || *endp != '/')
goto invalid_stop_date;
else
str = endp + 1;
time->era_entries[idx].stop_date[0] -= 1900;
time->era_entries[idx].stop_date[1] = strtol (str, &endp, 10);
if (endp == str || *endp != '/')
goto invalid_stop_date;
else
str = endp + 1;
time->era_entries[idx].stop_date[1] -= 1;
time->era_entries[idx].stop_date[2] = strtol (str, &endp, 10);
if (endp == str)
{
invalid_stop_date:
error (0, 0, _("illegal stopping date in string %d in"
" `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else if (*endp != ':')
{
garbage_stop_date:
error (0, 0, _("garbage at end of stopping date in string %d"
" in `era' field in category `%s'"),
idx + 1, "LC_TIME");
(void) strsep (&str, ":");
}
else
{
str = endp + 1;
/* Check for valid value. */
if (time->era_entries[idx].stop_date[1] < 0
|| time->era_entries[idx].stop_date[1] >= 12
|| time->era_entries[idx].stop_date[2] < 0
|| (time->era_entries[idx].stop_date[2]
> days_per_month[time->era_entries[idx].stop_date[1]])
|| (time->era_entries[idx].stop_date[1] == 2
&& time->era_entries[idx].stop_date[2] == 29
&& !__isleap (time->era_entries[idx].stop_date[0])))
error (0, 0, _("stopping date is illegal in"
" string %d in `era' field in"
" category `%s'"),
idx + 1, "LC_TIME");
}
}
if (str == NULL || *str == '\0')
{
error (0, 0, _("missing era name in string %d in `era' field"
"in category `%s'"), idx + 1, "LC_TIME");
time->era_entries[idx].name =
time->era_entries[idx].format = "";
}
else
{
time->era_entries[idx].name = strsep (&str, ":");
if (str == NULL || *str == '\0')
{
error (0, 0, _("missing era format in string %d in `era'"
" field in category `%s'"),
idx + 1, "LC_TIME");
time->era_entries[idx].name =
time->era_entries[idx].format = "";
}
else
time->era_entries[idx].format = str;
}
}
/* Construct the array for the other byte order. */
time->era_entries_ob =
(struct era_data *) xmalloc (time->cur_num_era
* sizeof (struct era_data));
for (idx = 0; idx < time->cur_num_era; ++idx)
{
time->era_entries_ob[idx].direction =
SWAPU32 (time->era_entries[idx].direction);
time->era_entries_ob[idx].offset =
SWAPU32 (time->era_entries[idx].offset);
time->era_entries_ob[idx].start_date[0] =
SWAPU32 (time->era_entries[idx].start_date[0]);
time->era_entries_ob[idx].start_date[1] =
SWAPU32 (time->era_entries[idx].start_date[1]);
time->era_entries_ob[idx].start_date[2] =
SWAPU32 (time->era_entries[idx].stop_date[2]);
time->era_entries_ob[idx].stop_date[0] =
SWAPU32 (time->era_entries[idx].stop_date[0]);
time->era_entries_ob[idx].stop_date[1] =
SWAPU32 (time->era_entries[idx].stop_date[1]);
time->era_entries_ob[idx].stop_date[2] =
SWAPU32 (time->era_entries[idx].stop_date[2]);
time->era_entries_ob[idx].name =
time->era_entries[idx].name;
time->era_entries_ob[idx].format =
time->era_entries[idx].format;
}
}
} }
@ -117,8 +393,9 @@ time_output (struct localedef_t *locale, const char *output_path)
{ {
struct locale_time_t *time = locale->categories[LC_TIME].time; struct locale_time_t *time = locale->categories[LC_TIME].time;
struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME) struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME)
+ (time->era_num > 0 ? time->era_num - 1 : 0) + time->cur_num_era - 1
+ time->cur_num_alt_digits]; + time->cur_num_alt_digits - 1
+ 1 + (time->cur_num_era * 9 - 1) * 2];
struct locale_file data; struct locale_file data;
u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)]; u_int32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)];
size_t cnt, last_idx, num; size_t cnt, last_idx, num;
@ -209,10 +486,11 @@ time_output (struct localedef_t *locale, const char *output_path)
last_idx = ++cnt; last_idx = ++cnt;
idx[1 + last_idx] = idx[last_idx]; idx[1 + last_idx] = idx[last_idx];
for (num = 0; num < time->era_num; ++num, ++cnt) for (num = 0; num < time->cur_num_era; ++num, ++cnt)
{ {
iov[2 + cnt].iov_base = (void *) time->era[num]; iov[2 + cnt].iov_base = (void *) time->era[num];
iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1; iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1;
idx[1 + last_idx] += iov[2 + cnt].iov_len;
} }
++last_idx; ++last_idx;
@ -241,13 +519,128 @@ time_output (struct localedef_t *locale, const char *output_path)
iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1; iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1;
idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len; idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len;
++cnt; ++cnt;
++last_idx;
iov[2 + cnt].iov_base = (void *) (time->era_d_fmt ?: ""); iov[2 + cnt].iov_base = (void *) (time->era_t_fmt ?: "");
iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1; iov[2 + cnt].iov_len = strlen (iov[2 + cnt].iov_base) + 1;
idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len;
++cnt;
++last_idx;
/* We must align the following data. */
iov[2 + cnt].iov_base = (void *) "\0\0";
iov[2 + cnt].iov_len = ((idx[last_idx] + 3) & ~3) - idx[last_idx];
idx[last_idx] = (idx[last_idx] + 3) & ~3;
++cnt; ++cnt;
assert (cnt == (_NL_ITEM_INDEX (_NL_NUM_LC_TIME) - 1 iov[2 + cnt].iov_base = (void *) &time->cur_num_alt_digits;
+ time->cur_num_alt_digits)); iov[2 + cnt].iov_len = sizeof (u_int32_t);
idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len;
++cnt;
++last_idx;
/* The `era' data in usable form. */
iov[2 + cnt].iov_base = (void *) &time->cur_num_era;
iov[2 + cnt].iov_len = sizeof (u_int32_t);
idx[1 + last_idx] = idx[last_idx] + iov[2 + cnt].iov_len;
++cnt;
++last_idx;
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define ERA_B1 time->era_entries
# define ERA_B2 time->era_entries_ob
#else
# define ERA_B1 time->era_entries_ob
# define ERA_B2 time->era_entries
#endif
idx[1 + last_idx] = idx[last_idx];
for (num = 0; num < time->cur_num_era; ++num)
{
size_t l;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].direction;
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].offset;
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[0];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[1];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].start_date[2];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[0];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[1];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B1[num].stop_date[2];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
l = (strchr (ERA_B1[num].format, '\0') - ERA_B1[num].name) + 1;
l = (l + 3) & ~3;
iov[2 + cnt].iov_base = (void *) ERA_B1[num].name;
iov[2 + cnt].iov_len = l;
++cnt;
idx[1 + last_idx] += 8 * sizeof (int32_t) + l;
assert (idx[1 + last_idx] % 4 == 0);
}
++last_idx;
/* idx[1 + last_idx] = idx[last_idx]; */
for (num = 0; num < time->cur_num_era; ++num)
{
size_t l;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].direction;
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].offset;
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[0];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[1];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].start_date[2];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[0];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[1];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
iov[2 + cnt].iov_base = (void *) &ERA_B2[num].stop_date[2];
iov[2 + cnt].iov_len = sizeof (int32_t);
++cnt;
l = (strchr (ERA_B2[num].format, '\0') - ERA_B2[num].name) + 1;
l = (l + 3) & ~3;
iov[2 + cnt].iov_base = (void *) ERA_B2[num].name;
iov[2 + cnt].iov_len = l;
++cnt;
/* idx[1 + last_idx] += 8 * sizeof (int32_t) + l; */
}
assert (cnt == (_NL_ITEM_INDEX (_NL_NUM_LC_TIME)
+ time->cur_num_era - 1
+ time->cur_num_alt_digits - 1
+ 1 + (time->cur_num_era * 9 - 1) * 2)
&& last_idx + 1 == _NL_ITEM_INDEX (_NL_NUM_LC_TIME));
write_locale_data (output_path, "LC_TIME", 2 + cnt, iov); write_locale_data (output_path, "LC_TIME", 2 + cnt, iov);
} }
@ -291,9 +684,10 @@ too many values for field `%s' in category `LC_TIME'"), \
"era", "LC_TIME"); "era", "LC_TIME");
else else
{ {
++time->era_num; ++time->cur_num_era;
time->era = xrealloc (time->era, time->era_num * sizeof (char *)); time->era = xrealloc (time->era,
time->era[time->era_num - 1] = code->val.str.start; time->cur_num_era * sizeof (char *));
time->era[time->cur_num_era - 1] = code->val.str.start;
} }
break; break;

View File

@ -183,14 +183,14 @@ main (int argc, char *argv[])
/* Version information is requested. */ /* Version information is requested. */
if (do_version) if (do_version)
{ {
fprintf (stderr, "locale - GNU %s %s\n", PACKAGE, VERSION); fprintf (stderr, "locale (GNU %s) %s\n", PACKAGE, VERSION);
fprintf (stderr, _("\ fprintf (stderr, _("\
Copyright (C) %s Free Software Foundation, Inc.\n\ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\ This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "1995, 1996"); "), "1995, 1996");
fprintf (stderr, _("Written by %s\n"), fprintf (stderr, _("Written by %s.\n"),
"Ulrich Drepper <drepper@cygnus.com>"); "Ulrich Drepper");
exit (EXIT_SUCCESS); exit (EXIT_SUCCESS);
} }
@ -255,7 +255,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
-c, --category-name write names of selected categories\n\ -c, --category-name write names of selected categories\n\
-k, --keyword-name write names of selected keywords\n"), -k, --keyword-name write names of selected keywords\n"),
__progname); __progname);
printf (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n")); fputs (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n"),
stdout);
} }
exit (status); exit (status);

View File

@ -173,14 +173,14 @@ main (int argc, char *argv[])
/* Version information is requested. */ /* Version information is requested. */
if (do_version) if (do_version)
{ {
fprintf (stderr, "localedef - GNU %s %s\n", PACKAGE, VERSION); fprintf (stderr, "localedef (GNU %s) %s\n", PACKAGE, VERSION);
fprintf (stderr, _("\ fprintf (stderr, _("\
Copyright (C) %s Free Software Foundation, Inc.\n\ Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\ This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
"), "1995, 1996"); "), "1995, 1996");
fprintf (stderr, _("Written by %s\n"), fprintf (stderr, _("Written by %s.\n"),
"Ulrich Drepper <drepper@cygnus.com>"); "Ulrich Drepper");
exit (0); exit (0);
} }
@ -406,7 +406,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\
System's directory for character maps: %s\n\ System's directory for character maps: %s\n\
locale files : %s\n"), locale files : %s\n"),
program_invocation_name, CHARMAP_PATH, LOCALE_PATH); program_invocation_name, CHARMAP_PATH, LOCALE_PATH);
printf (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n")); fputs (gettext ("Report bugs to <bug-glibc@prep.ai.mit.edu>.\n"),
stdout);
} }
exit (status); exit (status);
@ -429,7 +430,7 @@ error_print ()
static const char * static const char *
construct_output_path (char *path) construct_output_path (char *path)
{ {
char *normal = NULL; const char *normal = NULL;
char *result; char *result;
if (strchr (path, '/') == NULL) if (strchr (path, '/') == NULL)
@ -455,6 +456,9 @@ construct_output_path (char *path)
if (endp > startp) if (endp > startp)
normal = _nl_normalize_codeset (startp, endp - startp); normal = _nl_normalize_codeset (startp, endp - startp);
} }
else
/* This is to keep gcc quiet. */
endp = NULL;
/* We put an additional '\0' at the end of the string because at /* We put an additional '\0' at the end of the string because at
the end of the function we need another byte for the trailing the end of the function we need another byte for the trailing

View File

@ -829,6 +829,7 @@ syntax error in collating order definition"));
case tok_mon: case tok_mon:
case tok_am_pm: case tok_am_pm:
case tok_alt_digits: case tok_alt_digits:
case tok_era:
READ_STRING_LIST (time_add, bad_time); READ_STRING_LIST (time_add, bad_time);
continue; continue;
@ -836,7 +837,6 @@ syntax error in collating order definition"));
case tok_d_fmt: case tok_d_fmt:
case tok_t_fmt: case tok_t_fmt:
case tok_t_fmt_ampm: case tok_t_fmt_ampm:
case tok_era:
case tok_era_year: case tok_era_year:
case tok_era_d_t_fmt: case tok_era_d_t_fmt:
case tok_era_d_fmt: case tok_era_d_fmt:
@ -935,7 +935,7 @@ write_locale_data (const char *output_path, const char *category,
int fd; int fd;
char *fname; char *fname;
fname = malloc (strlen (output_path) + strlen (category) + 6); fname = malloc (strlen (output_path) + 2 * strlen (category) + 6);
if (fname == NULL) if (fname == NULL)
error (5, errno, _("memory exhausted")); error (5, errno, _("memory exhausted"));

View File

@ -116,13 +116,13 @@ static const char *_nl_current_names[] =
/* Lock for protecting global data. */ /* Lock for protecting global data. */
__libc_lock_define_initialized (static, lock) __libc_lock_define_initialized (, __libc_setlocale_lock)
/* Use this when we come along an error. */ /* Use this when we come along an error. */
#define ERROR_RETURN \ #define ERROR_RETURN \
do { \ do { \
errno = EINVAL; \ __set_errno (EINVAL); \
return NULL; \ return NULL; \
} while (0) } while (0)
@ -314,7 +314,7 @@ setlocale (int category, const char *locale)
} }
/* Protect global data. */ /* Protect global data. */
__libc_lock_lock (lock); __libc_lock_lock (__libc_setlocale_lock);
/* Load the new data for each category. */ /* Load the new data for each category. */
while (category-- > 0) while (category-- > 0)
@ -354,7 +354,7 @@ setlocale (int category, const char *locale)
} }
/* Critical section left. */ /* Critical section left. */
__libc_lock_unlock (lock); __libc_lock_unlock (__libc_setlocale_lock);
return composite; return composite;
} }
@ -364,7 +364,7 @@ setlocale (int category, const char *locale)
char *newname = (char *) locale; char *newname = (char *) locale;
/* Protect global data. */ /* Protect global data. */
__libc_lock_lock (lock); __libc_lock_lock (__libc_setlocale_lock);
if (_nl_current[category] != NULL) if (_nl_current[category] != NULL)
{ {
@ -393,7 +393,7 @@ setlocale (int category, const char *locale)
} }
/* Critical section left. */ /* Critical section left. */
__libc_lock_unlock (lock); __libc_lock_unlock (__libc_setlocale_lock);
return newname; return newname;
} }

View File

@ -37,7 +37,7 @@ __getutid_r (const struct utmp *id, struct utmp **utmp,
&& id->ut_type != USER_PROCESS && id->ut_type != DEAD_PROCESS) && id->ut_type != USER_PROCESS && id->ut_type != DEAD_PROCESS)
/* No, using '<' and '>' for the test is not possible. */ /* No, using '<' and '>' for the test is not possible. */
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
@ -66,7 +66,7 @@ __getutid_r (const struct utmp *id, struct utmp **utmp,
!= sizeof (struct utmp)) != sizeof (struct utmp))
{ {
utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */ utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */
errno = ESRCH; __set_errno (ESRCH);
return -1; return -1;
} }
@ -89,7 +89,7 @@ __getutid_r (const struct utmp *id, struct utmp **utmp,
!= sizeof (struct utmp)) != sizeof (struct utmp))
{ {
utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */ utmp_data->loc_utmp = 0; /* Mark loc_utmp invalid. */
errno = ESRCH; __set_errno (ESRCH);
return -1; return -1;
} }
@ -110,7 +110,7 @@ __getutid_r (const struct utmp *id, struct utmp **utmp,
return 0; return 0;
#else /* !_HAVE_UT_ID && !_HAVE_UT_TYPE */ #else /* !_HAVE_UT_ID && !_HAVE_UT_TYPE */
errno = ENOSYS; __set_errno (ENOSYS);
return -1; return -1;
#endif #endif
} }

View File

@ -48,7 +48,7 @@ __getutline_r (const struct utmp *line, struct utmp **utmp,
!= sizeof (struct utmp)) != sizeof (struct utmp))
{ {
utmp_data->loc_utmp = 0; /* Mark UTMP_DATA->ubuf invalid. */ utmp_data->loc_utmp = 0; /* Mark UTMP_DATA->ubuf invalid. */
errno = ESRCH; __set_errno (ESRCH);
return -1; return -1;
} }

View File

@ -62,7 +62,7 @@ tty_name (int fd, char **tty, size_t buf_len)
if (! new_buf) if (! new_buf)
{ {
rv = -1; rv = -1;
errno = ENOMEM; __set_errno (ENOMEM);
break; break;
} }
} }

View File

@ -45,7 +45,7 @@ __pututline_r (const struct utmp *id, struct utmp_data *utmp_data)
&& id->ut_type != USER_PROCESS && id->ut_type != DEAD_PROCESS) && id->ut_type != USER_PROCESS && id->ut_type != DEAD_PROCESS)
/* No, using '<' and '>' for the test is not possible. */ /* No, using '<' and '>' for the test is not possible. */
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
#endif #endif

View File

@ -55,7 +55,7 @@ routines := brk sbrk sstk ioctl \
efgcvt efgcvt_r qefgcvt qefgcvt_r \ efgcvt efgcvt_r qefgcvt qefgcvt_r \
hsearch hsearch_r tsearch lsearch \ hsearch hsearch_r tsearch lsearch \
err error ustat \ err error ustat \
getsysstats getsysstats force-wrapper
aux := init-misc aux := init-misc
distribute := bsd-compat.c distribute := bsd-compat.c
extra-objs := bsd-compat.o extra-objs := bsd-compat.o

View File

@ -51,7 +51,7 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
if (buf == NULL) if (buf == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

25
misc/force-wrapper.c Normal file
View File

@ -0,0 +1,25 @@
/* force-wrapper - Default definition of hook for wrapper
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
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. */
/* The startup code for the reentrant version of GNU libc requires the
symbol `__libc_force_canceled_wrapper' to be defined. When
libpthread is used the symbol is defined there. Otherwise the
definition in this file is used. */
const int __libc_force_cancel_wrapper = 0;

View File

@ -70,7 +70,7 @@ hcreate_r (nel, htab)
/* Test for correct arguments. */ /* Test for correct arguments. */
if (htab == NULL) if (htab == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return 0; return 0;
} }
@ -105,7 +105,7 @@ hdestroy_r (htab)
/* Test for correct arguments. */ /* Test for correct arguments. */
if (htab == NULL) if (htab == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return; return;
} }
@ -147,7 +147,7 @@ hsearch_r (item, action, retval, htab)
error. */ error. */
if (action == ENTER && htab->filled == htab->size) if (action == ENTER && htab->filled == htab->size)
{ {
errno = ENOMEM; __set_errno (ENOMEM);
*retval = NULL; *retval = NULL;
return 0; return 0;
} }
@ -222,7 +222,7 @@ hsearch_r (item, action, retval, htab)
return 1; return 1;
} }
errno = ESRCH; __set_errno (ESRCH);
*retval = NULL; *retval = NULL;
return 0; return 0;
} }

View File

@ -34,6 +34,21 @@ Cambridge, MA 02139, USA. */
#define MOUNTED _PATH_MOUNTED /* Deprecated alias. */ #define MOUNTED _PATH_MOUNTED /* Deprecated alias. */
/* General filesystem types. */
#define MNTTYPE_IGNORE "ignore" /* Ignore this entry. */
#define MNTTYPE_NFS "nfs" /* Network file system. */
#define MNTTYPE_SWAP "swap" /* Swap device. */
/* Generic mount options. */
#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
#define MNTOPT_RO "ro" /* Read only. */
#define MNTOPT_RW "rw" /* Read/write. */
#define MNTOPT_SUID "suid" /* Set uid allowed. */
#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
__BEGIN_DECLS __BEGIN_DECLS
/* Structure describing a mount table entry. */ /* Structure describing a mount table entry. */
@ -50,10 +65,8 @@ struct mntent
/* Prepare to begin reading and/or writing mount table entries from the /* Prepare to begin reading and/or writing mount table entries from the
beginning of FILE. MODE is as for `fopen'. */ beginning of FILE. MODE is as for `fopen'. */
extern FILE *__setmntent __P ((__const char *__file, extern FILE *__setmntent __P ((__const char *__file, __const char *__mode));
__const char *__mode)); extern FILE *setmntent __P ((__const char *__file, __const char *__mode));
extern FILE *setmntent __P ((__const char *__file,
__const char *__mode));
/* Read one mount table entry from STREAM. Returns a pointer to storage /* Read one mount table entry from STREAM. Returns a pointer to storage
reused on the next call, or null for EOF or error (use feof/ferror to reused on the next call, or null for EOF or error (use feof/ferror to
@ -72,10 +85,8 @@ extern struct mntent *getmntent_r __P ((FILE *__stream,
/* Write the mount table entry described by MNT to STREAM. /* Write the mount table entry described by MNT to STREAM.
Return zero on success, nonzero on failure. */ Return zero on success, nonzero on failure. */
extern int __addmntent __P ((FILE *__stream, extern int __addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
__const struct mntent *__mnt)); extern int addmntent __P ((FILE *__stream, __const struct mntent *__mnt));
extern int addmntent __P ((FILE *__stream,
__const struct mntent *__mnt));
/* Close a stream opened with `setmntent'. */ /* Close a stream opened with `setmntent'. */
extern int __endmntent __P ((FILE *__stream)); extern int __endmntent __P ((FILE *__stream));

View File

@ -149,7 +149,7 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
break; break;
default: default:
*h_errnop = NETDB_INTERNAL; *h_errnop = NETDB_INTERNAL;
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
return NSS_STATUS_UNAVAIL; return NSS_STATUS_UNAVAIL;
} }
@ -310,13 +310,13 @@ _nss_dns_gethostbyaddr_r (const char *addr, int len, int af,
size = IN6ADDRSZ; size = IN6ADDRSZ;
break; break;
default: default:
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
*h_errnop = NETDB_INTERNAL; *h_errnop = NETDB_INTERNAL;
return NSS_STATUS_UNAVAIL; return NSS_STATUS_UNAVAIL;
} }
if (size != len) if (size != len)
{ {
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
*h_errnop = NETDB_INTERNAL; *h_errnop = NETDB_INTERNAL;
return NSS_STATUS_UNAVAIL; return NSS_STATUS_UNAVAIL;
} }

View File

@ -146,7 +146,7 @@ internal_getent (struct STRUCTURE *result,
if (buflen < (int) sizeof *data + 1) if (buflen < (int) sizeof *data + 1)
{ {
errno = ERANGE; __set_errno (ERANGE);
return NSS_STATUS_TRYAGAIN; return NSS_STATUS_TRYAGAIN;
} }

View File

@ -183,7 +183,7 @@ parse_list (char *line, struct parser_data *data, int datalen)
if ((char *) &p[1] - (char *) data > datalen) if ((char *) &p[1] - (char *) data > datalen)
{ {
/* We cannot fit another pointer in the buffer. */ /* We cannot fit another pointer in the buffer. */
errno = ERANGE; __set_errno (ERANGE);
return NULL; return NULL;
} }
if (*line == '\0') if (*line == '\0')

View File

@ -195,14 +195,14 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
break; break;
if (cmp > 0) if (cmp > 0)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
} }
if (cnt == sizeof databases) if (cnt == sizeof databases)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
@ -216,7 +216,7 @@ __nss_configure_lookup (const char *dbname, const char *service_line)
if (new_db == NULL) if (new_db == NULL)
{ {
/* Illegal service specification. */ /* Illegal service specification. */
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -34,6 +34,8 @@ endif
# Text domain name to install under; must match ../locale/SYS_libc.c string. # Text domain name to install under; must match ../locale/SYS_libc.c string.
domainname = libc domainname = libc
all: # Make this the default target; it will be defined in Rules.
# Get $(version) defined. # Get $(version) defined.
include ../Makeconfig include ../Makeconfig
-include $(common-objpfx)version.mk -include $(common-objpfx)version.mk

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stddef.h> #include <stddef.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
@ -27,24 +26,26 @@ Cambridge, MA 02139, USA. */
with the value corresponding to NAME. Return the number with the value corresponding to NAME. Return the number
of characters required to hold NAME's entire value. */ of characters required to hold NAME's entire value. */
size_t size_t
DEFUN(confstr, (name, buf, len), confstr (name, buf, len)
int name AND char *buf AND size_t len) int name;
char *buf;
size_t len;
{ {
CONST char *string; const char *string;
size_t string_len; size_t string_len;
switch (name) switch (name)
{ {
case _CS_PATH: case _CS_PATH:
{ {
static CONST char cs_path[] = CS_PATH; static const char cs_path[] = CS_PATH;
string = cs_path; string = cs_path;
string_len = sizeof (cs_path); string_len = sizeof (cs_path);
} }
break; break;
default: default:
errno = EINVAL; __set_errno (EINVAL);
return 0; return 0;
} }

View File

@ -135,7 +135,7 @@ execvp (file, argv)
if (got_eacces) if (got_eacces)
/* At least one failure was due to permissions, so report that error. */ /* At least one failure was due to permissions, so report that error. */
errno = EACCES; __set_errno (EACCES);
/* Return the error from the last attempt (probably ENOENT). */ /* Return the error from the last attempt (probably ENOENT). */
return -1; return -1;

View File

@ -72,6 +72,9 @@ Cambridge, MA 02139, USA. */
#if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS) #if !defined(__GNU_LIBRARY__) && !defined(STDC_HEADERS)
extern int errno; extern int errno;
#endif #endif
#ifndef __set_errno
#define __set_errno(val) errno = (val)
#endif
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
@ -274,7 +277,7 @@ glob (pattern, flags, errfunc, pglob)
if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0) if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
@ -880,7 +883,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
(*pglob->gl_closedir) (stream); (*pglob->gl_closedir) (stream);
else else
closedir ((DIR *) stream); closedir ((DIR *) stream);
errno = save; __set_errno (save);
} }
return nfound == 0 ? GLOB_NOMATCH : 0; return nfound == 0 ? GLOB_NOMATCH : 0;
@ -891,7 +894,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
(*pglob->gl_closedir) (stream); (*pglob->gl_closedir) (stream);
else else
closedir ((DIR *) stream); closedir ((DIR *) stream);
errno = save; __set_errno (save);
} }
while (names != NULL) while (names != NULL)
{ {
@ -903,4 +906,3 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
} }
#endif /* Not ELIDE_CODE. */ #endif /* Not ELIDE_CODE. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>
@ -26,13 +25,15 @@ Cambridge, MA 02139, USA. */
in the given buffer. This knows the format that the caller in the given buffer. This knows the format that the caller
will expect, but this need not be the format of the password file. */ will expect, but this need not be the format of the password file. */
int int
DEFUN(getpw, (uid, buf), __uid_t uid AND register char *buf) getpw (uid, buf)
__uid_t uid;
register char *buf;
{ {
register struct passwd *p; register struct passwd *p;
if (buf == NULL) if (buf == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>
@ -25,11 +24,13 @@ Cambridge, MA 02139, USA. */
/* Write an entry to the given stream. /* Write an entry to the given stream.
This must know the format of the password file. */ This must know the format of the password file. */
int int
DEFUN(putpwent, (p, stream), register CONST struct passwd *p AND FILE *stream) putpwent (p, stream)
register const struct passwd *p;
FILE *stream;
{ {
if (p == NULL || stream == NULL) if (p == NULL || stream == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -60,7 +60,7 @@ inet_net_ntop(af, src, bits, dst, size)
case AF_INET: case AF_INET:
return (inet_net_ntop_ipv4(src, bits, dst, size)); return (inet_net_ntop_ipv4(src, bits, dst, size));
default: default:
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
return (NULL); return (NULL);
} }
} }
@ -91,7 +91,7 @@ inet_net_ntop_ipv4(src, bits, dst, size)
int b; int b;
if (bits < 0 || bits > 32) { if (bits < 0 || bits > 32) {
errno = EINVAL; __set_errno (EINVAL);
return (NULL); return (NULL);
} }
if (bits == 0) { if (bits == 0) {
@ -134,6 +134,6 @@ inet_net_ntop_ipv4(src, bits, dst, size)
return (odst); return (odst);
emsgsize: emsgsize:
errno = EMSGSIZE; __set_errno (EMSGSIZE);
return (NULL); return (NULL);
} }

View File

@ -64,7 +64,7 @@ inet_net_pton(af, src, dst, size)
case AF_INET: case AF_INET:
return (inet_net_pton_ipv4(src, dst, size)); return (inet_net_pton_ipv4(src, dst, size));
default: default:
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
return (-1); return (-1);
} }
} }
@ -192,10 +192,10 @@ inet_net_pton_ipv4(src, dst, size)
return (bits); return (bits);
enoent: enoent:
errno = ENOENT; __set_errno (ENOENT);
return (-1); return (-1);
emsgsize: emsgsize:
errno = EMSGSIZE; __set_errno (EMSGSIZE);
return (-1); return (-1);
} }

View File

@ -77,6 +77,6 @@ inet_neta(src, dst, size)
return (odst); return (odst);
emsgsize: emsgsize:
errno = EMSGSIZE; __set_errno (EMSGSIZE);
return (NULL); return (NULL);
} }

View File

@ -64,7 +64,7 @@ inet_ntop(af, src, dst, size)
case AF_INET6: case AF_INET6:
return (inet_ntop6(src, dst, size)); return (inet_ntop6(src, dst, size));
default: default:
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
return (NULL); return (NULL);
} }
/* NOTREACHED */ /* NOTREACHED */
@ -91,7 +91,7 @@ inet_ntop4(src, dst, size)
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
errno = ENOSPC; __set_errno (ENOSPC);
return (NULL); return (NULL);
} }
strcpy(dst, tmp); strcpy(dst, tmp);
@ -187,7 +187,7 @@ inet_ntop6(src, dst, size)
* Check for overflow, copy, and we're done. * Check for overflow, copy, and we're done.
*/ */
if ((size_t)(tp - tmp) > size) { if ((size_t)(tp - tmp) > size) {
errno = ENOSPC; __set_errno (ENOSPC);
return (NULL); return (NULL);
} }
strcpy(dst, tmp); strcpy(dst, tmp);

View File

@ -59,7 +59,7 @@ inet_pton(af, src, dst)
case AF_INET6: case AF_INET6:
return (inet_pton6(src, dst)); return (inet_pton6(src, dst));
default: default:
errno = EAFNOSUPPORT; __set_errno (EAFNOSUPPORT);
return (-1); return (-1);
} }
/* NOTREACHED */ /* NOTREACHED */

View File

@ -192,7 +192,7 @@ res_search(name, class, type, answer, anslen)
h_errno = NETDB_INTERNAL; h_errno = NETDB_INTERNAL;
return (-1); return (-1);
} }
errno = 0; __set_errno (0);
h_errno = HOST_NOT_FOUND; /* default, if we never query */ h_errno = HOST_NOT_FOUND; /* default, if we never query */
dots = 0; dots = 0;
for (cp = name; *cp; cp++) for (cp = name; *cp; cp++)

View File

@ -144,7 +144,7 @@ static int vc = 0; /* is the socket a virtual ciruit? */
ntohs(address.sin_port), ntohs(address.sin_port),
strerror(error)); strerror(error));
} }
errno = save; __set_errno (save);
} }
static void static void
Perror(file, string, error) Perror(file, string, error)
@ -158,7 +158,7 @@ static int vc = 0; /* is the socket a virtual ciruit? */
fprintf(file, "res_send: %s: %s\n", fprintf(file, "res_send: %s: %s\n",
string, strerror(error)); string, strerror(error));
} }
errno = save; __set_errno (save);
} }
#endif #endif
@ -380,7 +380,7 @@ res_send(buf, buflen, ans, anssiz)
Perror(stderr, "socket(vc)", errno); Perror(stderr, "socket(vc)", errno);
return (-1); return (-1);
} }
errno = 0; __set_errno (0);
if (connect(s, (struct sockaddr *)nsap, if (connect(s, (struct sockaddr *)nsap,
sizeof(struct sockaddr)) < 0) { sizeof(struct sockaddr)) < 0) {
terrno = errno; terrno = errno;
@ -581,7 +581,7 @@ read_len:
(stdout, ";; new DG socket\n")) (stdout, ";; new DG socket\n"))
#endif #endif
connected = 0; connected = 0;
errno = 0; __set_errno (0);
} }
if (sendto(s, (char*)buf, buflen, 0, if (sendto(s, (char*)buf, buflen, 0,
(struct sockaddr *)nsap, (struct sockaddr *)nsap,
@ -625,7 +625,7 @@ read_len:
_res_close(); _res_close();
goto next_ns; goto next_ns;
} }
errno = 0; __set_errno (0);
fromlen = sizeof(struct sockaddr_in); fromlen = sizeof(struct sockaddr_in);
resplen = recvfrom(s, (char*)ans, anssiz, 0, resplen = recvfrom(s, (char*)ans, anssiz, 0,
(struct sockaddr *)&from, &fromlen); (struct sockaddr *)&from, &fromlen);
@ -756,11 +756,11 @@ read_len:
_res_close(); _res_close();
if (!v_circuit) if (!v_circuit)
if (!gotsomewhere) if (!gotsomewhere)
errno = ECONNREFUSED; /* no nameservers found */ __set_errno (ECONNREFUSED); /* no nameservers found */
else else
errno = ETIMEDOUT; /* no answer obtained */ __set_errno (ETIMEDOUT); /* no answer obtained */
else else
errno = terrno; __set_errno (terrno);
return (-1); return (-1);
} }

View File

@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA. */
/* Name of the lock file. */ /* Name of the lock file. */
#define PWD_LOCKFILE "/var/lock/lock.pwd" #define PWD_LOCKFILE "/etc/lock.pwd"
/* How long to wait for getting the lock before returning with an /* How long to wait for getting the lock before returning with an
error. */ error. */

View File

@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <shadow.h> #include <shadow.h>
@ -31,39 +30,39 @@ putspent (const struct spwd *p, FILE *stream)
if (fprintf (stream, "%s:%s:", p->sp_namp, p->sp_pwdp) < 0) if (fprintf (stream, "%s:%s:", p->sp_namp, p->sp_pwdp) < 0)
++errors; ++errors;
if ((p->sp_lstchg != (time_t) -1 if ((p->sp_lstchg != (long int) -1
&& fprintf (stream, "%ld:", p->sp_lstchg) < 0) && fprintf (stream, "%ld:", p->sp_lstchg) < 0)
|| (p->sp_lstchg == (time_t) -1 || (p->sp_lstchg == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;
if ((p->sp_min != (time_t) -1 if ((p->sp_min != (long int) -1
&& fprintf (stream, "%ld:", p->sp_min) < 0) && fprintf (stream, "%ld:", p->sp_min) < 0)
|| (p->sp_min == (time_t) -1 || (p->sp_min == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;
if ((p->sp_max != (time_t) -1 if ((p->sp_max != (long int) -1
&& fprintf (stream, "%ld:", p->sp_max) < 0) && fprintf (stream, "%ld:", p->sp_max) < 0)
|| (p->sp_max == (time_t) -1 || (p->sp_max == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;
if ((p->sp_warn != (time_t) -1 if ((p->sp_warn != (long int) -1
&& fprintf (stream, "%ld:", p->sp_warn) < 0) && fprintf (stream, "%ld:", p->sp_warn) < 0)
|| (p->sp_warn == (time_t) -1 || (p->sp_warn == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;
if ((p->sp_inact != (time_t) -1 if ((p->sp_inact != (long int) -1
&& fprintf (stream, "%ld:", p->sp_inact) < 0) && fprintf (stream, "%ld:", p->sp_inact) < 0)
|| (p->sp_inact == (time_t) -1 || (p->sp_inact == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;
if ((p->sp_expire != (time_t) -1 if ((p->sp_expire != (long int) -1
&& fprintf (stream, "%ld:", p->sp_expire) < 0) && fprintf (stream, "%ld:", p->sp_expire) < 0)
|| (p->sp_expire == (time_t) -1 || (p->sp_expire == (long int) -1
&& putc (':', stream) == EOF)) && putc (':', stream) == EOF))
++errors; ++errors;

View File

@ -28,34 +28,41 @@ Cambridge, MA 02139, USA. */
#define ENTNAME spent #define ENTNAME spent
struct spent_data {}; struct spent_data {};
/* Predicate which always returns false, needed below. */
#define FALSE(arg) 0
#include "../nss/nss_files/files-parse.c" #include "../nss/nss_files/files-parse.c"
LINE_PARSER LINE_PARSER
(, (,
STRING_FIELD (result->sp_namp, ISCOLON, 0); STRING_FIELD (result->sp_namp, ISCOLON, 0);
STRING_FIELD (result->sp_pwdp, ISCOLON, 0); STRING_FIELD (result->sp_pwdp, ISCOLON, 0);
INT_FIELD (result->sp_lstchg, ISCOLON, 0, 10, (time_t)); INT_FIELD (result->sp_lstchg, ISCOLON, 0, 10, (long int));
INT_FIELD (result->sp_min, ISCOLON, 0, 10, (time_t)); INT_FIELD (result->sp_min, ISCOLON, 0, 10, (long int));
INT_FIELD (result->sp_max, ISCOLON, 0, 10, (time_t)); INT_FIELD (result->sp_max, ISCOLON, 0, 10, (long int));
while (isspace (*line)) while (isspace (*line))
++line; ++line;
if (*line == '\0') if (*line == '\0')
{ {
/* The old form. */ /* The old form. */
result->sp_warn = (time_t) -1; result->sp_warn = (long int) -1;
result->sp_inact = (time_t) -1; result->sp_inact = (long int) -1;
result->sp_expire = (time_t) -1; result->sp_expire = (long int) -1;
result->sp_flag = ~0ul; result->sp_flag = ~0ul;
} }
else else
{ {
INT_FIELD_MAYBE_NULL (result->sp_warn, ISCOLON, 0, 10, (time_t), INT_FIELD_MAYBE_NULL (result->sp_warn, ISCOLON, 0, 10, (long int),
(time_t) -1); (long int) -1);
INT_FIELD_MAYBE_NULL (result->sp_inact, ISCOLON, 0, 10, (time_t), INT_FIELD_MAYBE_NULL (result->sp_inact, ISCOLON, 0, 10, (long int),
(time_t) -1); (long int) -1);
INT_FIELD_MAYBE_NULL (result->sp_expire, ISCOLON, 0, 10, (time_t), INT_FIELD_MAYBE_NULL (result->sp_expire, ISCOLON, 0, 10, (long int),
(time_t) -1); (long int) -1);
INT_FIELD_MAYBE_NULL (result->sp_flag, ISCOLON, 0, 10, if (*line != '\0')
(unsigned long int), ~0ul); INT_FIELD_MAYBE_NULL (result->sp_flag, FALSE, 0, 10,
(unsigned long int), ~0ul)
else
result->sp_flag = ~0ul;
} }
) )

View File

@ -25,8 +25,6 @@ Boston, MA 02111-1307, USA. */
#define __need_FILE #define __need_FILE
#include <stdio.h> #include <stdio.h>
#define __need_time_t
#include <time.h>
/* Paths to the userd files. */ /* Paths to the userd files. */
#define SHADOW "/etc/shadow" #define SHADOW "/etc/shadow"
@ -39,14 +37,14 @@ struct spwd
{ {
char *sp_namp; /* Login name. */ char *sp_namp; /* Login name. */
char *sp_pwdp; /* Encrypted password. */ char *sp_pwdp; /* Encrypted password. */
__time_t sp_lstchg; /* Date of last change. */ long int sp_lstchg; /* Date of last change. */
__time_t sp_min; /* Minimum number of days between changes. */ long int sp_min; /* Minimum number of days between changes. */
__time_t sp_max; /* Maximum number of days between changes. */ long int sp_max; /* Maximum number of days between changes. */
__time_t sp_warn; /* Number of days to warn user to change long int sp_warn; /* Number of days to warn user to change
the password. */ the password. */
__time_t sp_inact; /* Number of days the account may be long int sp_inact; /* Number of days the account may be
inactive. */ inactive. */
__time_t sp_expire; /* Number of days since 1970-01-01 until long int sp_expire; /* Number of days since 1970-01-01 until
account expires. */ account expires. */
unsigned long int sp_flag; /* Reserved. */ unsigned long int sp_flag; /* Reserved. */
}; };

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -20,11 +20,13 @@ Cambridge, MA 02139, USA. */
/* Add SIGNO to SET. */ /* Add SIGNO to SET. */
int int
DEFUN(sigaddset, (set, signo), sigset_t *set AND int signo) sigaddset (set, signo)
sigset_t *set;
int signo;
{ {
if (set == NULL || signo <= 0 || signo >= NSIG) if (set == NULL || signo <= 0 || signo >= NSIG)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -20,11 +20,13 @@ Cambridge, MA 02139, USA. */
/* Add SIGNO to SET. */ /* Add SIGNO to SET. */
int int
DEFUN(sigdelset, (set, signo), sigset_t *set AND int signo) sigdelset (set, signo)
sigset_t *set;
int signo;
{ {
if (set == NULL || signo <= 0 || signo >= NSIG) if (set == NULL || signo <= 0 || signo >= NSIG)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -20,11 +20,12 @@ Cambridge, MA 02139, USA. */
/* Clear all signals from SET. */ /* Clear all signals from SET. */
int int
DEFUN(sigemptyset, (set), sigset_t *set) sigemptyset (set)
sigset_t *set;
{ {
if (set == NULL) if (set == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -20,11 +20,12 @@ Cambridge, MA 02139, USA. */
/* Set all signals in SET. */ /* Set all signals in SET. */
int int
DEFUN(sigfillset, (set), sigset_t *set) sigfillset (set)
sigset_t *set;
{ {
if (set == NULL) if (set == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -20,11 +20,13 @@ Cambridge, MA 02139, USA. */
/* Return 1 if SIGNO is in SET, 0 if not. */ /* Return 1 if SIGNO is in SET, 0 if not. */
int int
DEFUN(sigismember, (set, signo), CONST sigset_t *set AND int signo) sigismember (set, signo)
const sigset_t *set;
int signo;
{ {
if (set == NULL || signo <= 0 || signo >= NSIG) if (set == NULL || signo <= 0 || signo >= NSIG)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -35,7 +35,7 @@ __register_printf_function (spec, converter, arginfo)
{ {
if (spec < 0 || spec > (int) UCHAR_MAX) if (spec < 0 || spec > (int) UCHAR_MAX)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -102,7 +102,6 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n));
} \ } \
} while (0) } while (0)
# define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED) # define UNBUFFERED_P(S) ((S)->_IO_file_flags & _IO_UNBUFFERED)
/* This macro must be without parameter! Don't change it. */
#else /* ! USE_IN_LIBIO */ #else /* ! USE_IN_LIBIO */
/* This code is for use in the GNU C library. */ /* This code is for use in the GNU C library. */
# include <stdio.h> # include <stdio.h>
@ -113,7 +112,7 @@ ssize_t __wprintf_pad __P ((FILE *, wchar_t pad, size_t n));
/* Check file argument for consistence. */ \ /* Check file argument for consistence. */ \
if (!__validfp(S) || !S->__mode.__write || Format == NULL) \ if (!__validfp(S) || !S->__mode.__write || Format == NULL) \
{ \ { \
errno = EINVAL; \ __set_errno (EINVAL); \
return -1; \ return -1; \
} \ } \
if (!S->__seen) \ if (!S->__seen) \
@ -1431,6 +1430,9 @@ struct helper_file
{ {
struct _IO_FILE_plus _f; struct _IO_FILE_plus _f;
_IO_FILE *_put_stream; _IO_FILE *_put_stream;
#ifdef _IO_MTSAFE_IO
_IO_lock_t lock;
#endif
}; };
static int static int
@ -1483,6 +1485,9 @@ buffered_vfprintf (register _IO_FILE *s, const CHAR_T *format,
hp->_IO_write_ptr = buf; hp->_IO_write_ptr = buf;
hp->_IO_write_end = buf + sizeof buf; hp->_IO_write_end = buf + sizeof buf;
hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS; hp->_IO_file_flags = _IO_MAGIC|_IO_NO_READS;
#ifdef _IO_MTSAFE_IO
hp->_lock = &helper.lock;
#endif
_IO_JUMPS (hp) = (struct _IO_jump_t *) &_IO_helper_jumps; _IO_JUMPS (hp) = (struct _IO_jump_t *) &_IO_helper_jumps;
/* Now print to helper instead. */ /* Now print to helper instead. */

View File

@ -66,7 +66,7 @@ Cambridge, MA 02139, USA. */
} while (0) } while (0)
# define memory_error() do { \ # define memory_error() do { \
_IO_funlockfile (s); \ _IO_funlockfile (s); \
errno = ENOMEM; \ __set_errno (ENOMEM); \
return EOF; \ return EOF; \
} while (0) } while (0)
# define ARGCHECK(s, format) \ # define ARGCHECK(s, format) \
@ -97,7 +97,7 @@ Cambridge, MA 02139, USA. */
} while (0) } while (0)
# define memory_error() do { \ # define memory_error() do { \
funlockfile (s); \ funlockfile (s); \
errno = ENOMEM; \ __set_errno (ENOMEM); \
return EOF; \ return EOF; \
} while (0) } while (0)
# define ARGCHECK(s, format) \ # define ARGCHECK(s, format) \
@ -106,7 +106,7 @@ Cambridge, MA 02139, USA. */
/* Check file argument for consistence. */ \ /* Check file argument for consistence. */ \
if (!__validfp (s) || !s->__mode.__read || format == NULL) \ if (!__validfp (s) || !s->__mode.__read || format == NULL) \
{ \ { \
errno = EINVAL; \ __set_errno (EINVAL); \
return EOF; \ return EOF; \
} \ } \
} while (0) } while (0)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -26,7 +25,8 @@ Cambridge, MA 02139, USA. */
/* Close a stream. */ /* Close a stream. */
int int
DEFUN(fclose, (stream), register FILE *stream) fclose (stream)
register FILE *stream;
{ {
int status; int status;
@ -42,7 +42,7 @@ DEFUN(fclose, (stream), register FILE *stream)
if (!__validfp(stream)) if (!__validfp(stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -25,13 +24,14 @@ Cambridge, MA 02139, USA. */
/* Return non-zero if STREAM has its EOF indicator set. */ /* Return non-zero if STREAM has its EOF indicator set. */
int int
DEFUN(feof, (stream), FILE *stream) feof (stream)
FILE *stream;
{ {
if (!__validfp (stream)) if (!__validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return(-1); return -1;
} }
return(stream->__eof); return stream->__eof;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -25,13 +24,14 @@ Cambridge, MA 02139, USA. */
/* Return non-zero if STREAM has its error indicator set. */ /* Return non-zero if STREAM has its error indicator set. */
int int
DEFUN(ferror, (stream), FILE *stream) ferror (stream)
FILE *stream;
{ {
if (!__validfp (stream)) if (!__validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return(-1); return -1;
} }
return(stream->__error); return stream->__error;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -24,7 +23,8 @@ Cambridge, MA 02139, USA. */
/* Flush STREAM's buffer. /* Flush STREAM's buffer.
If STREAM is NULL, flush the buffers of all streams that are writing. */ If STREAM is NULL, flush the buffers of all streams that are writing. */
int int
DEFUN(fflush, (stream), register FILE *stream) fflush (stream)
register FILE *stream;
{ {
if (stream == NULL) if (stream == NULL)
{ {
@ -37,7 +37,7 @@ DEFUN(fflush, (stream), register FILE *stream)
if (!__validfp (stream) || !stream->__mode.__write) if (!__validfp (stream) || !stream->__mode.__write)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,18 +16,18 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Read a character from STREAM. */ /* Read a character from STREAM. */
int int
DEFUN(fgetc, (stream), FILE *stream) fgetc (stream)
FILE *stream;
{ {
if (!__validfp (stream) || !stream->__mode.__read) if (!__validfp (stream) || !stream->__mode.__read)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -25,16 +24,18 @@ Cambridge, MA 02139, USA. */
/* Put the current position of STREAM in *POS. */ /* Put the current position of STREAM in *POS. */
int int
DEFUN(fgetpos, (stream, pos), FILE *stream AND fpos_t *pos) fgetpos (stream, pos)
FILE *stream;
fpos_t *pos;
{ {
if (!__validfp (stream) || pos == NULL) if (!__validfp (stream) || pos == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return(-1); return -1;
} }
*pos = ftell (stream); *pos = ftell (stream);
if (*pos < 0L) if (*pos < 0L)
return(-1); return -1;
return(0); return 0;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -28,13 +27,16 @@ Cambridge, MA 02139, USA. */
to S, the function returns NULL without appending the null character. to S, the function returns NULL without appending the null character.
If there is a file error, always return NULL. */ If there is a file error, always return NULL. */
char * char *
DEFUN(fgets, (s, n, stream), char *s AND int n AND register FILE *stream) fgets (s, n, stream)
char *s;
int n;
register FILE *stream;
{ {
register char *p = s; register char *p = s;
if (!__validfp (stream) || s == NULL || n <= 0) if (!__validfp (stream) || s == NULL || n <= 0)
{ {
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc. /* Copyright (C) 1991, 1993, 1994, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,19 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Return the system file descriptor associated with STREAM. */ /* Return the system file descriptor associated with STREAM. */
int int
DEFUN(fileno, (stream), FILE *stream) fileno (stream)
FILE *stream;
{ {
extern void __stdio_check_funcs __P ((FILE *)); extern void __stdio_check_funcs __P ((FILE *));
if (! __validfp (stream)) if (! __validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
@ -37,9 +37,9 @@ DEFUN(fileno, (stream), FILE *stream)
if (stream->__io_funcs.__fileno == NULL) if (stream->__io_funcs.__fileno == NULL)
{ {
#ifdef EOPNOTSUPP #ifdef EOPNOTSUPP
errno = EOPNOTSUPP; __set_errno (EOPNOTSUPP);
#else #else
errno = ENOSYS; __set_errno (ENOSYS);
#endif #endif
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
@ -25,7 +24,7 @@ Cambridge, MA 02139, USA. */
/* Defined in fopen.c. */ /* Defined in fopen.c. */
extern int EXFUN(__getmode, (CONST char *mode, __io_mode *mptr)); extern int __getmode __P ((const char *mode, __io_mode *mptr));
/* Open a new stream that will read and/or write from the buffer in /* Open a new stream that will read and/or write from the buffer in
S, which is of LEN bytes. If the mode indicates appending, the S, which is of LEN bytes. If the mode indicates appending, the
@ -40,8 +39,10 @@ extern int EXFUN(__getmode, (CONST char *mode, __io_mode *mptr));
to read, attempted writes always return an output error and attempted to read, attempted writes always return an output error and attempted
reads always return end-of-file. */ reads always return end-of-file. */
FILE * FILE *
DEFUN(fmemopen, (s, len, mode), fmemopen (s, len, mode)
PTR s AND size_t len AND CONST char *mode) void *s;
size_t len;
const char *mode;
{ {
__io_mode m; __io_mode m;
register FILE *stream; register FILE *stream;
@ -77,7 +78,7 @@ DEFUN(fmemopen, (s, len, mode),
{ {
int save = errno; int save = errno;
(void) fclose (stream); (void) fclose (stream);
errno = save; __set_errno (save);
return NULL; return NULL;
} }
} }
@ -102,7 +103,7 @@ DEFUN(fmemopen, (s, len, mode),
stream->__bufp = p; stream->__bufp = p;
} }
else if (stream->__mode.__truncate) else if (stream->__mode.__truncate)
memset ((PTR) stream->__buffer, 0, len); memset ((void *) stream->__buffer, 0, len);
return stream; return stream;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -24,18 +23,20 @@ Cambridge, MA 02139, USA. */
#include <string.h> #include <string.h>
#define badmode() return ((errno = EINVAL), 0) #define badmode() return ((__set_errno (EINVAL)), 0)
/* Dissect the given mode string into an __io_mode. */ /* Dissect the given mode string into an __io_mode. */
int int
DEFUN(__getmode, (mode, mptr), CONST char *mode AND __io_mode *mptr) __getmode (mode, mptr)
const char *mode;
__io_mode *mptr;
{ {
register unsigned char i; register unsigned char i;
if (mode == NULL) if (mode == NULL)
badmode (); badmode ();
memset ((PTR) mptr, 0, sizeof (*mptr)); memset ((void *) mptr, 0, sizeof (*mptr));
switch (*mode) switch (*mode)
{ {
@ -78,14 +79,16 @@ DEFUN(__getmode, (mode, mptr), CONST char *mode AND __io_mode *mptr)
/* Open a new stream on the given file. */ /* Open a new stream on the given file. */
FILE * FILE *
DEFUN(fopen, (filename, mode), CONST char *filename AND CONST char *mode) fopen (filename, mode)
const char *filename;
const char *mode;
{ {
FILE *stream; FILE *stream;
__io_mode m; __io_mode m;
if (filename == NULL) if (filename == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
@ -100,7 +103,7 @@ DEFUN(fopen, (filename, mode), CONST char *filename AND CONST char *mode)
{ {
int save = errno; int save = errno;
(void) fclose (stream); (void) fclose (stream);
errno = save; __set_errno (save);
return NULL; return NULL;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,18 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Write the character C to STREAM. */ /* Write the character C to STREAM. */
int int
DEFUN(fputc, (c, stream), int c AND FILE *stream) fputc (c, stream)
int c;
FILE *stream;
{ {
if (!__validfp (stream) || !stream->__mode.__write) if (!__validfp (stream) || !stream->__mode.__write)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -26,8 +25,11 @@ Cambridge, MA 02139, USA. */
/* Read NMEMB chunks of SIZE bytes each from STREAM into P. */ /* Read NMEMB chunks of SIZE bytes each from STREAM into P. */
size_t size_t
DEFUN(fread, (p, size, nmemb, stream), fread (p, size, nmemb, stream)
PTR p AND size_t size AND size_t nmemb AND register FILE *stream) void *p;
size_t size;
size_t nmemb;
register FILE *stream;
{ {
register char *ptr = (char *) p; register char *ptr = (char *) p;
register size_t to_read = size * nmemb; register size_t to_read = size * nmemb;
@ -35,7 +37,7 @@ DEFUN(fread, (p, size, nmemb, stream),
if (!__validfp (stream) || !stream->__mode.__read) if (!__validfp (stream) || !stream->__mode.__read)
{ {
errno = EINVAL; __set_errno (EINVAL);
return 0; return 0;
} }
if (feof (stream) || ferror (stream)) if (feof (stream) || ferror (stream))
@ -65,7 +67,7 @@ DEFUN(fread, (p, size, nmemb, stream),
copy = to_read; copy = to_read;
to_read -= copy; to_read -= copy;
if (copy > 20) if (copy > 20)
memcpy((PTR) ptr, (PTR) stream->__bufp, copy); memcpy((void *) ptr, (void *) stream->__bufp, copy);
else else
{ {
register size_t i; register size_t i;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -30,16 +29,18 @@ extern int __stdio_reopen __P ((const char *filename, __io_mode mode,
/* Replace STREAM, opening it on FILENAME. */ /* Replace STREAM, opening it on FILENAME. */
FILE * FILE *
DEFUN(freopen, (filename, mode, stream), freopen (filename, mode, stream)
CONST char *filename AND CONST char *mode AND register FILE *stream) const char *filename;
const char *mode;
register FILE *stream;
{ {
__io_mode m; __io_mode m;
PTR cookie; void *cookie;
if (!__getmode (mode, &m)) if (!__getmode (mode, &m))
{ {
(void) fclose (stream); (void) fclose (stream);
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
@ -56,7 +57,7 @@ DEFUN(freopen, (filename, mode, stream),
{ {
int save = errno; int save = errno;
(void) fclose (stream); (void) fclose (stream);
errno = save; __set_errno (save);
return NULL; return NULL;
} }

View File

@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -26,14 +25,16 @@ Cambridge, MA 02139, USA. */
is SEEK_SET, the end of the file is it is SEEK_END, is SEEK_SET, the end of the file is it is SEEK_END,
or the current position if it is SEEK_CUR. */ or the current position if it is SEEK_CUR. */
int int
DEFUN(fseek, (stream, offset, whence), fseek (stream, offset, whence)
register FILE *stream AND long int offset AND int whence) register FILE *stream;
long int offset;
int whence;
{ {
long int o; long int o;
if (!__validfp (stream)) if (!__validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
@ -63,7 +64,7 @@ DEFUN(fseek, (stream, offset, whence),
switch (whence) switch (whence)
{ {
default: default:
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
case SEEK_END: case SEEK_END:
@ -72,7 +73,7 @@ DEFUN(fseek, (stream, offset, whence),
for, and then look where that is. */ for, and then look where that is. */
if (stream->__io_funcs.__seek == NULL) if (stream->__io_funcs.__seek == NULL)
{ {
errno = ESPIPE; __set_errno (ESPIPE);
return EOF; return EOF;
} }
else else
@ -144,7 +145,7 @@ DEFUN(fseek, (stream, offset, whence),
if (o < 0) if (o < 0)
{ {
/* Negative file position is meaningless. */ /* Negative file position is meaningless. */
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
@ -167,7 +168,7 @@ DEFUN(fseek, (stream, offset, whence),
But it makes more sense for fseek to to fail with ESPIPE But it makes more sense for fseek to to fail with ESPIPE
than for the next reading or writing operation to fail than for the next reading or writing operation to fail
that way. */ that way. */
errno = ESPIPE; __set_errno (ESPIPE);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc. /* Copyright (C) 1991, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -25,11 +24,13 @@ Cambridge, MA 02139, USA. */
/* Set the file position of STREAM to *POS. */ /* Set the file position of STREAM to *POS. */
int int
DEFUN(fsetpos, (stream, pos), FILE *stream AND CONST fpos_t *pos) fsetpos (stream, pos)
FILE *stream;
const fpos_t *pos;
{ {
if (pos == NULL) if (pos == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1994, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,20 +16,20 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Return the offset in bytes from the beginning /* Return the offset in bytes from the beginning
of the file of the file position of STREAM. */ of the file of the file position of STREAM. */
long int long int
DEFUN(ftell, (stream), FILE *stream) ftell (stream)
FILE *stream;
{ {
long int pos; long int pos;
if (!__validfp (stream)) if (!__validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1L; return -1L;
} }

View File

@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -24,11 +23,13 @@ Cambridge, MA 02139, USA. */
/* Write NMEMB chunks of SIZE bytes each from PTR onto STREAM. */ /* Write NMEMB chunks of SIZE bytes each from PTR onto STREAM. */
size_t size_t
DEFUN(fwrite, (ptr, size, nmemb, stream), fwrite (ptr, size, nmemb, stream)
CONST PTR ptr AND size_t size AND const void *ptr;
size_t nmemb AND register FILE *stream) size_t size;
size_t nmemb;
register FILE *stream;
{ {
register CONST unsigned char *p = (CONST unsigned char *) ptr; register const unsigned char *p = (const unsigned char *) ptr;
register size_t to_write = size * nmemb; register size_t to_write = size * nmemb;
register size_t written = 0; register size_t written = 0;
int newlinep; int newlinep;
@ -37,7 +38,7 @@ DEFUN(fwrite, (ptr, size, nmemb, stream),
if (!__validfp (stream) || !stream->__mode.__write) if (!__validfp (stream) || !stream->__mode.__write)
{ {
errno = EINVAL; __set_errno (EINVAL);
return 0; return 0;
} }
@ -71,7 +72,7 @@ DEFUN(fwrite, (ptr, size, nmemb, stream),
goto done; goto done;
} }
errno = save; __set_errno (save);
} }
if (stream->__buffer == NULL && default_func && if (stream->__buffer == NULL && default_func &&
@ -82,7 +83,7 @@ DEFUN(fwrite, (ptr, size, nmemb, stream),
{ {
int count = (stream->__io_funcs.__write == NULL ? to_write : int count = (stream->__io_funcs.__write == NULL ? to_write :
(*stream->__io_funcs.__write) (stream->__cookie, (*stream->__io_funcs.__write) (stream->__cookie,
(CONST char *) p, (const char *) p,
to_write)); to_write));
if (count > 0) if (count > 0)
{ {
@ -105,7 +106,7 @@ DEFUN(fwrite, (ptr, size, nmemb, stream),
buffer_space = stream->__bufsize - (stream->__bufp - stream->__buffer); buffer_space = stream->__bufsize - (stream->__bufp - stream->__buffer);
newlinep = (stream->__linebuf && newlinep = (stream->__linebuf &&
memchr ((CONST PTR) p, '\n', to_write) != NULL); memchr ((const void *) p, '\n', to_write) != NULL);
if (newlinep && stream->__bufp == stream->__buffer && if (newlinep && stream->__bufp == stream->__buffer &&
stream->__offset == stream->__target) stream->__offset == stream->__target)
@ -148,7 +149,7 @@ DEFUN(fwrite, (ptr, size, nmemb, stream),
*stream->__bufp++ = *p++; *stream->__bufp++ = *p++;
else else
{ {
memcpy ((PTR) stream->__bufp, (PTR) p, n); memcpy ((void *) stream->__bufp, (void *) p, n);
stream->__bufp += n; stream->__bufp += n;
p += n; p += n;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -31,15 +30,18 @@ Cambridge, MA 02139, USA. */
null terminator), or -1 on error or EOF. */ null terminator), or -1 on error or EOF. */
ssize_t ssize_t
DEFUN(__getdelim, (lineptr, n, terminator, stream), __getdelim (lineptr, n, terminator, stream)
char **lineptr AND size_t *n AND int terminator AND FILE *stream) char **lineptr;
size_t *n;
int terminator;
FILE *stream;
{ {
char *line, *p; char *line, *p;
size_t size, copy; size_t size, copy;
if (!__validfp (stream) || lineptr == NULL || n == NULL) if (!__validfp (stream) || lineptr == NULL || n == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@ -27,7 +26,8 @@ link_warning (gets,
/* Read a newline-terminated string from stdin into S, /* Read a newline-terminated string from stdin into S,
removing the trailing newline. Return S or NULL. */ removing the trailing newline. Return S or NULL. */
char * char *
DEFUN(gets, (s), char *s) gets (s)
char *s;
{ {
register char *p = s; register char *p = s;
register int c; register int c;
@ -35,7 +35,7 @@ DEFUN(gets, (s), char *s)
if (!__validfp (stream) || p == NULL) if (!__validfp (stream) || p == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -27,7 +27,6 @@ Cambridge, MA 02139, USA. */
libraries) compiled with Unix header files to work with the GNU C libraries) compiled with Unix header files to work with the GNU C
library. */ library. */
#include <ansidecl.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
@ -74,7 +73,8 @@ unix_FILE _iob[] =
In a Unix stdio FILE `_cnt' is the first element. In a Unix stdio FILE `_cnt' is the first element.
In a GNU stdio or glued FILE, the first element is the magic number. */ In a GNU stdio or glued FILE, the first element is the magic number. */
int int
DEFUN(_filbuf, (file), unix_FILE *file) _filbuf (file)
unix_FILE *file;
{ {
switch (++file->glue.magic) /* Compensate for Unix getc's decrement. */ switch (++file->glue.magic) /* Compensate for Unix getc's decrement. */
{ {
@ -88,15 +88,16 @@ DEFUN(_filbuf, (file), unix_FILE *file)
default: default:
/* Bogus stream. */ /* Bogus stream. */
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
} }
/* Called by the Unix stdio `putc' macro. Much like getc, above. */ /* Called by the Unix stdio `putc' macro. Much like getc, above. */
int int
DEFUN(_flsbuf, (c, file), _flsbuf (c, file)
int c AND unix_FILE *file) int c;
unix_FILE *file;
{ {
/* Compensate for putc's decrement. */ /* Compensate for putc's decrement. */
switch (++file->glue.magic) switch (++file->glue.magic)
@ -108,7 +109,7 @@ DEFUN(_flsbuf, (c, file),
return putc (c, (FILE *) file); return putc (c, (FILE *) file);
default: default:
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
} }

View File

@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -25,7 +24,8 @@ Cambridge, MA 02139, USA. */
/* Make sure that FP has its functions set. */ /* Make sure that FP has its functions set. */
void void
DEFUN(__stdio_check_funcs, (fp), register FILE *fp) __stdio_check_funcs (fp)
register FILE *fp;
{ {
if (!fp->__seen) if (!fp->__seen)
{ {
@ -34,7 +34,7 @@ DEFUN(__stdio_check_funcs, (fp), register FILE *fp)
If no buffer is set (and the stream is not made explicitly If no buffer is set (and the stream is not made explicitly
unbuffered), we allocate a buffer below, using the bufsize unbuffered), we allocate a buffer below, using the bufsize
set by this function. */ set by this function. */
extern void EXFUN(__stdio_init_stream, (FILE *)); extern void __stdio_init_stream __P ((FILE *));
fp->__room_funcs = __default_room_functions; fp->__room_funcs = __default_room_functions;
fp->__io_funcs = __default_io_functions; fp->__io_funcs = __default_io_functions;
__stdio_init_stream (fp); __stdio_init_stream (fp);
@ -51,7 +51,8 @@ DEFUN(__stdio_check_funcs, (fp), register FILE *fp)
/* Figure out what kind of buffering (none, line, or full) /* Figure out what kind of buffering (none, line, or full)
and what buffer size to give FP. */ and what buffer size to give FP. */
static void static void
DEFUN(init_stream, (fp), register FILE *fp) init_stream (fp)
register FILE *fp;
{ {
__stdio_check_funcs (fp); __stdio_check_funcs (fp);
@ -75,7 +76,7 @@ DEFUN(init_stream, (fp), register FILE *fp)
else else
break; break;
} }
errno = save; __set_errno (save);
if (fp->__buffer == NULL) if (fp->__buffer == NULL)
{ {
@ -96,7 +97,8 @@ DEFUN(init_stream, (fp), register FILE *fp)
/* Determine the current file position of STREAM if it is unknown. */ /* Determine the current file position of STREAM if it is unknown. */
int int
DEFUN(__stdio_check_offset, (stream), FILE *stream) __stdio_check_offset (stream)
FILE *stream;
{ {
init_stream (stream); init_stream (stream);
@ -106,7 +108,7 @@ DEFUN(__stdio_check_offset, (stream), FILE *stream)
if (stream->__io_funcs.__seek == NULL) if (stream->__io_funcs.__seek == NULL)
{ {
/* Unknowable. */ /* Unknowable. */
errno = ESPIPE; __set_errno (ESPIPE);
return EOF; return EOF;
} }
else else
@ -139,13 +141,14 @@ DEFUN(__stdio_check_offset, (stream), FILE *stream)
seeking as necessary and updating its `offset' field. seeking as necessary and updating its `offset' field.
Sets ferror(FP) (and possibly errno) for errors. */ Sets ferror(FP) (and possibly errno) for errors. */
static void static void
DEFUN(seek_to_target, (fp), FILE *fp) seek_to_target (fp)
FILE *fp;
{ {
int save = errno; int save = errno;
if (__stdio_check_offset (fp) == EOF) if (__stdio_check_offset (fp) == EOF)
{ {
if (errno == ESPIPE) if (errno == ESPIPE)
errno = save; __set_errno (save);
else else
fp->__error = 1; fp->__error = 1;
} }
@ -156,7 +159,7 @@ DEFUN(seek_to_target, (fp), FILE *fp)
if (fp->__io_funcs.__seek == NULL) if (fp->__io_funcs.__seek == NULL)
{ {
/* We can't seek! */ /* We can't seek! */
errno = ESPIPE; __set_errno (ESPIPE);
fp->__error = 1; fp->__error = 1;
} }
else else
@ -175,10 +178,10 @@ DEFUN(seek_to_target, (fp), FILE *fp)
#ifdef EGRATUITOUS #ifdef EGRATUITOUS
/* It happens in the Hurd when the io server doesn't /* It happens in the Hurd when the io server doesn't
obey the protocol for io_seek. */ obey the protocol for io_seek. */
errno = EGRATUITOUS; __set_errno (EGRATUITOUS);
#else #else
/* I don't think this can happen in Unix. */ /* I don't think this can happen in Unix. */
errno = ESPIPE; /* ??? */ __set_errno (ESPIPE); /* ??? */
#endif #endif
fp->__error = 1; fp->__error = 1;
} }
@ -194,8 +197,9 @@ DEFUN(seek_to_target, (fp), FILE *fp)
flushed to avoid a system call for a single character. flushed to avoid a system call for a single character.
This is the default `output room' function. */ This is the default `output room' function. */
static void static void
DEFUN(flushbuf, (fp, c), flushbuf (fp, c)
register FILE *fp AND int c) register FILE *fp;
int c;
{ {
int flush_only = c == EOF; int flush_only = c == EOF;
size_t buffer_written; size_t buffer_written;
@ -223,16 +227,16 @@ DEFUN(flushbuf, (fp, c),
!fp->__mode.__append) !fp->__mode.__append)
{ {
int save = errno; int save = errno;
CONST int aligned = (fp->__buffer == NULL || const int aligned = (fp->__buffer == NULL ||
__stdio_check_offset (fp) == EOF || __stdio_check_offset (fp) == EOF ||
fp->__target % fp->__bufsize == 0); fp->__target % fp->__bufsize == 0);
errno = save; __set_errno (save);
if (!aligned) if (!aligned)
{ {
/* Move to a block (buffer size) boundary and read in a block. /* Move to a block (buffer size) boundary and read in a block.
Then the output will be written as a whole block, too. */ Then the output will be written as a whole block, too. */
CONST size_t o = fp->__target % fp->__bufsize; const size_t o = fp->__target % fp->__bufsize;
fp->__target -= o; fp->__target -= o;
if ((*fp->__room_funcs.__input) (fp) == EOF && ferror (fp)) if ((*fp->__room_funcs.__input) (fp) == EOF && ferror (fp))
return; return;
@ -390,7 +394,8 @@ DEFUN(flushbuf, (fp, c),
/* Fill the buffer for FP and return the first character read (or EOF). /* Fill the buffer for FP and return the first character read (or EOF).
This is the default `input_room' function. */ This is the default `input_room' function. */
static int static int
DEFUN(fillbuf, (fp), register FILE *fp) fillbuf (fp)
register FILE *fp;
{ {
/* How far into the buffer we read we want to start bufp. */ /* How far into the buffer we read we want to start bufp. */
size_t buffer_offset = 0; size_t buffer_offset = 0;
@ -435,7 +440,7 @@ DEFUN(fillbuf, (fp), register FILE *fp)
} }
seek_to_target (fp); seek_to_target (fp);
} }
errno = save; __set_errno (save);
} }
while (!ferror (fp) && !feof (fp) && nread <= buffer_offset) while (!ferror (fp) && !feof (fp) && nread <= buffer_offset)
@ -494,12 +499,12 @@ extern __io_write_fn __stdio_write;
extern __io_seek_fn __stdio_seek; extern __io_seek_fn __stdio_seek;
extern __io_close_fn __stdio_close; extern __io_close_fn __stdio_close;
extern __io_fileno_fn __stdio_fileno; extern __io_fileno_fn __stdio_fileno;
CONST __io_functions __default_io_functions = const __io_functions __default_io_functions =
{ {
__stdio_read, __stdio_write, __stdio_seek, __stdio_close, __stdio_fileno __stdio_read, __stdio_write, __stdio_seek, __stdio_close, __stdio_fileno
}; };
CONST __room_functions __default_room_functions = const __room_functions __default_room_functions =
{ {
fillbuf, flushbuf fillbuf, flushbuf
}; };
@ -508,14 +513,15 @@ CONST __room_functions __default_room_functions =
/* Flush the buffer for FP and also write C if FLUSH_ONLY is nonzero. /* Flush the buffer for FP and also write C if FLUSH_ONLY is nonzero.
This is the function used by putc and fflush. */ This is the function used by putc and fflush. */
int int
DEFUN(__flshfp, (fp, c), __flshfp (fp, c)
register FILE *fp AND int c) register FILE *fp;
int c;
{ {
int flush_only = c == EOF; int flush_only = c == EOF;
if (!__validfp (fp) || !fp->__mode.__write) if (!__validfp (fp) || !fp->__mode.__write)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
@ -589,14 +595,15 @@ DEFUN(__flshfp, (fp, c),
/* Fill the buffer for FP and return the first character read. /* Fill the buffer for FP and return the first character read.
This is the function used by getc. */ This is the function used by getc. */
int int
DEFUN(__fillbf, (fp), register FILE *fp) __fillbf (fp)
register FILE *fp;
{ {
register int c; register int c;
fpos_t new_target; fpos_t new_target;
if (!__validfp (fp) || !fp->__mode.__read) if (!__validfp (fp) || !fp->__mode.__read)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
@ -673,13 +680,14 @@ DEFUN(__fillbf, (fp), register FILE *fp)
/* Nuke a stream, but don't kill its link in the chain. */ /* Nuke a stream, but don't kill its link in the chain. */
void void
DEFUN(__invalidate, (stream), register FILE *stream) __invalidate (stream)
register FILE *stream;
{ {
/* Save its link. */ /* Save its link. */
register FILE *next = stream->__next; register FILE *next = stream->__next;
/* Pulverize the fucker. */ /* Pulverize the fucker. */
memset((PTR) stream, 0, sizeof(FILE)); memset((void *) stream, 0, sizeof(FILE));
/* Restore the deceased's link. */ /* Restore the deceased's link. */
stream->__next = next; stream->__next = next;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -30,8 +29,9 @@ struct memstream_info
/* Enlarge STREAM's buffer. */ /* Enlarge STREAM's buffer. */
static void static void
DEFUN(enlarge_buffer, (stream, c), enlarge_buffer (stream, c)
register FILE *stream AND int c) register FILE *stream;
int c;
{ {
struct memstream_info *info = (struct memstream_info *) stream->__cookie; struct memstream_info *info = (struct memstream_info *) stream->__cookie;
size_t need; size_t need;
@ -64,7 +64,7 @@ DEFUN(enlarge_buffer, (stream, c),
newsize = need; newsize = need;
else else
newsize = stream->__bufsize * 2; newsize = stream->__bufsize * 2;
newbuf = (char *) realloc ((PTR) stream->__buffer, newsize); newbuf = (char *) realloc ((void *) stream->__buffer, newsize);
if (newbuf == NULL) if (newbuf == NULL)
{ {
stream->__error = 1; stream->__error = 1;
@ -82,7 +82,7 @@ DEFUN(enlarge_buffer, (stream, c),
if (need > 0) if (need > 0)
{ {
/* We are extending the buffer after an fseek; zero-fill new space. */ /* We are extending the buffer after an fseek; zero-fill new space. */
bzero (stream->__bufp, need); memset (stream->__bufp, '\0', need);
stream->__bufp += need; stream->__bufp += need;
} }
@ -96,8 +96,10 @@ DEFUN(enlarge_buffer, (stream, c),
There is no external state to munge. */ There is no external state to munge. */
static int static int
DEFUN(seek, (cookie, pos, whence), seek (cookie, pos, whence)
PTR cookie AND fpos_t *pos AND int whence) void *cookie;
fpos_t *pos;
int whence;
{ {
switch (whence) switch (whence)
{ {
@ -118,7 +120,8 @@ DEFUN(seek, (cookie, pos, whence),
} }
static int static int
DEFUN(free_info, (cookie), PTR cookie) free_info (cookie)
void *cookie;
{ {
#if 0 #if 0
struct memstream_info *info = (struct memstream_info *) cookie; struct memstream_info *info = (struct memstream_info *) cookie;
@ -138,15 +141,16 @@ DEFUN(free_info, (cookie), PTR cookie)
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
and the number of characters written on fflush or fclose. */ and the number of characters written on fflush or fclose. */
FILE * FILE *
DEFUN(open_memstream, (bufloc, sizeloc), open_memstream (bufloc, sizeloc)
char **bufloc AND size_t *sizeloc) char **bufloc;
size_t *sizeloc;
{ {
FILE *stream; FILE *stream;
struct memstream_info *info; struct memstream_info *info;
if (bufloc == NULL || sizeloc == NULL) if (bufloc == NULL || sizeloc == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
@ -159,14 +163,14 @@ DEFUN(open_memstream, (bufloc, sizeloc),
{ {
int save = errno; int save = errno;
(void) fclose (stream); (void) fclose (stream);
errno = save; __set_errno (save);
return NULL; return NULL;
} }
stream->__room_funcs.__output = enlarge_buffer; stream->__room_funcs.__output = enlarge_buffer;
stream->__io_funcs.__seek = seek; stream->__io_funcs.__seek = seek;
stream->__io_funcs.__close = free_info; stream->__io_funcs.__close = free_info;
stream->__cookie = (PTR) info; stream->__cookie = (void *) info;
stream->__userbuf = 1; stream->__userbuf = 1;
info->buffer = bufloc; info->buffer = bufloc;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1993, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -27,12 +26,15 @@ Cambridge, MA 02139, USA. */
If MODE indicates full or line buffering, use BUF, If MODE indicates full or line buffering, use BUF,
a buffer of SIZE bytes; if BUF is NULL, malloc a buffer. */ a buffer of SIZE bytes; if BUF is NULL, malloc a buffer. */
int int
DEFUN(setvbuf, (stream, buf, mode, size), setvbuf (stream, buf, mode, size)
FILE *stream AND char *buf AND int mode AND size_t size) FILE *stream;
char *buf;
int mode;
size_t size;
{ {
if (!__validfp (stream)) if (!__validfp (stream))
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
@ -53,7 +55,7 @@ DEFUN(setvbuf, (stream, buf, mode, size),
switch (mode) switch (mode)
{ {
default: default:
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
case _IONBF: /* Unbuffered. */ case _IONBF: /* Unbuffered. */
stream->__buffer = NULL; stream->__buffer = NULL;
@ -65,7 +67,7 @@ DEFUN(setvbuf, (stream, buf, mode, size),
case _IOFBF: /* Fully buffered. */ case _IOFBF: /* Fully buffered. */
if (size == 0) if (size == 0)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }
stream->__bufsize = size; stream->__bufsize = size;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993 Free Software Foundation, Inc. /* Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,18 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
/* Push the character C back onto the input stream of STREAM. */ /* Push the character C back onto the input stream of STREAM. */
int int
DEFUN(ungetc, (c, stream), register int c AND register FILE *stream) ungetc (c, stream)
register int c;
register FILE *stream;
{ {
if (!__validfp (stream) || !stream->__mode.__read) if (!__validfp (stream) || !stream->__mode.__read)
{ {
errno = EINVAL; __set_errno (EINVAL);
return EOF; return EOF;
} }

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. /* Copyright (C) 1991, 1992, 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave, not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -28,18 +27,20 @@ Cambridge, MA 02139, USA. */
/* Read formatted input from S according to the format /* Read formatted input from S according to the format
string FORMAT, using the argument list in ARG. */ string FORMAT, using the argument list in ARG. */
int int
DEFUN(__vsscanf, (s, format, arg), __vsscanf (s, format, arg)
CONST char *s AND CONST char *format AND va_list arg) const char *s;
const char *format;
va_list arg;
{ {
FILE f; FILE f;
if (s == NULL) if (s == NULL)
{ {
errno = EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
memset((PTR) &f, 0, sizeof(f)); memset ((void *) &f, 0, sizeof (f));
f.__magic = _IOMAGIC; f.__magic = _IOMAGIC;
f.__mode.__read = 1; f.__mode.__read = 1;
f.__bufp = f.__buffer = (char *) s; f.__bufp = f.__buffer = (char *) s;

Some files were not shown because too many files have changed in this diff Show More