These are unidiffs between versions 1.01 and 1.02 of the GNU C library. You will need the GNU version of patch to apply these diffs. Some files are moved or deleted between version 1.01 and version 1.02. In the diffs, a moved or deleted file is represented by a patch to make that file empty. The empty files that result from applying the patches normally may cause problems, so they should be removed. You can do this with the -E option to GNU patch if you have version 2.0.12u6 or later; or by running a `find' command in the library source directory, like this: find . -size 0 -exec rm {} \; diff -Nru glibc-1.01/ChangeLog glibc-1.02/ChangeLog --- glibc-1.01/ChangeLog Wed Mar 11 20:14:23 1992 +++ glibc-1.02/ChangeLog Fri Mar 20 21:47:17 1992 @@ -1,3 +1,210 @@ +Fri Mar 20 00:35:36 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Version 1.02. + + * stdio/Makefile (routines): Add __getdelim, __getline. + + * sysdeps/unix/i386/start.c: No ../ in #include file name. + + * sysdeps/posix/sysd-stdio.c, sysdeps/stub/sysd-stdio.c + (__stdio_seek): Doc fix. + + * sysdeps/posix/mk-stdiolim.c: Add one to L_tmpnam, for the null + terminator. + + * sysdeps/posix/__dup2.c: Use an extra fcntl call to check that the + first fd is valid. Close the second fd before doing the dup. + + * pwd/pwdread.c, grp/grpread.c: Use __getline. Ignore lines + beginning with #. + + * Makeconfig (objdir): If $(ARCH) starts with a slash, don't prepend + $(..). + +Thu Mar 19 21:36:57 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Makefile (install-lib): Add Mcrt1.o. + (Mcrt1.o): Create empty file. + +Wed Mar 18 16:00:18 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * Makeconfig (+link): Use $(libdir) for gnulib. + +Tue Mar 17 20:12:35 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * math/bsd/common_source/mathimpl.h: Include . + [__LITTLE_ENDIAN]: #define national. + + * /home/gd2/gnu/libc/stdio/__vfscanf.c: EOF at end of string is not + an error. + + * stdio/tstscanf.c: Added new sscanf test. + + * stdio/vfprintf.c: For %#x, print 0x after padding 0s, not before. + + * stdio/fputs.c: Reverse size args to fwrite and test for returning + LEN, rather than 1, so 0-length wins. + + * io/gnu/fcntl.h: Moved to sysdeps/unix/bsd/fcntlbits.h. + * io/Makefile (headers), io/fcntl.h: gnu/fcntl.h -> fcntlbits.h. + * sysdeps/stub/fcntlbits.h, sysdeps/unix/sysv/fcntlbits.h: New. + + * stdio/fopen.c (__getmode): Don't fall through in switch after 'a' + case. + + * locale/C-ctype_ct.c (__ctype_b_C): Use symbolic constants. + 9..12 are not _NOgraph. + +Tue Mar 17 19:04:01 1992 Torbjorn Granlund (tege@hal.gnu.ai.mit.edu) + + * string/testcopy.c: Fix typo in comment. + +Tue Mar 17 19:57:49 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * sysdeps/generic/strstr.c, string/string.h, string/tester.c + (strstr): Arguments were reversed. + +Tue Mar 17 18:52:39 1992 Torbjorn Granlund (tege@hal.gnu.ai.mit.edu) + + * sysdeps/i386/memcopy.h (WORD_COPY_BWD): Divide nbytes by 4. + * sysdeps/i386/memchr.c: Rewrite. Handle zero length correctly. + Don't ask gcc to allocate eax to two regs. + +Tue Mar 17 17:31:06 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * posix/unistd.h (getpagesize): Declare as size_t. + + * Makeconfig (CC): Define unless origin is default. + + * stdio/__getdelim.c: Be sure to leave room for the terminating null. + + * string/testcopy.c: New version from tege. + + * malloc/dist-README: Changed mailing list addr to bug-glibc. + + * sysdeps/unix/bsd/__sigproc.c: Use right mask for SIG_UNBLOCK. + + * Makefile, Rules (clean, mostlyclean): Put - before rm commands. + +Tue Mar 17 11:14:40 1992 Torbjorn Granlund (tege@hal.gnu.ai.mit.edu) + + * sysdeps/rs6000/memcopy.h (BYTE_COPY_BWD): Assign __nbytes. + * sysdeps/m68k/memcopy.h (WORD_COPY_BWD): Copy memory, not just + pointers. Clean up switch expression. + +Mon Mar 16 05:09:23 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * posix/wordexp.c: New. + + * time/tzfile.c (__tzfile_read): Don't die if some of the sections + of the datafile are empty. + + * stdio/getline.c, stdio/getdelim.c: Moved to + __getline.c/__getdelim.c. + New files with fn aliases. + * stdio/stdio.h (__getline, __getdelim): Declare. + + * time/Makefile (zonenames): Hair to find the names of zones + described by $(tzfiles). + (install-data): Install zoneinfo/$(zonenames). + Rules to make zones from tzfiles. + [localtime] (zoneinfo/localtime): Make from zoneinfo/$(localtime). + * Makeconfig (localtime): New user-frobbable variable. + +Sun Mar 15 00:01:05 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu) + + * sysdeps/unix/bsd/Makefile, sysdeps/unix/Makefile: In rules to + compile generator programs, cd into $(objdir) first to avoid + braindead cc clobbering foo.o in cwdir. + + * Makerules (sysdep-Makefile): Do if ... else true to avoid bogus + nonzero status. + + * Makefile: Denewlinify +sysdep-subdirs after including sysd-dirs. + + * sysdeps/vax/__infnan.c [!__GNUC__]: Error. + + * zic.c, scheck.c, emkdir.c, ialloc.c, private.h, tzfile.h: Snarfed + from localtime3 dist. + * time/Makefile (others): Added zic. + (distribute): Added private.h, emkdir.c, ialloc.c, scheck.c. + (install): Defined: zic, zdump. + + * Makeconfig (bindir): Define. + * Makerules: Add rule to install $(install) in $(bindir). + (+install): Include $(install) in $(bindir). + + * sysdeps/unix/Makefile: Moved siglist.c rules to unix/bsd/Makefile. + * sysdeps/unix/make_siglist.c: Moved to bsd/. + * sysdeps/unix/Dist: Remove it. + * sysdeps/unix/bsd/Dist: Add it. + + * malloc/Makefile (malloc/gmalloc.c): Depend on headers and sources. + + * sysdeps/unix/bsd/sun/sun4/__sigvec.S: Doc fix. + + * sysdeps/stub/stty.c, sysdeps/stub/gtty.c: Include . + + * sysdeps/unix/sysv/__fstat.c: Include sysv_stat.h. + + * misc/bsd-compat.c: Define _BSD_SOURCE rather than __FAVOR_BSD. + (longjmp): Use function_alias_void. + + * time/Makefile (tzfile.o): Compile with + -DTZDIR='"$(datadir)/zoneinfo"'.d + +Sat Mar 14 23:26:46 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu) + + * Makeconfig (INSTALL_DATA, INSTALL_PROGRAM, INSTALL): Don't define + if already defined. + + * setjmp/longjmp.c: Use function_alias_void. + + * gnu-stabs.h (function_alias_void): New macro. + + * gnu-stabs.h [!HAVE_GNU_LD] (function_alias): Fixed not to loop. + +Fri Mar 13 17:20:19 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu) + + * sysdeps/posix/sysd-stdio.c (__stdio_gen_tempname): Include null + terminator in length calculation. + + * stdio/fgets.c: Be sure to return NULL on error/eof for unbuffered + stream. If N==1, don't write the first char if !seen. + When the buffer is empty, notice the effect of __fillbf after + calling it, avoiding a (costly) no-op iteration. + Don't return NULL for reading no chars; only for EOF or error. + Don't write terminator at beginning of S if eof on first char. + + * malloc/Makefile (libmcheck.a), Makefile (crt0.o): Remove target + first; don't use -f to ln. + + * posix/execl.c, posix/execv.c, sysdeps/posix/getenv.c, + sysdeps/posix/system.c [HAVE_GNU_LD]: #define __environ environ + + * posix/unistd.h [__OPTIMIZE__] (execv): Removed defn. Can't know + whether to use __environ or environ. + + * io/fchown.c, io/chown.c, io/open.c, misc/select.c, + signal/sigvec.c, time/adjtime.c: Fixed DEFUNs in fn aliases. + + * time/__tzset.c: Don't dereference NULL if getenv returns it. + +Thu Mar 12 16:01:33 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * sysdeps/ieee754/sqrt.c: Replaced undefined var ref `k' with constant. + + * sysdeps/i386/__longjmp.c: #include . + + * time/tzfile.c (__tzfile_compute): Use types[0] if TIMER falls + between transitions[0] and transitions[1]. + Always set __tzname[INFO->isdst] to the name for INFO. + + * sysdeps/i386/__longjmp.c: Changed register names for gcc; eax/%eax + -> ax. + + * sysdeps/unix/snarf-ioctls: Avoid infinite recursion. + Wed Mar 11 00:16:18 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) * Version 1.01. diff -Nru glibc-1.01/INSTALL glibc-1.02/INSTALL --- glibc-1.01/INSTALL Wed Mar 11 20:19:39 1992 +++ glibc-1.02/INSTALL Fri Mar 20 19:47:33 1992 @@ -102,6 +102,282 @@ report those as well. +Porting the GNU C Library +========================== + + The GNU C library is written to be easily portable to a variety of +machines and operating systems. Machine- and operating +system-dependent functions are well separated to make it easy to add +implementations for new machines or operating systems. This section +describes the layout of the library source tree and explains the +mechanisms used to select machine-dependent code to use. + + The process of building the library is driven by the makefiles, +which make heavy use of GNU `make' features. The makefiles are very +complex, and you probably don't want to try to understand them. But +what they do is fairly straightforward, and only requires that you +define a few variables in the right places. + + The library sources are divided into subdirectories, grouped by +topic. The `string' subdirectory has all the string-manipulation +functions, `stdio' has all the standard I/O functions, etc. + + Each subdirectory contains a simple makefile, called `Makefile', +which defines a few `make' variables and then includes the global +makefile `Rules' with a line like: + + include ../Rules + +The basic variables that a subdirectory makefile defines are: + +`subdir' + The name of the subdirectory, for example `stdio'. This variable + *must* be defined. + +`headers' + The names of the header files in this section of the library, + such as `stdio.h'. + +`routines' +`aux' + The names of the modules (source files) in this section of the + library. These should be simple names, such as `strlen' (rather + than complete file names, such as `strlen.c'). The idea is that + `routines' is for modules that define functions in the library, + and `aux' is for auxiliary modules containing things like data + definitions. But the values of `routines' and `aux' are + concatenated, so there really is no practical difference. + +`tests' + The names of test programs for this section of the library. These + should be simple names, such as `tester' (rather than complete + file names, such as `tester.c'). `make tests' will build and run + all the test programs. If a test program needs input, put the + test data in a file called `TEST-PROGRAM.input'; it will given to + the test program on its standard input. If a test program wants + to be run with arguments, put the arguments (all on a single + line) in a file called `TEST-PROGRAM.args'. + +`others' + The names of "other" in programs associated with this section of + the library. These are programs which are not tests per se, but + are other small programs included with the library. These are + built by `make others'. + +`install-lib' +`install-data' +`install' + Files to be installed by `make install'. Things listed in + `install-lib' are installed in the directory specified by + `libdir' in `Makeconfig' (*note Installation::.). Things listed + in `install-data' are installed in the directory specified by + `datadir' in `Makeconfig'. Things listed in `install' are + installed in the directory specified by `bindir' in `Makeconfig'. + +`distribute' + Other files from this subdirectory which should be put into a + distribution tar file. The source and header files listed in the + other standard variables, and the makefile itself, need not be + listed here. Only define `distribute' if there are files used in + an unusual way that should go into the distribution. + + All the machine-dependent and operating system-dependent files in +the library are in the subdirectory `sysdeps' under the top-level +library source directory. This directory contains a hierarchy of +directories. Each subdirectory of `sysdeps' contains source files for +a particular machine or operating system, or for a class of machine or +operating system. A configuration is specified by an ordered list of +these subdirectories. Each subdirectory implicitly appends its parent +directory to the list. For example, specifying the list +`unix/bsd/hp9k3bsd' is equivalent to specifying the list +`unix/bsd/hp9k3bsd unix/bsd unix'. A subdirectory can also specify +that it implies other subdirectories which are not directly above it in +the directory hierarchy. If the file `Implies' exists in a +subdirectory, it lists other subdirectories of `sysdeps' which are +appended to the list, appearing after the subdirectory containing the +`Implies' file. Lines in an `Implies' file that begin with a `#' +character are ignored as comments. For example, +`unix/bsd/hp9k3bsd/Implies' contains: + + # HP 9000 series 300 is 68k. + m68k + +Since `m68k/Implies' contains: + + # 68k uses IEEE 754 floating point. + ieee754 + +and `unix/bsd/Implies' contains: + + # BSD has Internet-related things. + unix/inet + + and `unix/Implies' contains: + + posix + +the final list is ` unix/bsd/hp9k3bsd unix/bsd m68k unix/inet unix +ieee754 posix '. + + There are two "special" subdirectories of `sysdeps', `generic' and +`stub'. These two are always implicitly appended to the list of +subdirectories (in that order), so you needn't put them in an +`Implies' file, and you should not create any subdirectories under +them. `generic' is for things that can be implemented in +machine-independent C, using only other machine-independent functions +in the C library. `stub' is for "stub" versions of functions which +cannot be implemented on a particular machine or operating system. +These functions always return an error, and set `errno' to `ENOSYS' +(Function not implemented). A source file is known to be +system-dependent by its having a version in `generic' or `stub', so +every system-dependent function should have a generic or stub +implementation (there is no point in having both). If you come across +a file that is in one of the main source directories (`string', +`stdio', etc.), and you want to write a machine- or operating +system-dependent version of it, move the file into `sysdeps/generic' +and write your new implementation in the appropriate system-specific +subdirectory. Note that if a file is to be system-dependent, it *must +not* appear in one of the main source directories. + + There are a few special files that may exist in each subdirectory of +`sysdeps': + +`Makefile' + A makefile for this machine or operating system, or class of + machine or operating system. This file is included by the + library makefile `Makerules', which is used by the top-level + makefile and the subdirectory makefiles. It can change the + variables set in the including makefile or add new rules. It can + use GNU `make' conditional commands based on the variable + `subdir' (see above) to select different sets of variables and + rules for different sections of the library. It can also set the + `make' variable `sysdep-routines', to specify extra modules to be + included in the library. You should use `sysdep-routines' rather + than adding modules to `routines' because the latter is used in + determining what to distribute for each subdirectory of the main + source tree. + + Each makefile in a subdirectory in the ordered list of + subdirectories to be searched is included in order. Since + several system-dependent makefiles may be included, each should + append to `sysdep-routines' rather than simply setting it: + + sysdep-routines := $(sysdep-routines) foo bar + +`Subdirs' + This file contains the names of new whole subdirectories under the + top-level library source tree that should be included for this + system. These subdirectories are treated just like the + system-independent subdirectories in the library source tree, + such as `stdio' and `math'. Use this when there are whole new + sets of routines and header files that should go into the library + for the system this subdirectory of `sysdeps' implements. For + example, `sysdeps/unix/inet/Subdirs' contains `inet'; the `inet' + directory contains various network-oriented operations which only + make sense to put in the library on systems that support the + Internet. + +`Dist' + This file contains the names of files (relative the the + subdirectory of `sysdeps' in which it appears) which should be + included in the distribution. List any new files used by rules + in the `Makefile' in the same directory, or header files used by + the source files in that directory. You don't need to list files + that are implementations (either C or assembly source) of + routines whose names are given in the machine-independent + makefiles in the main source tree. + + That is the general system for how system-dependencies are isolated. +The rest of this section describes details of particular +implementations for classes of systems, and how existing classes and +systems are organized. + + + +The Layout of the `sysdeps' Directory Hierarchy +------------------------------------------------ + + Different machine architectures are generally at the top level of +the `sysdeps' hierarchy. For example, `sysdeps/sparc' and +`sysdeps/m68k'. These contain things specific to those machine +architectures (perhaps with subdirectories for specialization of those +architectures, such as `sysdeps/m68k/68881'), but not specific to any +particular operating system. + + Things specific to a particular operating system on a particular +machine are canonically put in a subdirectory in the section of the +hierarchy for the operating system, usually with an `Implies' file +referring to the top-level subdirectory under `sysdeps' for the +particular machine. For example, `unix/bsd/hp9k3bsd' implies `m68k'. + + There are a few directories at the top level of the `sysdeps' +hierarchy that are not for particular machine architectures. + +`generic' +`stub' + As described above (*note Porting::.), these are the two + subdirectories that every configuration uses, usually last. + +`ieee754' + This directory is for code using the IEEE 754 floating-point + format, where the C type `float' is IEEE 754 single-precision + format, and `double' is IEEE 754 double-precision format. + Usually this is directory is referred to in the `Implies' file in + a machine architecture-specific directory, such as `m68k/Implies'. + +`posix' + This directory contains implementations of things in the library + in terms of POSIX.1 functions. This includes some of the POSIX.1 + functions themselves. Of course, POSIX.1 cannot be completely + implemented in terms of itself, so a configuration using just + `posix' cannot be complete. + +`unix' + This is the directory for Unix-like things. See *Note Porting to + Unix::. `unix' implies `posix'. + +`mach' + This is the directory for things based on the Mach microkernel + from CMU (including the GNU operating system). Other basic + operating systems (VMS, for example) would have their own + directories at the top level of the `sysdeps' hierarchy, parallel + to `unix' and `mach'. + + +Porting the GNU C Library to Unix Systems +------------------------------------------ + + Most Unix systems are fundamentally very similar. There are +variations between different machines, and variations in what +facilities are provided by the kernel. But the interface to the +operating system facilities is, for the most part, pretty uniform and +simple. + + The code for Unix systems is in the directory `unix', at the top +level of the `sysdeps' hierarchy. This directory contains +subdirectories (and subdirectory trees) for various Unix variants. + + The routines which are system calls in most Unix systems are +implemented in assembly code in files in `sysdeps/unix'. These files +are named with a suffix of `.S'; for example, `__open.S'. Files ending +in `.S' are run through the C preprocessor before being fed to the +assembler. These files all use a set of macros that should be defined +in `sysdep.h'. The `sysdep.h' in `sysdeps/unix' does not adequately +define them. They must be defined for the particular machine and +operating system variant. See `sysdeps/unix/sysdep.h' and the +machine-specific `sysdep.h' implementations to see what these macros +are and what they should do. + + The system-specific makefile for the `unix' directory, +`sysdeps/unix/Makefile', gives rules to generate several files from +the Unix system you are building the library on (which is assumed to be +the target system you are building the library *for*). All the +generated files are put in the directory where the object files are +kept; they should not affect the source tree itself. The files +generated are: `ioctls.h', `errnos.h', `sys/param.h', and `errlist.c' +(for the `stdio' section of the library). + + Compatibility with Traditional C ================================= @@ -187,9 +463,12 @@  Tag Table: Node: Maintenance97 -Node: How to Install the GNU C Library141 +Node: Installation141 Node: Reporting Bugs3131 -Node: Compatibility with Traditional C4714 -Node: Contributors to the GNU C Library5930 +Node: Porting4714 +Node: Hierarchy Conventions13569 +Node: Porting to Unix15729 +Node: Compatibility with Traditional C17429 +Node: Contributors to the GNU C Library18645  End Tag Table diff -Nru glibc-1.01/Make-dist glibc-1.02/Make-dist --- glibc-1.01/Make-dist Thu Mar 5 21:55:50 1992 +++ glibc-1.02/Make-dist Fri Mar 20 19:42:23 1992 @@ -88,7 +88,7 @@ tardir := glibc-$(version) endif -$(..)$(tardir): +$(..)glibc-%: ln -s . $@ ifdef subdir @@ -145,6 +145,7 @@ -rm -fr /tmp/$(tardir) README: README.template version.c + -rm -f $@ sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@ # Make it unwritable so I won't change it by mistake. chmod a-w $@ diff -Nru glibc-1.01/Makeconfig glibc-1.02/Makeconfig --- glibc-1.01/Makeconfig Sun Mar 8 15:44:09 1992 +++ glibc-1.02/Makeconfig Thu Mar 19 23:35:33 1992 @@ -51,9 +51,13 @@ # Directory for object files, libc.a, and ansi/ and trad/ directories. # If this is not defined, the object files live in the subdirectories # where their sources live, and libc.a and the ansi/ and trad/ directories -# live in the parent directory. +# live in the parent directory (this probably doesn't work any more). ifdef ARCH +ifeq ($(filter /%,$(ARCH)),) objdir := $(..)$(ARCH) +else +objdir = $(ARCH) +endif ifneq ($(wildcard $(objdir)/Makeconfig),) include $(objdir)/Makeconfig @@ -89,16 +93,31 @@ datadir = $(prefix)/lib endif +# Where to install programs. +ifndef bindir +bindir = $(prefix)/bin +endif + +# What timezone should be the installed default. +# This can be changed with `zic -l TIMEZONE' at any time. +localtime = Factory + # Commands to install files. +ifndef INSTALL_DATA INSTALL_DATA = $(INSTALL) +endif +ifndef INSTALL_PROGRAM INSTALL_PROGRAM = $(INSTALL) +endif +ifndef INSTALL INSTALL = install +endif # The name of the C compiler. # If you've got GCC, and it works, use it. -ifndef CC +ifeq ($(origin CC),default) CC := gcc -pipe endif @@ -115,7 +134,7 @@ endif # Command for linking programs with the C library. -+link = $(LD) -o $@ -e __start $(objpfx)start.o $(^:lib=$(objpfx)libc.a) /usr/local/lib/gcc-gnulib $(objpfx)libc.a -lc ++link = $(LD) -o $@ -e __start $(objpfx)start.o $(^:lib=$(objpfx)libc.a) $(libdir)/gcc-gnulib $(objpfx)libc.a -lc ifndef LD LD := ld -X diff -Nru glibc-1.01/Makefile glibc-1.02/Makefile --- glibc-1.01/Makefile Wed Mar 11 19:05:35 1992 +++ glibc-1.02/Makefile Thu Mar 19 20:35:50 1992 @@ -31,7 +31,12 @@ include Makeconfig include $(objpfx)sysd-dirs +define \n + +endef ++sysdep-subdirs := $(subst $(\n), ,$(+sysdep-subdirs)) + # These are the subdirectories containing the library source. +ansi_dirs := assert ctype locale math setjmp \ signal stdio stdlib malloc string time @@ -75,7 +80,7 @@ # What to install. -install-lib = libc.a crt0.o +install-lib = libc.a crt0.o Mcrt1.o include Makerules @@ -86,8 +91,11 @@ # `crt0' is the traditional name for the startup code, # so that's what we install start.o as. $(objpfx)crt0.o: $(objpfx)start.o - ln -f $< $@ + -rm -f $@ + ln $< $@ +$(objpfx)Mcrt1.o: + touch $@ lib: subdir_lib @@ -97,6 +105,7 @@ for dir in `cat $<`; do \ if [ -r $(sysdep_dir)/$$dir/Subdirs ]; then \ cat $(sysdep_dir)/$$dir/Subdirs; \ + else true; \ fi; \ done; \ echo endef) > $@-tmp @@ -121,9 +130,9 @@ .PHONY: clean realclean realclean: clean clean: - rm -f $(objects) $(+depfiles) munch-init.c - rm -f $(libc.a) dist.tar lint.out core TAGS - rm -f -r ansi/ trad/ + -rm -f $(objects) $(+depfiles) munch-init.c + -rm -f $(libc.a) dist.tar lint.out core TAGS + -rm -f -r ansi/ trad/ # This is done this way rather than having `subdir_clean' be a # dependency of this target so that libc.a will be removed before the # subdirectories are dealt with and so they won't try to remove object diff -Nru glibc-1.01/Makerules glibc-1.02/Makerules --- glibc-1.01/Makerules Sun Feb 16 01:23:39 1992 +++ glibc-1.02/Makerules Sun Mar 15 22:01:08 1992 @@ -119,6 +119,7 @@ file=sysdeps/$$dir/Makefile; \ if [ -r $(..)$$file ]; then \ echo include "\$$(..)$$file"; \ + else true; \ fi; \ done) > $@ @@ -256,14 +257,21 @@ ifneq "$(findstring env,$(origin install-data))" "" override install-data := endif +ifneq "$(findstring env,$(origin install))" "" +override install := +endif # install-lib are installed from the object directory into libdir. # install-data are installed as they are into datadir. # headers are installed from the object directory header directories into -# one or both ofg ansi-incldir and trad-incldir. +# one or both of ansi-incldir and trad-incldir. do-install = $(INSTALL_DATA) $< $@ +ifdef install +$(addprefix $(bindir)/,$(install)): $(bindir)/%: $(objpfx)% + $(INSTALL) $< $@ +endif ifdef install-lib $(addprefix $(libdir)/,$(install-lib)): $(libdir)/%: $(objpfx)%;$(do-install) endif @@ -271,7 +279,8 @@ $(addprefix $(datadir)/,$(install-data)): $(datadir)/%: %;$(do-install) endif +install := $(addprefix $(libdir)/,$(install-lib)) \ - $(addprefix $(datadir)/,$(install-data)) + $(addprefix $(datadir)/,$(install-data)) \ + $(addprefix $(bindir)/,$(install)) ifdef headers ifdef ansi-incldir $(addprefix $(ansi-incldir)/,$(headers)): \ diff -Nru glibc-1.01/README glibc-1.02/README --- glibc-1.01/README Wed Mar 11 20:19:36 1992 +++ glibc-1.02/README Fri Mar 20 19:47:30 1992 @@ -1,5 +1,4 @@ -This directory contains the version 1.01 test release of the GNU C Library. -All known bugs have been fixed. +This directory contains the version 1.02 test release of the GNU C Library. Some bugs surely remain. As of this release, the GNU C library has been ported to only three machines: @@ -7,8 +6,8 @@ the library is not hard. If you are interested in doing a port, please get on the mailing list bug-glibc-request@prep.ai.mit.edu -See the file INSTALL for how to configure, build, and install the GNU C -library. +See the file INSTALL for how to configure, build, install, and port the GNU +C library. The manual for the GNU C library is still being worked on, and is not yet distributed. The file Q+A contains a few questions you're likely to have, @@ -22,6 +21,9 @@ The GNU C Library is free software. See the file COPYING.LIB for copying conditions. + +Please do not send patches for the file `Makeconfig'. That file is for +configuration. You are meant to change it to suit your needs. Please note that there are some files in the distribution whose names exceed 14 characters in length. None of these files are needed to build diff -Nru glibc-1.01/Rules glibc-1.02/Rules --- glibc-1.01/Rules Wed Mar 11 17:49:14 1992 +++ glibc-1.02/Rules Tue Mar 17 16:32:05 1992 @@ -79,8 +79,8 @@ # except for the object files and the object-file library members. .PHONY: mostlyclean mostlyclean: - rm -f $(addprefix $(objpfx),$(tests) $(others)) - rm -f core TAGS depend + -rm -f $(addprefix $(objpfx),$(tests) $(others)) + -rm -f core TAGS depend # This removes absolutely everything that can be regenerated. .PHONY: subdir_clean clean realclean @@ -87,7 +87,7 @@ subdir_clean realclean: clean +objs := $(objects) clean: mostlyclean - rm -f $(+objs) $(+depfiles) + -rm -f $(+objs) $(+depfiles) .PHONY: subdir_echo-headers subdir_echo-headers: echo-headers diff -Nru glibc-1.01/gnu/fcntl.h glibc-1.02/gnu/fcntl.h --- glibc-1.01/gnu/fcntl.h Mon Feb 17 05:29:21 1992 +++ glibc-1.02/gnu/fcntl.h @@ -1 +0,0 @@ -#include diff -Nru glibc-1.01/gnu-stabs.h glibc-1.02/gnu-stabs.h --- glibc-1.01/gnu-stabs.h Sun Mar 8 15:20:10 1992 +++ glibc-1.02/gnu-stabs.h Sat Mar 14 22:51:57 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,8 +28,11 @@ CONST char *file AND int mode)) Yes, this is very repetitive. Nothing you can do about it, so shut up. */ #define function_alias(name, _name, type, args, defun) \ - symbol_alias(_name, name); + symbol_alias (_name, name); +#define function_alias_void(name, _name, args, defun) \ + symbol_alias (_name, name); + /* Make references to ALIAS refer to SYMBOL. */ #ifdef __STDC__ #define symbol_alias(symbol, alias) \ @@ -76,7 +79,10 @@ #else /* No GNU stabs. */ #define function_alias(name, _name, type, args, defun) \ - type defun { return name args; } + type defun { return _name args; } + +#define function_alias_void(name, _name, args, defun) \ + void defun { _name args; } #endif /* GNU stabs. */ diff -Nru glibc-1.01/grp/grpread.c glibc-1.02/grp/grpread.c --- glibc-1.01/grp/grpread.c Mon Jul 15 18:55:48 1991 +++ glibc-1.02/grp/grpread.c Fri Mar 20 00:17:54 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -31,10 +31,8 @@ /* Structure containing info kept by each __grpread caller. */ typedef struct { -#define NAME_SIZE 8 -#define PASSWD_SIZE 20 -#define MEMLIST_SIZE 1000 - char buf[NAME_SIZE + 1 + PASSWD_SIZE + 1 + 20 + 1 + 20 + MEMLIST_SIZE + 1]; + char *buf; + size_t buflen; size_t max_members; char **members; struct group g; @@ -45,15 +43,18 @@ PTR DEFUN_VOID(__grpalloc) { - grpread_info *info = (PTR) malloc(sizeof(grpread_info)); + grpread_info *info = (PTR) malloc (sizeof(grpread_info)); if (info == NULL) return NULL; + info->buf = NULL; + info->buflen = 0; + info->max_members = 5; - info->members = (char **) malloc(5 * sizeof(char *)); + info->members = (char **) malloc (5 * sizeof(char *)); if (info->members == NULL) { - free((PTR) info); + free ((PTR) info); return NULL; } @@ -75,8 +76,10 @@ return NULL; } - if (fgets (info->buf, sizeof(info->buf), stream) == NULL) - return NULL; + do + if (__getline (&info->buf, &info->buflen, stream) == -1) + return NULL; + while (info->buf[0] == '#'); start = info->buf; end = strchr (start, ':'); diff -Nru glibc-1.01/hurd/__getdport.c glibc-1.02/hurd/__getdport.c --- glibc-1.01/hurd/__getdport.c Fri Feb 7 18:19:32 1992 +++ glibc-1.02/hurd/__getdport.c Fri Mar 20 22:27:32 1992 @@ -26,20 +26,35 @@ if (_hurd_dtable.d != NULL) { /* We have a real descriptor table. */ - = _hurd_dport (fd); - /* getdport is the only use of file descriptors, - so we don't bother allocating a real table. */ - else if (fd < 0 || fd > _hurd_init_dtablesize || - _hurd_init_dtable[fd] == MACH_PORT_NULL) + file_t dport; + int err = _HURD_DPORT_USE (fd, + __mach_port_mod_refs (__mach_task_self (), + (dport = port), + MACH_PORT_RIGHT_SEND, + 1)); + if (err) + { + errno = err; + return MACH_PORT_NULL; + } + else + return dport; + } + else { - errno = EBADF; - return MACH_PORT_NULL; + /* getdport is the only use of file descriptors, + so we don't bother allocating a real table. */ + if (fd < 0 || fd > _hurd_init_dtablesize || + _hurd_init_dtable[fd] == MACH_PORT_NULL) + { + errno = EBADF; + return MACH_PORT_NULL; + } + else + { + __mach_port_mod_refs (__mach_task_self (), _hurd_init_dtable[fd], + MACH_PORT_RIGHT_SEND, 1); + return _hurd_init_dtable[fd]; + } } - else - port = _hurd_init_dtable[fd]; - - __mach_port_mod_refs (__mach_task_self (), port, - MACH_PORT_RIGHT_SEND, 1); - - return port; } diff -Nru glibc-1.01/hurd/hurd.h glibc-1.02/hurd/hurd.h --- glibc-1.01/hurd/hurd.h Tue Feb 25 21:17:12 1992 +++ glibc-1.02/hurd/hurd.h Fri Mar 20 19:09:01 1992 @@ -222,10 +222,7 @@ #define _HURD_DPORT_USE(fd, expr) \ ({ struct _hurd_port *__port = _hurd_dport (fd); \ if (__port == NULL) \ - { \ - errno = EBADF; \ - -1; \ - } \ + EBADF; \ else \ { \ int __dealloc = 0; \ @@ -359,12 +356,14 @@ { case EINTR: /* RPC went out and was interrupted. */ case MACH_SEND_INTERRUPTED: /* RPC didn't get out. */ - case MACH_RCV_INTERRUPTED: /* RPC pending. */ if (__ss->intr_restart) /* Restart the interrupted call. */ goto __do_call; /* Return EINTR. */ __err = EINTR; + break; + case MACH_RCV_INTERRUPTED: /* RPC pending. */ + /* XXX */ ; break; } __ss->intr_port = MACH_PORT_NULL; diff -Nru glibc-1.01/io/Makefile glibc-1.02/io/Makefile --- glibc-1.01/io/Makefile Wed Mar 4 19:45:47 1992 +++ glibc-1.02/io/Makefile Tue Mar 17 19:23:36 1992 @@ -21,7 +21,7 @@ # subdir := io -headers := sys/stat.h gnu/stat.h gnu/fcntl.h filebits.h fcntl.h utime.h +headers := sys/stat.h gnu/stat.h fcntlbits.h filebits.h fcntl.h utime.h routines := \ utime \ diff -Nru glibc-1.01/io/chown.c glibc-1.02/io/chown.c --- glibc-1.01/io/chown.c Wed Jun 12 13:25:04 1991 +++ glibc-1.02/io/chown.c Fri Mar 13 16:36:30 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,5 +23,5 @@ #undef chown function_alias(chown, __chown, int, (file, owner, group), - DEFUN(__chown, (file, owner, group), + DEFUN(chown, (file, owner, group), CONST char *file AND int owner AND int group)) diff -Nru glibc-1.01/io/fchown.c glibc-1.02/io/fchown.c --- glibc-1.01/io/fchown.c Wed Jun 12 13:25:54 1991 +++ glibc-1.02/io/fchown.c Fri Mar 13 16:36:27 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,5 +23,5 @@ #undef fchown function_alias(fchown, __fchown, int, (fd, owner, group), - DEFUN(__fchown, (fd, owner, group), + DEFUN(fchown, (fd, owner, group), int fd AND int owner AND int group)) diff -Nru glibc-1.01/io/fcntl.h glibc-1.02/io/fcntl.h --- glibc-1.01/io/fcntl.h Mon Feb 17 03:02:17 1992 +++ glibc-1.02/io/fcntl.h Tue Mar 17 19:23:34 1992 @@ -25,7 +25,7 @@ #define _FCNTL_H 1 #include -#include +#include #include diff -Nru glibc-1.01/io/gnu/fcntl.h glibc-1.02/io/gnu/fcntl.h --- glibc-1.01/io/gnu/fcntl.h Mon Feb 17 02:58:25 1992 +++ glibc-1.02/io/gnu/fcntl.h @@ -1,59 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#ifndef _GNU_FCNTL_H - -#define _GNU_FCNTL_H 1 - - -#include - - -/* Values for the second argument to fcntl. */ -#define __F_DUPFD 0 /* Duplicate file descriptor. */ -#define __F_GETFD 1 /* Get file descriptor flags. */ -#define __F_SETFD 2 /* Set file descriptor flags. */ -#define __F_GETFL 3 /* Get file status flags. */ -#define __F_SETFL 4 /* Set file status flags. */ -#define __F_GETOWN 5 /* Get owner (receiver of SIGIO). */ -#define __F_SETOWN 6 /* Set owner (receiver of SIGIO). */ -#define __F_GETLK 7 /* Get record locking info. */ -#define __F_SETLK 8 /* Set record locking info. */ -#define __F_SETLKW 9 /* Set record locking info, wait. */ - -/* File descriptor flags used with F_GETFD and F_SETFD. */ -#define __FD_CLOEXEC 1 /* Close on exec. */ - - -/* The structure describing an advisory lock. This is the type of the third - argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ -struct __flock - { - short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ - short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ - __off_t l_start; /* Offset where the lock begins. */ - __off_t l_len; /* Size of the locked area; zero means until EOF. */ - __pid_t l_pid; /* Process holding the lock. */ - }; - -#define __F_RDLCK 1 /* Read lock. */ -#define __F_WRLCK 2 /* Write lock. */ -#define __F_UNLCK 3 /* Remove lock. */ - - -#endif /* gnu/fcntl.h */ diff -Nru glibc-1.01/io/open.c glibc-1.02/io/open.c --- glibc-1.01/io/open.c Sun Mar 8 15:48:09 1992 +++ glibc-1.02/io/open.c Fri Mar 13 16:36:24 1992 @@ -21,6 +21,8 @@ /* The `open' function might take three arguments. */ +#undef open + #ifdef HAVE_GNU_LD #include diff -Nru glibc-1.01/locale/C-ctype_ct.c glibc-1.02/locale/C-ctype_ct.c --- glibc-1.01/locale/C-ctype_ct.c Fri Jul 26 18:07:50 1991 +++ glibc-1.02/locale/C-ctype_ct.c Fri Mar 20 00:55:23 1992 @@ -6,262 +6,262 @@ CONST unsigned short int __ctype_b_C[] = { 0, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 148|_ISblank, - 148, - 148, - 148, - 148, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 144|_ISblank, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 40, - 40, - 40, - 40, - 40, - 40, - 40, - 40, - 40, - 40, - 64, - 64, - 64, - 64, - 64, - 64, - 64, - 33, - 33, - 33, - 33, - 33, - 33, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 1, - 64, - 64, - 64, - 64, - 64, - 64, - 34, - 34, - 34, - 34, - 34, - 34, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 2, - 64, - 64, - 64, - 64, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, - 4, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl|_ISspace|_ISblank, + _IScntrl|_ISspace, + _IScntrl|_ISspace, + _IScntrl|_ISspace, + _IScntrl|_ISspace, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _ISspace|_NOgraph|_ISblank, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISdigit|_IShex, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISupper|_IShex, + _ISupper|_IShex, + _ISupper|_IShex, + _ISupper|_IShex, + _ISupper|_IShex, + _ISupper|_IShex, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISupper, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _ISlower|_IShex, + _ISlower|_IShex, + _ISlower|_IShex, + _ISlower|_IShex, + _ISlower|_IShex, + _ISlower|_IShex, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISlower, + _ISpunct, + _ISpunct, + _ISpunct, + _ISpunct, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, + _IScntrl, }; CONST unsigned char __ctype_tolower_C[] = { diff -Nru glibc-1.01/mach/devstream.c glibc-1.02/mach/devstream.c --- glibc-1.01/mach/devstream.c Sat Oct 19 21:48:26 1991 +++ glibc-1.02/mach/devstream.c Fri Mar 20 19:31:05 1992 @@ -1,6 +1,24 @@ /* stdio on a Mach device port. - Translates \n to \r on output. */ + Translates \n to \r on output. +Copyright (C) 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + #include #include #include @@ -30,9 +48,9 @@ if (err = device_read_inband ((device_t) cookie, 0, f->__target, to_read, buffer, &nread)) { - errno = EIO; f->__error = 1; f->__bufp = f->__get_limit = f->__put_limit = f->__buffer; + errno = err; return EOF; } @@ -64,7 +82,7 @@ f->__target, &cc, 1, &wrote)) || wrote != 1) { - errno = EIO; + errno = err; f->__error = 1; } } diff -Nru glibc-1.01/mach/hello.c glibc-1.02/mach/hello.c --- glibc-1.01/mach/hello.c Fri Oct 25 20:20:18 1991 +++ glibc-1.02/mach/hello.c Fri Mar 20 19:30:37 1992 @@ -1,6 +1,6 @@ -/* "Hello world" program for GNU C Library on bare Mach 3.0. */ +/* "Hello world" program for GNU C Library on bare Mach 3.0. -Copyright (C) 1991 Free Software Foundation, Inc. +Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -43,5 +43,6 @@ exit (errno); fputs ("Hello, world!\n", consf); - exit (0); + + return 0; } diff -Nru glibc-1.01/malloc/Makefile glibc-1.02/malloc/Makefile --- glibc-1.01/malloc/Makefile Mon Feb 17 05:03:57 1992 +++ glibc-1.02/malloc/Makefile Sat Mar 14 23:17:45 1992 @@ -39,6 +39,7 @@ include ../Rules $(objpfx)libmcheck.a: $(objpfx)mcheck-init.o + -rm -f $@ ln $< $@ # Make the standalone malloc distribution. @@ -65,7 +66,9 @@ -e 's,,$(addsuffix .o,$(dist-routines)),' \ -e 's,,$(headers),' < $< > $@-tmp mv $@-tmp $@ -malloc/gmalloc.c: malloc/Makefile +malloc/gmalloc.c: malloc/Makefile \ + $(addprefix malloc/,$(headers) \ + $(addsuffix .c,$(dist-routines))) $(MAKE) -C malloc gmalloc.c malloc/README: dist-README @rm -f $@ diff -Nru glibc-1.01/malloc/dist-README glibc-1.02/malloc/dist-README --- glibc-1.01/malloc/dist-README Tue Feb 25 21:29:18 1992 +++ glibc-1.02/malloc/dist-README Tue Mar 17 16:40:27 1992 @@ -1,7 +1,7 @@ This is the standalone distribution of GNU malloc. GNU malloc is part of the GNU C Library, but is also distributed separately. -If you find bugs in GNU malloc, send reports to bug-gnu-libc@prep.ai.mit.edu. +If you find bugs in GNU malloc, send reports to bug-glibc@prep.ai.mit.edu. GNU malloc is free software. See the file COPYING.LIB for copying conditions. diff -Nru glibc-1.01/math/Makefile glibc-1.02/math/Makefile --- glibc-1.01/math/Makefile Fri Mar 6 12:47:04 1992 +++ glibc-1.02/math/Makefile Fri Mar 20 18:01:53 1992 @@ -1,4 +1,4 @@ -# Copyright (C) 1991 Free Software Foundation, Inc. +# Copyright (C) 1991, 1992 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -29,7 +29,8 @@ isinf isnan finite infnan copysign scalb drem logb \ __isinf __isnan __finite __infnan __copysign __scalb __drem __logb\ __rint rint hypot cabs cbrt __expm1 expm1 log1p acosh asinh atanh -install := libm.a +tests := test-math +install-lib := libm.a include ../Rules diff -Nru glibc-1.01/math/bsd/common_source/mathimpl.h glibc-1.02/math/bsd/common_source/mathimpl.h --- glibc-1.01/math/bsd/common_source/mathimpl.h Tue Feb 11 02:34:18 1992 +++ glibc-1.02/math/bsd/common_source/mathimpl.h Tue Mar 17 20:08:04 1992 @@ -21,6 +21,12 @@ #include +#include +#ifdef __LITTLE_ENDIAN +#undef national +#define national +#endif + #undef isinf #define isinf __isinf diff -Nru glibc-1.01/math/test-math.c glibc-1.02/math/test-math.c --- glibc-1.01/math/test-math.c +++ glibc-1.02/math/test-math.c Fri Mar 20 18:01:03 1992 @@ -0,0 +1,17 @@ +#include +#include +#include +#include + +int +DEFUN_VOID(main) +{ + CONST char str[] = "123.456"; + double x; + + x = atof (str); + + printf ("%g %g\n", x, pow (10.0, 3.0)); + + return 0; +} diff -Nru glibc-1.01/misc/a.out.h glibc-1.02/misc/a.out.h --- glibc-1.01/misc/a.out.h Tue Mar 10 21:26:11 1992 +++ glibc-1.02/misc/a.out.h Fri Mar 20 01:52:43 1992 @@ -132,19 +132,21 @@ /* Address of data segment in memory after it is loaded. Note that it is up to you to define SEGMENT_SIZE on machines not listed here. */ -#if defined(vax) || defined(hp300) || defined(pyr) || defined(sparc) \ - || (defined(m68k) && defined(PORTAR)) +#if (defined(vax) || defined(hp300) || defined(pyr) || defined(sparc) \ + || (defined(m68k) && defined(PORTAR)) \ + || defined (NeXT) || defined (mips)) #define SEGMENT_SIZE PAGE_SIZE #endif -#ifdef hp300 +#if defined (hp300) || defined (mips) #define PAGE_SIZE 4096 #endif #ifdef sparc #define PAGE_SIZE 0x2000 #endif -#if defined (sony) || (defined (sun) && defined (mc68000)) +#if (defined (sony) || (defined (sun) && defined (mc68000)) \ + || defined (NeXT)) #define SEGMENT_SIZE 0x2000 -#endif /* Sony or 68k Sun. */ +#endif /* Sony, 68k Sun, or NeXT. */ #ifdef is68k #define SEGMENT_SIZE 0x20000 #endif diff -Nru glibc-1.01/misc/bsd-compat.c glibc-1.02/misc/bsd-compat.c --- glibc-1.01/misc/bsd-compat.c Mon Feb 17 01:49:40 1992 +++ glibc-1.02/misc/bsd-compat.c Sat Mar 14 23:13:55 1992 @@ -1,6 +1,6 @@ /* BSD-compatible versions of functions where BSD and POSIX.1 conflict. -Copyright (C) 1991 Free Software Foundation, Inc. +Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define __FAVOR_BSD +#define _BSD_SOURCE #include #include @@ -39,5 +39,5 @@ } #undef longjmp -function_alias(longjmp, siglongjmp, void, (env, val), - DEFUN(longjmp, (env, val), jmp_buf env AND int val)) +function_alias_void(longjmp, siglongjmp, void, (env, val), + DEFUN(longjmp, (env, val), jmp_buf env AND int val)) diff -Nru glibc-1.01/misc/select.c glibc-1.02/misc/select.c --- glibc-1.01/misc/select.c Thu Feb 27 14:48:42 1992 +++ glibc-1.02/misc/select.c Fri Mar 13 16:36:23 1992 @@ -25,6 +25,6 @@ function_alias(select, __select, int, (nfds, readfds, writefds, exceptfds, timeout), - DEFUN(__select, (nfds, readfds, writefds, exceptfds, timeout), + DEFUN(select, (nfds, readfds, writefds, exceptfds, timeout), int nfds AND fd_set *readfds AND fd_set *writefds AND fd_set *exceptfds AND struct timeval *timeout)) diff -Nru glibc-1.01/posix/execl.c glibc-1.02/posix/execl.c --- glibc-1.01/posix/execl.c Wed Jun 26 12:52:56 1991 +++ glibc-1.02/posix/execl.c Fri Mar 13 16:36:14 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,6 +20,10 @@ #include #include #include + +#ifndef HAVE_GNU_LD +#define __environ environ +#endif /* Execute PATH with all arguments after PATH until a NULL pointer and environment from `environ'. */ diff -Nru glibc-1.01/posix/execv.c glibc-1.02/posix/execv.c --- glibc-1.01/posix/execv.c Wed Jun 12 13:25:37 1991 +++ glibc-1.02/posix/execv.c Fri Mar 13 16:36:16 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,7 +19,9 @@ #include #include -#undef execv +#ifndef HAVE_GNU_LD +#define __environ environ +#endif /* Execute PATH with arguments ARGV and environment from `environ'. */ int diff -Nru glibc-1.01/posix/getopt.c glibc-1.02/posix/getopt.c --- glibc-1.01/posix/getopt.c Tue Feb 25 21:23:48 1992 +++ glibc-1.02/posix/getopt.c Sun Mar 15 21:50:27 1992 @@ -23,7 +23,7 @@ #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not __GNUC__ */ -#ifdef sparc +#if defined(sparc) && !defined(USG) && !defined(SVR4) && !defined(__svr4__) #include #else #ifdef _AIX diff -Nru glibc-1.01/posix/unistd.h glibc-1.02/posix/unistd.h --- glibc-1.01/posix/unistd.h Wed Feb 12 13:14:51 1992 +++ glibc-1.02/posix/unistd.h Tue Mar 17 18:07:22 1992 @@ -236,10 +236,6 @@ /* Execute PATH with arguments ARGV and environment from `environ'. */ extern int EXFUN(execv, (CONST char *__path, char *CONST __argv[])); -#ifdef __OPTIMIZE__ -#define execv(path, argv) __execve((path), (argv), __environ) -#endif /* Optimizing. */ - /* Execute PATH with all arguments after PATH until a NULL pointer, and the argument after that for environment. */ extern int EXFUN(execle, (CONST char *__path, CONST char *__arg, ...)); @@ -574,8 +570,8 @@ /* Return the number of bytes in a page. This is the system's page size, which is not necessarily the same as the hardware page size. */ -extern int EXFUN(__getpagesize, (NOARGS)); -extern int EXFUN(getpagesize, (NOARGS)); +extern size_t EXFUN(__getpagesize, (NOARGS)); +extern size_t EXFUN(getpagesize, (NOARGS)); #ifdef __OPTIMIZE__ #define getpagesize() __getpagesize() diff -Nru glibc-1.01/posix/wordexp.h glibc-1.02/posix/wordexp.h --- glibc-1.01/posix/wordexp.h Wed Jun 12 13:30:10 1991 +++ glibc-1.02/posix/wordexp.h Mon Mar 16 06:33:06 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -45,8 +45,7 @@ /* Possible nonzero return values from `wordexp'. */ enum { - WRDE_ABEND = 1, /* WORDS contains unquoted metacharacters. */ - WRDE_NOSPACE, /* Ran out of memory. */ + WRDE_NOSPACE = 1, /* Ran out of memory. */ WRDE_BADCHAR, /* A metacharacter appears in the wrong place. */ WRDE_BADVAL, /* Reference to undefined variable with WRDE_UNDEF. */ WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */ diff -Nru glibc-1.01/pwd/pwdread.c glibc-1.02/pwd/pwdread.c --- glibc-1.01/pwd/pwdread.c Fri Oct 4 18:24:19 1991 +++ glibc-1.02/pwd/pwdread.c Fri Mar 20 00:14:31 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -33,11 +33,8 @@ /* Structure containing info kept by each __pwdread caller. */ typedef struct { -#define NAME_SIZE 8 -#define PASSWD_SIZE 20 -#define GECOS_SIZE 100 - char buf[NAME_SIZE + 1 + PASSWD_SIZE + 1 + 20 + 1 + 20 + 1 + - GECOS_SIZE + 1 + PATH_MAX + 1 + PATH_MAX + 1]; + char *buf; + size_t buflen; struct passwd p; } pwdread_info; @@ -46,9 +43,11 @@ PTR DEFUN_VOID(__pwdalloc) { - pwdread_info *info = (PTR) malloc(sizeof(pwdread_info)); + pwdread_info *info = (PTR) malloc (sizeof(pwdread_info)); if (info == NULL) return NULL; + info->buf = NULL; + info->buflen = 0; return info; } @@ -66,8 +65,10 @@ return NULL; } - if (fgets (info->buf, sizeof (info->buf), stream) == NULL) - return NULL; + do + if (__getline (&info->buf, &info->buflen, stream) == -1) + return NULL; + while (info->buf[0] == '#'); start = info->buf; end = strchr (start, ':'); diff -Nru glibc-1.01/setjmp/longjmp.c glibc-1.02/setjmp/longjmp.c --- glibc-1.01/setjmp/longjmp.c Sat Feb 15 18:03:40 1992 +++ glibc-1.02/setjmp/longjmp.c Sat Mar 14 22:53:43 1992 @@ -22,5 +22,5 @@ #undef longjmp -function_alias(longjmp, __longjmp, void, (env, val), - DEFUN(longjmp, (env, val), CONST jmp_buf env AND int val)) +function_alias_void(longjmp, __longjmp, (env, val), + DEFUN(longjmp, (env, val), CONST jmp_buf env AND int val)) diff -Nru glibc-1.01/signal/sigvec.c glibc-1.02/signal/sigvec.c --- glibc-1.01/signal/sigvec.c Wed Mar 11 18:40:46 1992 +++ glibc-1.02/signal/sigvec.c Fri Mar 13 16:36:18 1992 @@ -23,6 +23,6 @@ #undef sigvec function_alias(sigvec, __sigvec, int, (sig, vec, ovec), - DEFUN(__sigvec, (sig, vec, ovec), + DEFUN(sigvec, (sig, vec, ovec), int sig AND CONST struct __sigvec *vec AND struct __sigvec *ovec)) diff -Nru glibc-1.01/stdio/Makefile glibc-1.02/stdio/Makefile --- glibc-1.01/stdio/Makefile Thu Mar 5 18:26:48 1992 +++ glibc-1.02/stdio/Makefile Fri Mar 20 21:46:22 1992 @@ -39,7 +39,8 @@ ungetc \ fgetc getc getchar getw \ fputc putc putchar putw \ - fgets gets fputs puts getdelim getline \ + fgets gets fputs puts \ + getdelim getline __getdelim __getline \ perror psignal \ tmpfile tmpnam tempnam \ fclose fflush \ diff -Nru glibc-1.01/stdio/__getdelim.c glibc-1.02/stdio/__getdelim.c --- glibc-1.01/stdio/__getdelim.c +++ glibc-1.02/stdio/__getdelim.c Tue Mar 17 17:30:56 1992 @@ -0,0 +1,165 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include +#include +#include +#include + +/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR + (and null-terminate it). *LINEPTR is a pointer returned from malloc (or + NULL), pointing to *N characters of space. It is realloc'd as + necessary. Returns the number of characters read (not including the + null terminator), or -1 on error or EOF. */ + +ssize_t +DEFUN(__getdelim, (lineptr, n, terminator, stream), + char **lineptr AND size_t *n AND int terminator AND FILE *stream) +{ + char *line, *p; + size_t size, copy; + + if (!__validfp (stream) || lineptr == NULL || n == NULL) + { + errno = EINVAL; + return -1; + } + + if (ferror (stream)) + return -1; + + /* Make sure we have a line buffer to start with. */ + if (*lineptr == NULL || *n < 2) /* !seen and no buf yet need 2 chars. */ + { +#ifndef MAX_CANON +#define MAX_CANON 256 +#endif + line = realloc (*lineptr, MAX_CANON); + if (line == NULL) + return -1; + *lineptr = line; + *n = MAX_CANON; + } + + line = *lineptr; + size = *n; + + copy = size; + p = line; + + if (stream->__buffer == NULL && stream->__userbuf) + { + /* Unbuffered stream. Not much optimization to do. */ + + while (1) + { + size_t len; + + while (--copy > 0) + { + register int c = getc (stream); + if (c == EOF) + goto lose; + else if ((*p++ = c) == terminator) + goto win; + } + + /* Need to enlarge the line buffer. */ + len = p - line; + size *= 2; + line = realloc (line, size); + if (line == NULL) + goto lose; + *lineptr = line; + *n = size; + p = line + len; + copy = size - len; + } + } + else + { + if (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back) + { + /* Do one with getc to allocate a buffer. */ + int c = getc (stream); + if (c == EOF) + goto lose; + *p++ = c; + if (c == terminator) + goto win; + --copy; + } + + while (1) + { + size_t i; + char *found; + + i = stream->__get_limit - stream->__bufp; + if (i == 0) + { + /* Refill the buffer. */ + int c = __fillbf (stream); + if (c == EOF) + goto lose; + *p++ = c; + if (c == terminator) + goto win; + i = stream->__get_limit - stream->__bufp; + } + + if (i > copy - 1) + i = copy - 1; + + found = (char *) __memccpy ((PTR) p, stream->__bufp, terminator, i); + if (found != NULL) + { + stream->__bufp += found - p; + p = found; + goto win; + } + + stream->__bufp += i; + p += i; + copy -= i; + if (copy == 0) + { + /* Need to enlarge the line buffer. */ + size_t len = p - line; + size *= 2; + line = realloc (line, size); + if (line == NULL) + goto lose; + *lineptr = line; + *n = size; + p = line + len; + copy = size - len; + } + } + } + + lose: + if (p == *lineptr) + return -1; + /* Return a partial line since we got an error in the middle. */ + win: + *p = '\0'; + return p - *lineptr; +} diff -Nru glibc-1.01/stdio/__getline.c glibc-1.02/stdio/__getline.c --- glibc-1.01/stdio/__getline.c +++ glibc-1.02/stdio/__getline.c Mon Mar 16 05:27:01 1992 @@ -0,0 +1,31 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +#undef __getline + +/* Like getdelim, but always looks for a newline. */ +ssize_t +DEFUN(__getline, (lineptr, n, stream), + char **lineptr AND size_t *n AND FILE *stream) +{ + return __getdelim (lineptr, n, '\n', stream); +} diff -Nru glibc-1.01/stdio/__vfscanf.c glibc-1.02/stdio/__vfscanf.c --- glibc-1.01/stdio/__vfscanf.c Thu Mar 5 19:13:05 1992 +++ glibc-1.02/stdio/__vfscanf.c Tue Mar 17 20:05:49 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -256,9 +256,6 @@ *str = '\0'; ++done; } - - if (c == EOF) - input_error(); break; case 'x': /* Hexadecimal integer. */ diff -Nru glibc-1.01/stdio/fgets.c glibc-1.02/stdio/fgets.c --- glibc-1.01/stdio/fgets.c Tue Feb 11 03:12:28 1992 +++ glibc-1.02/stdio/fgets.c Tue Mar 17 19:51:35 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,34 +21,44 @@ #include #include -/* Get a newline-terminated string of not more than - N - 1 characters from `stream' and put it in S. */ +/* Reads characters from STREAM into S, until either a newline character + is read, N - 1 characters have been read, or EOF is seen. Returns + the newline, unlike gets. Finishes by appending a null character and + returning S. If EOF is seen before any characters have been written + to S, the function returns NULL without appending the null character. + If there is a file error, always return NULL. */ char * DEFUN(fgets, (s, n, stream), char *s AND size_t n AND register FILE *stream) { register char *p = s; - if (!__validfp(stream)) + if (!__validfp(stream) || s == NULL || n == 0) { errno = EINVAL; return NULL; } - if (s == NULL || n == 0 || ferror(stream)) + if (ferror (stream)) return NULL; if (stream->__buffer == NULL && stream->__userbuf) { /* Unbuffered stream. Not much optimization to do. */ - register int c; - while (--n > 0 && (c = getc(stream)) != EOF) + register int c = 0; + while (--n > 0 && (c = getc (stream)) != EOF) if ((*p++ = c) == '\n') break; + if (c == EOF) + return NULL; *p = '\0'; return s; } - if (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back) + /* Leave space for the null. */ + --n; + + if (n > 0 && + !stream->__seen || stream->__buffer == NULL || stream->__pushed_back) { /* Do one with getc to allocate a buffer. */ int c = getc (stream); @@ -60,11 +70,10 @@ *p = '\0'; return s; } + else + --n; } - /* Leave space for the null. */ - --n; - while (n > 0) { size_t i; @@ -74,9 +83,9 @@ if (i == 0) { /* Refill the buffer. */ - int c = __fillbf(stream); + int c = __fillbf (stream); if (c == EOF) - break; + break; *p++ = c; if (c == '\n') { @@ -83,12 +92,13 @@ *p = '\0'; return s; } + i = stream->__get_limit - stream->__bufp; } if (i > n) i = n; - found = (char *) __memccpy((PTR) p, stream->__bufp, '\n', i); + found = (char *) __memccpy ((PTR) p, stream->__bufp, '\n', i); if (found != NULL) { @@ -102,6 +112,7 @@ p += i; } - *p = '\0'; - return (p == s || ferror(stream)) ? NULL : s; + if (p > s) + *p = '\0'; + return ferror (stream) ? NULL : s; } diff -Nru glibc-1.01/stdio/fopen.c glibc-1.02/stdio/fopen.c --- glibc-1.01/stdio/fopen.c Thu Mar 5 17:30:13 1992 +++ glibc-1.02/stdio/fopen.c Tue Mar 17 19:18:37 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -41,6 +41,7 @@ { case 'a': mptr->__write = mptr->__create = mptr->__append = 1; + break; case 'w': mptr->__write = mptr->__create = mptr->__truncate = 1; break; diff -Nru glibc-1.01/stdio/fputs.c glibc-1.02/stdio/fputs.c --- glibc-1.01/stdio/fputs.c Wed Jun 12 14:08:58 1991 +++ glibc-1.02/stdio/fputs.c Tue Mar 17 19:36:58 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -26,10 +26,10 @@ int DEFUN(fputs, (s, stream), CONST char *s AND FILE *stream) { - register CONST size_t len = strlen(s); + register CONST size_t len = strlen (s); if (len == 1) - return putc(*s, stream) == EOF ? EOF : 0; - if (fwrite((PTR) s, len, 1, stream) != 1) + return putc (*s, stream) == EOF ? EOF : 0; + if (fwrite ((PTR) s, 1, len, stream) != len) return EOF; return 0; } diff -Nru glibc-1.01/stdio/getdelim.c glibc-1.02/stdio/getdelim.c --- glibc-1.01/stdio/getdelim.c Tue Mar 10 21:31:54 1992 +++ glibc-1.02/stdio/getdelim.c Mon Mar 16 05:28:29 1992 @@ -19,147 +19,12 @@ #include #include #include -#include -#include -#include +#include -/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR - (and null-terminate it). *LINEPTR is a pointer returned from malloc (or - NULL), pointing to *N characters of space. It is realloc'd as - necessary. Returns the number of characters read (not including the - null terminator), or -1 on error or EOF. */ +#undef getdelim -ssize_t -DEFUN(getdelim, (lineptr, n, terminator, stream), - char **lineptr AND size_t *n AND int terminator AND FILE *stream) -{ - char *line, *p; - size_t size, copy; - - if (!__validfp (stream) || lineptr == NULL || n == NULL) - { - errno = EINVAL; - return -1; - } - - if (ferror (stream)) - return -1; - - /* Make sure we have a line buffer to start with. */ - if (*lineptr == NULL || *n < 2) /* !seen and no buf yet need 2 chars. */ - { -#ifndef MAX_CANON -#define MAX_CANON 256 -#endif - line = realloc (*lineptr, MAX_CANON); - if (line == NULL) - return -1; - *lineptr = line; - *n = MAX_CANON; - } - - line = *lineptr; - size = *n; - - copy = size; - p = line; - - if (stream->__buffer == NULL && stream->__userbuf) - { - /* Unbuffered stream. Not much optimization to do. */ - - while (1) - { - size_t len; - - while (--copy > 0) - { - register int c = getc (stream); - if (c == EOF) - goto lose; - else if ((*p++ = c) == terminator) - goto win; - } - - /* Need to enlarge the line buffer. */ - len = p - line; - size *= 2; - line = realloc (line, size); - if (line == NULL) - goto lose; - *lineptr = line; - *n = size; - p = line + len; - copy = size - len; - } - } - else - { - if (!stream->__seen || stream->__buffer == NULL || stream->__pushed_back) - { - /* Do one with getc to allocate a buffer. */ - int c = getc (stream); - if (c == EOF) - goto lose; - *p++ = c; - if (c == terminator) - goto win; - --copy; - } - - while (1) - { - size_t i; - char *found; - - i = stream->__get_limit - stream->__bufp; - if (i == 0) - { - /* Refill the buffer. */ - int c = __fillbf (stream); - if (c == EOF) - goto lose; - *p++ = c; - if (c == terminator) - goto win; - i = stream->__get_limit - stream->__bufp; - } - - if (i > copy) - i = copy; - - found = (char *) __memccpy ((PTR) p, stream->__bufp, terminator, i); - if (found != NULL) - { - stream->__bufp += found - p; - p = found; - goto win; - } - - stream->__bufp += i; - p += i; - copy -= i; - if (copy == 0) - { - /* Need to enlarge the line buffer. */ - size_t len = p - line; - size *= 2; - line = realloc (line, size); - if (line == NULL) - goto lose; - *lineptr = line; - *n = size; - p = line + len; - copy = size - len; - } - } - } - - lose: - if (p == *lineptr) - return -1; - /* Return a partial line since we got an error in the middle. */ - win: - *p = '\0'; - return p - *lineptr; -} +function_alias (getdelim, __getdelim, ssize_t, + (lineptr, n, terminator, stream), + DEFUN(getdelim, (lineptr, n, terminator, stream), + char **lineptr AND size_t *n AND + int terminator AND FILE *stream)) diff -Nru glibc-1.01/stdio/getline.c glibc-1.02/stdio/getline.c --- glibc-1.01/stdio/getline.c Sun Feb 16 02:01:48 1992 +++ glibc-1.02/stdio/getline.c Mon Mar 16 05:28:44 1992 @@ -19,13 +19,10 @@ #include #include #include +#include #undef getline -/* Like getdelim, but always looks for a newline. */ -ssize_t -DEFUN(getline, (lineptr, n, stream), - char **lineptr AND size_t *n AND FILE *stream) -{ - return getdelim (lineptr, n, '\n', stream); -} +function_alias (getline, __getline, ssize_t, (lineptr, n, stream), + DEFUN(getline, (lineptr, n, stream), + char **lineptr AND size_t *n AND FILE *stream)) diff -Nru glibc-1.01/stdio/stdio.h glibc-1.02/stdio/stdio.h --- glibc-1.01/stdio/stdio.h Thu Mar 5 18:02:55 1992 +++ glibc-1.02/stdio/stdio.h Mon Mar 16 05:25:44 1992 @@ -458,14 +458,19 @@ NULL), pointing to *N characters of space. It is realloc'd as necessary. Returns the number of characters read (not including the null terminator), or -1 on error or EOF. */ +ssize_t EXFUN(__getdelim, (char **lineptr, size_t *n, + int delimiter, FILE *stream)); ssize_t EXFUN(getdelim, (char **lineptr, size_t *n, int delimiter, FILE *stream)); /* Like `getdelim', but reads up to a newline. */ +ssize_t EXFUN(__getline, (char **lineptr, size_t *n, FILE *stream)); ssize_t EXFUN(getline, (char **lineptr, size_t *n, FILE *stream)); #ifdef __OPTIMIZE__ -#define getline(lineptr, n, stream) getdelim ((lineptr), (n), '\n', (stream)) +#define getdelim(l, n, d, s) __getdelim ((l), (n), (d), (s)) +#define getline(l, n, s) __getline ((l), (n), (s)) +#define __getline(l, n, stream) __getdelim ((l), (n), '\n', (stream)) #endif /* Optimizing. */ #endif diff -Nru glibc-1.01/stdio/tst-printf.c glibc-1.02/stdio/tst-printf.c --- glibc-1.01/stdio/tst-printf.c Thu Jul 25 19:52:22 1991 +++ glibc-1.02/stdio/tst-printf.c Tue Mar 17 18:07:12 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -99,6 +99,7 @@ printf("e-style >= .1:\t\"%e\"\n", 0.1234); printf("e-style < .1:\t\"%e\"\n", 0.001234); printf("e-style big:\t\"%.60e\"\n", 1e20); + printf ("e-style == .1:\t\"%e\"\n", 0.1); printf("f-style >= 1:\t\"%f\"\n", 12.34); printf("f-style >= .1:\t\"%f\"\n", 0.1234); printf("f-style < .1:\t\"%f\"\n", 0.001234); diff -Nru glibc-1.01/stdio/tstscanf.c glibc-1.02/stdio/tstscanf.c --- glibc-1.01/stdio/tstscanf.c Sat Aug 31 01:57:16 1991 +++ glibc-1.02/stdio/tstscanf.c Tue Mar 17 19:58:54 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -46,6 +46,14 @@ sprintf (buf, "/bin/cat %s", argv[2]); in = popen (buf, "r"); } + + { + char name[50]; + fprintf (out, + "sscanf (\"thompson\", \"%%s\", name) == %d, name == \"%s\"\n", + sscanf ("thompson", "%s", name), + name); + } fputs ("Testing scanf (vfscanf)\n", out); diff -Nru glibc-1.01/stdio/vfprintf.c glibc-1.02/stdio/vfprintf.c --- glibc-1.01/stdio/vfprintf.c Thu Mar 5 19:01:52 1992 +++ glibc-1.02/stdio/vfprintf.c Tue Mar 17 19:55:44 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -406,11 +406,7 @@ } if (alt && base == 16) - { - *w-- = fc; - *w-- = '0'; - width -= 2; - } + width -= 2; if (is_neg || showsign || space) --width; @@ -429,6 +425,12 @@ if (!left && pad == '0') while (width-- > 0) outchar('0'); + + if (alt && base == 16) + { + outchar ('0'); + outchar (fc); + } /* Write the number. */ while (++w <= workend) diff -Nru glibc-1.01/stdlib/Makefile glibc-1.02/stdlib/Makefile --- glibc-1.01/stdlib/Makefile Wed Feb 12 13:14:27 1992 +++ glibc-1.02/stdlib/Makefile Tue Mar 17 16:30:02 1992 @@ -37,6 +37,6 @@ system distribute := exit.h -tests := tst-strtol tst-strtod +tests := tst-strtol tst-strtod abortme include ../Rules diff -Nru glibc-1.01/stdlib/abortme.c glibc-1.02/stdlib/abortme.c --- glibc-1.01/stdlib/abortme.c +++ glibc-1.02/stdlib/abortme.c Tue Mar 17 16:28:32 1992 @@ -0,0 +1,9 @@ +#include +#include + +int +DEFUN_VOID(main) +{ + abort (); + return 1; +} diff -Nru glibc-1.01/string/string.h glibc-1.02/string/string.h --- glibc-1.01/string/string.h Tue Feb 25 22:24:33 1992 +++ glibc-1.02/string/string.h Tue Mar 17 18:58:27 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -100,7 +100,7 @@ /* Find the first occurence in S of any character in ACCEPT. */ extern char *EXFUN(strpbrk, (CONST char *__s, CONST char *__accept)); /* Find the first occurence of NEEDLE in HAYSTACK. */ -extern char *EXFUN(strstr, (CONST char *__needle, CONST char *__haystack)); +extern char *EXFUN(strstr, (CONST char *__haystack, CONST char *__needle)); /* Divide S into tokens separated by characters in DELIM. */ extern char *EXFUN(strtok, (char *__s, CONST char *__delim)); diff -Nru glibc-1.01/string/testcopy.c glibc-1.02/string/testcopy.c --- glibc-1.01/string/testcopy.c Sat Feb 15 17:40:47 1992 +++ glibc-1.02/string/testcopy.c Tue Mar 17 19:01:45 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). This file is part of the GNU C Library. @@ -27,78 +27,82 @@ DEFUN(main, (argc, argv), int argc AND char **argv) { - if (argc > 1) - { - long int s[1025], d[1025]; - int i; - int a, b = 0; - - a = atoi(argv[1]); - if (argc > 2) - b = atoi(argv[2]); + char *mem, *memp; + char *rand_mem; + char *lo_around, *hi_around; + int size, max_size; + int src_off, dst_off; + int i; + int space_around = 10; + + max_size = 256; + + mem = malloc (max_size + 2 * max_size + 2 * space_around); + rand_mem = malloc (max_size); + lo_around = malloc (space_around); + hi_around = malloc (space_around); + memp = mem + space_around; - for (i = 10000; --i; ) - memmove (((char *) d) + b, ((char *) s) + a, 1024 * 4); - } - else + /* Fill RAND_MEM with random bytes, each non-zero. */ + for (i = 0; i < max_size; i++) { -#define SIZE (3*0x200) - - unsigned char *p = valloc(SIZE + 40); - int src_align, dst_align; - int i; - int len; + int x; + do + x = random (); + while (x == 0); + rand_mem[i] = x; + } - for (len = 0; len < 256; len++) + for (size = 0; size < max_size; size++) + { + printf("phase %d\n", size); + for (src_off = 0; src_off <= 16; src_off++) { - printf("phase %d\n", len); - for (src_align = 0; src_align < 32; src_align++) + for (dst_off = 0; dst_off <= 16; dst_off++) { - unsigned char *src; + /* Put zero around the intended destination, to check + that it's not clobbered. */ + for (i = 1; i < space_around; i++) + { + memp[dst_off - i] = 0; + memp[dst_off + size - 1 + i] = 0; + } + + /* Fill the source area with known contents. */ + for (i = 0; i < size; i++) + memp[src_off + i] = rand_mem[i]; + + /* Remember the contents around the destination area. + (It might not be what we wrote some lines above, since + the src area and the dst area overlap.) */ + for (i = 1; i < space_around; i++) + { + lo_around[i] = memp[dst_off - i]; + hi_around[i] = memp[dst_off + size - 1 + i]; + } - src = p + 40 + SIZE/3 + src_align; + memmove (memp + dst_off, memp + src_off, size); - for (dst_align = 0; dst_align < 32; dst_align++) + /* Check that the destination area has the same + contents we wrote to the source area. */ + for (i = 0; i < size; i++) { - unsigned char *dst; + if (memp[dst_off + i] != rand_mem[i]) + abort (); + } - memset (p, 0, SIZE + 40); - for (i = 0; i < len; i++) - src[i] = i; - - dst = p + 40 + dst_align; - memmove (dst, src, len); - - for (i = -32; i < 0; i++) - if (dst[i] != 0) - abort(); - for (i = 0; i < len; i++) - if (dst[i] != i) - abort(); - for (i = 32; i >= 0; i--) - if (dst[len + i] != 0) - abort(); - - memset (p, 0, SIZE + 40); - for (i = 0; i < len; i++) - src[i] = i; - - dst = p + 40 + SIZE/3*2 + dst_align; - memmove (dst, src, len); - - for (i = -32; i < 0; i++) - if (dst[i] != 0) - abort(); - for (i = 0; i < len; i++) - if (dst[i] != i) - abort(); - for (i = 32; i >= 0; i--) - if (dst[len + i] != 0) - abort(); + /* Check that the area around the destination is not + clobbered. */ + for (i = 1; i < space_around; i++) + { + if (memp[dst_off - i] != lo_around[i]) + abort (); + if (memp[dst_off + size - 1 + i] != hi_around[i]) + abort (); } } } } - exit (0); + return 0; } diff -Nru glibc-1.01/string/tester.c glibc-1.02/string/tester.c --- glibc-1.01/string/tester.c Wed Jan 23 07:51:46 1991 +++ glibc-1.02/string/tester.c Tue Mar 17 18:58:23 1992 @@ -266,27 +266,27 @@ /* strstr - somewhat like strchr. */ it = "strstr"; - check(strstr("z", "abcd") == NULL, 1); /* Not found. */ - check(strstr("abx", "abcd") == NULL, 2); /* Dead end. */ + check(strstr("abcd", "z") == NULL, 1); /* Not found. */ + check(strstr("abcd", "abx") == NULL, 2); /* Dead end. */ (void) strcpy(one, "abcd"); - check(strstr("c", one) == one+2, 3); /* Basic test. */ - check(strstr("bc", one) == one+1, 4); /* Multichar. */ - check(strstr("d", one) == one+3, 5); /* End of string. */ - check(strstr("cd", one) == one+2, 6); /* Tail of string. */ - check(strstr("abc", one) == one, 7); /* Beginning. */ - check(strstr("abcd", one) == one, 8); /* Exact match. */ - check(strstr("abcde", one) == NULL, 9); /* Too long. */ - check(strstr("de", one) == NULL, 10); /* Past end. */ - check(strstr("", one) == one+4, 11); /* Finding empty. */ + check(strstr(one, "c") == one+2, 3); /* Basic test. */ + check(strstr(one, "bc") == one+1, 4); /* Multichar. */ + check(strstr(one, "d") == one+3, 5); /* End of string. */ + check(strstr(one, "cd") == one+2, 6); /* Tail of string. */ + check(strstr(one, "abc") == one, 7); /* Beginning. */ + check(strstr(one, "abcd") == one, 8); /* Exact match. */ + check(strstr(one, "abcde") == NULL, 9); /* Too long. */ + check(strstr(one, "de") == NULL, 10); /* Past end. */ + check(strstr(one, "") == one+4, 11); /* Finding empty. */ (void) strcpy(one, "ababa"); - check(strstr("ba", one) == one+1, 12); /* Finding first. */ + check(strstr(one, "ba") == one+1, 12); /* Finding first. */ (void) strcpy(one, ""); - check(strstr("b", one) == NULL, 13); /* Empty string. */ - check(strstr("", one) == one, 14); /* Empty in empty string. */ + check(strstr(one, "b") == NULL, 13); /* Empty string. */ + check(strstr(one, "") == one, 14); /* Empty in empty string. */ (void) strcpy(one, "bcbca"); - check(strstr("bca", one) == one+2, 15); /* False start. */ + check(strstr(one, "bca") == one+2, 15); /* False start. */ (void) strcpy(one, "bbbcabbca"); - check(strstr("bbca", one) == one+1, 16); /* With overlap. */ + check(strstr(one, "bbca") == one+1, 16); /* With overlap. */ /* strspn. */ it = "strspn"; diff -Nru glibc-1.01/sysdeps/generic/strstr.c glibc-1.02/sysdeps/generic/strstr.c --- glibc-1.01/sysdeps/generic/strstr.c Wed Jun 12 14:25:08 1991 +++ glibc-1.02/sysdeps/generic/strstr.c Tue Mar 17 18:58:21 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -23,8 +23,9 @@ /* Return the first ocurrence of NEEDLE in HAYSTACK. */ char * -DEFUN(strstr, (needle, haystack), - CONST char *CONST needle AND CONST char *CONST haystack) +DEFUN(strstr, (haystack, needle), + CONST char *CONST haystack AND + CONST char *CONST needle) { register CONST char *CONST needle_end = strchr(needle, '\0'); register CONST char *CONST haystack_end = strchr(haystack, '\0'); diff -Nru glibc-1.01/sysdeps/i386/__longjmp.c glibc-1.02/sysdeps/i386/__longjmp.c --- glibc-1.01/sysdeps/i386/__longjmp.c Wed Mar 11 18:10:35 1992 +++ glibc-1.02/sysdeps/i386/__longjmp.c Thu Mar 12 19:35:27 1992 @@ -19,6 +19,7 @@ #include #include #include +#include #ifndef __GNUC__ @@ -32,15 +33,15 @@ void DEFUN(__longjmp, (env, val), CONST jmp_buf env AND int val) { - register long int bp asm("%ebp"), ax asm("%eax"); + register long int bp asm("bp"), ax asm("ax"); if (env[0].__bp != bp) { - asm("movl %0, %%ebx" : : "g" (env[0].__bx) : "ebx"); - asm("movl %0, %%esi" : : "g" (env[0].__si) : "esi"); - asm("movl %0, %%edi" : : "g" (env[0].__di) : "edi"); - asm("movl %0, %%ebp" : : "g" (env[0].__bp) : "ebp"); - asm("movl %0, %%esp" : : "g" (env[0].__sp) : "esp"); + asm("movl %0, %%ebx" : : "g" (env[0].__bx) : "bx"); + asm("movl %0, %%esi" : : "g" (env[0].__si) : "si"); + asm("movl %0, %%edi" : : "g" (env[0].__di) : "di"); + asm("movl %0, %%ebp" : : "g" (env[0].__bp) : "bp"); + asm("movl %0, %%esp" : : "g" (env[0].__sp) : "sp"); } ax = val == 0 ? 1 : val; diff -Nru glibc-1.01/sysdeps/i386/memchr.c glibc-1.02/sysdeps/i386/memchr.c --- glibc-1.01/sysdeps/i386/memchr.c Wed Mar 11 18:10:26 1992 +++ glibc-1.02/sysdeps/i386/memchr.c Tue Mar 17 18:43:15 1992 @@ -29,14 +29,13 @@ CONST PTR str AND int c AND size_t len) { asm("cld\n" /* Search forward. */ - "orl %2, %2\n" /* Reset zero flag, to handle LEN == 0. */ - "repne\n" /* Search for C. */ + "orl %0,%0\n" /* Reset zero flag, to handle LEN == 0. */ + "repnz\n" /* Search for C. */ "scasb\n" "jz 1f\n" /* Jump if we found something equal to C */ - "xorl %0, %0\n" /* Nothing found. Return NULL. */ - "jmp 2f\n" - "1:leal -1(%2), %0\n" /* edi has been incremented. Return edi-1. */ - "2:" : "=a" (str), "=D" (str) : "c" (len), "1" (str), "a" (c)); + "movl %4,%0\n" /* Nothing found. Return NULL. */ + "1:decl %0" : /* edi has been incremented. Return edi-1. */ + "=D" (str) : "c" (len), "0" (str), "a" (c), "n" (1)); return str; } diff -Nru glibc-1.01/sysdeps/i386/memcopy.h glibc-1.02/sysdeps/i386/memcopy.h --- glibc-1.01/sysdeps/i386/memcopy.h Wed Jun 12 14:25:53 1991 +++ glibc-1.02/sysdeps/i386/memcopy.h Tue Mar 17 18:04:03 1992 @@ -41,7 +41,9 @@ "std\n" \ /* Copy bytes. */ \ "rep\n" \ - "movsb" : \ + "movsb\n" \ + /* Clear the dir flag. Convention says it should be 0. */ \ + "cld" : \ "=D" (dst_ep), "=S" (src_ep) : \ "0" (dst_ep - 1), "1" (src_ep - 1), "c" (nbytes) : \ "cx"); \ @@ -53,7 +55,8 @@ #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \ do \ { \ - asm volatile("cld\n" \ + asm volatile(/* Clear the direction flag, so copying goes forward. */ \ + "cld\n" \ /* Copy longwords. */ \ "rep\n" \ "movsl" : \ @@ -67,11 +70,15 @@ #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \ do \ { \ - asm volatile("std\n" \ + asm volatile(/* Set the direction flag, so copying goes backwards. */ \ + "std\n" \ + /* Copy longwords. */ \ "rep\n" \ - "movsl" : \ + "movsl\n" \ + /* Clear the dir flag. Convention says it should be 0. */ \ + "cld" : \ "=D" (dst_ep), "=S" (src_ep) : \ - "0" (dst_ep - 4), "1" (src_ep - 4), "c" (nbytes) : \ + "0" (dst_ep - 4), "1" (src_ep - 4), "c" ((nbytes) / 4) : \ "cx"); \ dst_ep += 4; \ src_ep += 4; \ diff -Nru glibc-1.01/sysdeps/ieee754/sqrt.c glibc-1.02/sysdeps/ieee754/sqrt.c --- glibc-1.01/sysdeps/ieee754/sqrt.c Fri Mar 6 12:23:30 1992 +++ glibc-1.02/sysdeps/ieee754/sqrt.c Thu Mar 12 20:06:58 1992 @@ -63,7 +63,7 @@ s = 4.0; x -= 1.0; r = 1; - for (i = 1; i <= k; i++) + for (i = 1; i <= 51; i++) { t = s + 1; x *= 4; diff -Nru glibc-1.01/sysdeps/m68k/fl.h glibc-1.02/sysdeps/m68k/fl.h --- glibc-1.01/sysdeps/m68k/fl.h Wed Jun 12 14:27:01 1991 +++ glibc-1.02/sysdeps/m68k/fl.h @@ -1,72 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#ifndef __need_HUGE_VAL - -/* Floating-point constants for 68000s. */ - -#define FLT_RADIX 2 - -#define FLT_ROUNDS _FLT_ROUNDS_TONEAREST - -#define FLT_MANT_DIG 24 -#define DBL_MANT_DIG 53 -#define LDBL_MANT_DIG 53 - -#define FLT_DIG 7 -#define DBL_DIG 15 -#define LDBL_DIG 15 - -#define FLT_MIN_EXP (-127) -#define DBL_MIN_EXP (-1021) -#define LDBL_MIN_EXP (-1021) - -#define FLT_MIN_10_EXP (-36) -#define DBL_MIN_10_EXP (-36) -#define LDBL_MIN_10_EXP (-36) - -#define FLT_MAX_EXP 128 -#define DBL_MAX_EXP 1024 -#define LDBL_MAX_EXP 1024 - -#define FLT_MAX_10_EXP 37 -#define DBL_MAX_10_EXP 37 -#define LDBL_MAX_10_EXP 37 - -#define FLT_MAX 1.701411733192644270e38 -#define DBL_MAX 1.701411733192644270e38 -#define LDBL_MAX 1.701411733192644270e38 - -#define FLT_EPSILON 5.96046e-08 -#define DBL_EPSILON 1.38778e-17 -#define LDBL_EPSILON 1.38778e-17 - -#define FLT_MIN 1.17549e-38 -#define DBL_MIN 2.22507e-308 -#define LDBL_MIN 2.22507e-308 - -#else /* Need HUGE_VAL. */ - -/* Used by and functions for overflow. */ - -/* IEEE infinity. */ -static CONST char __huge_val[] = "\177\360\000\000\000\000\000\000"; - -#define HUGE_VAL (*(CONST double *) __huge_val) - -#endif /* Don't need HUGE_VAL. */ diff -Nru glibc-1.01/sysdeps/m68k/memcopy.h glibc-1.02/sysdeps/m68k/memcopy.h --- glibc-1.01/sysdeps/m68k/memcopy.h Sun Dec 8 18:55:00 1991 +++ glibc-1.02/sysdeps/m68k/memcopy.h Tue Mar 17 11:42:55 1992 @@ -67,24 +67,24 @@ do \ { \ size_t __nblocks = (nbytes) / 32 + 1; \ - switch ((nbytes) % 32 / sizeof (op_t)) \ + switch ((nbytes) / sizeof (op_t) % 8) \ do \ { \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 7: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 6: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 5: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 4: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 3: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 2: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 1: \ - --((op_t *) dst_ep) = --((op_t *) src_ep); \ + *--((op_t *) dst_ep) = *--((op_t *) src_ep); \ case 0: \ __nblocks--; \ } \ diff -Nru glibc-1.01/sysdeps/mach/i386/start.c glibc-1.02/sysdeps/mach/i386/start.c --- glibc-1.01/sysdeps/mach/i386/start.c Wed Mar 11 18:09:12 1992 +++ glibc-1.02/sysdeps/mach/i386/start.c Thu Mar 12 19:20:54 1992 @@ -36,8 +36,8 @@ #endif char **__environ; -extern void EXFUN(__libc_init, (NOARGS)); extern void EXFUN(__mach_init, (NOARGS)); +extern void EXFUN(__libc_init, (int argc, char **argv, char **envp)); extern int EXFUN(main, (int argc, char **argv, char **envp)); extern void *(*_cthread_init_routine) (void); /* Returns new SP to use. */ diff -Nru glibc-1.01/sysdeps/posix/__dup2.c glibc-1.02/sysdeps/posix/__dup2.c --- glibc-1.01/sysdeps/posix/__dup2.c Wed Jun 12 14:29:42 1991 +++ glibc-1.02/sysdeps/posix/__dup2.c Fri Mar 20 00:42:35 1992 @@ -27,15 +27,26 @@ int DEFUN(__dup2, (fd, fd2), int fd AND int fd2) { - if (fd < 0 || fd2 < 0) + int save; + + if (fd2 < 0) { errno = EBADF; return -1; } + /* Check if FD is kosher. */ + if (fcntl (fd, F_GETFL) < 0) + return -1; + if (fd == fd2) - /* No way to check that they are valid. */ return fd2; - return fcntl(fd, F_DUPFD, fd2); + /* This is not atomic. */, 1992 + + save = errno; + (void) close (fd2); + errno = save; + + return fcntl (fd, F_DUPFD, fd2); } diff -Nru glibc-1.01/sysdeps/posix/getenv.c glibc-1.02/sysdeps/posix/getenv.c --- glibc-1.01/sysdeps/posix/getenv.c Wed Jun 12 14:31:01 1991 +++ glibc-1.02/sysdeps/posix/getenv.c Tue Mar 17 16:31:50 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,6 +21,10 @@ #include #include #include + +#ifndef HAVE_GNU_LD +#define __environ environ +#endif /* Return the value of the environment variable NAME. */ char * diff -Nru glibc-1.01/sysdeps/posix/mk-stdiolim.c glibc-1.02/sysdeps/posix/mk-stdiolim.c --- glibc-1.01/sysdeps/posix/mk-stdiolim.c Thu Feb 13 21:56:26 1992 +++ glibc-1.02/sysdeps/posix/mk-stdiolim.c Fri Mar 20 00:46:17 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,7 @@ int main() { - printf("#define L_tmpnam %u\n", sizeof("/usr/tmp") + 8); + printf("#define L_tmpnam %u\n", sizeof("/usr/tmp/") + 8); printf("#define TMP_MAX %u\n", 52 * 52 * 52); puts ("#ifdef __USE_POSIX"); printf("#define L_ctermid %u\n", sizeof("/dev/tty")); diff -Nru glibc-1.01/sysdeps/posix/sysd-stdio.c glibc-1.02/sysdeps/posix/sysd-stdio.c --- glibc-1.01/sysdeps/posix/sysd-stdio.c Fri Mar 6 14:52:55 1992 +++ glibc-1.02/sysdeps/posix/sysd-stdio.c Fri Mar 20 00:49:49 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -90,7 +90,7 @@ /* Move COOKIE's file position *POS bytes, according to WHENCE. - The old file position is stored in *POS. + The current file position is stored in *POS. Returns zero if successful, nonzero if not. */ int DEFUN(__stdio_seek, (cookie, pos, whence), @@ -291,6 +291,6 @@ } if (lenptr != NULL) - *lenptr = len; + *lenptr = len + 1; return buf; } diff -Nru glibc-1.01/sysdeps/posix/system.c glibc-1.02/sysdeps/posix/system.c --- glibc-1.01/sysdeps/posix/system.c Wed Jun 26 12:28:00 1991 +++ glibc-1.02/sysdeps/posix/system.c Fri Mar 13 16:45:09 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -24,6 +24,10 @@ #include #include + +#ifndef HAVE_GNU_LD +#define __environ environ +#endif #define SHELL_PATH "/bin/sh" /* Path of the shell. */ #define SHELL_NAME "sh" /* Name to give it. */ diff -Nru glibc-1.01/sysdeps/rs6000/memcopy.h glibc-1.02/sysdeps/rs6000/memcopy.h --- glibc-1.01/sysdeps/rs6000/memcopy.h Sat Feb 15 12:52:41 1992 +++ glibc-1.02/sysdeps/rs6000/memcopy.h Tue Mar 17 11:13:33 1992 @@ -39,7 +39,7 @@ #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \ do \ { \ - size_t __nbytes; \ + size_t __nbytes = (nbytes); \ dst_ep -= __nbytes; \ src_ep -= __nbytes; \ asm volatile("mtspr 1,%2\n" \ diff -Nru glibc-1.01/sysdeps/stub/fcntlbits.h glibc-1.02/sysdeps/stub/fcntlbits.h --- glibc-1.01/sysdeps/stub/fcntlbits.h +++ glibc-1.02/sysdeps/stub/fcntlbits.h Tue Mar 17 19:21:01 1992 @@ -0,0 +1,61 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* These values should be changed as appropriate for your system. */ + +#ifndef _GNU_FCNTL_H + +#define _GNU_FCNTL_H 1 + + +#include + + +/* Values for the second argument to fcntl. */ +#define __F_DUPFD 0 /* Duplicate file descriptor. */ +#define __F_GETFD 1 /* Get file descriptor flags. */ +#define __F_SETFD 2 /* Set file descriptor flags. */ +#define __F_GETFL 3 /* Get file status flags. */ +#define __F_SETFL 4 /* Set file status flags. */ +#define __F_GETOWN 5 /* Get owner (receiver of SIGIO). */ +#define __F_SETOWN 6 /* Set owner (receiver of SIGIO). */ +#define __F_GETLK 7 /* Get record locking info. */ +#define __F_SETLK 8 /* Set record locking info. */ +#define __F_SETLKW 9 /* Set record locking info, wait. */ + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define __FD_CLOEXEC 1 /* Close on exec. */ + + +/* The structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct __flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; + +#define __F_RDLCK 1 /* Read lock. */ +#define __F_WRLCK 2 /* Write lock. */ +#define __F_UNLCK 3 /* Remove lock. */ + + +#endif /* gnu/fcntl.h */ diff -Nru glibc-1.01/sysdeps/stub/gtty.c glibc-1.02/sysdeps/stub/gtty.c --- glibc-1.01/sysdeps/stub/gtty.c Wed Jun 12 15:13:00 1991 +++ glibc-1.02/sysdeps/stub/gtty.c Sat Mar 14 23:13:50 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include #include #include +#include /* Fill in *PARAMS with terminal parameters associated with FD. */ int diff -Nru glibc-1.01/sysdeps/stub/stty.c glibc-1.02/sysdeps/stub/stty.c --- glibc-1.01/sysdeps/stub/stty.c Wed Jun 12 15:17:32 1991 +++ glibc-1.02/sysdeps/stub/stty.c Sat Mar 14 23:13:48 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include #include #include +#include /* Set the terminal parameters associated with FD to *PARAMS. */ int diff -Nru glibc-1.01/sysdeps/stub/sysd-stdio.c glibc-1.02/sysdeps/stub/sysd-stdio.c --- glibc-1.01/sysdeps/stub/sysd-stdio.c Sun Mar 8 15:45:35 1992 +++ glibc-1.02/sysdeps/stub/sysd-stdio.c Fri Mar 20 00:49:45 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,7 +42,7 @@ } /* Move COOKIE's file position *POS bytes, according to WHENCE. - The old file position is stored in *POS. + The current file position is stored in *POS. Returns zero if successful, nonzero if not. */ int DEFUN(__stdio_seek, (cookie, pos, whence), diff -Nru glibc-1.01/sysdeps/unix/Dist glibc-1.02/sysdeps/unix/Dist --- glibc-1.01/sysdeps/unix/Dist Thu Feb 13 23:38:23 1992 +++ glibc-1.02/sysdeps/unix/Dist Sun Mar 15 00:18:40 1992 @@ -1,3 +1,3 @@ errnos-tmpl.c errnos.awk ioctls-tmpl.c ioctls.awk snarf-ioctls -make_errlist.c make_siglist.c +make_errlist.c diff -Nru glibc-1.01/sysdeps/unix/Makefile glibc-1.02/sysdeps/unix/Makefile --- glibc-1.01/sysdeps/unix/Makefile Thu Mar 5 17:30:11 1992 +++ glibc-1.02/sysdeps/unix/Makefile Sun Mar 15 00:19:42 1992 @@ -33,7 +33,7 @@ mv $@-tmp $@ $(objpfx)errnos: $(wildcard /usr/include/errno.h /usr/include/sys/errno.h) - cat $^ | sed -n 's/^#define[ ]*\(E[A-Z0-9]*\).*$$/\1/p' > $@-tmp + cat $^ | sed -n 's/^#define[ ]*\(E[A-Z0-9]*\)[ ]*[0-9][0-9]*[ ]*.*$$/\1/p' > $@-tmp mv $@-tmp $@ ifeq ($(subdir),misc) @@ -74,21 +74,13 @@ ifeq ($(subdir),stdio) -before-compile: $(objpfx)errlist.c $(objpfx)siglist.c +before-compile: $(objpfx)errlist.c $(objpfx)errlist.c: $(objpfx)make_errlist @rm -f $@ $< > $@-tmp mv $@-tmp $@ -$(objpfx)siglist.c: $(objpfx)make_siglist - @rm -f $@ - $< > $@-tmp - mv $@-tmp $@ - $(objpfx)make_errlist: $(sysdep_dir)/unix/make_errlist.c - $(CC) $< -o $@ - -$(objpfx)make_siglist: $(sysdep_dir)/unix/make_siglist.c $(CC) $< -o $@ endif diff -Nru glibc-1.01/sysdeps/unix/bsd/Dist glibc-1.02/sysdeps/unix/bsd/Dist --- glibc-1.01/sysdeps/unix/bsd/Dist Thu Feb 13 23:38:22 1992 +++ glibc-1.02/sysdeps/unix/bsd/Dist Sun Mar 15 00:18:30 1992 @@ -1,2 +1,2 @@ make-local_lim.c bsddir.h bsd_getgrp.S bsdtty.h -glue-ctype.c +glue-ctype.c make_siglist.c diff -Nru glibc-1.01/sysdeps/unix/bsd/Makefile glibc-1.02/sysdeps/unix/bsd/Makefile --- glibc-1.01/sysdeps/unix/bsd/Makefile Fri Feb 14 06:33:53 1992 +++ glibc-1.02/sysdeps/unix/bsd/Makefile Tue Mar 17 18:10:04 1992 @@ -41,3 +41,16 @@ $(CC) $< -o $@ endif + +ifeq ($(subdir),stdio) + +before-compile: $(objpfx)siglist.c +$(objpfx)siglist.c: $(objpfx)make_siglist + @rm -f $@ + $< > $@-tmp + mv $@-tmp $@ + +$(objpfx)make_siglist: $(sysdep_dir)/unix/bsd/make_siglist.c + $(CC) $< -o $@ + +endif diff -Nru glibc-1.01/sysdeps/unix/bsd/__sigproc.c glibc-1.02/sysdeps/unix/bsd/__sigproc.c --- glibc-1.01/sysdeps/unix/bsd/__sigproc.c Wed Jun 12 20:18:32 1991 +++ glibc-1.02/sysdeps/unix/bsd/__sigproc.c Tue Mar 17 16:38:22 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -41,7 +41,7 @@ break; case SIG_UNBLOCK: - mask &= ~__sigblock(0); + mask = __sigblock (0) & ~mask; /* Fall through. */ case SIG_SETMASK: diff -Nru glibc-1.01/sysdeps/unix/bsd/fcntlbits.h glibc-1.02/sysdeps/unix/bsd/fcntlbits.h --- glibc-1.01/sysdeps/unix/bsd/fcntlbits.h +++ glibc-1.02/sysdeps/unix/bsd/fcntlbits.h Mon Feb 17 02:58:25 1992 @@ -0,0 +1,59 @@ +/* Copyright (C) 1991 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _GNU_FCNTL_H + +#define _GNU_FCNTL_H 1 + + +#include + + +/* Values for the second argument to fcntl. */ +#define __F_DUPFD 0 /* Duplicate file descriptor. */ +#define __F_GETFD 1 /* Get file descriptor flags. */ +#define __F_SETFD 2 /* Set file descriptor flags. */ +#define __F_GETFL 3 /* Get file status flags. */ +#define __F_SETFL 4 /* Set file status flags. */ +#define __F_GETOWN 5 /* Get owner (receiver of SIGIO). */ +#define __F_SETOWN 6 /* Set owner (receiver of SIGIO). */ +#define __F_GETLK 7 /* Get record locking info. */ +#define __F_SETLK 8 /* Set record locking info. */ +#define __F_SETLKW 9 /* Set record locking info, wait. */ + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define __FD_CLOEXEC 1 /* Close on exec. */ + + +/* The structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct __flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; + +#define __F_RDLCK 1 /* Read lock. */ +#define __F_WRLCK 2 /* Write lock. */ +#define __F_UNLCK 3 /* Remove lock. */ + + +#endif /* gnu/fcntl.h */ diff -Nru glibc-1.01/sysdeps/unix/bsd/make_siglist.c glibc-1.02/sysdeps/unix/bsd/make_siglist.c --- glibc-1.01/sysdeps/unix/bsd/make_siglist.c +++ glibc-1.02/sysdeps/unix/bsd/make_siglist.c Wed Jun 12 15:35:14 1991 @@ -0,0 +1,43 @@ +/* Copyright (C) 1991 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, 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 General Public License for more details. + +You should have received a copy of the GNU General Public License +along with the GNU C Library; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#include +#include + + +/* Make a definition for sys_siglist. */ + +extern char *sys_siglist[]; + +int +main() +{ + register int i; + + puts("#include \"ansidecl.h\"\n#include \n"); + + puts("\n/* This is a list of all known signal numbers. */"); + + puts("\nCONST char *CONST _sys_siglist[] =\n {"); + + for (i = 0; i < NSIG; ++i) + printf(" \"%s\",\n", sys_siglist[i]); + + puts(" NULL\n };\n"); + + exit(0); +} diff -Nru glibc-1.01/sysdeps/unix/bsd/sun/sun4/__sigvec.S glibc-1.02/sysdeps/unix/bsd/sun/sun4/__sigvec.S --- glibc-1.01/sysdeps/unix/bsd/sun/sun4/__sigvec.S Sat Jul 27 22:22:30 1991 +++ glibc-1.02/sysdeps/unix/bsd/sun/sun4/__sigvec.S Sat Mar 14 23:13:44 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -18,7 +18,7 @@ #include -/* __sigvec is defined by tramp_sigvec.c. */ +/* __sigvec is defined by sigtramp.c. */ PSEUDO (__raw_sigvec, sigvec) ret diff -Nru glibc-1.01/sysdeps/unix/errlist.c glibc-1.02/sysdeps/unix/errlist.c --- glibc-1.01/sysdeps/unix/errlist.c Mon Oct 1 16:47:22 1990 +++ glibc-1.02/sysdeps/unix/errlist.c @@ -1,92 +0,0 @@ -#include -#include - - -/* This is a list of all known `errno' codes. */ - -CONST int _sys_nerr = 80; - -CONST char *CONST _sys_errlist[] = - { - "Error 0", - "Not owner", - "No such file or directory", - "No such process", - "Interrupted system call", - "I/O error", - "No such device or address", - "Arg list too long", - "Exec format error", - "Bad file number", - "No children", - "No more processes", - "Not enough memory", - "Permission denied", - "Bad address", - "Block device required", - "Device busy", - "File exists", - "Cross-device link", - "No such device", - "Not a directory", - "Is a directory", - "Invalid argument", - "File table overflow", - "Too many open files", - "Inappropriate ioctl for device", - "Text file busy", - "File too large", - "No space left on device", - "Illegal seek", - "Read-only file system", - "Too many links", - "Broken pipe", - "Argument too large", - "Result too large", - "Operation would block", - "Operation now in progress", - "Operation already in progress", - "Socket operation on non-socket", - "Destination address required", - "Message too long", - "Protocol wrong type for socket", - "Option not supported by protocol", - "Protocol not supported", - "Socket type not supported", - "Operation not supported on socket", - "Protocol family not supported", - "Address family not supported by protocol family", - "Address already in use", - "Can't assign requested address", - "Network is down", - "Network is unreachable", - "Network dropped connection on reset", - "Software caused connection abort", - "Connection reset by peer", - "No buffer space available", - "Socket is already connected", - "Socket is not connected", - "Can't send after socket shutdown", - "Too many references: can't splice", - "Connection timed out", - "Connection refused", - "Too many levels of symbolic links", - "File name too long", - "Host is down", - "Host is unreachable", - "Directory not empty", - "Too many processes", - "Too many users", - "Disc quota exceeded", - "Stale NFS file handle", - "Too many levels of remote in path", - "Error 72", - "Error 73", - "Error 74", - "No message of desired type", - "Not a data message", - "Identifier removed", - "Deadlock situation detected/avoided", - "No record locks available", - NULL - }; diff -Nru glibc-1.01/sysdeps/unix/i386/start.c glibc-1.02/sysdeps/unix/i386/start.c --- glibc-1.01/sysdeps/unix/i386/start.c Tue Jan 14 22:02:10 1992 +++ glibc-1.02/sysdeps/unix/i386/start.c Fri Mar 20 00:50:40 1992 @@ -1,2 +1,2 @@ #define DUMMIES dummy0 -#include <../sysdeps/unix/start.c> +#include diff -Nru glibc-1.01/sysdeps/unix/make_siglist.c glibc-1.02/sysdeps/unix/make_siglist.c --- glibc-1.01/sysdeps/unix/make_siglist.c Wed Jun 12 15:35:14 1991 +++ glibc-1.02/sysdeps/unix/make_siglist.c @@ -1,43 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, 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 General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the GNU C Library; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include - - -/* Make a definition for sys_siglist. */ - -extern char *sys_siglist[]; - -int -main() -{ - register int i; - - puts("#include \"ansidecl.h\"\n#include \n"); - - puts("\n/* This is a list of all known signal numbers. */"); - - puts("\nCONST char *CONST _sys_siglist[] =\n {"); - - for (i = 0; i < NSIG; ++i) - printf(" \"%s\",\n", sys_siglist[i]); - - puts(" NULL\n };\n"); - - exit(0); -} diff -Nru glibc-1.01/sysdeps/unix/snarf-ioctls glibc-1.02/sysdeps/unix/snarf-ioctls --- glibc-1.01/sysdeps/unix/snarf-ioctls Fri Jan 18 04:41:42 1991 +++ glibc-1.02/sysdeps/unix/snarf-ioctls Thu Mar 12 16:21:56 1992 @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 1991 Free Software Foundation, Inc. +# Copyright (C) 1991, 1992 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or modify @@ -19,5 +19,17 @@ for file in $*; do sed -n 's/^#define[ ]*\([A-Z][A-Z0-9_]*\)[ ][ ]*[^ ].*$/\1/p' \ < $file - $0 `sed -n 's,^#include[ ]*<\(.*\)>.*$,/usr/include/\1,p' < $file` + + snarfexclude="$snarfexclude \ + `echo $file | sed -e 's,/,\\\\/,g' -e 's,^.*$,-e /&/d,'`" + export snarfexclude + + included="`sed -n < $file \ + -e 's,^#include[ ]*<\(.*\)>.*$,/usr/include/\1,p' \ + | sed $snarfexclude`" + if [ "$included" ]; then + $0 $included + fi done + +exit 0 diff -Nru glibc-1.01/sysdeps/unix/sysdep.h glibc-1.02/sysdeps/unix/sysdep.h --- glibc-1.01/sysdeps/unix/sysdep.h Wed Jun 19 13:07:38 1991 +++ glibc-1.02/sysdeps/unix/sysdep.h Sun Mar 15 00:20:00 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,6 +34,6 @@ as the return instruction. */ -#ifndef __GNU_STAB__ +#ifndef HAVE_GNU_LD #define ___errno _errno #endif diff -Nru glibc-1.01/sysdeps/unix/sysv/__fstat.c glibc-1.02/sysdeps/unix/sysv/__fstat.c --- glibc-1.01/sysdeps/unix/sysv/__fstat.c Mon Feb 17 04:16:11 1992 +++ glibc-1.02/sysdeps/unix/sysv/__fstat.c Sat Mar 14 23:13:51 1992 @@ -20,6 +20,7 @@ #include #include #include +#include "sysv_stat.h" /* Get information about the file descriptor FD in BUF. */ int diff -Nru glibc-1.01/sysdeps/unix/sysv/fcntlbits.h glibc-1.02/sysdeps/unix/sysv/fcntlbits.h --- glibc-1.01/sysdeps/unix/sysv/fcntlbits.h +++ glibc-1.02/sysdeps/unix/sysv/fcntlbits.h Tue Mar 17 19:21:54 1992 @@ -0,0 +1,61 @@ +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* These values should be changed as appropriate for your system. */ + +#ifndef _GNU_FCNTL_H + +#define _GNU_FCNTL_H 1 + + +#include + + +/* Values for the second argument to fcntl. */ +#define __F_DUPFD 0 /* Duplicate file descriptor. */ +#define __F_GETFD 1 /* Get file descriptor flags. */ +#define __F_SETFD 2 /* Set file descriptor flags. */ +#define __F_GETFL 3 /* Get file status flags. */ +#define __F_SETFL 4 /* Set file status flags. */ +#define __F_GETOWN 8 /* Get owner (receiver of SIGIO). */ +#define __F_SETOWN 9 /* Set owner (receiver of SIGIO). */ +#define __F_GETLK 5 /* Get record locking info. */ +#define __F_SETLK 6 /* Set record locking info. */ +#define __F_SETLKW 7 /* Set record locking info, wait. */ + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define __FD_CLOEXEC 1 /* Close on exec. */ + + +/* The structure describing an advisory lock. This is the type of the third + argument to `fcntl' for the F_GETLK, F_SETLK, and F_SETLKW requests. */ +struct __flock + { + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ + __pid_t l_pid; /* Process holding the lock. */ + }; + +#define __F_RDLCK 1 /* Read lock. */ +#define __F_WRLCK 2 /* Write lock. */ +#define __F_UNLCK 3 /* Remove lock. */ + + +#endif /* gnu/fcntl.h */ diff -Nru glibc-1.01/sysdeps/vax/__infnan.c glibc-1.02/sysdeps/vax/__infnan.c --- glibc-1.01/sysdeps/vax/__infnan.c Wed Jun 12 17:47:58 1991 +++ glibc-1.02/sysdeps/vax/__infnan.c Sun Mar 15 17:51:19 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -17,7 +17,7 @@ Cambridge, MA 02139, USA. */ #ifndef __GNUC__ -#include <../sysdeps/generic/infnan.c> + #error This file uses GNU C extensions; you must compile with GCC. #else #include diff -Nru glibc-1.01/time/Makefile glibc-1.02/time/Makefile --- glibc-1.01/time/Makefile Thu Mar 5 16:36:08 1992 +++ glibc-1.02/time/Makefile Mon Mar 16 05:17:59 1992 @@ -22,7 +22,7 @@ subdir := time headers := time.h sys/time.h gnu/time.h -distribute := tzfile.h +distribute := tzfile.h private.h scheck.c ialloc.c emkdir.c routines := offtime asctime clock ctime difftime gmtime \ localtime mktime strftime time __tzset tzfile \ @@ -31,8 +31,65 @@ __setitmr tzset gettod setitmr aux := syms-time -others := ap zdump +others := ap zdump zic tests := test_time +tzfiles := africa antarctica asia australasia europe northamerica \ + southamerica pacificnew etcetera factory systemv +distribute := $(distribute) $(tzfiles) leapseconds +install := zic zdump + +define \n + + +endef +include zonenames +zonenames := $(subst $(\n), ,$(zonenames)) + +include ../Makeconfig +ifdef localtime +zonenames := $(zonenames) localtime +endif + +install-data := $(addprefix zoneinfo/,$(zonenames)) + + include ../Rules + + +$(tzfiles:%=zones-%): zones-%: % + (echo 'define $*-zones' ;\ + awk '$$1 == "Zone" { print $$2 } $$1 == "Link" { print $$3 }' $^;\ + echo 'endef' ;\ + echo '$*-zones := $$(subst $$(\\n), ,$$($*-zones))' ;\ + echo 'ifdef $*-zones' ;\ + echo '$$(addprefix %/,$$($*-zones)): \' ;\ + echo '$< $$(objpfx)zic leapseconds zoneinfo/' ;\ + echo ' $$(tzcompile)' ;\ + echo 'endif' ;\ + ) > $@ +zonenames: Makefile + (for file in $(tzfiles); do \ + echo "include zones-$$file"; \ + done) > $@ + +# Make all the zoneinfo files. +.PHONY: zones zoneinfo +zones: zoneinfo +zoneinfo: $(foreach file,$(tzfiles),$(addprefix zoneinfo/,$($(file)-zones))) + +define tzcompile +$(word 2,$^) -d zoneinfo -L $(word 3,$^) $< +endef + +ifdef localtime +zoneinfo/localtime: zoneinfo/$(localtime) $(objpfx)zic + $(word 2,$^) -d zoneinfo -l $(<:zoneinfo/%=%) +zoneinfo: zoneinfo/localtime +endif + +$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o $(objpfx)emkdir.o + +$(objpfx)tzfile.o: tzfile.c + $(COMPILE.c) -DTZDIR='"$(datadir)/zoneinfo"' $< $(OUTPUT_OPTION) diff -Nru glibc-1.01/time/__tzset.c glibc-1.02/time/__tzset.c --- glibc-1.01/time/__tzset.c Tue Feb 25 23:26:04 1992 +++ glibc-1.02/time/__tzset.c Fri Mar 13 16:36:33 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -81,7 +81,7 @@ tz = getenv("TZ"); - if (*tz == ':') + if (tz != NULL && *tz == ':') { __tzfile_read(tz + 1); if (__use_tzfile) diff -Nru glibc-1.01/time/adjtime.c glibc-1.02/time/adjtime.c --- glibc-1.01/time/adjtime.c Wed Jun 12 17:48:19 1991 +++ glibc-1.02/time/adjtime.c Fri Mar 13 16:36:21 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,6 +25,6 @@ #include function_alias(adjtime, __adjtime, int, (delta, olddelta), - DEFUN(__adjtime, (delta, olddelta), + DEFUN(adjtime, (delta, olddelta), CONST struct timeval *delta AND struct timeval *olddelta)) diff -Nru glibc-1.01/time/africa glibc-1.02/time/africa --- glibc-1.01/time/africa +++ glibc-1.02/time/africa Mon Sep 9 22:26:24 1991 @@ -0,0 +1,43 @@ +# @(#)africa 7.1 + +############################################################################### + +# Egypt + +# From Bob Devine (January 28, 1988): +# Egypt: DST from first day of May to first of October (ending may +# also be on Sept 30th not 31st -- you might want to ask one of the +# soc.* groups, you might hit someone who could ask an embassy). +# DST since 1960 except for 1981-82. + +# From U. S. Naval Observatory (January 19, 1989): +# EGYPT 2 H AHEAD OF UTC +# EGYPT 3 H AHEAD OF UTC MAY 17 - SEP 30 (AFTER +# EGYPT RAMADAN) + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Egypt 1960 max - May 1 2:00 1:00 " DST" +Rule Egypt 1960 max - Oct 1 2:00 0 - + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Egypt 2:00 Egypt EET%s 1981 + 2:00 - EET 1983 + 2:00 Egypt EET%s + +############################################################################### + +# Libya + +# From Bob Devine (January 28 1988): +# Libya: Since 1982 April 1st to September 30th (?) + +# From U. S. Naval Observatory (January 19, 1989): +# LIBYAN ARAB 1 H AHEAD OF UTC JAMAHIRIYA/LIBYA +# LIBYAN ARAB 2 H AHEAD OF UTC APR 1 - SEP 30 JAMAHIRIYA/LIBYA + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Libya 1982 max - Apr 1 2:00 1:00 " DST" +Rule Libya 1982 max - Sep 30 2:00 0 - + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Libya 2:00 Libya EET%s diff -Nru glibc-1.01/time/antarctica glibc-1.02/time/antarctica --- glibc-1.01/time/antarctica +++ glibc-1.02/time/antarctica Mon Sep 9 22:26:24 1991 @@ -0,0 +1,4 @@ +# @(#)antarctica 7.1 + +# From Arthur David Olson (February 13, 1988): +# No data available. diff -Nru glibc-1.01/time/asia glibc-1.02/time/asia --- glibc-1.01/time/asia +++ glibc-1.02/time/asia Mon Sep 9 22:26:25 1991 @@ -0,0 +1,134 @@ +# @(#)asia 7.1 + +# From Guy Harris: +# Incorporates data for Singapore from Robert Elz' asia 1.1, as well as +# additional information from Tom Yap, Sun Microsystems Intercontinental +# Technical Support (including a page from the Official Airline Guide - +# Worldwide Edition). The names for time zones are guesses. + +############################################################################### + +# People's Republic of China + +# From Guy Harris: +# People's Republic of China. Yes, they really have only one time zone. + +# From Bob Devine (January 28, 1988): +# No they don't. See TIME mag, February 17, 1986 p.52. Even though +# China is across 4 physical time zones, before Feb 1, 1986 only the +# Peking (Bejing) time zone was recognized. Since that date, China +# has two of 'em -- Peking's and Urumqi (named after the capital of +# the Xinjiang Uighur Autonomous Region). I don't know about DST for it. +# +# . . .I just deleted the DST table and this editor makes it too +# painful to suck in another copy.. So, here is what I have for +# DST start/end dates for Peking's time zone (info from AP): +# +# 1986 May 4 - Sept 14 +# 1987 mid-April - ?? + +# From U. S. Naval Observatory (January 19, 1989): +# CHINA 8 H AHEAD OF UTC ALL OF CHINA, INCL TAIWAN +# CHINA 9 H AHEAD OF UTC APR 17 - SEP 10 + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule PRC 1970 max - Apr Sun<=14 2:00 1:00 D +Rule PRC 1970 max - Sep Sun<=14 3:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone PRC 8:00 PRC C%sT + +############################################################################### + +# Republic of China + +# From Guy Harris + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone ROC 8:00 - CST + +############################################################################### + +# Hongkong + +# From Guy Harris + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Hongkong 8:00 - HKT + +############################################################################### + +# Iran + +# From Bob Devine (January 28, 1988): +# Iran: Last Sunday in March to third (?) Sunday in +# September. Since the revolution, the official calendar is Monarchic +# calendar; I have no idea what the correspondence between dates are. + +# From U. S. Naval Observatory (January 19, 1989): +# IRAN 3.5H AHEAD OF UTC + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Iran 1988 max - Mar lastSun 2:00 1:00 D +Rule Iran 1988 max - Sep Sun>=15 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Iran 3:30 Iran I%sT + +############################################################################### + +# Israel + +# From U. S. Naval Observatory (January 19, 1989): +# ISRAEL 2 H AHEAD OF UTC +# ISRAEL 3 H AHEAD OF UTC APR 10 - SEP 3 + +# From Arthur David Olson (January 21, 1989): +# Stick with rules below (which were provided by Guy Harris and which were +# posted in 1988) for now. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Israel 1987 max - Apr Sun<=21 2:00 1:00 D +Rule Israel 1987 max - Aug Sat<=28 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Israel 3:00 Israel I%sT + +############################################################################### + +# Japan + +# From Guy Harris + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Japan 9:00 - JST + +############################################################################### + +# Republic of Korea + +# From Guy Harris: +# According to someone at the Korean Times in San Francisco, +# Daylight Savings Time was not observed until 1987. He did not know +# at what time of day DST starts or ends. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule ROK 1987 max - May Sun<=14 2:00 1:00 D +Rule ROK 1987 max - Oct Sun<=14 3:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone ROK 9:00 ROK K%sT + +############################################################################### + +# Lebanon + +# From Bob Devine (January 28, 1988): +# Lebanon: They do have DST but I don't know the dates. + +############################################################################### + +# Singapore + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Singapore 8:00 - SST diff -Nru glibc-1.01/time/australasia glibc-1.02/time/australasia --- glibc-1.01/time/australasia +++ glibc-1.02/time/australasia Mon Sep 9 22:26:27 1991 @@ -0,0 +1,100 @@ +# @(#)australasia 7.1 + +# Incorporates updates for Australia from Robert Elz' australia 1.1 +# and further updates from the Australian consulate. + +############################################################################### + +# Australia + +# Australian Data (for states with DST), standard rules +# Includes shift in 1987 to follow Vic/NSW rules for ending DST, +# and shift in 1986 to start DST earlier. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Oz 1971 1985 - Oct lastSun 2:00 1:00 - +Rule Oz 1986 max - Oct Sun<=24 2:00 1:00 - +Rule Oz 1972 only - Feb 27 3:00 0 - +Rule Oz 1973 1986 - Mar Sun>=1 3:00 0 - +Rule Oz 1987 max - Mar Sun<=21 3:00 0 - + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Australia/Tasmania 10:00 Oz EST +Zone Australia/Queensland 10:00 - EST # No DST here +Zone Australia/North 9:30 - CST # No DST here +Zone Australia/West 8:00 - WST # No DST here +Zone Australia/South 9:30 Oz CST + +# Victoria jumped to a later ending date for DST in 1986 rather than 1987. + +Zone Australia/Victoria 10:00 Oz EST 1985 Oct lastSun 2:00 + 10:00 1:00 EST 1986 Mar Sun<=21 3:00 + 10:00 Oz EST + +# New South Wales and subjurisdictions have their own ideas of a fun time. +# Based on law library research by John Mackin (john@basser.cs.su.oz), +# who notes: +# In Australia, time is not legislated federally, but rather by the +# individual states. Thus, while such terms as ``Eastern Standard Time'' +# [I mean, of course, Australian EST, not any other kind] are in common +# use, _they have NO REAL MEANING_, as they are not defined in the +# legislation. This is very important to understand. +# I have researched New South Wales time only; . . .I hope that perhaps a +# resident of each state could be found to do it for their own state. +# (And I can guarantee that Victoria and NSW are different, so the link +# between them in the current australasia file must be broken.) + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule NSW 1971 1985 - Oct lastSun 2:00 1:00 - +Rule NSW 1972 only - Feb lastSun 3:00 0 - +Rule NSW 1973 1981 - Mar Sun>=1 3:00 0 - +Rule NSW 1982 only - Apr 4 3:00 0 - +Rule NSW 1983 1985 - Mar Sun>=1 3:00 0 - +Rule NSW 1986 only - Mar 16 3:00 0 - +Rule NSW 1986 only - Oct 19 2:00 1:00 - +Rule NSW 1987 only - Mar 15 3:00 0 - +Rule NSW 1987 max - Oct lastSun 2:00 1:00 - +Rule NSW 1988 max - Mar Sun<=21 3:00 0 - + +# Zone NAME GMTOFF RULES FORMAT [UNTIL] +Zone Australia/NSW 10:00 NSW EST +# `Broken Hill' means the County of Yancowinna. [john@basser.cs.su.oz.au,1/4/89] +Zone Australia/Yancowinna 9:30 NSW ??? +Zone Australia/LHI 10:30 NSW ??? + +# A footnote here: +# +# . . . +# Date: Thu, j19 Feb 87 12:02:17 EST +# From: Bradley White +# . . . +# I am including a description of Australian time zones. . . +# this stuff is definitely accurate. +# . . . +# a) Australian Eastern Time: (EST = GMT+10:00, EDT = GMT+11:00) +# . . . +# Summer of 86/87 - present (current legislation): +# third Sun Oct 02:00 EST -> third [S]un Mar 02:00 EST +# +# If this turns out to be true, substitute Sun<=21 (third Sunday in October) +# for Sun<=24 (next-to-last Sunday in October) above. . .some time before +# October 1988, the first time it makes a difference. + +############################################################################### + +# New Zealand + +# New Zealand, from Elz' asia 1.1 +# Elz says "no guarantees" + +# From U. S. Naval Observatory (January 19, 1989): +# NEW ZEALAND 12 H AHEAD OF UTC (EXCLUDING CHATHAM ISLAND) +# NEW ZEALAND 13 H AHEAD OF UTC OCT 30, '88-MAR 4, '89 +# NEW ZEALAND 12H45M AHEAD OF UTC CHATHAM ISLAND + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule NZ 1974 max - Oct lastSun 2:00 1:00 D +Rule NZ 1975 max - Mar Sun>=1 3:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone NZ 12:00 NZ NZ%sT # New Zealand diff -Nru glibc-1.01/time/emkdir.c glibc-1.02/time/emkdir.c --- glibc-1.01/time/emkdir.c +++ glibc-1.02/time/emkdir.c Sun Mar 15 15:29:23 1992 @@ -0,0 +1,87 @@ +#ifdef LIBC +#include +#endif + +#ifndef lint +#ifndef NOID +static char elsieid[] = "@(#)emkdir.c 8.20"; +#endif /* !defined NOID */ +#endif /* !defined lint */ + +#ifndef emkdir + +/*LINTLIBRARY*/ + +#include "private.h" + +extern char * imalloc P((int n)); +extern void ifree P((char * p)); + +static char * +quoted(name) +register const char * name; +{ + register char * result; + register char * cp; + register int c; + + if (name == NULL) + name = ""; + result = imalloc(4 * strlen(name) + 3); + if (result == NULL) + return NULL; + cp = result; +#ifdef unix + *cp++ = '\''; + while ((c = *name++) != '\0') + if (c == '\'') { + *cp++ = c; + *cp++ = '\\'; + *cp++ = c; + *cp++ = c; + } else *cp++ = c; + *cp++ = '\''; +#else /* !defined unix */ + while ((c = *name++) != '\0') + if (c == '/') + *cp++ = '\\'; + else *cp++ = c; +#endif /* !defined unix */ + *cp = '\0'; + return result; +} + +int +emkdir(name, mode) +const char * name; +const int mode; +{ + register int result; + register const char * format; + register char * command; + register char * qname; + + if ((qname = quoted(name)) == NULL) + return -1; +#ifdef unix + format = "mkdir 2>&- %s && chmod 2>&- %o %s"; +#else /* !defined unix */ + format = "mkdir %s"; +#endif /* !defined unix */ + command = imalloc(strlen(format) + 2 * strlen(qname) + 20 + 1); + if (command == NULL) { + ifree(qname); + return -1; + } + (void) sprintf(command, format, qname, mode, qname); + ifree(qname); + result = system(command); + ifree(command); + return (result == 0) ? 0 : -1; +} + +/* +** UNIX is a registered trademark of AT&T. +*/ + +#endif /* !defined emkdir */ diff -Nru glibc-1.01/time/etcetera glibc-1.02/time/etcetera --- glibc-1.01/time/etcetera +++ glibc-1.02/time/etcetera Mon Sep 9 22:26:33 1991 @@ -0,0 +1,55 @@ +# @(#)etcetera 7.1 + +# All of these are set up just so people can "zic -l" to a timezone +# that's right for their area, even if it doesn't have a name or dst rules +# (half hour zones are too much to bother with -- when someone asks!) + +Zone GMT 0 - GMT + +Zone GMT-12 -12 - GMT-1200 +Zone GMT-11 -11 - GMT-1100 +Zone GMT-10 -10 - GMT-1000 +Zone GMT-9 -9 - GMT-0900 +Zone GMT-8 -8 - GMT-0800 +Zone GMT-7 -7 - GMT-0700 +Zone GMT-6 -6 - GMT-0600 +Zone GMT-5 -5 - GMT-0500 +Zone GMT-4 -4 - GMT-0400 +Zone GMT-3 -3 - GMT-0300 +Zone GMT-2 -2 - GMT-0200 +Zone GMT-1 -1 - GMT-0100 +Zone GMT+1 1 - GMT+0100 +Zone GMT+2 2 - GMT+0200 +Zone GMT+3 3 - GMT+0300 +Zone GMT+4 4 - GMT+0400 +Zone GMT+5 5 - GMT+0500 +Zone GMT+6 6 - GMT+0600 +Zone GMT+7 7 - GMT+0700 +Zone GMT+8 8 - GMT+0800 +Zone GMT+9 9 - GMT+0900 +Zone GMT+10 10 - GMT+1000 +Zone GMT+11 11 - GMT+1100 +Zone GMT+12 12 - GMT+1200 +Zone GMT+13 13 - GMT+1300 # GMT+12 with DST + +Link GMT UTC +Link GMT UCT +Link GMT Universal +Link GMT Greenwich +Link GMT Zulu +Link GMT GMT-0 +Link GMT GMT+0 +Link GMT GMT0 +Link GMT+1 GMT1 +Link GMT+2 GMT2 +Link GMT+3 GMT3 +Link GMT+4 GMT4 +Link GMT+5 GMT5 +Link GMT+6 GMT6 +Link GMT+7 GMT7 +Link GMT+8 GMT8 +Link GMT+9 GMT9 +Link GMT+10 GMT10 +Link GMT+11 GMT11 +Link GMT+12 GMT12 +Link GMT+13 GMT13 diff -Nru glibc-1.01/time/europe glibc-1.02/time/europe --- glibc-1.01/time/europe +++ glibc-1.02/time/europe Mon Sep 9 22:26:28 1991 @@ -0,0 +1,224 @@ +# @(#)europe 7.1 + +# International country codes are used to identify countries' rules and +# zones +# +# This data is by no means authoritative; if you think you know better, go +# ahead and edit the file (and please send any changes to +# ado@ncifcrf.gov for general use in the future). + +############################################################################### + +# United Kingdom + +# From Arthur David Olson (January 19, 1989): +# +# The starting and ending dates below (from which the rules are derived) +# are from Whitaker's Almanack for 1987, page 146. +# 1960 is the earliest year for which dates are given; +# Whitaker's notes that British Summer Time (and, in some years, Double Summer +# Time) was observed in earlier years but does not give start and end dates. +# +# A source at the British Information Office in New York avers that it's +# known as "British" Summer Time in all parts of the United Kingdom. +# 1960 April 10 October 2 (yes, 2, according to the almanac) +# 1961 March 26 October 29 +# 1962 March 25 October 28 +# 1963 March 31 October 27 +# 1964 March 22 October 25 +# 1965 March 21 October 24 +# 1966 March 20 October 23 +# 1967 March 19 October 29 +# 1968 February 18 October 27 +# "British Standard Time, also one hour ahead of G. M. T., was kept between +# 1968 Oct. 27-1971 Oct. 31." +# 1972 March 19 October 29 +# 1973 March 18 October 28 +# 1974 March 17 October 27 +# 1975 March 16 October 26 +# 1976 March 21 October 24 +# 1977 March 20 October 23 +# 1978 March 19 October 29 +# 1979 March 18 October 28 +# 1980 March 16 October 26 +# 1981 March 29 October 25 +# 1982 March 28 October 24 +# 1983 March 27 October 23 +# 1984 March 25 October 28 +# 1985 March 31 October 27 +# 1986 March 30 October 26 +# 1987 March 29 October 25 + +# From an Anonymous U. K. Donor (January 4, 1989): +# +# It is NOT possible to predict when [British Summer Time] will change +# in a future year. +# +# (The admiralty calculate when they think it should be (no more that a couple +# of years in advance) and advise the government who then decide whether or +# not they will take the admiralty's advice) +# +# ...the Gre[e]nwich...observatory...[was] very helpful. +# +# I was not able to track down the Admiralty formula (I tried hard but failed) + +# ... +# Date: 4 Jan 89 08:57:25 GMT (Wed) +# From: Jonathan Leffler +# ... +# [British Summer Time] is fixed annually by Act of Parliament. +# If you can predict what Parliament will do, you should be in +# politics making a fortune, not computing. +# +# Summer time ends on Sunday 29 October 1989. + +# ... +# Date: 5 Jan 89 09:50:38 GMT (Thu) +# From: Peter Kendell +# ... +# +# From my Collins Diary for 1989 - +# +# "At the time of going to press the Home Office was unable to confirm +# the 1989 starting and finishing dates for BST*, but expressed the +# view that 26 March and 29 October were the likeliest dates to be +# adopted" +# +# *British Summer Time. + +# From an Anonymous U. K. Donor (January 5, 1989): +# +# . . .our government is seriously considering applying Double Summer Time - +# putting the clocks forwards and back TWO hours for daylight saving time. +# This is advocated to standardise time in the EEC - we're all supposed to +# keep the same time and to change the clocks on the same dates in the future. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +# Historic starting rules +Rule GB-Eire 1960 only - Apr 10 1:00s 1:00 BST +Rule GB-Eire 1961 1963 - Mar lastSun 1:00s 1:00 BST +Rule GB-Eire 1964 1967 - Mar Sun>=19 1:00s 1:00 BST +Rule GB-Eire 1968 only - Feb 18 1:00s 1:00 BST +Rule GB-Eire 1972 1980 - Mar Sun>=16 1:00s 1:00 BST +# Historic ending rules +Rule GB-Eire 1960 only - Oct 2 1:00s 0 GMT +Rule GB-Eire 1961 1967 - Oct Sun>=23 1:00s 0 GMT +Rule GB-Eire 1971 only - Oct 31 1:00s 0 GMT +# Current rules +Rule GB-Eire 1981 max - Mar lastSun 1:00s 1:00 BST +Rule GB-Eire 1972 max - Oct Sun>=23 1:00s 0 GMT + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone GB-Eire 0:00 GB-Eire %s 1968 Oct 27 1:00s + 1:00 - BST 1971 Oct 31 1:00s + 0:00 GB-Eire %s + +############################################################################### + +# Continental Europe + +# The use of 1986 as starting years below is conservative. + +Rule W-Eur 1986 max - Mar lastSun 1:00s 1:00 " DST" +Rule W-Eur 1986 max - Sep lastSun 1:00s 0 - + +Rule M-Eur 1986 max - Mar lastSun 2:00s 1:00 " DST" +Rule M-Eur 1986 max - Sep lastSun 2:00s 0 - + +Rule E-Eur 1986 max - Mar lastSun 3:00s 1:00 " DST" +Rule E-Eur 1986 max - Sep lastSun 3:00s 0 - + +Rule Turkey 1986 max - Mar lastSun 1:00 1:00 " DST" +Rule Turkey 1986 max - Sep lastSun 1:00 0 - + +Rule W-SU 1986 max - Mar lastSun 2:00s 1:00 " DST" +Rule W-SU 1986 max - Sep lastSun 2:00s 0 - + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone WET 0:00 W-Eur WET%s +Zone Iceland 0:00 - WET +Zone MET 1:00 M-Eur MET%s +Zone Poland 1:00 W-Eur MET%s +Zone EET 2:00 E-Eur EET%s +Zone Turkey 3:00 Turkey EET%s +Zone W-SU 3:00 M-Eur ???? + +# Tom Hoffman says that MET is also known as Central European Time + +Link MET CET + +############################################################################### + +# One source shows that Bulgaria, Cyprus, Finland, and Greece observe DST from +# the last Sunday in March to the last Sunday in September in 1986. +# The source shows Romania changing a day later than everybody else. +# +# According to Bernard Sieloff's source, Poland is in the MET time zone but +# uses the WE DST rules. The Western USSR uses EET+1 and ME DST rules. +# Bernard Sieloff's source claims Romania switches on the same day, but at +# 00:00 standard time (i.e., 01:00 DST). It also claims that Turkey +# switches on the same day, but switches on at 01:00 standard time +# and off at 00:00 standard time (i.e., 01:00 DST) + +# ... +# Date: Wed, 28 Jan 87 16:56:27 -0100 +# From: seismo!mcvax!cgcha!wtho (Tom Hofmann) +# Message-Id: <8701281556.AA22174@cgcha.uucp> +# ... +# +# ...the European time rules are...standardized since 1981, when +# most European coun[tr]ies started DST. Before that year, only +# a few countries (UK, France, Italy) had DST, each according +# to own national rules. In 1981, however, DST started on +# 'Apr firstSun', and not on 'Mar lastSun' as in the following +# years... +# But also since 1981 there are some more national exceptions +# than listed in 'europe': Switzerland, for example, joined DST +# one year later, Denmark ended DST on 'Oct 1' instead of 'Sep +# lastSun' in 1981---I don't know how they handle now. +# +# Finally, DST ist always from 'Apr 1' to 'Oct 1' in the +# Soviet Union (as far as I know). +# +# Tom Hofmann, Scientific Computer Center, CIBA-GEIGY AG, +# 4002 Basle, Switzerland +# UUCP: ...!mcvax!cernvax!cgcha!wtho + +# ... +# Date: Wed, 4 Feb 87 22:35:22 +0100 +# From: seismo!mcvax!cwi.nl!dik (Dik T. Winter) +# ... +# +# The information from Tom Hofmann is (as far as I know) not entirely correct. +# After a request from chongo at amdahl I tried to retrieve all information +# about DST in Europe. I was able to find all from about 1969. +# +# ...standardization on DST in Europe started in about 1977 with switches on +# first Sunday in April and last Sunday in September... +# In 1981 UK joined Europe insofar that +# the starting day for both shifted to last Sunday in March. And from 1982 +# the whole of Europe used DST, with switch dates April 1 and October 1 in +# the Sov[i]et Union. In 1985 the SU reverted to standard Europe[a]n switch +# dates... +# +# It should also be remembered that time-zones are not constants; e.g. +# Portugal switched in 1976 from MET (or CET) to WET with DST... +# Note also that though there were rules for switch dates not +# all countries abided to these dates, and many individual deviations +# occurred, though not since 1982 I believe. Another note: it is always +# assumed that DST is 1 hour ahead of normal time, this need not be the +# case; at least in the Netherlands there have been times when DST was 2 hours +# in advance of normal time. +# +# ... +# dik t. winter, cwi, amsterdam, nederland +# INTERNET : dik@cwi.nl +# BITNET/EARN: dik@mcvax + +# From Bob Devine (January 28, 1988): +# ... +# Greece: Last Sunday in April to last Sunday in September (iffy on dates). +# Since 1978. Change at midnight. +# ... +# Monaco: has same DST as France. +# ... diff -Nru glibc-1.01/time/factory glibc-1.02/time/factory --- glibc-1.01/time/factory +++ glibc-1.02/time/factory Mon Sep 9 22:26:34 1991 @@ -0,0 +1,8 @@ +# @(#)factory 7.1 + +# For companies who don't want to put time zone specification in +# their installation procedures. When users run date, they'll get the message. +# Also useful for the "comp.sources" version. + +# Zone NAME GMTOFF RULES FORMAT +Zone Factory 0 - "Local time zone must be set--see zic manual page" diff -Nru glibc-1.01/time/ialloc.c glibc-1.02/time/ialloc.c --- glibc-1.01/time/ialloc.c +++ glibc-1.02/time/ialloc.c Sun Mar 15 15:29:24 1992 @@ -0,0 +1,105 @@ +#ifdef LIBC +#include +#endif + +#ifndef lint +#ifndef NOID +static char elsieid[] = "@(#)ialloc.c 8.19"; +#endif /* !defined NOID */ +#endif /* !defined lint */ + +/*LINTLIBRARY*/ + +#include "private.h" + +#ifdef MAL +#define NULLMAL(x) ((x) == NULL || (x) == MAL) +#else /* !defined MAL */ +#define NULLMAL(x) ((x) == NULL) +#endif /* !defined MAL */ + +#define nonzero(n) (((n) == 0) ? 1 : (n)) + +char * icalloc P((int nelem, int elsize)); +char * icatalloc P((char * old, const char * new)); +char * icpyalloc P((const char * string)); +char * imalloc P((int n)); +char * irealloc P((char * pointer, int size)); +void ifree P((char * pointer)); + +char * +imalloc(n) +const int n; +{ +#ifdef MAL + register char * result; + + result = malloc((alloc_size_t) nonzero(n)); + return NULLMAL(result) ? NULL : result; +#else /* !defined MAL */ + return malloc((alloc_size_t) nonzero(n)); +#endif /* !defined MAL */ +} + +char * +icalloc(nelem, elsize) +int nelem; +int elsize; +{ + if (nelem == 0 || elsize == 0) + nelem = elsize = 1; + return calloc((alloc_size_t) nelem, (alloc_size_t) elsize); +} + +char * +irealloc(pointer, size) +char * const pointer; +const int size; +{ + if (NULLMAL(pointer)) + return imalloc(size); + return realloc((genericptr_t) pointer, (alloc_size_t) nonzero(size)); +} + +char * +icatalloc(old, new) +char * const old; +const char * const new; +{ + register char * result; + register oldsize, newsize; + + newsize = NULLMAL(new) ? 0 : strlen(new); + if (NULLMAL(old)) + oldsize = 0; + else if (newsize == 0) + return old; + else oldsize = strlen(old); + if ((result = irealloc(old, oldsize + newsize + 1)) != NULL) + if (!NULLMAL(new)) + (void) strcpy(result + oldsize, new); + return result; +} + +char * +icpyalloc(string) +const char * const string; +{ + return icatalloc((char *) NULL, string); +} + +void +ifree(p) +char * const p; +{ + if (!NULLMAL(p)) + (void) free(p); +} + +void +icfree(p) +char * const p; +{ + if (!NULLMAL(p)) + (void) free(p); +} diff -Nru glibc-1.01/time/leapseconds glibc-1.02/time/leapseconds --- glibc-1.01/time/leapseconds +++ glibc-1.02/time/leapseconds Mon Mar 16 03:49:15 1992 @@ -0,0 +1,28 @@ +# @(#)leapseconds 7.1 + +# Allowance for leapseconds added to each timezone file. + +# The correction (+ or -) is made at the given time, so lines +# will typically look like: +# Leap YEAR MON DAY 23:59:60 + R/S +# or +# Leap YEAR MON DAY 23:59:59 - R/S + +# If the leapsecond is Rolling (R) the given time is local time +# If the leapsecond is Stationary (S) the given time is GMT + +# Leap YEAR MONTH DAY HH:MM:SS CORR R/S +Leap 1972 Jun 30 23:59:60 + S +Leap 1972 Dec 31 23:59:60 + S +Leap 1973 Dec 31 23:59:60 + S +Leap 1974 Dec 31 23:59:60 + S +Leap 1975 Dec 31 23:59:60 + S +Leap 1976 Dec 31 23:59:60 + S +Leap 1977 Dec 31 23:59:60 + S +Leap 1978 Dec 31 23:59:60 + S +Leap 1979 Dec 31 23:59:60 + S +Leap 1981 Jun 30 23:59:60 + S +Leap 1982 Jun 30 23:59:60 + S +Leap 1983 Jun 30 23:59:60 + S +Leap 1985 Jun 30 23:59:60 + S +Leap 1987 Dec 31 23:59:60 + S diff -Nru glibc-1.01/time/northamerica glibc-1.02/time/northamerica --- glibc-1.01/time/northamerica +++ glibc-1.02/time/northamerica Mon Sep 9 22:26:30 1991 @@ -0,0 +1,321 @@ +# @(#)northamerica 7.1 + +############################################################################### + +# United States + +# From Arthur David Olson: +# US Daylight Saving Time ended on the last Sunday of *October* in 1974. +# See, for example, the front page of the Saturday, October 26, 1974 +# and Sunday, October 27, 1974 editions of the Washington Post. + +# From seismo!munnari!kre: +# I recall also being told by someone once that Canada didn't have +# the DST variations in 74/75 that the US did, but I am not nearly +# sure enough of this to add anything. + +# From Arthur David Olson: +# The above has been confirmed by Bob Devine; we'll go with it here. + +# From Arthur David Olson: +# Before the Uniform Time Act of 1966 took effect in 1967, observance of +# Daylight Saving Time in the US was by local option, except during wartime. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule US 1918 1919 - Mar lastSun 2:00 1:00 D +Rule US 1918 1919 - Oct lastSun 2:00 0 S +Rule US 1942 only - Feb 9 2:00 1:00 W # War +Rule US 1945 only - Sep 30 2:00 0 S +Rule US 1967 max - Oct lastSun 2:00 0 S +Rule US 1967 1973 - Apr lastSun 2:00 1:00 D +Rule US 1974 only - Jan 6 2:00 1:00 D +Rule US 1975 only - Feb 23 2:00 1:00 D +Rule US 1976 1986 - Apr lastSun 2:00 1:00 D +Rule US 1987 max - Apr Sun>=1 2:00 1:00 D + +# From Bob Devine (January 28, 1988): +# ...Alaska (and Hawaii) had the timezone names changed in 1967. +# old new +# Pacific Standard Time(PST) -same- +# Yukon Standard Time(YST) -same- +# Central Alaska S.T. (CAT) Alaska-Hawaii St[an]dard Time (AHST) +# Nome Standard Time (NT) Bering Standard Time (BST) +# +# ...Alaska's timezone lines were redrawn in 1983 to give only 2 tz. +# The YST zone now covers nearly all of the state, AHST just part +# of the Aleutian islands. No DST. + +# From U. S. Naval Observatory (January 19, 1989): +# USA EASTERN 5 H BEHIND UTC NEW YORK, WASHINGTON +# USA EASTERN 4 H BEHIND UTC APR 3 - OCT 30 +# USA CENTRAL 6 H BEHIND UTC CHICAGO, HOUSTON +# USA CENTRAL 5 H BEHIND UTC APR 3 - OCT 30 +# USA MOUNTAIN 7 H BEHIND UTC DENVER +# USA MOUNTAIN 6 H BEHIND UTC APR 3 - OCT 30 +# USA PACIFIC 8 H BEHIND UTC L.A., SAN FRANCISCO +# USA PACIFIC 7 H BEHIND UTC APR 3 - OCT 30 +# USA ALASKA STD 9 H BEHIND UTC MOST OF ALASKA (AKST) +# USA ALASKA STD 8 H BEHIND UTC APR 3 - OCT 30 (AKDT) +# USA ALEUTIAN 10 H BEHIND UTC ISLANDS WEST OF 170W +# USA - " - 9 H BEHIND UTC APR 3 - OCT 30 +# USA HAWAII 10 H BEHIND UTC +# USA BERING 11 H BEHIND UTC SAMOA, MIDWAY + +# From Arthur David Olson (January 21, 1989): +# The above dates are for 1988. +# Note the "AKST" and "AKDT" abbreviations, the claim that there's +# no DST in Samoa, and the claim that there is DST in Alaska and the +# Aleutians. + +# From Arthur David Olson (February 13, 1988): +# Legal standard time zone names, from United States Code (1982 Edition and +# Supplement III), Title 15, Chapter 6, Section 260 and forward. First, names +# up to April 1, 1967 (when most provisions of the Uniform Time Act of 1966 +# took effect), as explained in sections 263 and 261: +# (none) +# United States standard eastern time +# United States standard mountain time +# United States standard central time +# United States standard Pacific time +# (none) +# United States standard Alaska time +# (none) +# Next, names from April 1, 1967 until November 30, 1983 (the date for +# public law 98-181): +# Atlantic standard time +# eastern standard time +# central standard time +# mountain standard time +# Pacific standard time +# Yukon standard time +# Alaska-Hawaii standard time +# Bering standard time +# And after November 30, 1983: +# Atlantic standard time +# eastern standard time +# central standard time +# mountain standard time +# Pacific standard time +# Alaska standard time +# Hawaii-Aleutian standard time +# Samoa standard time +# The law doesn't give abbreviations. + +# Easy stuff first--including Alaska, where we ignore history (since we +# can't tell if we should give Yukon time or Alaska-Hawaii time for "old" +# times). + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone US/Eastern -5:00 US E%sT +Zone US/Central -6:00 US C%sT +Zone US/Mountain -7:00 US M%sT +Zone US/Pacific -8:00 US P%sT +Zone US/Alaska -9:00 US AK%sT # Abbreviation per USNO + +# Mainland US areas that are always Standard as of 1986. + +Zone US/East-Indiana -5:00 US E%sT 1946 + -5:00 - EST # Always EST as of 1986 +Zone US/Arizona -7:00 US M%sT 1946 + -7:00 - MST # Always MST as of 1986 + +# From Arthur David Olson (February 13, 1988): +# However. . .a writer from the Inter Tribal Council of Arizona, Inc., +# notes in private correspondence dated 12/28/87 that "Presently, only the +# Navajo Nation participates in the Daylight Saving Time policy, due to its +# large size and location in three states." (The "only" means that other +# tribal nations don't use DST.) + +Link US/Mountain Navajo + +# From Bob Devine (January 28, 1988): +# Michigan didn't observe DST from 1968 to 1973. + +Zone US/Michigan -5:00 US E%sT 1968 + -5:00 - EST 1973 + -5:00 US E%sT + +# Samoa just changes names. No DST, per Naval Observatory. + +Zone US/Samoa -11:00 - NST 1967 Apr 1 # N=Nome + -11:00 - BST 1983 Nov 30 # B=Bering + -11:00 - SST # S=Samoa + +# Aleutian has a name change. DST, per Naval Observatory. + +Zone US/Aleutian -10:00 US AH%sT 1983 Nov 30 + -10:00 US HA%sT + +# From Arthur David Olson: +# And then there's Hawaii. +# DST was observed for one day in 1933; +# Standard time was change by half an hour in 1947; +# it's always standard as of 1986. + +Zone US/Hawaii -10:30 US H%sT 1933 Apr 30 2:00 + -10:30 1:00 HDT 1933 May 1 2:00 + -10:30 US H%sT 1947 Jun 8 2:00 + -10:00 - HST + +# Old names, for S5 users + +# Link LINK-FROM LINK-TO +# Link US/Eastern EST5EDT +# Link US/Central CST6CDT +# Link US/Mountain MST7MDT +# Link US/Pacific PST8PDT +# Link US/East-Indiana EST +# Link US/Arizona MST +# Link US/Hawaii HST + +################################################################################ + +# Canada + +# Canada is reportedly lots easier than the US--leastways since 1951. +# I don't know what they did before then. +# 4.3BSD claims that it's perfectly regular. +# According to a posting in "comp.bugs.misc", "comp.unix.wizards", etc. +# on February 8, 1987, by Dave Sherman of the Law Society of Upper Canada, +# "...Canada (well, Ontario and at least some of the other provinces) are +# adopting the new daylight savings time rules...". We assume all of +# Canada is doing so. + +# From Bob Devine (January 28, 1988): +# All of Canada did have DST from your first rule except Saskatchewan. +# Which parts did not observe DST is hard to pinpoint but most of the +# province follows the rules. +# NOTE: those that didn't have DST for that rule, also +# probably did not have it for several years previous. + +# From U. S. Naval Observatory (January 19, 1989): +# CANADA NEW FDL 3.5H BEHIND UTC ST.JOHN'S +# CANADA NEW FDL 1.5H BEHIND UTC APR 3 - OCT 29 +# CANADA ATLANTIC 4 H BEHIND UTC HALIFAX +# CANADA ATLANTIC 3 H BEHIND UTC APR 3 - OCT 29 +# CANADA EASTERN 5 H BEHIND UTC TORONTO, MONTREAL, OTTAWA +# CANADA EASTERN 4 H BEHIND UTC APR 3 - OCT 29 +# CANADA CENTRAL 6 H BEHIND UTC REGINA, WINNIPEG +# CANADA CENTRAL 5 H BEHIND UTC APR 3 - OCT 29 +# CANADA MOUNTAIN 7 H BEHIND UTC CALGARY, EDMONTON +# CANADA MOUNTAIN 6 H BEHIND UTC APR 3 - OCT 29 +# CANADA PACIFIC 8 H BEHIND UTC VANCOUVER +# CANADA PACIFIC 7 H BEHIND UTC APR 3 - OCT 29 +# CANADA YUKON SAME AS PACIFIC DAWSON + +# From Arthur David Olson (January 21, 1989): +# April 3 fell on a Sunday in 1988; October 29 fell on a Sunday in 1989. Ahem. +# Note claim that there's double DST in Newfoundland and that Yukon should +# be same as Pacific. Stick with rules posted in 1988 until more authoritative +# information is available. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Canada 1969 max - Oct lastSun 2:00 0 S +Rule Canada 1969 1986 - Apr lastSun 2:00 1:00 D +Rule Canada 1987 max - Apr Sun>=1 2:00 1:00 D + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +# Bob Devine says that DST *is* observed in Newfoundland +Zone Canada/Newfoundland -3:30 Canada N%sT +Zone Canada/Atlantic -4:00 Canada A%sT +Zone Canada/Eastern -5:00 Canada E%sT +Zone Canada/Central -6:00 Canada C%sT +Zone Canada/East-Saskatchewan -6:00 - CST # No DST as of 1987 +Zone Canada/Mountain -7:00 Canada M%sT +Zone Canada/Pacific -8:00 Canada P%sT +Zone Canada/Yukon -9:00 Canada Y%sT + +############################################################################### + +# Mexico + +# From Guy Harris: +# Rules are from the Official Airline Guide, Worldwide Edition, for 1987. +# Rules prior to 1987 are unknown. +# The comments in the OAG say "Only Ensenada, Mexicale, San Felipe and Tijuana +# observe DST." This is presumably Baja California Norte, above 28th parallel, +# as listed there; Mexico/BajaSur is for "Baja California Sur and N. Pacific +# Coast (States of Sinaloa and Sonora)." + +# From Bob Devine (January 28, 1988): +# The Federal District (where Mexico City is) has observed [DST] several +# times but not recently. +# +# I don't where to drawn the line in the North Baja area. 28th latitude +# sounds good -- but it may be higher (how far [d]o radio stations from +# San Diego affect culture?). +# +# The dates of DST probably go back to 1981. The rules are the same as +# US's. This is going to be a headache for US presidential electi[o]n years! + +# From Arthur David Olson (February 13, 1988) +# Since the 1981 starting date is only "probable," we'll keep the 1987 +# starting date below. + +# From U. S. Naval Observatory (January 19, 1989): +# MEXICO BAJA CAL N 7 H BEHIND UTC BAJA CALIFORNIA SUR AND +# MEXICO BAJA CAL N N. PACIFIC COAST (STATES +# MEXICO BAJA CAL N OF SINALOA AND SONORA) +# MEXICO BAJA CAL N 8 H BEHIND UTC ABOVE 28TH PARALLAL APR 3 +# MEXICO BAJA CAL N - OCT 29 +# MEXICO BAJA CAL N 7 H BEHIND UTC ABOVE 28TH PARALLAL APR 3 +# MEXICO BAJA CAL N - 0CT 29 +# MEXICO 6 H BEHIND UTC STATES OF DURANGO, +# MEXICO COAHUILA, NUEVO LEON, +# MEXICO TAMAULIPAS +# MEXICO 5 H BEHIND UTC STATES OF DURANGO, +# MEXICO COAHUILA, NUEVO LEON, +# MEXICO TAMAULIPAS APR 3 - OCT 29 +# MEXICO 6 H BEHIND UTC GENERAL MEXICO, STATES OF +# MEXICO CAMPECHE, QUINTANA ROO AND +# MEXICO YUCATAN + +# From Arthur David Olson (January 21, 1989): +# April 3 fell on a Sunday in 1988; October 29 fell on a Sunday in 1989. Ahem. +# USNO claims there should be four Mexican zones rather than three: +# a zone that's GMT-8 with DST; a zone that's always GMT-7; +# a zone that's GMT-6 with DST; and a zone that's always GMT-6. +# Wait for more authoritative information before changing. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Mexico 1987 max - Oct lastSun 2:00 0 S +Rule Mexico 1987 max - Apr Sun>=1 2:00 1:00 D + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Mexico/BajaNorte -8:00 Mexico P%sT +Zone Mexico/BajaSur -7:00 - MST +Zone Mexico/General -6:00 - CST + +############################################################################### + +# Jamaica + +# From Bob Devine (January 28, 1988): +# Follows US rules. + +# From U. S. Naval Observatory (January 19, 1989): +# JAMAICA 5 H BEHIND UTC + +Link US/Eastern Jamaica + +############################################################################### + +# Cuba + +# From Bob Devine (January 28, 1988): +# . . .DST is from 2nd Sunday in May to 2nd Sunday in October since 1981. +# Change at midnight. In 1979 & 1980, started at 3rd Sunday in March +# (I think). + +# From U. S. Naval Observatory (January 19, 1989): +# CUBA 5 H BEHIND UTC +# CUBA 4 H BEHIND UTC MAR 20 - OCT 8 + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Cuba 1979 1980 - Mar Sun>=15 0:00 1:00 D +Rule Cuba 1979 1980 - Oct Sun>=8 0:00 0 S +Rule Cuba 1981 max - May Sun>=8 0:00 1:00 D +Rule Cuba 1981 max - Oct Sun>=8 0:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT +Zone Cuba -5:00 Cuba C%sT diff -Nru glibc-1.01/time/pacificnew glibc-1.02/time/pacificnew --- glibc-1.01/time/pacificnew +++ glibc-1.02/time/pacificnew Mon Sep 9 22:26:32 1991 @@ -0,0 +1,20 @@ +# @(#)pacificnew 7.1 + +# From Arthur David Olson (April 5, 1989): +# On April 5, 1989, the U. S. House of Representatives passed (238-154) a bill +# establishing "Pacific Presidential Election Time"; it has yet to be acted on +# by the Senate or signed into law by the President. +# You might want to change the "PE" (Presidential Election) below to +# "Q" (Quadrennial) to maintain three-character zone abbreviations. +# If you're really conservative, you might want to change it to "D". +# Avoid "L" (Leap Year), which won't be true in 2100. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Twilite 1989 max - Apr Sun>=1 2:00 1:00 D +Rule Twilite 1989 max uspres Oct lastSun 2:00 1:00 PE +Rule Twilite 1989 max uspres Nov Sun>=7 2:00 0 S +Rule Twilite 1989 max nonpres Oct lastSun 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone US/Pacific-New -8:00 US P%sT 1989 + -8:00 Twilite P%sT diff -Nru glibc-1.01/time/private.h glibc-1.02/time/private.h --- glibc-1.01/time/private.h +++ glibc-1.02/time/private.h Sun Mar 15 14:28:14 1992 @@ -0,0 +1,168 @@ +#ifndef PRIVATE_H + +#define PRIVATE_H + +/* +** This header is for use ONLY with the time conversion code. +** There is no guarantee that it will remain unchanged, +** or that it will remain at all. +** Do NOT copy it to any system include directory. +** Thank you! +*/ + +/* +** ID +*/ + +#ifndef lint +#ifndef NOID +static char privatehid[] = "@(#)private.h 7.1"; +#endif /* !defined NOID */ +#endif /* !defined lint */ + +/* +** const +*/ + +#ifndef const +#ifndef __STDC__ +#define const +#endif /* !defined __STDC__ */ +#endif /* !defined const */ + +/* +** void +*/ + +#ifndef void +#ifndef __STDC__ +#ifndef vax +#ifndef sun +#define void char +#endif /* !defined sun */ +#endif /* !defined vax */ +#endif /* !defined __STDC__ */ +#endif /* !defined void */ + +/* +** P((args)) +*/ + +#ifndef P +#ifdef __STDC__ +#define P(x) x +#else /* !defined __STDC__ */ +#define ASTERISK * +#define P(x) ( /ASTERISK x ASTERISK/ ) +#endif /* !defined __STDC__ */ +#endif /* !defined P */ + +/* +** genericptr_t +*/ + +#ifdef __STDC__ +typedef void * genericptr_t; +#else /* !defined __STDC__ */ +typedef char * genericptr_t; +#endif /* !defined __STDC__ */ + +#include "sys/types.h" /* for time_t */ +#include "stdio.h" +#include "ctype.h" +#include "errno.h" +#include "string.h" +#ifndef _TIME_ +#include "time.h" +#endif /* !defined _TIME_ */ + +#ifndef remove +extern int unlink P((const char * filename)); +#define remove unlink +#endif /* !defined remove */ + +#ifndef FILENAME_MAX + +#ifndef MAXPATHLEN +#ifdef unix +#include "sys/param.h" +#endif /* defined unix */ +#endif /* !defined MAXPATHLEN */ + +#ifdef MAXPATHLEN +#define FILENAME_MAX MAXPATHLEN +#else /* !defined MAXPATHLEN */ +#define FILENAME_MAX 1024 /* Pure guesswork */ +#endif /* !defined MAXPATHLEN */ + +#endif /* !defined FILENAME_MAX */ + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif /* !defined EXIT_SUCCESS */ + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif /* !defined EXIT_FAILURE */ + +#ifdef __STDC__ + +#define alloc_size_t size_t +#define qsort_size_t size_t +#define fwrite_size_t size_t + +#else /* !defined __STDC__ */ + +#ifndef alloc_size_t +#define alloc_size_t unsigned +#endif /* !defined alloc_size_t */ + +#ifndef qsort_size_t +#ifdef USG +#define qsort_size_t unsigned +#else /* !defined USG */ +#define qsort_size_t int +#endif /* !defined USG */ +#endif /* !defined qsort_size_t */ + +#ifndef fwrite_size_t +#define fwrite_size_t int +#endif /* !defined fwrite_size_t */ + +#ifndef USG +extern char * sprintf P((char * buf, const char * format, ...)); +#endif /* !defined USG */ + +#endif /* !defined __STDC__ */ + +/* +** Ensure that these are declared--redundantly declaring them shouldn't hurt. +*/ + +extern char * getenv P((const char * name)); +extern genericptr_t malloc P((alloc_size_t size)); +extern genericptr_t calloc P((alloc_size_t nelem, alloc_size_t elsize)); +extern genericptr_t realloc P((genericptr_t oldptr, alloc_size_t newsize)); + +#ifdef USG +extern void exit P((int s)); +extern void qsort P((genericptr_t base, qsort_size_t nelem, + qsort_size_t elsize, int (*comp)())); +extern void perror P((const char * string)); +extern void free P((char * buf)); +#endif /* defined USG */ + +#ifndef TRUE +#define TRUE 1 +#endif /* !defined TRUE */ + +#ifndef FALSE +#define FALSE 0 +#endif /* !defined FALSE */ + +/* +** UNIX is a registered trademark of AT&T. +** VAX is a trademark of Digital Equipment Corporation. +*/ + +#endif /* !defined PRIVATE_H */ diff -Nru glibc-1.01/time/scheck.c glibc-1.02/time/scheck.c --- glibc-1.01/time/scheck.c +++ glibc-1.02/time/scheck.c Sun Mar 15 15:29:25 1992 @@ -0,0 +1,65 @@ +#ifdef LIBC +#include +#endif + +#ifndef lint +#ifndef NOID +static char elsieid[] = "@(#)scheck.c 8.10"; +#endif /* !defined lint */ +#endif /* !defined NOID */ + +/*LINTLIBRARY*/ + +#include "private.h" + +extern char * imalloc P((int n)); +extern void ifree P((char * p)); + +char * +scheck(string, format) +const char * const string; +const char * const format; +{ + register char * fbuf; + register const char * fp; + register char * tp; + register int c; + register char * result; + char dummy; + + result = ""; + if (string == NULL || format == NULL) + return result; + fbuf = imalloc(2 * strlen(format) + 4); + if (fbuf == NULL) + return result; + fp = format; + tp = fbuf; + while ((*tp++ = c = *fp++) != '\0') { + if (c != '%') + continue; + if (*fp == '%') { + *tp++ = *fp++; + continue; + } + *tp++ = '*'; + if (*fp == '*') + ++fp; + while (isascii(*fp) && isdigit(*fp)) + *tp++ = *fp++; + if (*fp == 'l' || *fp == 'h') + *tp++ = *fp++; + else if (*fp == '[') + do *tp++ = *fp++; + while (*fp != '\0' && *fp != ']'); + if ((*tp++ = *fp++) == '\0') + break; + } + *(tp - 1) = '%'; + *tp++ = 'c'; + *tp = '\0'; + if (sscanf(string, fbuf, &dummy) != 1) + result = (char *) format; + ifree(fbuf); + return result; +} diff -Nru glibc-1.01/time/southamerica glibc-1.02/time/southamerica --- glibc-1.01/time/southamerica +++ glibc-1.02/time/southamerica Mon Sep 9 22:26:31 1991 @@ -0,0 +1,103 @@ +# @(#)southamerica 7.1 + +# From Guy Harris: +# From Official Airline Guide - Worldwide Edition (1987). Countries not +# listed here do not observe DST, according to the OAG. Time zone names +# are pure inventions, and none are supplied for countries not observing +# DST; updates from natives would be appreciated. The times that DST +# starts and ends are based on the assumption that they switch a 2AM just +# as everybody else does. + +############################################################################### + +# Brazil + +# From Guy Harris: +# The OAG lists October 25, 1987 and February 12, 1988 as the starting and +# ending dates, giving them as "estimated date(s) based on previous year". We +# infer a rule here from one example, always a dangerous practice.... Yes, +# they really do switch on Saturday, according to the OAG. +# "Brazil/Acre" is for the Territory of Acre; "Brazil/DeNoronha" is for +# Fernando De Noronha. + +# From Bob Devine (January 28, 1988): +# The only information I found is that there was no DST up to 1985. +# But there was some before 1952! + +# From U. S. Naval Observatory (January 16, 1989): +# BRAZIL WEST 5 H BEHIND UTC TERRITORY OF ACRE +# BRAZIL WEST 4 H BEHIND UTC ACRE OCT 23, '88-FEB 11, +# BRAZIL '89 (ESTIMATED) +# BRAZIL CENTRAL 4 H BEHIND UTC MANAUS +# BRAZIL CENTRAL 3 H BEHIND UTC MANAUS OCT 23, '88-FEB 11, +# BRAZIL CENTRAL '89 (ESTIMATED) +# BRAZIL EAST 3 H BEHIND UTC COASTAL STATES, RIO, SAO +# BRAZIL EAST PAULO, BRASILIA +# BRAZIL EAST 2 H BEHIND UTC COASTAL STATES, RIO, SAO +# BRAZIL PAULO, BRASILIA OCT 23, +# BRAZIL '88-FEB 11, '89 +# BRAZIL (ESTIMATED) +# BRAZIL 2 H BEHIND UTC ATLANTIC ISLANDS, FERNANDO +# BRAZIL DE NORONHA +# BRAZIL 1 H BEHIND UTC OCT 23, '88-FEB 11, '89 +# BRAZIL (ESTIMATED) +# BRAZIL 3 H BEHIND UTC FOR MOST MAJOR AIRPORTS. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Brazil 1987 max - Feb Sat<=14 2:00 0 S +Rule Brazil 1987 max - Oct Sat<=28 2:00 1:00 D + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Brazil/East -3:00 Brazil E%sT +Zone Brazil/West -4:00 Brazil W%sT +Zone Brazil/Acre -5:00 Brazil A%sT +Zone Brazil/DeNoronha -2:00 Brazil F%sT + +############################################################################### + +# Chile + +# From Guy Harris: +# The OAG lists October 11, 1987 and March 12, 1988 as the starting and +# ending dates, giving them as "estimated date(s) based on previous year." + +# From Bob Devine (January 28, 1988): +# Chile has had 2nd Sunday in October to 2nd Sunday in March DST since 1977. +# Switch is at midnight. OAG is right. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule Chile 1977 max - Oct Sun>=8 0:00 1:00 D +Rule Chile 1978 max - Mar Sun>=8 0:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone Chile/Continental -4:00 Chile C%sT +Zone Chile/EasterIsland -6:00 Chile E%sT + +############################################################################### + +# Paraguay + +# From Bob Devine (January 28, 1988): +# Paraguay: First day in October to last in March. Midnight switch?? +# Since 1980. + +# From U. S. Naval Observatory (January 19, 1989): +# PARAGUAY 4 H BEHIND UTC +# PARAGUAY 3 H BEHIND UTC OCT 1, '88-MAR 31, '89 + +# From Arthur David Olson (January 21, 1989): +# Still don't know time of day when switch occurs. Punt. + +############################################################################### + +# Argentina + +# From Bob Devine (January 28, 1988): +# Argentina: first Sunday in October to first Sunday in April since 1976. +# Double Summer time from 1969 to 1974. Switches at midnight. + +# From U. S. Naval Observatory (January 19, 19889): +# ARGENTINA 3 H BEHIND UTC + +# From Arthur David Olson (January 21, 1989): +# OAG, USNO and Bob have different data. Punt. diff -Nru glibc-1.01/time/systemv glibc-1.02/time/systemv --- glibc-1.01/time/systemv +++ glibc-1.02/time/systemv Mon Sep 9 22:26:35 1991 @@ -0,0 +1,35 @@ +# @(#)systemv 7.1 + +# Old rules, should the need arise. +# No attempt is made to handle Newfoundland, since it cannot be expressed +# using the System V "TZ" scheme (half-hour offset), or anything outside +# North America (no support for non-standard DST start/end dates), nor +# the change in the DST rules in the US in 1987 (can't split between +# Canada, with no changes, and the US) +# +# Be sure to compile this *without* leap second correction for true conformance. + +# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S +Rule SystemV min 1973 - Apr lastSun 2:00 1:00 D +Rule SystemV min 1973 - Oct lastSun 2:00 0 S +Rule SystemV 1974 only - Jan 6 2:00 1:00 D +Rule SystemV 1974 only - Nov lastSun 2:00 0 S +Rule SystemV 1975 only - Feb 23 2:00 1:00 D +Rule SystemV 1975 only - Oct lastSun 2:00 0 S +Rule SystemV 1976 max - Apr lastSun 2:00 1:00 D +Rule SystemV 1976 max - Oct lastSun 2:00 0 S + +# Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] +Zone SystemV/AST4ADT -4:00 SystemV A%sT +Zone SystemV/EST5EDT -5:00 SystemV E%sT +Zone SystemV/CST6CDT -6:00 SystemV C%sT +Zone SystemV/MST7MDT -7:00 SystemV M%sT +Zone SystemV/PST8PDT -8:00 SystemV P%sT +Zone SystemV/YST9YDT -9:00 SystemV Y%sT +Zone SystemV/AST4 -4:00 - AST +Zone SystemV/EST5 -5:00 - EST +Zone SystemV/CST6 -6:00 - CST +Zone SystemV/MST7 -7:00 - MST +Zone SystemV/PST8 -8:00 - PST +Zone SystemV/YST9 -9:00 - YST +Zone SystemV/HST10 -10:00 - HST diff -Nru glibc-1.01/time/test_time.c glibc-1.02/time/test_time.c --- glibc-1.01/time/test_time.c Tue Jul 30 17:09:44 1991 +++ glibc-1.02/time/test_time.c Mon Mar 16 07:13:57 1992 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -42,9 +42,11 @@ sprintf(buf, "TZ=%s", *argv); if (putenv(buf)) { - puts("putenv() failed."); + puts("putenv failed."); lose = 1; } + else + puts (buf); } tzset(); tbuf.tm_year = 72; diff -Nru glibc-1.01/time/tzfile.c glibc-1.02/time/tzfile.c --- glibc-1.01/time/tzfile.c Tue Mar 10 23:16:16 1992 +++ glibc-1.02/time/tzfile.c Mon Mar 16 07:24:21 1992 @@ -108,27 +108,32 @@ num_types = (size_t) uc2ul(tzhead.tzh_typecnt); chars = (size_t) uc2ul(tzhead.tzh_charcnt); num_leaps = (size_t) uc2ul(tzhead.tzh_leapcnt); -#if 0 num_isstd = (size_t) uc2ul(tzhead.tzh_ttisstdcnt); -#else - num_isstd = 0; -#endif - transitions = (time_t *) malloc(num_transitions * sizeof(time_t)); - if (transitions == NULL) - goto lose; - type_idxs = (unsigned char *) malloc(num_transitions); - if (type_idxs == NULL) - goto lose; - types = (struct ttinfo *) malloc(num_types * sizeof(struct ttinfo)); - if (types == NULL) - goto lose; - zone_names = (char *) malloc(chars); - if (zone_names == NULL) - goto lose; - if (num_leaps != 0) + if (num_transitions > 0) + { + transitions = (time_t *) malloc (num_transitions * sizeof(time_t)); + if (transitions == NULL) + goto lose; + type_idxs = (unsigned char *) malloc (num_transitions); + if (type_idxs == NULL) + goto lose; + } + if (num_types > 0) + { + types = (struct ttinfo *) malloc (num_types * sizeof (struct ttinfo)); + if (types == NULL) + goto lose; + } + if (chars > 0) + { + zone_names = (char *) malloc (chars); + if (zone_names == NULL) + goto lose; + } + if (num_leaps > 0) { - leaps = (struct leap *) malloc(num_leaps * sizeof(struct leap)); + leaps = (struct leap *) malloc (num_leaps * sizeof (struct leap)); if (leaps == NULL) goto lose; } @@ -187,27 +192,34 @@ struct ttinfo *info; register size_t i; - /* Find the first transition after TIMER, and then go back one. */ - i = 0; - while (i < num_transitions && transitions[i] < timer) - ++i; - - if (i == 0) + if (num_transitions == 0 || timer < transitions[0]) { - /* TIMER is before any transition. - Choose the first non-DST type. */ + /* TIMER is before any transition (or there are no transitions). + Choose the first non-DST type + (or the first if they're all DST types). */ + i = 0; while (i < num_types && types[i].isdst) ++i; - info = &types[i]; + if (i == num_types) + i = 0; } else - info = &types[type_idxs[i - 1]]; + { + /* Find the first transition after TIMER, and then go back one. */ + i = 1; + while (i < num_transitions && transitions[i] < timer) + ++i; + --i; + } + info = &types[type_idxs[i]]; __daylight = info->isdst; __timezone = info->offset; for (i = 0; i < num_types && i < sizeof (__tzname) / sizeof (__tzname[0]); ++i) __tzname[types[i].isdst] = &zone_names[types[i].idx]; + if (info->isdst < sizeof (__tzname) / sizeof (__tzname[0])) + __tzname[info->isdst] = &zone_names[info->idx]; i = num_leaps; do diff -Nru glibc-1.01/time/tzfile.h glibc-1.02/time/tzfile.h --- glibc-1.01/time/tzfile.h Tue Jul 11 04:16:55 1989 +++ glibc-1.02/time/tzfile.h Sun Mar 15 15:16:07 1992 @@ -1,9 +1,22 @@ -#ifndef lint -#ifndef NOID #ifndef TZFILE_H + #define TZFILE_H -static char tzfilehid[] = "@(#)tzfile.h 4.1"; -#endif /* !defined TZFILE_H */ + +/* +** This header is for use ONLY with the time conversion code. +** There is no guarantee that it will remain unchanged, +** or that it will remain at all. +** Do NOT copy it to any system include directory. +** Thank you! +*/ + +/* +** ID +*/ + +#ifndef lint +#ifndef NOID +static char tzfilehid[] = "@(#)tzfile.h 7.1"; #endif /* !defined NOID */ #endif /* !defined lint */ @@ -12,7 +25,7 @@ */ #ifndef TZDIR -#define TZDIR "/etc/zoneinfo" /* Time zone object file directory */ +#define TZDIR "/usr/local/etc/zoneinfo" /* Time zone object file directory */ #endif /* !defined TZDIR */ #ifndef TZDEFAULT @@ -19,12 +32,17 @@ #define TZDEFAULT "localtime" #endif /* !defined TZDEFAULT */ +#ifndef TZDEFRULES +#define TZDEFRULES "posixrules" +#endif /* !defined TZDEFRULES */ + /* ** Each file begins with. . . */ struct tzhead { - char tzh_reserved[28]; /* reserved for future use */ + char tzh_reserved[24]; /* reserved for future use */ + char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ char tzh_leapcnt[4]; /* coded number of leap seconds */ char tzh_timecnt[4]; /* coded number of transition times */ char tzh_typecnt[4]; /* coded number of local time types */ @@ -38,12 +56,17 @@ ** tzh_timecnt (unsigned char)s types of local time starting at above ** tzh_typecnt repetitions of ** one (char [4]) coded GMT offset in seconds -** one (unsigned char) used to set tm_isdt +** one (unsigned char) used to set tm_isdst ** one (unsigned char) that's an abbreviation list index ** tzh_charcnt (char)s '\0'-terminated zone abbreviations ** tzh_leapcnt repetitions of ** one (char [4]) coded leap second transition times ** one (char [4]) total correction after above +** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition +** time is standard time, if FALSE, +** transition time is wall clock time +** if absent, transition times are +** assumed to be wall clock time */ /* @@ -107,7 +130,6 @@ #define TM_OCTOBER 9 #define TM_NOVEMBER 10 #define TM_DECEMBER 11 -#define TM_SUNDAY 0 #define TM_YEAR_BASE 1900 @@ -120,3 +142,27 @@ */ #define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) + +#ifndef USG + +/* +** Use of the underscored variants may cause problems if you move your code to +** certain System-V-based systems; for maximum portability, use the +** underscore-free variants. The underscored variants are provided for +** backward compatibility only; they may disappear from future versions of +** this file. +*/ + +#define SECS_PER_MIN SECSPERMIN +#define MINS_PER_HOUR MINSPERHOUR +#define HOURS_PER_DAY HOURSPERDAY +#define DAYS_PER_WEEK DAYSPERWEEK +#define DAYS_PER_NYEAR DAYSPERNYEAR +#define DAYS_PER_LYEAR DAYSPERLYEAR +#define SECS_PER_HOUR SECSPERHOUR +#define SECS_PER_DAY SECSPERDAY +#define MONS_PER_YEAR MONSPERYEAR + +#endif /* !defined USG */ + +#endif /* !defined TZFILE_H */ diff -Nru glibc-1.01/time/zic.c glibc-1.02/time/zic.c --- glibc-1.01/time/zic.c +++ glibc-1.02/time/zic.c Sun Mar 15 14:28:38 1992 @@ -0,0 +1,1874 @@ +#ifdef LIBC +#include +#endif + +#ifndef lint +#ifndef NOID +static char elsieid[] = "@(#)zic.c 7.1"; +#endif /* !defined NOID */ +#endif /* !defined lint */ + +#include "private.h" +#include "tzfile.h" + +struct rule { + const char * r_filename; + int r_linenum; + const char * r_name; + + int r_loyear; /* for example, 1986 */ + int r_hiyear; /* for example, 1986 */ + const char * r_yrtype; + + int r_month; /* 0..11 */ + + int r_dycode; /* see below */ + int r_dayofmonth; + int r_wday; + + long r_tod; /* time from midnight */ + int r_todisstd; /* above is standard time if TRUE */ + /* or wall clock time if FALSE */ + long r_stdoff; /* offset from standard time */ + const char * r_abbrvar; /* variable part of abbreviation */ + + int r_todo; /* a rule to do (used in outzone) */ + time_t r_temp; /* used in outzone */ +}; + +/* +** r_dycode r_dayofmonth r_wday +*/ + +#define DC_DOM 0 /* 1..31 */ /* unused */ +#define DC_DOWGEQ 1 /* 1..31 */ /* 0..6 (Sun..Sat) */ +#define DC_DOWLEQ 2 /* 1..31 */ /* 0..6 (Sun..Sat) */ + +struct zone { + const char * z_filename; + int z_linenum; + + const char * z_name; + long z_gmtoff; + const char * z_rule; + const char * z_format; + + long z_stdoff; + + struct rule * z_rules; + int z_nrules; + + struct rule z_untilrule; + time_t z_untiltime; +}; + +extern int emkdir P((const char * name, int mode)); +extern int getopt P((int argc, char * argv[], const char * options)); +extern char * icatalloc P((char * old, const char * new)); +extern char * icpyalloc P((const char * string)); +extern void ifree P((char * p)); +extern char * imalloc P((int n)); +extern char * irealloc P((char * old, int n)); +extern int link P((const char * fromname, const char * toname)); +extern char * optarg; +extern int optind; +extern char * scheck P((const char * string, const char * format)); + +static void addtt P((time_t starttime, int type)); +static int addtype P((long gmtoff, const char * abbr, int isdst, + int ttisstd)); +static void addleap P((time_t t, int positive, int rolling)); +static void adjleap P((void)); +static void associate P((void)); +static int ciequal P((const char * ap, const char * bp)); +static void convert P((long val, char * buf)); +static void dolink P((const char * fromfile, const char * tofile)); +static void eat P((const char * name, int num)); +static void eats P((const char * name, int num, + const char * rname, int rnum)); +static long eitol P((int i)); +static void error P((const char * message)); +static char ** getfields P((char * buf)); +static long gethms P((const char * string, const char * errstrng, + int signable)); +static void infile P((const char * filename)); +static void inleap P((char ** fields, int nfields)); +static void inlink P((char ** fields, int nfields)); +static void inrule P((char ** fields, int nfields)); +static int inzcont P((char ** fields, int nfields)); +static int inzone P((char ** fields, int nfields)); +static int inzsub P((char ** fields, int nfields, int iscont)); +static int itsabbr P((const char * abbr, const char * word)); +static int itsdir P((const char * name)); +static int lowerit P((int c)); +static char * memcheck P((char * tocheck)); +static int mkdirs P((char * filename)); +static void newabbr P((const char * abbr)); +static long oadd P((long t1, long t2)); +static void outzone P((const struct zone * zp, int ntzones)); +static void puttzcode P((long code, FILE * fp)); +static int rcomp P((const genericptr_t leftp, const genericptr_t rightp)); +static time_t rpytime P((const struct rule * rp, int wantedy)); +static void rulesub P((struct rule * rp, + char * loyearp, char * hiyearp, + char * typep, char * monthp, + char * dayp, char * timep)); +static void setboundaries P((void)); +static time_t tadd P((time_t t1, long t2)); +static void usage P((void)); +static void writezone P((const char * name)); +static int yearistype P((int year, const char * type)); + +static int charcnt; +static int errors; +static const char * filename; +static int leapcnt; +static int linenum; +static time_t max_time; +static int max_year; +static time_t min_time; +static int min_year; +static int noise; +static const char * rfilename; +static int rlinenum; +static const char * progname; +static int timecnt; +static int typecnt; +static int tt_signed; + +/* +** Line codes. +*/ + +#define LC_RULE 0 +#define LC_ZONE 1 +#define LC_LINK 2 +#define LC_LEAP 3 + +/* +** Which fields are which on a Zone line. +*/ + +#define ZF_NAME 1 +#define ZF_GMTOFF 2 +#define ZF_RULE 3 +#define ZF_FORMAT 4 +#define ZF_TILYEAR 5 +#define ZF_TILMONTH 6 +#define ZF_TILDAY 7 +#define ZF_TILTIME 8 +#define ZONE_MINFIELDS 5 +#define ZONE_MAXFIELDS 9 + +/* +** Which fields are which on a Zone continuation line. +*/ + +#define ZFC_GMTOFF 0 +#define ZFC_RULE 1 +#define ZFC_FORMAT 2 +#define ZFC_TILYEAR 3 +#define ZFC_TILMONTH 4 +#define ZFC_TILDAY 5 +#define ZFC_TILTIME 6 +#define ZONEC_MINFIELDS 3 +#define ZONEC_MAXFIELDS 7 + +/* +** Which files are which on a Rule line. +*/ + +#define RF_NAME 1 +#define RF_LOYEAR 2 +#define RF_HIYEAR 3 +#define RF_COMMAND 4 +#define RF_MONTH 5 +#define RF_DAY 6 +#define RF_TOD 7 +#define RF_STDOFF 8 +#define RF_ABBRVAR 9 +#define RULE_FIELDS 10 + +/* +** Which fields are which on a Link line. +*/ + +#define LF_FROM 1 +#define LF_TO 2 +#define LINK_FIELDS 3 + +/* +** Which fields are which on a Leap line. +*/ + +#define LP_YEAR 1 +#define LP_MONTH 2 +#define LP_DAY 3 +#define LP_TIME 4 +#define LP_CORR 5 +#define LP_ROLL 6 +#define LEAP_FIELDS 7 + +/* +** Year synonyms. +*/ + +#define YR_MINIMUM 0 +#define YR_MAXIMUM 1 +#define YR_ONLY 2 + +static struct rule * rules; +static int nrules; /* number of rules */ + +static struct zone * zones; +static int nzones; /* number of zones */ + +struct link { + const char * l_filename; + int l_linenum; + const char * l_from; + const char * l_to; +}; + +static struct link * links; +static int nlinks; + +struct lookup { + const char * l_word; + const int l_value; +}; + +static struct lookup const * byword P((const char * string, + const struct lookup * lp)); + +static struct lookup const line_codes[] = { + "Rule", LC_RULE, + "Zone", LC_ZONE, + "Link", LC_LINK, + "Leap", LC_LEAP, + NULL, 0 +}; + +static struct lookup const mon_names[] = { + "January", TM_JANUARY, + "February", TM_FEBRUARY, + "March", TM_MARCH, + "April", TM_APRIL, + "May", TM_MAY, + "June", TM_JUNE, + "July", TM_JULY, + "August", TM_AUGUST, + "September", TM_SEPTEMBER, + "October", TM_OCTOBER, + "November", TM_NOVEMBER, + "December", TM_DECEMBER, + NULL, 0 +}; + +static struct lookup const wday_names[] = { + "Sunday", TM_SUNDAY, + "Monday", TM_MONDAY, + "Tuesday", TM_TUESDAY, + "Wednesday", TM_WEDNESDAY, + "Thursday", TM_THURSDAY, + "Friday", TM_FRIDAY, + "Saturday", TM_SATURDAY, + NULL, 0 +}; + +static struct lookup const lasts[] = { + "last-Sunday", TM_SUNDAY, + "last-Monday", TM_MONDAY, + "last-Tuesday", TM_TUESDAY, + "last-Wednesday", TM_WEDNESDAY, + "last-Thursday", TM_THURSDAY, + "last-Friday", TM_FRIDAY, + "last-Saturday", TM_SATURDAY, + NULL, 0 +}; + +static struct lookup const begin_years[] = { + "minimum", YR_MINIMUM, + "maximum", YR_MAXIMUM, + NULL, 0 +}; + +static struct lookup const end_years[] = { + "minimum", YR_MINIMUM, + "maximum", YR_MAXIMUM, + "only", YR_ONLY, + NULL, 0 +}; + +static struct lookup const leap_types[] = { + "Rolling", TRUE, + "Stationary", FALSE, + NULL, 0 +}; + +static const int len_months[2][MONSPERYEAR] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static const int len_years[2] = { + DAYSPERNYEAR, DAYSPERLYEAR +}; + +static time_t ats[TZ_MAX_TIMES]; +static unsigned char types[TZ_MAX_TIMES]; +static long gmtoffs[TZ_MAX_TYPES]; +static char isdsts[TZ_MAX_TYPES]; +static char abbrinds[TZ_MAX_TYPES]; +static char ttisstds[TZ_MAX_TYPES]; +static char chars[TZ_MAX_CHARS]; +static time_t trans[TZ_MAX_LEAPS]; +static long corr[TZ_MAX_LEAPS]; +static char roll[TZ_MAX_LEAPS]; + +/* +** Memory allocation. +*/ + +static char * +memcheck(ptr) +char * const ptr; +{ + if (ptr == NULL) { + (void) perror(progname); + (void) exit(EXIT_FAILURE); + } + return ptr; +} + +#define emalloc(size) memcheck(imalloc(size)) +#define erealloc(ptr, size) memcheck(irealloc(ptr, size)) +#define ecpyalloc(ptr) memcheck(icpyalloc(ptr)) +#define ecatalloc(oldp, newp) memcheck(icatalloc(oldp, newp)) + +/* +** Error handling. +*/ + +static void +eats(name, num, rname, rnum) +const char * const name; +const int num; +const char * const rname; +const int rnum; +{ + filename = name; + linenum = num; + rfilename = rname; + rlinenum = rnum; +} + +static void +eat(name, num) +const char * const name; +const int num; +{ + eats(name, num, (char *) NULL, -1); +} + +static void +error(string) +const char * const string; +{ + /* + ** Match the format of "cc" to allow sh users to + ** zic ... 2>&1 | error -t "*" -v + ** on BSD systems. + */ + (void) fprintf(stderr, "\"%s\", line %d: %s", + filename, linenum, string); + if (rfilename != NULL) + (void) fprintf(stderr, " (rule from \"%s\", line %d)", + rfilename, rlinenum); + (void) fprintf(stderr, "\n"); + ++errors; +} + +static void +usage() +{ + (void) fprintf(stderr, +"%s: usage is %s [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] [ -d directory ]\n\ +\t[ -L leapseconds ] [ filename ... ]\n", + progname, progname); + (void) exit(EXIT_FAILURE); +} + +static const char * psxrules; +static const char * lcltime; +static const char * directory; +static const char * leapsec; +static int sflag = FALSE; + +int +main(argc, argv) +int argc; +char * argv[]; +{ + register int i, j; + register int c; + +#ifdef unix + (void) umask(umask(022) | 022); +#endif /* defined unix */ + progname = argv[0]; + while ((c = getopt(argc, argv, "d:l:p:L:vs")) != EOF) + switch (c) { + default: + usage(); + case 'd': + if (directory == NULL) + directory = optarg; + else { + (void) fprintf(stderr, +"%s: More than one -d option specified\n", + progname); + (void) exit(EXIT_FAILURE); + } + break; + case 'l': + if (lcltime == NULL) + lcltime = optarg; + else { + (void) fprintf(stderr, +"%s: More than one -l option specified\n", + progname); + (void) exit(EXIT_FAILURE); + } + break; + case 'p': + if (psxrules == NULL) + psxrules = optarg; + else { + (void) fprintf(stderr, +"%s: More than one -p option specified\n", + progname); + (void) exit(EXIT_FAILURE); + } + break; + case 'L': + if (leapsec == NULL) + leapsec = optarg; + else { + (void) fprintf(stderr, +"%s: More than one -L option specified\n", + progname); + (void) exit(EXIT_FAILURE); + } + break; + case 'v': + noise = TRUE; + break; + case 's': + sflag = TRUE; + break; + } + if (optind == argc - 1 && strcmp(argv[optind], "=") == 0) + usage(); /* usage message by request */ + if (directory == NULL) + directory = TZDIR; + + setboundaries(); + + if (optind < argc && leapsec != NULL) { + infile(leapsec); + adjleap(); + } + + zones = (struct zone *) emalloc(0); + rules = (struct rule *) emalloc(0); + links = (struct link *) emalloc(0); + for (i = optind; i < argc; ++i) + infile(argv[i]); + if (errors) + (void) exit(EXIT_FAILURE); + associate(); + for (i = 0; i < nzones; i = j) { + /* + ** Find the next non-continuation zone entry. + */ + for (j = i + 1; j < nzones && zones[j].z_name == NULL; ++j) + ; + outzone(&zones[i], j - i); + } + /* + ** Make links. + */ + for (i = 0; i < nlinks; ++i) + dolink(links[i].l_from, links[i].l_to); + if (lcltime != NULL) + dolink(lcltime, TZDEFAULT); + if (psxrules != NULL) + dolink(psxrules, TZDEFRULES); + return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} + +static void +dolink(fromfile, tofile) +const char * const fromfile; +const char * const tofile; +{ + register char * fromname; + register char * toname; + + fromname = ecpyalloc(directory); + fromname = ecatalloc(fromname, "/"); + fromname = ecatalloc(fromname, fromfile); + toname = ecpyalloc(directory); + toname = ecatalloc(toname, "/"); + toname = ecatalloc(toname, tofile); + /* + ** We get to be careful here since + ** there's a fair chance of root running us. + */ + if (!itsdir(toname)) + (void) remove(toname); + if (link(fromname, toname) != 0) { + (void) fprintf(stderr, "%s: Can't link from %s to ", + progname, fromname); + (void) perror(toname); + (void) exit(EXIT_FAILURE); + } + ifree(fromname); + ifree(toname); +} + +static void +setboundaries() +{ + register time_t bit; + + for (bit = 1; bit > 0; bit <<= 1) + ; + if (bit == 0) { /* time_t is an unsigned type */ + tt_signed = FALSE; + min_time = 0; + max_time = ~(time_t) 0; + if (sflag) + max_time >>= 1; + } else { + tt_signed = TRUE; + min_time = bit; + max_time = bit; + ++max_time; + max_time = -max_time; + if (sflag) + min_time = 0; + } + min_year = TM_YEAR_BASE + gmtime(&min_time)->tm_year; + max_year = TM_YEAR_BASE + gmtime(&max_time)->tm_year; +} + +static int +itsdir(name) +const char * const name; +{ + register char * myname; + register int accres; + + myname = ecpyalloc(name); + myname = ecatalloc(myname, "/."); + accres = access(myname, 0); + ifree(myname); + return accres == 0; +} + +/* +** Associate sets of rules with zones. +*/ + +/* +** Sort by rule name. +*/ + +static int +rcomp(cp1, cp2) +const genericptr_t cp1; +const genericptr_t cp2; +{ + return strcmp(((struct rule *) cp1)->r_name, + ((struct rule *) cp2)->r_name); +} + +static void +associate() +{ + register struct zone * zp; + register struct rule * rp; + register int base, out; + register int i; + + if (nrules != 0) + (void) qsort((genericptr_t) rules, + (qsort_size_t) nrules, + (qsort_size_t) sizeof *rules, rcomp); + for (i = 0; i < nzones; ++i) { + zp = &zones[i]; + zp->z_rules = NULL; + zp->z_nrules = 0; + } + for (base = 0; base < nrules; base = out) { + rp = &rules[base]; + for (out = base + 1; out < nrules; ++out) + if (strcmp(rp->r_name, rules[out].r_name) != 0) + break; + for (i = 0; i < nzones; ++i) { + zp = &zones[i]; + if (strcmp(zp->z_rule, rp->r_name) != 0) + continue; + zp->z_rules = rp; + zp->z_nrules = out - base; + } + } + for (i = 0; i < nzones; ++i) { + zp = &zones[i]; + if (zp->z_nrules == 0) { + /* + ** Maybe we have a local standard time offset. + */ + eat(zp->z_filename, zp->z_linenum); + zp->z_stdoff = gethms(zp->z_rule, "unruly zone", TRUE); + /* + ** Note, though, that if there's no rule, + ** a '%s' in the format is a bad thing. + */ + if (strchr(zp->z_format, '%') != 0) + error("%s in ruleless zone"); + } + } + if (errors) + (void) exit(EXIT_FAILURE); +} + +static void +infile(name) +const char * name; +{ + register FILE * fp; + register char ** fields; + register char * cp; + register const struct lookup * lp; + register int nfields; + register int wantcont; + register int num; + char buf[BUFSIZ]; + + if (strcmp(name, "-") == 0) { + name = "standard input"; + fp = stdin; + } else if ((fp = fopen(name, "r")) == NULL) { + (void) fprintf(stderr, "%s: Can't open ", progname); + (void) perror(name); + (void) exit(EXIT_FAILURE); + } + wantcont = FALSE; + for (num = 1; ; ++num) { + eat(name, num); + if (fgets(buf, (int) sizeof buf, fp) != buf) + break; + cp = strchr(buf, '\n'); + if (cp == NULL) { + error("line too long"); + (void) exit(EXIT_FAILURE); + } + *cp = '\0'; + fields = getfields(buf); + nfields = 0; + while (fields[nfields] != NULL) { + if (ciequal(fields[nfields], "-")) + fields[nfields] = ""; + ++nfields; + } + if (nfields == 0) { + /* nothing to do */ + } else if (wantcont) { + wantcont = inzcont(fields, nfields); + } else { + lp = byword(fields[0], line_codes); + if (lp == NULL) + error("input line of unknown type"); + else switch ((int) (lp->l_value)) { + case LC_RULE: + inrule(fields, nfields); + wantcont = FALSE; + break; + case LC_ZONE: + wantcont = inzone(fields, nfields); + break; + case LC_LINK: + inlink(fields, nfields); + wantcont = FALSE; + break; + case LC_LEAP: + if (name != leapsec) + (void) fprintf(stderr, +"%s: Leap line in non leap seconds file %s\n", + progname, name); + else inleap(fields, nfields); + wantcont = FALSE; + break; + default: /* "cannot happen" */ + (void) fprintf(stderr, +"%s: panic: Invalid l_value %d\n", + progname, lp->l_value); + (void) exit(EXIT_FAILURE); + } + } + ifree((char *) fields); + } + if (ferror(fp)) { + (void) fprintf(stderr, "%s: Error reading ", progname); + (void) perror(filename); + (void) exit(EXIT_FAILURE); + } + if (fp != stdin && fclose(fp)) { + (void) fprintf(stderr, "%s: Error closing ", progname); + (void) perror(filename); + (void) exit(EXIT_FAILURE); + } + if (wantcont) + error("expected continuation line not found"); +} + +/* +** Convert a string of one of the forms +** h -h hh:mm -hh:mm hh:mm:ss -hh:mm:ss +** into a number of seconds. +** A null string maps to zero. +** Call error with errstring and return zero on errors. +*/ + +static long +gethms(string, errstring, signable) +const char * string; +const char * const errstring; +const int signable; +{ + int hh, mm, ss, sign; + + if (string == NULL || *string == '\0') + return 0; + if (!signable) + sign = 1; + else if (*string == '-') { + sign = -1; + ++string; + } else sign = 1; + if (sscanf(string, scheck(string, "%d"), &hh) == 1) + mm = ss = 0; + else if (sscanf(string, scheck(string, "%d:%d"), &hh, &mm) == 2) + ss = 0; + else if (sscanf(string, scheck(string, "%d:%d:%d"), + &hh, &mm, &ss) != 3) { + error(errstring); + return 0; + } + if (hh < 0 || hh >= HOURSPERDAY || + mm < 0 || mm >= MINSPERHOUR || + ss < 0 || ss > SECSPERMIN) { + error(errstring); + return 0; + } + return eitol(sign) * + (eitol(hh * MINSPERHOUR + mm) * + eitol(SECSPERMIN) + eitol(ss)); +} + +static void +inrule(fields, nfields) +register char ** const fields; +const int nfields; +{ + static struct rule r; + + if (nfields != RULE_FIELDS) { + error("wrong number of fields on Rule line"); + return; + } + if (*fields[RF_NAME] == '\0') { + error("nameless rule"); + return; + } + r.r_filename = filename; + r.r_linenum = linenum; + r.r_stdoff = gethms(fields[RF_STDOFF], "invalid saved time", TRUE); + rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND], + fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]); + r.r_name = ecpyalloc(fields[RF_NAME]); + r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]); + rules = (struct rule *) erealloc((char *) rules, + (int) ((nrules + 1) * sizeof *rules)); + rules[nrules++] = r; +} + +static int +inzone(fields, nfields) +register char ** const fields; +const int nfields; +{ + register int i; + char buf[132]; + + if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS) { + error("wrong number of fields on Zone line"); + return FALSE; + } + if (strcmp(fields[ZF_NAME], TZDEFAULT) == 0 && lcltime != NULL) { + (void) sprintf(buf, + "\"Zone %s\" line and -l option are mutually exclusive", + TZDEFAULT); + error(buf); + return FALSE; + } + if (strcmp(fields[ZF_NAME], TZDEFRULES) == 0 && psxrules != NULL) { + (void) sprintf(buf, + "\"Zone %s\" line and -p option are mutually exclusive", + TZDEFRULES); + error(buf); + return FALSE; + } + for (i = 0; i < nzones; ++i) + if (zones[i].z_name != NULL && + strcmp(zones[i].z_name, fields[ZF_NAME]) == 0) { + (void) sprintf(buf, +"duplicate zone name %s (file \"%s\", line %d)", + fields[ZF_NAME], + zones[i].z_filename, + zones[i].z_linenum); + error(buf); + return FALSE; + } + return inzsub(fields, nfields, FALSE); +} + +static int +inzcont(fields, nfields) +register char ** const fields; +const int nfields; +{ + if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) { + error("wrong number of fields on Zone continuation line"); + return FALSE; + } + return inzsub(fields, nfields, TRUE); +} + +static int +inzsub(fields, nfields, iscont) +register char ** const fields; +const int nfields; +const int iscont; +{ + register char * cp; + static struct zone z; + register int i_gmtoff, i_rule, i_format; + register int i_untilyear, i_untilmonth; + register int i_untilday, i_untiltime; + register int hasuntil; + + if (iscont) { + i_gmtoff = ZFC_GMTOFF; + i_rule = ZFC_RULE; + i_format = ZFC_FORMAT; + i_untilyear = ZFC_TILYEAR; + i_untilmonth = ZFC_TILMONTH; + i_untilday = ZFC_TILDAY; + i_untiltime = ZFC_TILTIME; + z.z_name = NULL; + } else { + i_gmtoff = ZF_GMTOFF; + i_rule = ZF_RULE; + i_format = ZF_FORMAT; + i_untilyear = ZF_TILYEAR; + i_untilmonth = ZF_TILMONTH; + i_untilday = ZF_TILDAY; + i_untiltime = ZF_TILTIME; + z.z_name = ecpyalloc(fields[ZF_NAME]); + } + z.z_filename = filename; + z.z_linenum = linenum; + z.z_gmtoff = gethms(fields[i_gmtoff], "invalid GMT offset", TRUE); + if ((cp = strchr(fields[i_format], '%')) != 0) { + if (*++cp != 's' || strchr(cp, '%') != 0) { + error("invalid abbreviation format"); + return FALSE; + } + } + z.z_rule = ecpyalloc(fields[i_rule]); + z.z_format = ecpyalloc(fields[i_format]); + hasuntil = nfields > i_untilyear; + if (hasuntil) { + z.z_untilrule.r_filename = filename; + z.z_untilrule.r_linenum = linenum; + rulesub(&z.z_untilrule, + fields[i_untilyear], + "only", + "", + (nfields > i_untilmonth) ? fields[i_untilmonth] : "Jan", + (nfields > i_untilday) ? fields[i_untilday] : "1", + (nfields > i_untiltime) ? fields[i_untiltime] : "0"); + z.z_untiltime = rpytime(&z.z_untilrule, z.z_untilrule.r_loyear); + if (iscont && nzones > 0 && z.z_untiltime < max_time && + z.z_untiltime > min_time && + zones[nzones - 1].z_untiltime >= z.z_untiltime) { +error("Zone continuation line end time is not after end time of previous line"); + return FALSE; + } + } + zones = (struct zone *) erealloc((char *) zones, + (int) ((nzones + 1) * sizeof *zones)); + zones[nzones++] = z; + /* + ** If there was an UNTIL field on this line, + ** there's more information about the zone on the next line. + */ + return hasuntil; +} + +static void +inleap(fields, nfields) +register char ** const fields; +const int nfields; +{ + register const char * cp; + register const struct lookup * lp; + register int i, j; + int year, month, day; + long dayoff, tod; + time_t t; + + if (nfields != LEAP_FIELDS) { + error("wrong number of fields on Leap line"); + return; + } + dayoff = 0; + cp = fields[LP_YEAR]; + if (sscanf(cp, scheck(cp, "%d"), &year) != 1 || + year < min_year || year > max_year) { + /* + * Leapin' Lizards! + */ + error("invalid leaping year"); + return; + } + j = EPOCH_YEAR; + while (j != year) { + if (year > j) { + i = len_years[isleap(j)]; + ++j; + } else { + --j; + i = -len_years[isleap(j)]; + } + dayoff = oadd(dayoff, eitol(i)); + } + if ((lp = byword(fields[LP_MONTH], mon_names)) == NULL) { + error("invalid month name"); + return; + } + month = lp->l_value; + j = TM_JANUARY; + while (j != month) { + i = len_months[isleap(year)][j]; + dayoff = oadd(dayoff, eitol(i)); + ++j; + } + cp = fields[LP_DAY]; + if (sscanf(cp, scheck(cp, "%d"), &day) != 1 || + day <= 0 || day > len_months[isleap(year)][month]) { + error("invalid day of month"); + return; + } + dayoff = oadd(dayoff, eitol(day - 1)); + if (dayoff < 0 && !tt_signed) { + error("time before zero"); + return; + } + t = (time_t) dayoff * SECSPERDAY; + /* + ** Cheap overflow check. + */ + if (t / SECSPERDAY != dayoff) { + error("time overflow"); + return; + } + tod = gethms(fields[LP_TIME], "invalid time of day", FALSE); + cp = fields[LP_CORR]; + if (strcmp(cp, "+") != 0 && strcmp(cp, "") != 0) { + /* infile() turned "-" into "" */ + error("illegal CORRECTION field on Leap line"); + return; + } + if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) { + error("illegal Rolling/Stationary field on Leap line"); + return; + } + addleap(tadd(t, tod), *cp == '+', lp->l_value); +} + +static void +inlink(fields, nfields) +register char ** const fields; +const int nfields; +{ + struct link l; + + if (nfields != LINK_FIELDS) { + error("wrong number of fields on Link line"); + return; + } + if (*fields[LF_FROM] == '\0') { + error("blank FROM field on Link line"); + return; + } + if (*fields[LF_TO] == '\0') { + error("blank TO field on Link line"); + return; + } + l.l_filename = filename; + l.l_linenum = linenum; + l.l_from = ecpyalloc(fields[LF_FROM]); + l.l_to = ecpyalloc(fields[LF_TO]); + links = (struct link *) erealloc((char *) links, + (int) ((nlinks + 1) * sizeof *links)); + links[nlinks++] = l; +} + +static void +rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep) +register struct rule * const rp; +char * const loyearp; +char * const hiyearp; +char * const typep; +char * const monthp; +char * const dayp; +char * const timep; +{ + register struct lookup const * lp; + register char * cp; + + if ((lp = byword(monthp, mon_names)) == NULL) { + error("invalid month name"); + return; + } + rp->r_month = lp->l_value; + rp->r_todisstd = FALSE; + cp = timep; + if (*cp != '\0') { + cp += strlen(cp) - 1; + switch (lowerit(*cp)) { + case 's': + rp->r_todisstd = TRUE; + *cp = '\0'; + break; + case 'w': + rp->r_todisstd = FALSE; + *cp = '\0'; + break; + } + } + rp->r_tod = gethms(timep, "invalid time of day", FALSE); + /* + ** Year work. + */ + cp = loyearp; + if ((lp = byword(cp, begin_years)) != NULL) switch ((int) lp->l_value) { + case YR_MINIMUM: + rp->r_loyear = min_year; + break; + case YR_MAXIMUM: + rp->r_loyear = max_year; + break; + default: /* "cannot happen" */ + (void) fprintf(stderr, + "%s: panic: Invalid l_value %d\n", + progname, lp->l_value); + (void) exit(EXIT_FAILURE); + } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1 || + rp->r_loyear < min_year || rp->r_loyear > max_year) { + if (noise) + error("invalid starting year"); + if (rp->r_loyear > max_year) + return; + } + cp = hiyearp; + if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) { + case YR_MINIMUM: + rp->r_hiyear = min_year; + break; + case YR_MAXIMUM: + rp->r_hiyear = max_year; + break; + case YR_ONLY: + rp->r_hiyear = rp->r_loyear; + break; + default: /* "cannot happen" */ + (void) fprintf(stderr, + "%s: panic: Invalid l_value %d\n", + progname, lp->l_value); + (void) exit(EXIT_FAILURE); + } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1 || + rp->r_hiyear < min_year || rp->r_hiyear > max_year) { + if (noise) + error("invalid ending year"); + if (rp->r_hiyear < min_year) + return; + } + if (rp->r_hiyear < min_year) + return; + if (rp->r_loyear < min_year) + rp->r_loyear = min_year; + if (rp->r_hiyear > max_year) + rp->r_hiyear = max_year; + if (rp->r_loyear > rp->r_hiyear) { + error("starting year greater than ending year"); + return; + } + if (*typep == '\0') + rp->r_yrtype = NULL; + else { + if (rp->r_loyear == rp->r_hiyear) { + error("typed single year"); + return; + } + rp->r_yrtype = ecpyalloc(typep); + } + /* + ** Day work. + ** Accept things such as: + ** 1 + ** last-Sunday + ** Sun<=20 + ** Sun>=7 + */ + if ((lp = byword(dayp, lasts)) != NULL) { + rp->r_dycode = DC_DOWLEQ; + rp->r_wday = lp->l_value; + rp->r_dayofmonth = len_months[1][rp->r_month]; + } else { + if ((cp = strchr(dayp, '<')) != 0) + rp->r_dycode = DC_DOWLEQ; + else if ((cp = strchr(dayp, '>')) != 0) + rp->r_dycode = DC_DOWGEQ; + else { + cp = dayp; + rp->r_dycode = DC_DOM; + } + if (rp->r_dycode != DC_DOM) { + *cp++ = 0; + if (*cp++ != '=') { + error("invalid day of month"); + return; + } + if ((lp = byword(dayp, wday_names)) == NULL) { + error("invalid weekday name"); + return; + } + rp->r_wday = lp->l_value; + } + if (sscanf(cp, scheck(cp, "%d"), &rp->r_dayofmonth) != 1 || + rp->r_dayofmonth <= 0 || + (rp->r_dayofmonth > len_months[1][rp->r_month])) { + error("invalid day of month"); + return; + } + } +} + +static void +convert(val, buf) +const long val; +char * const buf; +{ + register int i; + register long shift; + + for (i = 0, shift = 24; i < 4; ++i, shift -= 8) + buf[i] = val >> shift; +} + +static void +puttzcode(val, fp) +const long val; +FILE * const fp; +{ + char buf[4]; + + convert(val, buf); + (void) fwrite((genericptr_t) buf, + (fwrite_size_t) sizeof buf, + (fwrite_size_t) 1, fp); +} + +static void +writezone(name) +const char * const name; +{ + register FILE * fp; + register int i, j; + char fullname[BUFSIZ]; + static struct tzhead tzh; + + if (strlen(directory) + 1 + strlen(name) >= sizeof fullname) { + (void) fprintf(stderr, + "%s: File name %s/%s too long\n", progname, + directory, name); + (void) exit(EXIT_FAILURE); + } + (void) sprintf(fullname, "%s/%s", directory, name); + if ((fp = fopen(fullname, "wb")) == NULL) { + if (mkdirs(fullname) != 0) + (void) exit(EXIT_FAILURE); + if ((fp = fopen(fullname, "wb")) == NULL) { + (void) fprintf(stderr, "%s: Can't create ", progname); + (void) perror(fullname); + (void) exit(EXIT_FAILURE); + } + } + convert(eitol(typecnt), tzh.tzh_ttisstdcnt); + convert(eitol(leapcnt), tzh.tzh_leapcnt); + convert(eitol(timecnt), tzh.tzh_timecnt); + convert(eitol(typecnt), tzh.tzh_typecnt); + convert(eitol(charcnt), tzh.tzh_charcnt); + (void) fwrite((genericptr_t) &tzh, + (fwrite_size_t) sizeof tzh, + (fwrite_size_t) 1, fp); + for (i = 0; i < timecnt; ++i) { + j = leapcnt; + while (--j >= 0) + if (ats[i] >= trans[j]) { + ats[i] = tadd(ats[i], corr[j]); + break; + } + puttzcode((long) ats[i], fp); + } + if (timecnt > 0) + (void) fwrite((genericptr_t) types, + (fwrite_size_t) sizeof types[0], + (fwrite_size_t) timecnt, fp); + for (i = 0; i < typecnt; ++i) { + puttzcode((long) gmtoffs[i], fp); + (void) putc(isdsts[i], fp); + (void) putc(abbrinds[i], fp); + } + if (charcnt != 0) + (void) fwrite((genericptr_t) chars, + (fwrite_size_t) sizeof chars[0], + (fwrite_size_t) charcnt, fp); + for (i = 0; i < leapcnt; ++i) { + if (roll[i]) { + if (timecnt == 0 || trans[i] < ats[0]) { + j = 0; + while (isdsts[j]) + if (++j >= typecnt) { + j = 0; + break; + } + } else { + j = 1; + while (j < timecnt && trans[i] >= ats[j]) + ++j; + j = types[j - 1]; + } + puttzcode((long) tadd(trans[i], -gmtoffs[j]), fp); + } else puttzcode((long) trans[i], fp); + puttzcode((long) corr[i], fp); + } + for (i = 0; i < typecnt; ++i) + (void) putc(ttisstds[i], fp); + if (ferror(fp) || fclose(fp)) { + (void) fprintf(stderr, "%s: Write error on ", progname); + (void) perror(fullname); + (void) exit(EXIT_FAILURE); + } +} + +static void +outzone(zpfirst, zonecount) +const struct zone * const zpfirst; +const int zonecount; +{ + register const struct zone * zp; + register struct rule * rp; + register int i, j; + register int usestart, useuntil; + register time_t starttime, untiltime; + register long gmtoff; + register long stdoff; + register int year; + register long startoff; + register int startisdst; + register int startttisstd; + register int type; + char startbuf[BUFSIZ]; + + /* + ** Now. . .finally. . .generate some useful data! + */ + timecnt = 0; + typecnt = 0; + charcnt = 0; + /* + ** Two guesses. . .the second may well be corrected later. + */ + gmtoff = zpfirst->z_gmtoff; + stdoff = 0; +#ifdef lint + starttime = 0; + startttisstd = FALSE; +#endif /* defined lint */ + for (i = 0; i < zonecount; ++i) { + usestart = i > 0; + useuntil = i < (zonecount - 1); + zp = &zpfirst[i]; + eat(zp->z_filename, zp->z_linenum); + startisdst = -1; + if (zp->z_nrules == 0) { + type = addtype(oadd(zp->z_gmtoff, zp->z_stdoff), + zp->z_format, zp->z_stdoff != 0, + startttisstd); + if (usestart) + addtt(starttime, type); + gmtoff = zp->z_gmtoff; + stdoff = zp->z_stdoff; + } else for (year = min_year; year <= max_year; ++year) { + if (useuntil && year > zp->z_untilrule.r_hiyear) + break; + /* + ** Mark which rules to do in the current year. + ** For those to do, calculate rpytime(rp, year); + */ + for (j = 0; j < zp->z_nrules; ++j) { + rp = &zp->z_rules[j]; + eats(zp->z_filename, zp->z_linenum, + rp->r_filename, rp->r_linenum); + rp->r_todo = year >= rp->r_loyear && + year <= rp->r_hiyear && + yearistype(year, rp->r_yrtype); + if (rp->r_todo) + rp->r_temp = rpytime(rp, year); + } + for ( ; ; ) { + register int k; + register time_t jtime, ktime; + register long offset; + char buf[BUFSIZ]; + + if (useuntil) { + /* + ** Turn untiltime into GMT + ** assuming the current gmtoff and + ** stdoff values. + */ + offset = gmtoff; + if (!zp->z_untilrule.r_todisstd) + offset = oadd(offset, stdoff); + untiltime = tadd(zp->z_untiltime, + -offset); + } + /* + ** Find the rule (of those to do, if any) + ** that takes effect earliest in the year. + */ + k = -1; +#ifdef lint + ktime = 0; +#endif /* defined lint */ + for (j = 0; j < zp->z_nrules; ++j) { + rp = &zp->z_rules[j]; + if (!rp->r_todo) + continue; + eats(zp->z_filename, zp->z_linenum, + rp->r_filename, rp->r_linenum); + offset = gmtoff; + if (!rp->r_todisstd) + offset = oadd(offset, stdoff); + jtime = rp->r_temp; + if (jtime == min_time || + jtime == max_time) + continue; + jtime = tadd(jtime, -offset); + if (k < 0 || jtime < ktime) { + k = j; + ktime = jtime; + } + } + if (k < 0) + break; /* go on to next year */ + rp = &zp->z_rules[k]; + rp->r_todo = FALSE; + if (useuntil && ktime >= untiltime) + break; + if (usestart) { + if (ktime < starttime) { + stdoff = rp->r_stdoff; + startoff = oadd(zp->z_gmtoff, + rp->r_stdoff); + (void) sprintf(startbuf, + zp->z_format, + rp->r_abbrvar); + startisdst = + rp->r_stdoff != 0; + continue; + } + if (ktime != starttime && + startisdst >= 0) +addtt(starttime, addtype(startoff, startbuf, startisdst, startttisstd)); + usestart = FALSE; + } + eats(zp->z_filename, zp->z_linenum, + rp->r_filename, rp->r_linenum); + (void) sprintf(buf, zp->z_format, + rp->r_abbrvar); + offset = oadd(zp->z_gmtoff, rp->r_stdoff); + type = addtype(offset, buf, rp->r_stdoff != 0, + rp->r_todisstd); + if (timecnt != 0 || rp->r_stdoff != 0) + addtt(ktime, type); + gmtoff = zp->z_gmtoff; + stdoff = rp->r_stdoff; + } + } + /* + ** Now we may get to set starttime for the next zone line. + */ + if (useuntil) { + starttime = tadd(zp->z_untiltime, + -gmtoffs[types[timecnt - 1]]); + startttisstd = zp->z_untilrule.r_todisstd; + } + } + writezone(zpfirst->z_name); +} + +static void +addtt(starttime, type) +const time_t starttime; +const int type; +{ + if (timecnt != 0 && type == types[timecnt - 1]) + return; /* easy enough! */ + if (timecnt >= TZ_MAX_TIMES) { + error("too many transitions?!"); + (void) exit(EXIT_FAILURE); + } + ats[timecnt] = starttime; + types[timecnt] = type; + ++timecnt; +} + +static int +addtype(gmtoff, abbr, isdst, ttisstd) +const long gmtoff; +const char * const abbr; +const int isdst; +const int ttisstd; +{ + register int i, j; + + /* + ** See if there's already an entry for this zone type. + ** If so, just return its index. + */ + for (i = 0; i < typecnt; ++i) { + if (gmtoff == gmtoffs[i] && isdst == isdsts[i] && + strcmp(abbr, &chars[abbrinds[i]]) == 0 && + ttisstd == ttisstds[i]) + return i; + } + /* + ** There isn't one; add a new one, unless there are already too + ** many. + */ + if (typecnt >= TZ_MAX_TYPES) { + error("too many local time types"); + (void) exit(EXIT_FAILURE); + } + gmtoffs[i] = gmtoff; + isdsts[i] = isdst; + ttisstds[i] = ttisstd; + + for (j = 0; j < charcnt; ++j) + if (strcmp(&chars[j], abbr) == 0) + break; + if (j == charcnt) + newabbr(abbr); + abbrinds[i] = j; + ++typecnt; + return i; +} + +static void +addleap(t, positive, rolling) +const time_t t; +const int positive; +const int rolling; +{ + register int i, j; + + if (leapcnt >= TZ_MAX_LEAPS) { + error("too many leap seconds"); + (void) exit(EXIT_FAILURE); + } + for (i = 0; i < leapcnt; ++i) + if (t <= trans[i]) { + if (t == trans[i]) { + error("repeated leap second moment"); + (void) exit(EXIT_FAILURE); + } + break; + } + for (j = leapcnt; j > i; --j) { + trans[j] = trans[j-1]; + corr[j] = corr[j-1]; + roll[j] = roll[j-1]; + } + trans[i] = t; + corr[i] = (positive ? 1L : -1L); + roll[i] = rolling; + ++leapcnt; +} + +static void +adjleap() +{ + register int i; + register long last = 0; + + /* + ** propagate leap seconds forward + */ + for (i = 0; i < leapcnt; ++i) { + trans[i] = tadd(trans[i], last); + last = corr[i] += last; + } +} + +static int +yearistype(year, type) +const int year; +const char * const type; +{ + char buf[BUFSIZ]; + int result; + + if (type == NULL || *type == '\0') + return TRUE; + if (strcmp(type, "uspres") == 0) + return (year % 4) == 0; + if (strcmp(type, "nonpres") == 0) + return (year % 4) != 0; + (void) sprintf(buf, "yearistype %d %s", year, type); + result = system(buf); + if (result == 0) + return TRUE; + if (result == (1 << 8)) + return FALSE; + error("Wild result from command execution"); + (void) fprintf(stderr, "%s: command was '%s', result was %d\n", + progname, buf, result); + for ( ; ; ) + (void) exit(EXIT_FAILURE); +} + +static int +lowerit(a) +const int a; +{ + return (isascii(a) && isupper(a)) ? tolower(a) : a; +} + +static int +ciequal(ap, bp) /* case-insensitive equality */ +register const char * ap; +register const char * bp; +{ + while (lowerit(*ap) == lowerit(*bp++)) + if (*ap++ == '\0') + return TRUE; + return FALSE; +} + +static int +itsabbr(abbr, word) +register const char * abbr; +register const char * word; +{ + if (lowerit(*abbr) != lowerit(*word)) + return FALSE; + ++word; + while (*++abbr != '\0') + do if (*word == '\0') + return FALSE; + while (lowerit(*word++) != lowerit(*abbr)); + return TRUE; +} + +static const struct lookup * +byword(word, table) +register const char * const word; +register const struct lookup * const table; +{ + register const struct lookup * foundlp; + register const struct lookup * lp; + + if (word == NULL || table == NULL) + return NULL; + /* + ** Look for exact match. + */ + for (lp = table; lp->l_word != NULL; ++lp) + if (ciequal(word, lp->l_word)) + return lp; + /* + ** Look for inexact match. + */ + foundlp = NULL; + for (lp = table; lp->l_word != NULL; ++lp) + if (itsabbr(word, lp->l_word)) + if (foundlp == NULL) + foundlp = lp; + else return NULL; /* multiple inexact matches */ + return foundlp; +} + +static char ** +getfields(cp) +register char * cp; +{ + register char * dp; + register char ** array; + register int nsubs; + + if (cp == NULL) + return NULL; + array = (char **) emalloc((int) ((strlen(cp) + 1) * sizeof *array)); + nsubs = 0; + for ( ; ; ) { + while (isascii(*cp) && isspace(*cp)) + ++cp; + if (*cp == '\0' || *cp == '#') + break; + array[nsubs++] = dp = cp; + do { + if ((*dp = *cp++) != '"') + ++dp; + else while ((*dp = *cp++) != '"') + if (*dp != '\0') + ++dp; + else error("Odd number of quotation marks"); + } while (*cp != '\0' && *cp != '#' && + (!isascii(*cp) || !isspace(*cp))); + if (isascii(*cp) && isspace(*cp)) + ++cp; + *dp = '\0'; + } + array[nsubs] = NULL; + return array; +} + +static long +oadd(t1, t2) +const long t1; +const long t2; +{ + register long t; + + t = t1 + t2; + if (t2 > 0 && t <= t1 || t2 < 0 && t >= t1) { + error("time overflow"); + (void) exit(EXIT_FAILURE); + } + return t; +} + +static time_t +tadd(t1, t2) +const time_t t1; +const long t2; +{ + register time_t t; + + if (t1 == max_time && t2 > 0) + return max_time; + if (t1 == min_time && t2 < 0) + return min_time; + t = t1 + t2; + if (t2 > 0 && t <= t1 || t2 < 0 && t >= t1) { + error("time overflow"); + (void) exit(EXIT_FAILURE); + } + return t; +} + +/* +** Given a rule, and a year, compute the date - in seconds since January 1, +** 1970, 00:00 LOCAL time - in that year that the rule refers to. +*/ + +static time_t +rpytime(rp, wantedy) +register const struct rule * const rp; +register const int wantedy; +{ + register int y, m, i; + register long dayoff; /* with a nod to Margaret O. */ + register time_t t; + + dayoff = 0; + m = TM_JANUARY; + y = EPOCH_YEAR; + while (wantedy != y) { + if (wantedy > y) { + i = len_years[isleap(y)]; + ++y; + } else { + --y; + i = -len_years[isleap(y)]; + } + dayoff = oadd(dayoff, eitol(i)); + } + while (m != rp->r_month) { + i = len_months[isleap(y)][m]; + dayoff = oadd(dayoff, eitol(i)); + ++m; + } + i = rp->r_dayofmonth; + if (m == TM_FEBRUARY && i == 29 && !isleap(y)) { + if (rp->r_dycode == DC_DOWLEQ) + --i; + else { + error("use of 2/29 in non leap-year"); + (void) exit(EXIT_FAILURE); + } + } + --i; + dayoff = oadd(dayoff, eitol(i)); + if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) { + register long wday; + +#define LDAYSPERWEEK ((long) DAYSPERWEEK) + wday = eitol(EPOCH_WDAY); + /* + ** Don't trust mod of negative numbers. + */ + if (dayoff >= 0) + wday = (wday + dayoff) % LDAYSPERWEEK; + else { + wday -= ((-dayoff) % LDAYSPERWEEK); + if (wday < 0) + wday += LDAYSPERWEEK; + } + while (wday != eitol(rp->r_wday)) + if (rp->r_dycode == DC_DOWGEQ) { + dayoff = oadd(dayoff, (long) 1); + if (++wday >= LDAYSPERWEEK) + wday = 0; + ++i; + } else { + dayoff = oadd(dayoff, (long) -1); + if (--wday < 0) + wday = LDAYSPERWEEK; + --i; + } + if (i < 0 || i >= len_months[isleap(y)][m]) { + error("no day in month matches rule"); + (void) exit(EXIT_FAILURE); + } + } + if (dayoff < 0 && !tt_signed) { + if (wantedy == rp->r_loyear) + return min_time; + error("time before zero"); + (void) exit(EXIT_FAILURE); + } + t = (time_t) dayoff * SECSPERDAY; + /* + ** Cheap overflow check. + */ + if (t / SECSPERDAY != dayoff) { + if (wantedy == rp->r_hiyear) + return max_time; + if (wantedy == rp->r_loyear) + return min_time; + error("time overflow"); + (void) exit(EXIT_FAILURE); + } + return tadd(t, rp->r_tod); +} + +static void +newabbr(string) +const char * const string; +{ + register int i; + + i = strlen(string) + 1; + if (charcnt + i >= TZ_MAX_CHARS) { + error("too many, or too long, time zone abbreviations"); + (void) exit(EXIT_FAILURE); + } + (void) strcpy(&chars[charcnt], string); + charcnt += eitol(i); +} + +static int +mkdirs(name) +char * const name; +{ + register char * cp; + + if ((cp = name) == NULL || *cp == '\0') + return 0; + while ((cp = strchr(cp + 1, '/')) != 0) { + *cp = '\0'; +#ifndef unix + /* + ** MS-DOS drive specifier? + */ + if (strlen(name) == 2 && isascii(name[0]) && + isalpha(name[0]) && name[1] == ':') { + *cp = '/'; + continue; + } +#endif /* !defined unix */ + if (!itsdir(name)) { + /* + ** It doesn't seem to exist, so we try to create it. + */ + if (emkdir(name, 0755) != 0) { + (void) fprintf(stderr, + "%s: Can't create directory ", + progname); + (void) perror(name); + return -1; + } + } + *cp = '/'; + } + return 0; +} + +static long +eitol(i) +const int i; +{ + long l; + + l = i; + if (i < 0 && l >= 0 || i == 0 && l != 0 || i > 0 && l <= 0) { + (void) fprintf(stderr, "%s: %d did not sign extend correctly\n", + progname, i); + (void) exit(EXIT_FAILURE); + } + return l; +} + +/* +** UNIX is a registered trademark of AT&T. +*/ diff -Nru glibc-1.01/version.c glibc-1.02/version.c --- glibc-1.01/version.c Wed Mar 11 20:14:14 1992 +++ glibc-1.02/version.c Fri Mar 20 19:36:09 1992 @@ -20,7 +20,7 @@ #include CONST char __libc_release[] = "beta"; -CONST char __libc_version[] = "1.01"; +CONST char __libc_version[] = "1.02"; void DEFUN_VOID(__libc_print_version)