summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:54:45 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:54:45 +0300
commitf20ab7c3039a4023f41372bfe4bde3b16d481df7 (patch)
tree4425de8c6177df655f165cb61d70d0acb5fdc968
parent6607eb3d5e40b98d2acc8f6b0d6a0b5a4b0f56bd (diff)
downloadgawk-f20ab7c3039a4023f41372bfe4bde3b16d481df7.tar.gz
Move to gawk-3.0.4.gawk-3.0.4
-rw-r--r--ChangeLog301
-rw-r--r--FUTURES2
-rw-r--r--Makefile.in12
-rw-r--r--NEWS76
-rw-r--r--PORTS57
-rw-r--r--POSIX.STD5
-rw-r--r--README8
-rw-r--r--README_d/README.FIRST2
-rw-r--r--README_d/README.atari5
-rw-r--r--README_d/README.linux2
-rw-r--r--README_d/README.pc100
-rw-r--r--README_d/README.sco2
-rw-r--r--README_d/README.solaris12
-rw-r--r--README_d/README.sony1
-rw-r--r--README_d/README.sunos42
-rw-r--r--README_d/README.yacc2
-rw-r--r--acconfig.h5
-rw-r--r--aclocal.m4129
-rw-r--r--array.c10
-rw-r--r--atari/ChangeLog4
-rw-r--r--atari/README.1st6
-rw-r--r--awk.h14
-rw-r--r--awk.y19
-rw-r--r--awklib/ChangeLog4
-rw-r--r--awklib/Makefile.in2
-rw-r--r--awklib/eg/lib/assert.awk2
-rw-r--r--awklib/eg/lib/ftrans.awk2
-rw-r--r--awklib/eg/lib/getopt.awk2
-rw-r--r--awklib/eg/lib/gettime.awk2
-rw-r--r--awklib/eg/lib/grcat.c2
-rw-r--r--awklib/eg/lib/groupawk.in4
-rw-r--r--awklib/eg/lib/join.awk2
-rw-r--r--awklib/eg/lib/mktime.awk2
-rw-r--r--awklib/eg/lib/nextfile.awk2
-rw-r--r--awklib/eg/lib/ord.awk2
-rw-r--r--awklib/eg/lib/passwdawk.in2
-rw-r--r--awklib/eg/lib/pwcat.c2
-rw-r--r--awklib/eg/lib/round.awk2
-rw-r--r--awklib/eg/prog/alarm.awk2
-rw-r--r--awklib/eg/prog/awksed.awk2
-rw-r--r--awklib/eg/prog/cut.awk2
-rw-r--r--awklib/eg/prog/dupword.awk2
-rw-r--r--awklib/eg/prog/egrep.awk2
-rw-r--r--awklib/eg/prog/extract.awk2
-rw-r--r--awklib/eg/prog/histsort.awk2
-rw-r--r--awklib/eg/prog/id.awk2
-rw-r--r--awklib/eg/prog/igawk.sh2
-rw-r--r--awklib/eg/prog/labels.awk2
-rw-r--r--awklib/eg/prog/split.awk2
-rw-r--r--awklib/eg/prog/tee.awk2
-rw-r--r--awklib/eg/prog/translate.awk2
-rw-r--r--awklib/eg/prog/uniq.awk2
-rw-r--r--awklib/eg/prog/wc.awk2
-rw-r--r--awklib/extract.awk4
-rw-r--r--awktab.c39
-rw-r--r--builtin.c109
-rwxr-xr-xconfig.guess1034
-rwxr-xr-xconfig.sub993
-rw-r--r--configh.in5
-rwxr-xr-xconfigure711
-rw-r--r--configure.in33
-rw-r--r--custom.h11
-rw-r--r--doc/ChangeLog27
-rw-r--r--doc/Makefile.in15
-rw-r--r--doc/ad.block9
-rw-r--r--doc/awkcard.in25
-rw-r--r--doc/cardfonts2
-rw-r--r--doc/colors4
-rw-r--r--doc/gawk.116
-rw-r--r--doc/gawk.info1242
-rw-r--r--doc/gawk.texi222
-rw-r--r--doc/igawk.12
-rw-r--r--doc/no.colors2
-rw-r--r--doc/texinfo.tex954
-rw-r--r--eval.c76
-rw-r--r--field.c66
-rw-r--r--gawkmisc.c2
-rw-r--r--io.c103
-rw-r--r--main.c8
-rw-r--r--missing/strftime.32
-rw-r--r--missing/strftime.c5
-rw-r--r--msg.c2
-rw-r--r--node.c31
-rw-r--r--patchlevel.h2
-rw-r--r--pc/ChangeLog58
-rw-r--r--pc/Makefile46
-rw-r--r--pc/Makefile.tst114
-rw-r--r--pc/config.h23
-rw-r--r--pc/getid.c4
-rw-r--r--pc/include/process.h3
-rw-r--r--pc/popen.c143
-rw-r--r--pc/popen.h30
-rw-r--r--posix/ChangeLog4
-rw-r--r--regex.c19
-rw-r--r--stamp-h.in2
-rw-r--r--test/ChangeLog44
-rw-r--r--test/Makefile.in31
-rw-r--r--test/badargs.ok4
-rw-r--r--test/getnr2tb.awk111
-rw-r--r--test/getnr2tb.in6
-rw-r--r--test/getnr2tb.ok6
-rw-r--r--test/getnr2tm.awk75
-rw-r--r--test/getnr2tm.in1
-rw-r--r--test/getnr2tm.ok1
-rwxr-xr-xtest/gsubtest.awk12
-rw-r--r--test/gsubtest.ok12
-rw-r--r--test/nasty.awk92
-rw-r--r--test/nasty.ok2
-rw-r--r--test/printf1.awk19
-rw-r--r--test/printf1.ok7
-rw-r--r--test/reg/Obsolete/exp.awk (renamed from test/reg/exp.awk)0
-rw-r--r--test/reg/Obsolete/exp.good (renamed from test/reg/exp.good)0
-rw-r--r--test/reg/Obsolete/exp.in (renamed from test/reg/exp.in)0
-rw-r--r--test/reg/Obsolete/log.awk (renamed from test/reg/log.awk)0
-rw-r--r--test/reg/Obsolete/log.good (renamed from test/reg/log.good)0
-rw-r--r--test/reg/Obsolete/log.in (renamed from test/reg/log.in)0
-rw-r--r--test/zeroflag.awk1
-rw-r--r--test/zeroflag.ok1
-rw-r--r--vms/ChangeLog17
-rw-r--r--vms/descrip.mms2
-rw-r--r--vms/gawk.hlp8
-rw-r--r--vms/vms-conf.h6
-rw-r--r--vms/vmsbuild.com2
-rw-r--r--vms/vmstest.com52
124 files changed, 5998 insertions, 1556 deletions
diff --git a/ChangeLog b/ChangeLog
index 0fa65154..8961fd5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,304 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
+Wed Jun 30 16:10:11 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.h: add include of <assert.h>, and comment about config.h
+ having to be included before any system headers. Otherwise,
+ with egcs-2.91.66 and later on Linux systems, and possibly
+ others, things break badly, due to the LFS macros.
+ * awk.y, builtin.c, eval.c, field.c, io.c: removed include
+ of assert.h
+
+Wed Jun 9 11:39:19 1999 Paul Eggert <eggert@twinsun.com>
+
+ Port the large-file code to AIX, HP-UX, and IRIX.
+ Add cross-compilation support for large files.
+
+ * config.guess, config.sub: New files.
+
+ * configure.in (AC_CANONICAL_HOST):
+ Add; GAWK_AC_SYS_LARGEFILE needs this.
+ (GAWK_AC_SYS_LARGEFILE): Renamed from GAWK_AC_LARGE_FILES.
+
+ * aclocal.m4 (GAWK_AC_SYS_LARGEFILE): Renamed from GAWK_AC_LARGE_FILES.
+ Add support for AIX and HP-UX.
+ (GAWK_AC_SYS_LARGEFILE_FLAGS, GAWK_AC_SYS_LARGEFILE_SPACE_APPEND,
+ GAWK_AC_SYS_LARGEFILE_MACRO_VALUE): New macros.
+
+ * acconfig.h (_FILE_OFFSET_BITS, _LARGEFILE_SOURCE, _LARGE_FILES):
+ New macros.
+
+ * Makefile.in (MISC): add config.guess and config.sub so they get
+ included in the distribution.
+
+Wed Jun 9 11:29:29 1999 Paul Eggert <eggert@twinsun.com>
+
+ * io.c (iop_alloc): Don't mmap files whose sizes don't fit in `int'.
+ [ This isn't really needed, as HAVE_MMAP is #undef'ed at the top,
+ but it's there in case people want to take their life in their hands. ]
+
+Sun Jun 6 11:28:07 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.46: Release tar file made.
+
+Wed Jun 2 14:36:24 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * PORTS: Updated with a more recent list of systems
+ that gawk compiles and tests ok on.
+
+Tue Jun 1 14:24:59 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.45: Release tar file made.
+
+Tue May 25 16:32:37 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (format_tree): more smarts for weird cases, such as
+ zero precisions and zero values used with the `#' flag.
+ Thanks to Andreas Schwab (schwab@gnu.org) for pointing these out.
+
+Wed May 19 14:02:54 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (do_close): move test for `close(FILENAME)' to after
+ loop through all open redirections. Fixes problems in obscure
+ cases with redirections in END rules.
+
+Sun May 16 14:08:39 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.y (yylex): fix group of characters including ',' to
+ set want_assign = FALSE. Fixes bizarre parsing problems in
+ function call lists, for example.
+ * io.c (get_a_record): repair logic for single-leading-newline
+ case.
+
+Tue May 11 16:48:11 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * aclocal.m4 (GAWK_AC_AIX_TWEAK): new macro.
+ * configure.in: call it
+ * Makefile.in: (awklib/all): pass CFLAGS on to sub-make so
+ that password programs will get AIX magic defines. Avoids
+ having to tweak program code for those in doc/gawk.texi.
+
+Mon May 3 16:56:23 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * array.c (do_delete): don't free_temp(subs) until after all
+ references to it are finished.
+
+Mon May 3 13:41:16 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.44: Release tar file made.
+
+Sun May 2 18:25:43 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (get_a_record): Do a really good job of stripping newlines
+ from the front of records when RS = "" and there's only one
+ newline at the front of the file, which the regex didn't catch.
+
+Wed Apr 28 12:27:49 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * configure.in: more HP stuff: fix the manual alloca code so that
+ gawk will compile and link on HP systems. See the comments.
+
+Sun Apr 25 13:39:16 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (gawk): add $(CFLAGS) to linking step.
+ * configure.in: correctly do AC_FUNC_GETPRGP on HP systems too.
+
+Tue Apr 13 20:21:00 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.43: Release tar file made.
+
+Tue Apr 13 19:02:20 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (useropen, pidopen): add casts to int on arguments to
+ silence gcc warnings.
+ * regex.c (regcomp,regexec,regfree): add ifdef for APPLE.
+
+Thu Feb 4 10:38:02 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * custom.h: hacks for BeOS. Not documented in the manual right now.
+ * configure.in: hacks for BeOS. Check for HP-UX and define C_ALLOCA
+ if not using gcc. I wish they'd just fix bison already.
+
+Sun Dec 20 16:57:38 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.42: Release tar file made.
+
+Sun Nov 15 21:05:39 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (gawk_popen): Add WIN32 to list of systems that use
+ the non-real-pipe version. From the PC gawk guys.
+
+Wed Nov 4 11:32:24 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.41: Release tar file made.
+
+Tue Nov 3 16:24:35 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * eval.c (r_get_lhs): Fix the cases for the special variables,
+ don't unref their current value if it's the same as the internal
+ copy; perhaps the current one is used in a concatenation or some
+ other expression somewhere higher up in the call chain. Ouch.
+ See test/getnr2tm.awk.
+
+Sun Nov 1 15:24:52 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (format_tree): improve handling of zero-fill
+ when a precision is present. See test/zeroflag.awk.
+
+Wed Oct 28 20:40:17 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * eval.c (r_tree_eval): Case for Node_concat. Get lengthes
+ separately, in case one expression has a side effect that
+ that changes another. Ugly, but it keeps gawk from core
+ dumping. See test/nasty.awk.
+
+Sun Oct 18 21:27:24 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.y (append_right): bug fix, if `list' or `new' are NULL,
+ return `list', so that things don't break too badly.
+ * regex.c (re_compile_fastmap): remove unused variable `num_regs'.
+
+Thu Oct 8 19:36:57 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.40: Release tar file made.
+
+Mon Jul 27 10:14:33 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * node.c (parse_escape): Remove assignment with side effects
+ from ISXDIGIT test. Thanks to "Mihai T. LAZARESCU"
+ <mihai@ccmserv.polito.it> for pointing this out.
+
+Mon Apr 27 11:31:32 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * main.c (usage): fix the email address for the bug list.
+ (copyleft): update the copyright year.
+
+Mon Mar 23 21:22:32 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * eval.c (r_get_lhs): make sure that values of type
+ Node_param_list don't have the FUNC flag set. This means
+ we don't allow the use of a function name as a variable or
+ array from within the function.
+
+Sun Mar 22 19:12:32 1998 Paul Eggert <eggert@twinsun.com>
+
+ * aclocal.m4 (GAWK_AC_LARGE_FILES): new macro that checks for
+ large file support, and updates CPPFLAGS, LDFLAGS, LIBS as
+ needed.
+ * configure.in: call GAWK_AC_LARGE_FILES.
+ * Makefile.in (CPPFLAGS, LDFLAGS): Let autoconf configure.
+ (COMPFLAGS): Add $(CPPFLAGS).
+
+Mon Mar 16 14:06:41 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * field.c (using_FIELDWIDTHS): new macro.
+ (using_fieldwidths): use new macro.
+ (do_split): in case for FS_DFLT, also check that
+ we're not using FIELDWIDTHS. Otherwise, split() would use
+ FIELDWIDTHS, not current value of FS. Oops.
+
+Sun Nov 16 20:08:59 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (sub_common): fix for count of matches in gsub
+ from Geert.Debyser@esat.kuleuven.ac.be.
+
+Wed Oct 15 03:38:12 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * field.c (set_FS): Use `sc_parsefield' if the value of FS is not
+ alphabetic OR if not ignoring case. Bug fix if IGNORECASE
+ is true and FS happens to be '^'. Sheesh, talk about obscure.
+ (rebuild_record): Add more smarts to the code that sets up the
+ fields. Thanks to Alan J. Broder (ajb@dtmr.com).
+
+Sun Oct 5 11:56:52 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * configure.in: if ISC add -D_SYSV3 to CFLAGS, per email from
+ Mario Vanoni (vanonim@dial.eunet.ch).
+
+Fri Sep 26 00:57:49 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.y (append_right): return if either list is NULL. Prevents
+ syntax errors from causing core dumps.
+
+Wed Sep 17 15:34:15 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * field.c (rebuild_record): set things up so that all fields point
+ into the new record and release any changed fields without
+ causing memory leaks. Avoids problems when fields are extended
+ with the value of $0 or other fields and then $0 is assigned to.
+
+Mon Sep 15 16:12:55 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (do_print): when testing for NUMBER, make sure
+ it's not a string too. Thanks to Michael Brennan for
+ clarifying the semantics.
+
+Sun Sep 14 19:55:12 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * node.c (format_val): always format values ourselves: avoids
+ problems if OFMT is bizarre, like %s.
+
+Sun Sep 14 00:08:53 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (get_a_record): replace all occurrences of the test
+ `grRS == FALSE' with `RS_is_null' which makes ` RS = "\0" '
+ actually work, is clearer code, and actually makes use of
+ the `RS_is_null' variable!
+
+Sun Aug 17 07:15:12 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * field.c (set_FS): Change logic to always set parse_field, even
+ if FS hasn't changed. Thanks to Igor Sheyn for catching this.
+
+Wed Aug 6 21:04:37 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * io.c (VMS et al gawk_popen): use pclose, not fclose, if
+ iop_alloc fails.
+
+Wed Jul 30 19:53:52 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.y [variable]: fix case for subscript if $3 == NULL.
+
+Sun Jul 27 22:47:30 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * awk.y (get_src_buf): don't close file if it's stdin.
+
+Sun Jul 27 22:47:15 1997 Pat Rankin <rankin@eql.caltech.edu>
+
+ * io.c (#if VMS: vmsrtl_fileno): new routine.
+ (#if VMS: fileno): new macro substituted for stdio one.
+
+Thu Jul 17 20:05:59 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (do_print): When OFMT != CONVFMT, create a new
+ temporary node with just the numeric value valid and format it,
+ and use that for printing. Avoids memory corruption.
+
+Wed Jul 16 10:01:16 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * regex.c: When SYNTAX_TABLE is defined, but not emacs, then
+ CHAR_SET_SIZE is not defined, though used in regcomp. It should
+ be taken out of #ifdef SYNTAX_TABLE. Fix from bug group, from
+ Akim Demaille, demaille@inf.enst.fr.
+ * awk.h (isnondecimal): make test a little smarter.
+ builtin.c (nondec2awknum): add bailout for decimal numbers, e.g.
+ `00.1'. Fix from Larry Schwimmer <rosebud@cyclone.Stanford.EDU>.
+
+Thu Jun 19 19:00:40 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * eval.c (interpret): case Node_K_next, Node_K_nextfile: fatal
+ error if called from BEGIN or END.
+ (Fixed completely Mon May 3 13:31:42 1999.)
+
+Mon Jun 9 22:40:04 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * builtin.c (nondec2awknum): Allow `f' and `F' in hexadecimal numbers.
+ Gotta get more sleep...
+ * array.c (assoc_lookup): Fix from Tom Karzes (karzes@equator.com)
+ for memory leak when forcing type to Node_var_array.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/FUTURES b/FUTURES
index 13a312c1..829f1683 100644
--- a/FUTURES
+++ b/FUTURES
@@ -73,8 +73,6 @@ In 3.1
Use GNU malloc.
- Use rx instead of regex.
-
DONE: Do a reference card.
? Have strftime() pay attention to the value of ENVIRON["TZ"]
diff --git a/Makefile.in b/Makefile.in
index 024ec7d3..311bf772 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for GNU Awk.
#
-# Copyright (C) 1986, 1988-1997 the Free Software Foundation, Inc.
+# Copyright (C) 1986, 1988-1999 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -33,6 +33,7 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
+LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ALLOCA = @ALLOCA@
@@ -57,8 +58,9 @@ libexecdir = @libexecdir@/awk
DEFPATH = ".:$(datadir)"
SHELL = /bin/sh
+CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
-COMPFLAGS = -DGAWK -I. -I$(srcdir) @DEFS@ $(CFLAGS)
+COMPFLAGS = -DGAWK -I. -I$(srcdir) $(CPPFLAGS) @DEFS@ $(CFLAGS)
# object files
AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \
@@ -95,7 +97,7 @@ TEXFILES= doc/gawk.aux doc/gawk.cp doc/gawk.cps doc/gawk.fn doc/gawk.fns \
MISC = NEWS COPYING FUTURES Makefile.in PROBLEMS README PORTS POSIX.STD \
configure configure.in acconfig.h configh.in ACKNOWLEDGMENT \
ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \
- stamp-h.in
+ stamp-h.in config.sub config.guess
OTHERS= doc pc atari vms README_d posix awklib
@@ -139,7 +141,7 @@ config.status: configure
# Note: if you need something at both compile time and link time, like -pg,
# you will have to edit the Makefile manually to set LDFLAGS.
gawk: $(ALLOBJS) $(LIBOBJS) $(REOBJS)
- $(CC) -o gawk $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
+ $(CC) -o gawk $(CFLAGS) $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
$(ALLOBJS): awk.h dfa.h regex.h config.h custom.h
@@ -252,7 +254,7 @@ doc/all:
cd doc && $(MAKE) all
awklib/all: gawk
- cd awklib && $(MAKE) all
+ cd awklib && $(MAKE) CFLAGS="$(CFLAGS)" all
dist: $(AWKSRC) $(LIBSRC) $(DOCS) $(MISC) $(COPIES) awklib/stamp-eg info distclean
-rm -rf gawk-$(REL)*
diff --git a/NEWS b/NEWS
index 2a3e7fec..2a3ae4b0 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,79 @@
+Changes from 3.0.3 to 3.0.4
+---------------------------
+
+This is a bug fix release only, pending further development on 3.1.0.
+
+Bugs Fixed:
+
+ 1. A memory leak when turning a function parameter into an array was
+ fixed.
+
+ 2. The non-decimal data option now works correctly.
+
+ 3. Using an empty pair of brackets as an array subscript no longer causes
+ a core dump during parsing. In general, syntax errors should not
+ cause core dumps any more.
+
+ 4. Standard input is no longer closed if it provides program source,
+ avoiding strange I/O problems.
+
+ 5. Memory corruption during printing with `print' has been fixed.
+
+ 6. The gsub function now correctly counts the number of matches.
+
+ 7. A typo in doc/Makefile.in has been fixed, making installation work.
+
+ 8. Calling `next' or `nextfile' from a BEGIN or END rule is now fatal.
+
+ 9. Subtle problems in rebuilding $0 when fields were changed have been
+ fixed.
+
+10. `FS = FS' now correctly turns off the use of FIELDWIDTHS.
+
+11. Gawk now parses fields correctly when FS is a single character.
+
+12. It is now possible for RS to be the NUL character ("\0").
+
+13. Weird problems with number conversions on MIPS and other systems
+ have been fixed.
+
+14. When parsing using FIELDWIDTHS is in effect, split() with no third
+ argument will still use the value of FS.
+
+15. Large File Support for Solaris, HP-UX, AIX, and IRIX is now enabled at
+ compile time, thanks to Paul Eggert.
+
+16. Attempting to use the name of a function as a variable or array
+ from within the function is now caught as a fatal error, instead
+ of as a core dump.
+
+17. A bug in parsing hex escapes was fixed.
+
+18. A weird bug with concatenation where one expression has side effects
+ that changes another was fixed.
+
+19. printf/sprintf now behave much better for uses of the '0' and '#' flags
+ and with precisions and field widths.
+
+20. Further strangenesses with concatenation and multiple accesses of some
+ of the special variables was fixed.
+
+21. The Atari port is marked as no longer supported.
+
+22. Build problems on HP-UX have been fixed.
+
+23. Minor fixes and additional explanations added to the documentation.
+
+24. For RS = "", even a single leading newline is now correctly stripped.
+
+25. Obscure parsing problems for regex constants like /=.../ fixed, so
+ that a regex constant is recognized, and not the /= operator.
+
+26. Fixed a bug when closing a redirection that matched the current
+ or last FILENAME.
+
+27. Build problems on AIX fixed.
+
Changes from 3.0.2 to 3.0.3
---------------------------
diff --git a/PORTS b/PORTS
index c6cbb839..7f30f707 100644
--- a/PORTS
+++ b/PORTS
@@ -1,36 +1,27 @@
-A recent version of gawk has been successfully compiled and run "make test"
+Gawk 3.0.4 has been successfully compiled and run "make test"
on the following:
-Using cc:
- Dec Alpha OSF 4.0
- HP9000/755 HP-UX 9.01
- IBM PowerPC AIX 4.1.4.0
- SCO Unix (OpenServer 5)
- SGI IRIX 4.0.5
- SGI IRIX 5.3
- SGI IRIX 6.1
- SGI IRIX 6.2
- SunOS 4.1.3
- SunOS 5.5
- IBM SP2 AIX 4.1
+Linux 2.2.5 gcc 2.7.2.3
+Linux 2.0.33 gcc 2.7.2.1
+IRIX64 6.4 gcc 2.8.1
+IRIX 5.3 gcc 2.7.2.2
+UNIX_SV maxion OS 4.2MP gcc 2.7.2
+IRIX 6.2 gcc 2.7.2.2
+CYGWIN_95-4.0 20.1 (0.3/1/1) egcs-2.91.66 (has minor problems due to env.)
-Other systems:
- DEC Alpha Linux/AXP
- DEC Alpha OSF/1 3.2
- DECstation 5000 ULTRIX 4.3
- HP 9000/735 HP-UX 10.01
- IBM RS/6000 AIX 3.2
- IBM SP2 AIX 4.1
- Intel x86 DOS (compiler: djgpp v2, emx+gcc,
- and MSC 6.00A, 7, and 8)
- Intel x86 Linux 2.0.27
- Intel x86 Linux 2.1.36
- Intel x86 OS+2 (compiler: emx+gcc)
- NeXT Turbostation Mach 3.3
- SGI Indigo/2 IRIX 5.3
- SGI O2 IRIX 6.2
- SGI PowerChallenge IRIX 6.1
- Sun SPARC Linux 2.0.22
- Sun SPARC Solaris 2.5
- Sun SPARC Solaris 2.5.1
- Sun SPARC SunOS 4.1.3
+The builds of gawk-3.0.45, and validation and installation, were
+successful on these systems:
+
+ DEC Alpha OSF/1 3.2
+ HP 9000/735 HP-UX 10.01
+ IBM PowerPC AIX 4.2
+ Intel Pentium II MMX GNU/Linux 2.0.35
+ NeXT Turbostation Mach 3.3
+ SGI Indigo/2 IRIX 5.3
+ SGI O2 R10000-SC IRIX 6.3
+ Sun SPARC Solaris 2.6
+
+On
+ SGI Origin 200 IRIX 6.4
+a build with gcc-2.8.1 succeeded, but several tests failed; a rebuild
+with c89 fixed the problem.
diff --git a/POSIX.STD b/POSIX.STD
index ac8e1abf..05129b65 100644
--- a/POSIX.STD
+++ b/POSIX.STD
@@ -1,3 +1,8 @@
+October 1998:
+
+The 1003.2 work has been at a stand-still for ages. Who knows if or
+when a new revision will actually happen...
+
August 1995:
Although the published 1003.2 standard contained the incorrect
diff --git a/README b/README
index 890b16db..49102c5d 100644
--- a/README
+++ b/README
@@ -1,10 +1,10 @@
README:
-This is GNU Awk 3.0.3. It should be upwardly compatible with the Bell
+This is GNU Awk 3.0.4. It should be upwardly compatible with the Bell
Labs research version of awk. It is almost completely compliant with
the 1993 POSIX 1003.2 standard for awk. (See the note below about POSIX.)
-Patches 1 through 3 just fix bugs -- see NEWS and ChangeLog for details.
+Patches 1 through 4 just fix bugs -- see NEWS and ChangeLog for details.
See the file INSTALL for installation instructions.
@@ -66,7 +66,7 @@ about the worst place to post a gawk bug report. Please, use the mechanisms
outlined in the manual.
Arnold Robbins
-INTERNET: arnold@gnu.ai.mit.edu
+INTERNET: arnold@gnu.org
BUG REPORTS AND FIXES (non-Unix ports):
@@ -81,7 +81,7 @@ VMS:
Pat Rankin
rankin@eql.caltech.edu
-Atari ST:
+Alpha/Linux:
Michal Jaegermann
michal@gortel.phys.ualberta.ca
diff --git a/README_d/README.FIRST b/README_d/README.FIRST
index 2ebd5b7e..ef527f20 100644
--- a/README_d/README.FIRST
+++ b/README_d/README.FIRST
@@ -18,4 +18,4 @@ If you send me email about this, without having read this
file, I will yell at you.
Arnold Robbins
-arnold@gnu.ai.mit.edu
+arnold@gnu.org
diff --git a/README_d/README.atari b/README_d/README.atari
index ffbb12ac..0c7fd74b 100644
--- a/README_d/README.atari
+++ b/README_d/README.atari
@@ -1,3 +1,8 @@
+Sun May 2 18:40:46 IDT 1999
+
+See the README.1st file in the atari directory.
+
+--------------------------------------------------------
Gawk on the Atari has been compiled and tested using gcc, both
with and without -mshort flag. Other compilers can be used but if
sizeof(pointer) != sizeof(int) this code will not compile correctly
diff --git a/README_d/README.linux b/README_d/README.linux
index 85973a2f..016d4749 100644
--- a/README_d/README.linux
+++ b/README_d/README.linux
@@ -10,4 +10,4 @@ Removing and redoing the symlinks fixes the problem. It is fixed in
post-4.1 RedHat Linux.
Arnold Robbins
-arnold@gnu.ai.mit.edu
+arnold@gnu.org
diff --git a/README_d/README.pc b/README_d/README.pc
index ddf2eb4b..13592ab3 100644
--- a/README_d/README.pc
+++ b/README_d/README.pc
@@ -1,16 +1,29 @@
-This is the README for GNU awk 3.0 under OS/2 and DOS.
+This is the README for GNU awk 3.0 under Win32, OS/2, and DOS.
Gawk has been compiled and tested under OS/2, DOS, and Win32 using
-the GNU development tools from DJ Delorie (DJGPP; DOS with special support
-for long filenames under Win95) and Eberhard Mattes (EMX; OS/2, DOS, and
-Win32 with rsxnt). Microsoft Visual C/C++ can be used to build a Win32
-version for Windows 95/NT, and MSC can be used to build 16-bit versions
-for DOS and OS/2.
+the GNU development tools from DJ Delorie (DJGPP; DOS with special
+support for long filenames under Win95), Eberhard Mattes (EMX; OS/2,
+DOS, and Win32 with rsxnt), and Jan-Jaap van der Heijden (Mingw32;
+Win32). Microsoft Visual C/C++ can be used to build a Win32 version for
+Windows 9x/NT, and MSC can be used to build 16-bit versions for DOS and
+OS/2.
Building gawk
-------------
+Building on DOS or Windows environments can be troublesome, in part due
+to shell limitations, the long filename issue, and various Win32 pipe
+considerations. The situation is somewhat better on OS/2. The general
+recommendation is to use tools (especially make) which are compatible
+or built with the compiler to be used on gawk.
+
+Building versions which do not understand long filenames on systems
+that offer long names is a special case. The maintainers unpack the
+distribution and process using utilities (unzip, make, cmp) which do not
+use long filenames. (For example, the djgpp tools will work if LFN=n is
+set in the environment.)
+
Copy the files in the `pc' directory (EXCEPT for `ChangeLog') to the
directory with the rest of the gawk sources. (The subdirectories of
`pc' need not be copied.) The makefile contains a configuration
@@ -45,6 +58,13 @@ used to modify test/Makefile for your platform. In addition, some
files in the test directory may need to have their end-of-line markers
converted, as described in Makefile.tst.
+As with building gawk, the OS, shell, and long filename issues come into
+play when testing, too. If you are testing gawk on a LFN aware system with
+some LFN aware tools, you may have problems if the shell that you specify in
+test/Makefile is not LFN aware. This problem will apply whether or not
+you are building a LFN aware gawk. See the comments in pc/Makefile.tst
+for more information on this.
+
It is routine to install by hand, but note that the install target also
builds igawk.bat and igawk.cmd, which are used to add an include
facility to gawk (and which require sh).
@@ -59,16 +79,12 @@ djgpp collection.
The GNUish Project was designed to bring GNU-like programs to small
systems running OS/2 and DOS. Binary distributions of gawk are
-maintained in GNUish, and include 16bit OS/2 and DOS versions and a
-djgpp-compiled version. Information on GNUish is available via
+maintained in GNUish, and include 16bit OS/2 and DOS, 32bit djgpp,
+and Win32 versions. Information on GNUish is available via
http://www.simtel.net/simtel.net/
- http://www.leo.org/pub/comp/platforms/pc/gnuish
- http://wuarchive.wustl.edu/systems/msdos/gnuish/
or
ftp://ftp.simtel.net/simtelnet/gnu/gnuish
- ftp://oak.oakland.edu/pub/simtelnet/gnu/gnuish
- ftp://wuarchive.wustl.edu/systems/msdos/gnuish/
Documentation appears in gnuish.htm (html) or gnuish.inf (info).
@@ -87,6 +103,13 @@ The djgpp collection at
contains a djgpp-compiled (32bit) version of gawk, along with many
djgpp-compiled utilities.
+The Mingw32 collection at
+
+ http://agnes.dida.physik.uni-essen.de/~janjaap/
+
+may contain a Win32 version of gawk, along with a Windows help
+version of the gawk manual.
+
2. The following table illustrates some of the differences among the various
compiled versions of gawk. For example, the djgpp version runs on all the
@@ -101,10 +124,11 @@ application").
emx(1) | N N N N OS2
emxbnd(2) | VCPI,DPMI DPMI DPMI,NoLFN DPMI,NoLFN DPMI,OS2
emxnt(3) | N N Win32 Win32 N
- msc | 16 16 16,NoLFN 16,NoLFN 16,DOS
+ msc(4) | 16 16 16,NoLFN 16,NoLFN 16,DOS
msc6bnd | 16 16 16,NoLFN 16,NoLFN 16,DOS,OS2
msc6os2 | N N N N 16,OS2
vcWin32 | N N Win32 Win32 N
+ mingw32 | N N Win32 Win32 N
(1) Requires emxrt.
@@ -114,6 +138,10 @@ application").
(3) Requires rsxnt.
+ (4) When compiling, MSC 8, when run in Windows 9x, will require that if
+ files are listed in #include statements with LFNs
+ (eg. <patchlevel.h>), that the file be named with the LFN.
+
16 16bit; limited capacity, especially under DOS.
DOS Runs as a DOS application.
@@ -139,13 +167,15 @@ application").
Win32 Uses/supports Win32 features (such as long filenames).
Reportedly, NTEmacs (another Win32 program) can run programs such as
-Win32-gawk asynchronously. Currently, NTEmacs supports async subprocesses
-only if the child is a Win32 app. Similarly, like native OS/2 versions are
-a plus under OS/2 even for command-line programs, native Win32 versions are
-nice to have under NT and Win95.
+Win32-gawk asynchronously. Similarly, as native OS/2 versions are a
+plus under OS/2 even for command-line programs, native Win32 versions
+may be desired under NT and Win95.
-Users interested in Win32 applications may also wish to examine the Cygnus
-GNU-Win32 Project at http://www.cygnus.com.
+Users interested in Win32 applications may also wish to examine the
+Cygnus GNU-Win32 Project at http://www.cygnus.com, or the Mingw32 work
+at http://agnes.dida.physik.uni-essen.de/~janjaap/. Win32 gawk will
+often require that utilities run from within gawk be Win32 (e.g., the
+tests place this requirement on the cat utility).
3. An sh-like shell may be useful for awk programming (and is essential
@@ -169,11 +199,10 @@ for other other utilities (such as sed and wc) may need to be edited
in order to match your specific collection of programs.
Daisuke Aoyama <jack@st.rim.or.jp> has ported Bash 1.14.7 to djgpp.
-This version worked flawlessly in tests with djgpp gawk and make. It
-is now part of the djgpp collection and also from
+This version worked flawlessly in tests with djgpp gawk and make. bash
+is now part of the djgpp collection, and may also found on
- http://www.st.rim.or.jp/~jack/alpha/
- http://www.neongenesis.com/~jack/djgpp-work/alpha/
+ http://www.neongenesis.com/~jack/djgpp-work/beta/index.html
Under OS/2, bash should be a good choice; however, there has been some
trouble getting a solid version. As of Feb-95, there are two bash ports,
@@ -192,9 +221,15 @@ continues to be a problem. Stewartson's shell may be the best choice
for emx-compiled programs (although djgpp-bash almost works with
emx on DOS). GNU make is recommended if using djgpp-bash.
+Beginning with 3.0.4, the MSC (DOS/Win32) and Mingw32 versions write
+pipe and system() commands to a temporary file, and then execute
+with SHELL or COMSPEC. The current mechanism defaults to dos-style
+shell conventions unless the shell is one of sh, bash, csh, tcsh, sh32,
+sh16, or ksh.
+
-4. GNU make is available at LEO for OS/2 and in the djgpp collection
-for DOS.
+4. GNU make is available at LEO for OS/2, in the djgpp collection
+for DOS, and in the Mingw32 collection for Win32.
dmake is by Dennis Vadura (dvadura@watdragon.uwaterloo.ca), CS
Dept., University of Waterloo. OS/2 and DOS versions can be found as
@@ -284,8 +319,18 @@ surprising to many.
7. MSC 6 fails the strftlng test. The funstack test exhausts memory
on the 16bit DOS versions.
+8. Eli Zaretskii writes: "Make can crash with SIGFPE after finishing all
+the tests. This happens on Windows 95 only, and Gawk 3.0.3 does that as
+well (as do older versions of Make). The cause for this is the log(-1)
+call in the last test. Based on some limited testing, I'd say that the
+problem is in sloppy Windows handling of the FPU: it doesn't clean up the
+FPU after a program exits, so if Make has SIGFPE unmasked, it crashes."
+
+9. gawk built from the mingw32 and vcWin32 targets continues to have
+problems with pipes; in particular, the pipeio1 test fails.
+
-Gawk-3.0.3 thanks
+Gawk-3.0.4 thanks
-----------------
The DOS maintainers wish to express their thanks to Eli Zaretskii
@@ -313,4 +358,5 @@ the Visual C++ version (vcWin32) may be sent to
Juan Grigera, j-grigera@usa.net (Visual C++ version)
-with a copy to Scott Deifik.
+with a copy to Scott Deifik. Other Win32 reports may go to Darrel
+Hankerson.
diff --git a/README_d/README.sco b/README_d/README.sco
index f40cf646..35555c02 100644
--- a/README_d/README.sco
+++ b/README_d/README.sco
@@ -19,4 +19,4 @@ If you complain to me about this, I will fuss at you for not having
done your homework.
Arnold Robbins
-arnold@gnu.ai.mit.edu
+arnold@gnu.org
diff --git a/README_d/README.solaris b/README_d/README.solaris
index e83d57e5..0b0fb6a2 100644
--- a/README_d/README.solaris
+++ b/README_d/README.solaris
@@ -1,3 +1,15 @@
+Tue Apr 13 16:57:45 IDT 1999
+
+There is a known problem in that the `manyfiles' test will fail under
+Solaris if you set your soft limit on the number of file descriptors to
+above 256. This is due to a "feature" of fdopen that an fd must be
+less than 256 (see fdopen(3)).
+
+IMHO this is Sun's problem, not mine.
+
+Arnold Robbins
+arnold@gnu.org
+----------------------------
From dragon!lehman.com!carson Fri Feb 7 01:12:09 1997
Return-Path: <dragon!lehman.com!carson>
From: carson@lehman.com
diff --git a/README_d/README.sony b/README_d/README.sony
index 32af9aa5..61f1be8e 100644
--- a/README_d/README.sony
+++ b/README_d/README.sony
@@ -9,3 +9,4 @@ This system has the same problem with the test/tweakfld case that Ultrix MIPS
has. See the README.ultrix file for details.
Arnold Robbins
+arnold@gnu.org
diff --git a/README_d/README.sunos4 b/README_d/README.sunos4
index ea9a1952..da3f0cb1 100644
--- a/README_d/README.sunos4
+++ b/README_d/README.sunos4
@@ -8,7 +8,7 @@ If you send me email about this without having read this file, I will
fuss at you!
Arnold Robbins
-arnold@gnu.ai.mit.edu
+arnold@gnu.org
Tue Jan 30 07:01:39 EST 1996
diff --git a/README_d/README.yacc b/README_d/README.yacc
index aa8ee8ef..e198c070 100644
--- a/README_d/README.yacc
+++ b/README_d/README.yacc
@@ -7,4 +7,4 @@ nested control structures, such as those in `awf'.
The problem goes away if you use either bison or Berkeley yacc.
Arnold Robbins
-arnold@gnu.ai.mit.edu
+arnold@gnu.org
diff --git a/acconfig.h b/acconfig.h
index 05f3c613..db80a4ce 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1995-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -30,6 +30,9 @@
#undef SPRINTF_RET /* return type of sprintf */
#undef BITOPS /* bitwise ops (undocumented feature) */
#undef NONDECDATA /* non-decimal input data (undocumented feature) */
+#undef _FILE_OFFSET_BITS /* bits in a file offset, where this matters */
+#undef _LARGEFILE_SOURCE /* makes fseeko etc. visible on some hosts */
+#undef _LARGE_FILES /* emables large files on AIX-style hosts */
@BOTTOM@
diff --git a/aclocal.m4 b/aclocal.m4
index ae92a0c1..8fc8c981 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
dnl
dnl aclocal.m4 --- autoconf input file for gawk
dnl
-dnl Copyright (C) 1995, 96 the Free Software Foundation, Inc.
+dnl Copyright (C) 1995, 1996, 1998, 1999 the Free Software Foundation, Inc.
dnl
dnl This file is part of GAWK, the GNU implementation of the
dnl AWK Progamming Language.
@@ -38,3 +38,130 @@ then
fi
AC_MSG_RESULT([${gawk_cv_c_stringize}])
])dnl
+
+
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert@twinsun.com>.
+
+dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
+dnl GAWK_AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
+AC_DEFUN(GAWK_AC_SYS_LARGEFILE_FLAGS,
+ [AC_CACHE_CHECK([for $1 value to request large file support],
+ gawk_cv_sys_largefile_$1,
+ [gawk_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
+ gawk_cv_sys_largefile_$1=no
+ ifelse($1, CFLAGS,
+ [case "$host_os" in
+ # IRIX 6.2 and later require cc -n32.
+changequote(, )dnl
+ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+changequote([, ])dnl
+ if test "$GCC" != yes; then
+ gawk_cv_sys_largefile_CFLAGS=-n32
+ fi
+ gawk_save_CC="$CC"
+ CC="$CC $gawk_cv_sys_largefile_CFLAGS"
+ AC_TRY_LINK(, , , gawk_cv_sys_largefile_CFLAGS=no)
+ CC="$gawk_save_CC"
+ esac])
+ }])])
+
+dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
+dnl GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
+AC_DEFUN(GAWK_AC_SYS_LARGEFILE_SPACE_APPEND,
+ [case $2 in
+ no) ;;
+ ?*)
+ case "[$]$1" in
+ '') $1=$2 ;;
+ *) $1=[$]$1' '$2 ;;
+ esac ;;
+ esac])
+
+dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
+dnl GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, CODE-TO-SET-DEFAULT)
+AC_DEFUN(GAWK_AC_SYS_LARGEFILE_MACRO_VALUE,
+ [AC_CACHE_CHECK([for $1], $2,
+ [$2=no
+changequote(, )dnl
+ $3
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ -D$1)
+ $2=1 ;;
+ -D$1=*)
+ $2=`expr " $gawk_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+changequote([, ])dnl
+ ])
+ if test "[$]$2" != no; then
+ AC_DEFINE_UNQUOTED([$1], [$]$2)
+ fi])
+
+AC_DEFUN(GAWK_AC_SYS_LARGEFILE,
+ [AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+ if test "$enable_largefile" != no; then
+ AC_CHECK_TOOL(GETCONF, getconf)
+ GAWK_AC_SYS_LARGEFILE_FLAGS(CFLAGS)
+ GAWK_AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
+ GAWK_AC_SYS_LARGEFILE_FLAGS(LIBS)
+
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ no) ;;
+ -D_FILE_OFFSET_BITS=*) ;;
+ -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+ -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+ -D?* | -I?*)
+ GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$gawk_flag") ;;
+ *)
+ GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$gawk_flag") ;;
+ esac
+ done
+ GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$gawk_cv_sys_largefile_LDFLAGS")
+ GAWK_AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$gawk_cv_sys_largefile_LIBS")
+ GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
+ gawk_cv_sys_file_offset_bits,
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ gawk_cv_sys_file_offset_bits=64 ;;
+ esac])
+ GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
+ gawk_cv_sys_largefile_source,
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ gawk_cv_sys_largefile_source=1 ;;
+ esac])
+ GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
+ gawk_cv_sys_large_files,
+ [case "$host_os" in
+ # AIX 4.2 and later
+ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+ gawk_cv_sys_large_files=1 ;;
+ esac])
+ fi
+ ])
+
+dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED
+AC_DEFUN(GAWK_AC_AIX_TWEAK, [
+AC_MSG_CHECKING([for AIX compilation hacks])
+AC_CACHE_VAL(gawk_cv_aix_hack, [
+if test -d /lpp/bos
+then
+ CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
+ gawk_cv_aix_hack=yes
+else
+ gawk_cv_aix_hack=no
+fi
+])dnl
+AC_MSG_RESULT([${gawk_cv_aix_hack}])
+])dnl
diff --git a/array.c b/array.c
index b178cd2a..4906384d 100644
--- a/array.c
+++ b/array.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991 - 97 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -272,7 +272,10 @@ NODE *symbol, *subs;
fatal("attempt to use scalar as array");
if (symbol->var_array == NULL) {
- symbol->type = Node_var_array;
+ if (symbol->type != Node_var_array) {
+ unref(symbol->var_value);
+ symbol->type = Node_var_array;
+ }
symbol->array_size = symbol->table_size = 0; /* sanity */
symbol->flags &= ~ARRAYMAXED;
grow_table(symbol);
@@ -360,13 +363,14 @@ NODE *symbol, *tree;
last = bucket, bucket = bucket->ahnext)
if (cmp_nodes(bucket->ahname, subs) == 0)
break;
- free_temp(subs);
if (bucket == NULL) {
if (do_lint)
warning("delete: index `%s' not in array `%s'",
subs->stptr, symbol->vname);
+ free_temp(subs);
return;
}
+ free_temp(subs);
if (last != NULL)
last->ahnext = bucket->ahnext;
else
diff --git a/atari/ChangeLog b/atari/ChangeLog
index ed4bb487..0443ac9d 100644
--- a/atari/ChangeLog
+++ b/atari/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/atari/README.1st b/atari/README.1st
new file mode 100644
index 00000000..3483cb0c
--- /dev/null
+++ b/atari/README.1st
@@ -0,0 +1,6 @@
+Sun Nov 29 10:34:01 EST 1998
+
+The atari port is no longer supported. In 3.1 this directory will
+be moved into a new `unsupported' directory. If you have an atari,
+you are welcome to try and use the port here, but we no longer have
+the hardware to test gawk on.
diff --git a/awk.h b/awk.h
index 630144d5..807f7006 100644
--- a/awk.h
+++ b/awk.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -25,6 +25,14 @@
/* ------------------------------ Includes ------------------------------ */
+/*
+ * config.h absolutely, positively, *M*U*S*T* be included before
+ * any system headers. Otherwise, extreme death, destruction
+ * and loss of life results.
+ *
+ * Well, OK, gawk just won't work on systems using egcs and LFS. But
+ * that's almost as bad.
+ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -34,6 +42,7 @@
#endif /* _GNU_SOURCE */
#include <stdio.h>
+#include <assert.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif /* HAVE_LIMITS_H */
@@ -584,7 +593,8 @@ extern char casetable[]; /* for case-independent regexp matching */
/* ------------------------- Pseudo-functions ------------------------- */
#define is_identchar(c) (isalnum(c) || (c) == '_')
-#define isnondecimal(str) (((str)[0]) == '0')
+#define isnondecimal(str) (((str)[0]) == '0' && (ISDIGIT((str)[1]) \
+ || (str)[1] == 'x' || (str)[1] == 'X'))
#ifdef MPROF
#define getnode(n) emalloc(n, NODE *, sizeof(NODE), "getnode")
diff --git a/awk.y b/awk.y
index 1b9a89bf..93959e82 100644
--- a/awk.y
+++ b/awk.y
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -830,7 +830,9 @@ variable
{ $$ = variable($1, CAN_FREE, Node_var); }
| NAME '[' expression_list ']'
{
- if ($3->rnode == NULL) {
+ if ($3 == NULL) {
+ fatal("invalid subscript expression");
+ } else if ($3->rnode == NULL) {
$$ = node(variable($1, CAN_FREE, Node_var_array), Node_subscript, $3->lnode);
freenode($3);
} else
@@ -1169,7 +1171,8 @@ again:
warning("source file `%s' is empty", source);
}
}
- close(fd);
+ if (fileno(stdin) != fd) /* safety */
+ close(fd);
samefile = FALSE;
nextfile++;
if (lexeme)
@@ -1451,14 +1454,17 @@ retry:
case ':':
case '?':
allow_newline();
- /* fall through */
+ return lasttok = c;
+
case ')':
case ']':
case '(':
- case '[':
case ';':
case '{':
case ',':
+ want_assign = FALSE;
+ /* fall through */
+ case '[':
return lasttok = c;
case '*':
@@ -2109,6 +2115,9 @@ NODE *list, *new;
register NODE *oldlist;
static NODE *savefront = NULL, *savetail = NULL;
+ if (list == NULL || new == NULL)
+ return list;
+
oldlist = list;
if (savefront == oldlist) {
savetail = savetail->rnode = new;
diff --git a/awklib/ChangeLog b/awklib/ChangeLog
index c27d3b2f..d87d5ccc 100644
--- a/awklib/ChangeLog
+++ b/awklib/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/awklib/Makefile.in b/awklib/Makefile.in
index c63947b3..67f0e500 100644
--- a/awklib/Makefile.in
+++ b/awklib/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for GNU Awk support library.
#
-# Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+# Copyright (C) 1995-1998 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
diff --git a/awklib/eg/lib/assert.awk b/awklib/eg/lib/assert.awk
index 914aa632..50f42e7d 100644
--- a/awklib/eg/lib/assert.awk
+++ b/awklib/eg/lib/assert.awk
@@ -1,5 +1,5 @@
# assert --- assert that a condition is true. Otherwise exit.
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
function assert(condition, string)
diff --git a/awklib/eg/lib/ftrans.awk b/awklib/eg/lib/ftrans.awk
index 0d6e8108..cec615be 100644
--- a/awklib/eg/lib/ftrans.awk
+++ b/awklib/eg/lib/ftrans.awk
@@ -2,7 +2,7 @@
#
# user supplies beginfile() and endfile() functions
#
-# Arnold Robbins, arnold@gnu.ai.mit.edu. November 1992
+# Arnold Robbins, arnold@gnu.org, November 1992
# Public Domain
FNR == 1 {
diff --git a/awklib/eg/lib/getopt.awk b/awklib/eg/lib/getopt.awk
index 70a1ec0f..dae20e5f 100644
--- a/awklib/eg/lib/getopt.awk
+++ b/awklib/eg/lib/getopt.awk
@@ -1,6 +1,6 @@
# getopt --- do C library getopt(3) function in awk
#
-# arnold@gnu.ai.mit.edu
+# arnold@gnu.org
# Public domain
#
# Initial version: March, 1991
diff --git a/awklib/eg/lib/gettime.awk b/awklib/eg/lib/gettime.awk
index 500dfcef..82f09d72 100644
--- a/awklib/eg/lib/gettime.awk
+++ b/awklib/eg/lib/gettime.awk
@@ -1,5 +1,5 @@
# gettimeofday --- get the time of day in a usable format
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain, May 1993
+# Arnold Robbins, arnold@gnu.org, Public Domain, May 1993
#
# Returns a string in the format of output of date(1)
# Populates the array argument time with individual values:
diff --git a/awklib/eg/lib/grcat.c b/awklib/eg/lib/grcat.c
index 9742c592..570b3230 100644
--- a/awklib/eg/lib/grcat.c
+++ b/awklib/eg/lib/grcat.c
@@ -3,7 +3,7 @@
*
* Generate a printable version of the group database
*
- * Arnold Robbins, arnold@gnu.ai.mit.edu
+ * Arnold Robbins, arnold@gnu.org
* May 1993
* Public Domain
*/
diff --git a/awklib/eg/lib/groupawk.in b/awklib/eg/lib/groupawk.in
index a8103a04..11a72a5a 100644
--- a/awklib/eg/lib/groupawk.in
+++ b/awklib/eg/lib/groupawk.in
@@ -1,5 +1,5 @@
# group.awk --- functions for dealing with the group file
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN \
@@ -70,7 +70,7 @@ function getgruser(user)
function getgrent()
{
_gr_init()
- if (++gr_count in _gr_bycount)
+ if (++_gr_count in _gr_bycount)
return _gr_bycount[_gr_count]
return ""
}
diff --git a/awklib/eg/lib/join.awk b/awklib/eg/lib/join.awk
index e6b81656..f52f5e62 100644
--- a/awklib/eg/lib/join.awk
+++ b/awklib/eg/lib/join.awk
@@ -1,5 +1,5 @@
# join.awk --- join an array into a string
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function join(array, start, end, sep, result, i)
diff --git a/awklib/eg/lib/mktime.awk b/awklib/eg/lib/mktime.awk
index f43d6d19..22239ea6 100644
--- a/awklib/eg/lib/mktime.awk
+++ b/awklib/eg/lib/mktime.awk
@@ -1,6 +1,6 @@
# mktime.awk --- convert a canonical date representation
# into a timestamp
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN \
diff --git a/awklib/eg/lib/nextfile.awk b/awklib/eg/lib/nextfile.awk
index 0f729a87..4bb07bc3 100644
--- a/awklib/eg/lib/nextfile.awk
+++ b/awklib/eg/lib/nextfile.awk
@@ -1,6 +1,6 @@
# nextfile --- skip remaining records in current file
# correctly handle successive occurrences of the same file
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
# this should be read in before the "main" awk program
diff --git a/awklib/eg/lib/ord.awk b/awklib/eg/lib/ord.awk
index 7e62cb88..b19149eb 100644
--- a/awklib/eg/lib/ord.awk
+++ b/awklib/eg/lib/ord.awk
@@ -5,7 +5,7 @@
# _ord_init: function to initialize _ord_
#
# Arnold Robbins
-# arnold@gnu.ai.mit.edu
+# arnold@gnu.org
# Public Domain
# 16 January, 1992
# 20 July, 1992, revised
diff --git a/awklib/eg/lib/passwdawk.in b/awklib/eg/lib/passwdawk.in
index 7b64f60d..dd6ee7f5 100644
--- a/awklib/eg/lib/passwdawk.in
+++ b/awklib/eg/lib/passwdawk.in
@@ -1,5 +1,5 @@
# passwd.awk --- access password file information
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN {
diff --git a/awklib/eg/lib/pwcat.c b/awklib/eg/lib/pwcat.c
index ecd25861..591b8523 100644
--- a/awklib/eg/lib/pwcat.c
+++ b/awklib/eg/lib/pwcat.c
@@ -4,7 +4,7 @@
* Generate a printable version of the password database
*
* Arnold Robbins
- * arnold@gnu.ai.mit.edu
+ * arnold@gnu.org
* May 1993
* Public Domain
*/
diff --git a/awklib/eg/lib/round.awk b/awklib/eg/lib/round.awk
index d484e148..67ce6469 100644
--- a/awklib/eg/lib/round.awk
+++ b/awklib/eg/lib/round.awk
@@ -1,6 +1,6 @@
# round --- do normal rounding
#
-# Arnold Robbins, arnold@gnu.ai.mit.edu, August, 1996
+# Arnold Robbins, arnold@gnu.org, August, 1996
# Public Domain
function round(x, ival, aval, fraction)
diff --git a/awklib/eg/prog/alarm.awk b/awklib/eg/prog/alarm.awk
index fa42dce0..e158e451 100644
--- a/awklib/eg/prog/alarm.awk
+++ b/awklib/eg/prog/alarm.awk
@@ -1,5 +1,5 @@
# alarm --- set an alarm
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# usage: alarm time [ "message" [ count [ delay ] ] ]
diff --git a/awklib/eg/prog/awksed.awk b/awklib/eg/prog/awksed.awk
index cd96ddeb..1795b24b 100644
--- a/awklib/eg/prog/awksed.awk
+++ b/awklib/eg/prog/awksed.awk
@@ -1,7 +1,7 @@
# awksed.awk --- do s/foo/bar/g using just print
# Thanks to Michael Brennan for the idea
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# August 1995
function usage()
diff --git a/awklib/eg/prog/cut.awk b/awklib/eg/prog/cut.awk
index 7c0da75e..6e2dd064 100644
--- a/awklib/eg/prog/cut.awk
+++ b/awklib/eg/prog/cut.awk
@@ -1,5 +1,5 @@
# cut.awk --- implement cut in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
diff --git a/awklib/eg/prog/dupword.awk b/awklib/eg/prog/dupword.awk
index 8ae0fdc7..9a518a16 100644
--- a/awklib/eg/prog/dupword.awk
+++ b/awklib/eg/prog/dupword.awk
@@ -1,5 +1,5 @@
# dupword --- find duplicate words in text
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# December 1991
{
diff --git a/awklib/eg/prog/egrep.awk b/awklib/eg/prog/egrep.awk
index 5a5ec988..06762a1f 100644
--- a/awklib/eg/prog/egrep.awk
+++ b/awklib/eg/prog/egrep.awk
@@ -1,5 +1,5 @@
# egrep.awk --- simulate egrep in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
diff --git a/awklib/eg/prog/extract.awk b/awklib/eg/prog/extract.awk
index a9f5b80f..f30ef458 100644
--- a/awklib/eg/prog/extract.awk
+++ b/awklib/eg/prog/extract.awk
@@ -1,6 +1,6 @@
# extract.awk --- extract files and run programs
# from texinfo files
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN { IGNORECASE = 1 }
diff --git a/awklib/eg/prog/histsort.awk b/awklib/eg/prog/histsort.awk
index c2c9d1a7..48186d0b 100644
--- a/awklib/eg/prog/histsort.awk
+++ b/awklib/eg/prog/histsort.awk
@@ -1,5 +1,5 @@
# histsort.awk --- compact a shell history file
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Thanks to Byron Rakitzis for the general idea
diff --git a/awklib/eg/prog/id.awk b/awklib/eg/prog/id.awk
index b29ef61a..a983c572 100644
--- a/awklib/eg/prog/id.awk
+++ b/awklib/eg/prog/id.awk
@@ -1,5 +1,5 @@
# id.awk --- implement id in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# output is:
diff --git a/awklib/eg/prog/igawk.sh b/awklib/eg/prog/igawk.sh
index a9fff180..df6da1ae 100644
--- a/awklib/eg/prog/igawk.sh
+++ b/awklib/eg/prog/igawk.sh
@@ -1,7 +1,7 @@
#! /bin/sh
# igawk --- like gawk but do @include processing
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# July 1993
if [ "$1" = debug ]
diff --git a/awklib/eg/prog/labels.awk b/awklib/eg/prog/labels.awk
index 55815d20..3c69751a 100644
--- a/awklib/eg/prog/labels.awk
+++ b/awklib/eg/prog/labels.awk
@@ -1,5 +1,5 @@
# labels.awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# June 1992
# Program to print labels. Each label is 5 lines of data
diff --git a/awklib/eg/prog/split.awk b/awklib/eg/prog/split.awk
index 593e3c64..863ba4e4 100644
--- a/awklib/eg/prog/split.awk
+++ b/awklib/eg/prog/split.awk
@@ -1,5 +1,5 @@
# split.awk --- do split in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# usage: split [-num] [file] [outname]
diff --git a/awklib/eg/prog/tee.awk b/awklib/eg/prog/tee.awk
index 895e4398..4c12c56d 100644
--- a/awklib/eg/prog/tee.awk
+++ b/awklib/eg/prog/tee.awk
@@ -1,5 +1,5 @@
# tee.awk --- tee in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Revised December 1995
diff --git a/awklib/eg/prog/translate.awk b/awklib/eg/prog/translate.awk
index 6e9aa5a5..97c4ada6 100644
--- a/awklib/eg/prog/translate.awk
+++ b/awklib/eg/prog/translate.awk
@@ -1,5 +1,5 @@
# translate --- do tr like stuff
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# August 1989
# bugs: does not handle things like: tr A-Z a-z, it has
diff --git a/awklib/eg/prog/uniq.awk b/awklib/eg/prog/uniq.awk
index 5f63ef0f..abc149a1 100644
--- a/awklib/eg/prog/uniq.awk
+++ b/awklib/eg/prog/uniq.awk
@@ -1,5 +1,5 @@
# uniq.awk --- do uniq in awk
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function usage( e)
diff --git a/awklib/eg/prog/wc.awk b/awklib/eg/prog/wc.awk
index e5553116..5ec21443 100644
--- a/awklib/eg/prog/wc.awk
+++ b/awklib/eg/prog/wc.awk
@@ -1,5 +1,5 @@
# wc.awk --- count lines, words, characters
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
diff --git a/awklib/extract.awk b/awklib/extract.awk
index 4f4648c4..e18a1ad9 100644
--- a/awklib/extract.awk
+++ b/awklib/extract.awk
@@ -1,6 +1,6 @@
# extract.awk --- extract files and run programs
# from texinfo files
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN { IGNORECASE = 1 }
@@ -71,7 +71,7 @@ END {
close(curfile)
}
# join.awk --- join an array into a string
-# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function join(array, start, end, sep, result, i)
diff --git a/awktab.c b/awktab.c
index 42971fa7..3283a8b9 100644
--- a/awktab.c
+++ b/awktab.c
@@ -262,8 +262,8 @@ static const short yyrline[] = { 0,
731, 733, 735, 737, 739, 741, 743, 748, 750, 752,
754, 756, 758, 760, 762, 764, 769, 771, 773, 776,
778, 786, 793, 794, 796, 798, 800, 803, 811, 822,
- 824, 829, 831, 839, 844, 848, 852, 856, 857, 861,
- 864
+ 824, 829, 831, 841, 846, 850, 854, 858, 859, 863,
+ 866
};
#endif
@@ -781,7 +781,7 @@ static const short yycheck[] = { 3,
46, 47, -1, -1, -1, 51, -1, -1, 54, 55
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/local/share/bison.simple"
+#line 3 "/usr/lib/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -974,7 +974,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
-#line 196 "/usr/local/share/bison.simple"
+#line 196 "/usr/lib/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@@ -2138,7 +2138,9 @@ case 152:
case 153:
#line 832 "./awk.y"
{
- if (yyvsp[-1].nodeval->rnode == NULL) {
+ if (yyvsp[-1].nodeval == NULL) {
+ fatal("invalid subscript expression");
+ } else if (yyvsp[-1].nodeval->rnode == NULL) {
yyval.nodeval = node(variable(yyvsp[-3].sval, CAN_FREE, Node_var_array), Node_subscript, yyvsp[-1].nodeval->lnode);
freenode(yyvsp[-1].nodeval);
} else
@@ -2146,28 +2148,28 @@ case 153:
;
break;}
case 154:
-#line 840 "./awk.y"
+#line 842 "./awk.y"
{ yyval.nodeval = node(yyvsp[0].nodeval, Node_field_spec, (NODE *) NULL); ;
break;}
case 156:
-#line 848 "./awk.y"
+#line 850 "./awk.y"
{ yyerrok; ;
break;}
case 157:
-#line 852 "./awk.y"
+#line 854 "./awk.y"
{ yyerrok; ;
break;}
case 160:
-#line 861 "./awk.y"
+#line 863 "./awk.y"
{ yyerrok; want_assign = FALSE; ;
break;}
case 161:
-#line 864 "./awk.y"
+#line 866 "./awk.y"
{ yyerrok; ;
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 498 "/usr/local/share/bison.simple"
+#line 498 "/usr/lib/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@@ -2363,7 +2365,7 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
}
-#line 867 "./awk.y"
+#line 869 "./awk.y"
struct token {
@@ -2669,7 +2671,8 @@ again:
warning("source file `%s' is empty", source);
}
}
- close(fd);
+ if (fileno(stdin) != fd) /* safety */
+ close(fd);
samefile = FALSE;
nextfile++;
if (lexeme)
@@ -2951,14 +2954,17 @@ retry:
case ':':
case '?':
allow_newline();
- /* fall through */
+ return lasttok = c;
+
case ')':
case ']':
case '(':
- case '[':
case ';':
case '{':
case ',':
+ want_assign = FALSE;
+ /* fall through */
+ case '[':
return lasttok = c;
case '*':
@@ -3609,6 +3615,9 @@ NODE *list, *new;
register NODE *oldlist;
static NODE *savefront = NULL, *savetail = NULL;
+ if (list == NULL || new == NULL)
+ return list;
+
oldlist = list;
if (savefront == oldlist) {
savetail = savetail->rnode = new;
diff --git a/builtin.c b/builtin.c
index 0686041c..a4e5a081 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -25,7 +25,6 @@
#include "awk.h"
-#include <assert.h>
#undef HUGE
#undef CHARBITS
#undef INTBITS
@@ -408,6 +407,7 @@ register NODE *carg;
double tmpval;
char signchar = FALSE;
size_t len;
+ int zero_flag = FALSE;
static char sp[] = " ";
static char zero_string[] = "0";
static char lchbuf[] = "0123456789abcdef";
@@ -435,6 +435,7 @@ register NODE *carg;
prec = 0;
have_prec = FALSE;
signchar = FALSE;
+ zero_flag = FALSE;
lj = alt = big = bigbig = small = FALSE;
fill = sp;
cp = cend;
@@ -458,10 +459,9 @@ check_pos:
break;
case '0':
+ zero_flag = TRUE;
if (lj)
goto retry;
- if (cur == &fw)
- fill = zero_string;
/* FALL through */
case '1':
case '2':
@@ -585,6 +585,8 @@ check_pos:
goto retry;
case 'c':
need_format = FALSE;
+ if (zero_flag && ! lj)
+ fill = zero_string;
parse_next_arg();
/* user input that looks numeric is numeric */
if ((arg->flags & (MAYBE_NUM|NUMBER)) == MAYBE_NUM)
@@ -609,6 +611,8 @@ check_pos:
goto pr_tail;
case 's':
need_format = FALSE;
+ if (zero_flag && ! lj)
+ fill = zero_string;
parse_next_arg();
arg = force_string(arg);
if (! have_prec || prec > arg->stlen)
@@ -620,6 +624,14 @@ check_pos:
need_format = FALSE;
parse_next_arg();
tmpval = force_number(arg);
+
+ /*
+ * ``The result of converting a zero value with a
+ * precision of zero is no characters.''
+ */
+ if (have_prec && prec == 0 && tmpval == 0)
+ goto pr_tail;
+
if (tmpval < 0) {
if (tmpval < LONG_MIN)
goto out_of_range;
@@ -637,17 +649,28 @@ check_pos:
*--cp = (char) ('0' + uval % 10);
uval /= 10;
} while (uval > 0);
+
+ /* add more output digits to match the precision */
+ if (have_prec) {
+ while (cend - cp < prec)
+ *--cp = '0';
+ }
+
if (sgn)
*--cp = '-';
else if (signchar)
*--cp = signchar;
/*
- * precision overrides '0' flags. however, for
- * integer formats, precsion is minimum number of
- * *digits*, not characters, thus we want to fill
- * with zeroes.
+ * When to fill with zeroes is of course not simple.
+ * First: No zero fill if left-justifying.
+ * Next: There seem to be two cases:
+ * A '0' without a precision, e.g. %06d
+ * A precision with no field width, e.g. %.10d
+ * Any other case, we don't want to fill with zeroes.
*/
- if (have_prec)
+ if (! lj
+ && ((zero_flag && ! have_prec)
+ || (fw == 0 && have_prec)))
fill = zero_string;
if (prec > fw)
fw = prec;
@@ -671,6 +694,22 @@ check_pos:
need_format = FALSE;
parse_next_arg();
tmpval = force_number(arg);
+
+ /*
+ * ``The result of converting a zero value with a
+ * precision of zero is no characters.''
+ *
+ * If I remember the ANSI C standard, though,
+ * it says that for octal conversions
+ * the precision is artificially increased
+ * to add an extra 0 if # is supplied.
+ * Indeed, in C,
+ * printf("%#.0o\n", 0);
+ * prints a single 0.
+ */
+ if (! alt && have_prec && prec == 0 && tmpval == 0)
+ goto pr_tail;
+
if (tmpval < 0) {
if (tmpval < LONG_MIN)
goto out_of_range;
@@ -683,18 +722,29 @@ check_pos:
uval = (unsigned long) tmpval;
}
/*
- * precision overrides '0' flags. however, for
- * integer formats, precsion is minimum number of
- * *digits*, not characters, thus we want to fill
- * with zeroes.
+ * When to fill with zeroes is of course not simple.
+ * First: No zero fill if left-justifying.
+ * Next: There seem to be two cases:
+ * A '0' without a precision, e.g. %06d
+ * A precision with no field width, e.g. %.10d
+ * Any other case, we don't want to fill with zeroes.
*/
- if (have_prec)
+ if (! lj
+ && ((zero_flag && ! have_prec)
+ || (fw == 0 && have_prec)))
fill = zero_string;
do {
*--cp = chbuf[uval % base];
uval /= base;
} while (uval > 0);
- if (alt) {
+
+ /* add more output digits to match the precision */
+ if (have_prec) {
+ while (cend - cp < prec)
+ *--cp = '0';
+ }
+
+ if (alt && tmpval != 0) {
if (base == 16) {
*--cp = cs1;
*--cp = '0';
@@ -753,7 +803,7 @@ check_pos:
*cp++ = signchar;
if (alt)
*cp++ = '#';
- if (fill != sp)
+ if (zero_flag)
*cp++ = '0';
cp = strcpy(cp, "*.*") + 3;
*cp++ = cs1;
@@ -1082,6 +1132,7 @@ register NODE *tree;
register FILE *fp;
int numnodes, i;
NODE *save;
+ NODE *tval;
if (tree->rnode) {
int errflg; /* not used, sigh */
@@ -1115,25 +1166,29 @@ register NODE *tree;
t[i] = dupnode(n);
free_temp(n);
- if (t[i]->flags & NUMBER) {
+ if ((t[i]->flags & (NUMBER|STRING)) == NUMBER) {
if (OFMTidx == CONVFMTidx)
(void) force_string(t[i]);
- else
- t[i] = format_val(OFMT, OFMTidx, t[i]);
+ else {
+ tval = tmp_number(t[i]->numbr);
+ unref(t[i]);
+ t[i] = format_val(OFMT, OFMTidx, tval);
+ }
}
}
for (i = 0; i < numnodes; i++) {
efwrite(t[i]->stptr, sizeof(char), t[i]->stlen, fp, "print", rp, FALSE);
unref(t[i]);
- if (i != numnodes - 1) {
- if (OFSlen > 0)
- efwrite(OFS, sizeof(char), (size_t) OFSlen,
- fp, "print", rp, FALSE);
- }
+
+ if (i != numnodes - 1 && OFSlen > 0)
+ efwrite(OFS, sizeof(char), (size_t) OFSlen,
+ fp, "print", rp, FALSE);
+
}
if (ORSlen > 0)
efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, TRUE);
+
free(t);
}
@@ -1506,6 +1561,7 @@ int how_many, backdigs;
*/
if (lastmatchnonzero && matchstart == matchend) {
lastmatchnonzero = FALSE;
+ matches--;
goto empty;
}
/*
@@ -2016,6 +2072,7 @@ size_t len;
case 'c':
case 'd':
case 'e':
+ case 'f':
val = *str - 'a' + 10;
break;
case 'A':
@@ -2023,6 +2080,7 @@ size_t len;
case 'C':
case 'D':
case 'E':
+ case 'F':
val = *str - 'A' + 10;
break;
default:
@@ -2033,11 +2091,12 @@ size_t len;
} else if (*str == '0') {
for (; len > 0; len--) {
if (! isdigit(*str) || *str == '8' || *str == '9')
- goto done;
+ goto decimal;
retval = (retval * 8) + (*str - '0');
str++;
}
} else {
+decimal:
save = str[len];
retval = atof(str);
str[len] = save;
diff --git a/config.guess b/config.guess
new file mode 100755
index 00000000..a1b76ce2
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1034 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+ if test x"$HOST_CC" != x; then
+ CC_FOR_BUILD="$HOST_CC"
+ else
+ if test x"$CC" != x; then
+ CC_FOR_BUILD="$CC"
+ else
+ CC_FOR_BUILD=cc
+ fi
+ fi
+fi
+
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 )
+ sed 's/^ //' << EOF >$dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE*:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo t3e-cray-unicosmk${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ if test -x /usr/bin/objformat; then
+ if test "elf" = "`/usr/bin/objformat`"; then
+ echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0
+ fi
+ fi
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # uname on the ARM produces all sorts of strangeness, and we need to
+ # filter it out.
+ case "$UNAME_MACHINE" in
+ armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
+ arm* | sa110*) UNAME_MACHINE="arm" ;;
+ esac
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_help_string=`cd /; ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >$dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ i?86:UnixWare:*:*)
+ if /bin/uname -X 2>/dev/null >/dev/null ; then
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ fi
+ echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.sub b/config.sub
new file mode 100755
index 00000000..33a3f60c
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,993 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+ | 580 | i960 | h8300 \
+ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w \
+ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ | 1750a | dsp16xx | pdp11 | mips64 | mipsel | mips64el \
+ | mips64orion | mips64orionel | mipstx39 | mipstx39el \
+ | sparc | sparclet | sparclite | sparc64 | v850)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
+ | xmp-* | ymp-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
+ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67] \
+ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+ | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mipstx39-* | mipstx39el-* \
+ | f301-* | armv*-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ os=-mpeix
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ os=-mpeix
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netwinder)
+ basic_machine=armv4l-corel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ *mint | *MiNT)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
+ | -openstep* | -mpeix* | -oskit*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -*MiNT)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-corel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -*mint | -*MiNT)
+ vendor=atari
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/configh.in b/configh.in
index 34e89b57..91d3fc90 100644
--- a/configh.in
+++ b/configh.in
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1995-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -130,6 +130,9 @@
#undef SPRINTF_RET /* return type of sprintf */
#undef BITOPS /* bitwise ops (undocumented feature) */
#undef NONDECDATA /* non-decimal input data (undocumented feature) */
+#undef _FILE_OFFSET_BITS /* bits in a file offset, where this matters */
+#undef _LARGEFILE_SOURCE /* makes fseeko etc. visible on some hosts */
+#undef _LARGE_FILES /* emables large files on AIX-style hosts */
/* Define if you have the fmod function. */
#undef HAVE_FMOD
diff --git a/configure b/configure
index 63a0d99d..cbb909fc 100755
--- a/configure
+++ b/configure
@@ -15,6 +15,8 @@ ac_help="$ac_help
--enable-bitops Enable Octal and Hex constants and bit functions"
ac_help="$ac_help
--enable-non-decimal-data Enable Octal and Hex constants as valid input data"
+ac_help="$ac_help
+ --disable-largefile omit support for large files"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -524,6 +526,52 @@ fi
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:556: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`$ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
# Check whether --enable-bitops or --disable-bitops was given.
if test "${enable_bitops+set}" = set; then
@@ -549,7 +597,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:553: checking for $ac_word" >&5
+echo "configure:601: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -579,7 +627,7 @@ done
test -n "$YACC" || YACC="yacc"
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:583: checking whether ln -s works" >&5
+echo "configure:631: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -602,7 +650,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:606: checking for $ac_word" >&5
+echo "configure:654: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -631,7 +679,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:635: checking for $ac_word" >&5
+echo "configure:683: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -679,7 +727,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:683: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:731: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -689,11 +737,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 693 "configure"
+#line 741 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:745: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -713,12 +761,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:765: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:722: checking whether we are using GNU C" >&5
+echo "configure:770: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -727,7 +775,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:779: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -742,7 +790,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:746: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:794: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -770,7 +818,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:774: checking how to run the C preprocessor" >&5
+echo "configure:822: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -785,13 +833,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 789 "configure"
+#line 837 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -802,13 +850,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 806 "configure"
+#line 854 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -834,25 +882,6 @@ echo "$ac_t""$CPP" 1>&6
# This is a hack. Different versions of install on different systems
# are just too different. Chuck it and use install-sh.
INSTALL="$srcdir/install-sh -c"; export INSTALL
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -864,7 +893,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:868: checking for a BSD compatible install" >&5
+echo "configure:897: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -915,7 +944,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:919: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:948: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -953,10 +982,268 @@ then
fi
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:987: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`$ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+
+ # Check whether --enable-largefile or --disable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval="$enable_largefile"
+ :
+fi
+
+ if test "$enable_largefile" != no; then
+ # Extract the first word of "${ac_tool_prefix}getconf", so it can be a program name with args.
+set dummy ${ac_tool_prefix}getconf; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1021: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_GETCONF'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$GETCONF"; then
+ ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_GETCONF="${ac_tool_prefix}getconf"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="getconf"
+fi
+fi
+GETCONF="$ac_cv_prog_GETCONF"
+if test -n "$GETCONF"; then
+ echo "$ac_t""$GETCONF" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ echo $ac_n "checking for CFLAGS value to request large file support""... $ac_c" 1>&6
+echo "configure:1050: checking for CFLAGS value to request large file support" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_largefile_CFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_largefile_CFLAGS=`($GETCONF LFS_CFLAGS) 2>/dev/null` || {
+ gawk_cv_sys_largefile_CFLAGS=no
+ case "$host_os" in
+ # IRIX 6.2 and later require cc -n32.
+ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+ if test "$GCC" != yes; then
+ gawk_cv_sys_largefile_CFLAGS=-n32
+ fi
+ gawk_save_CC="$CC"
+ CC="$CC $gawk_cv_sys_largefile_CFLAGS"
+ cat > conftest.$ac_ext <<EOF
+#line 1065 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gawk_cv_sys_largefile_CFLAGS=no
+fi
+rm -f conftest*
+ CC="$gawk_save_CC"
+ esac
+ }
+fi
+
+echo "$ac_t""$gawk_cv_sys_largefile_CFLAGS" 1>&6
+ echo $ac_n "checking for LDFLAGS value to request large file support""... $ac_c" 1>&6
+echo "configure:1088: checking for LDFLAGS value to request large file support" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_largefile_LDFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_largefile_LDFLAGS=`($GETCONF LFS_LDFLAGS) 2>/dev/null` || {
+ gawk_cv_sys_largefile_LDFLAGS=no
+
+ }
+fi
+
+echo "$ac_t""$gawk_cv_sys_largefile_LDFLAGS" 1>&6
+ echo $ac_n "checking for LIBS value to request large file support""... $ac_c" 1>&6
+echo "configure:1100: checking for LIBS value to request large file support" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_largefile_LIBS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_largefile_LIBS=`($GETCONF LFS_LIBS) 2>/dev/null` || {
+ gawk_cv_sys_largefile_LIBS=no
+
+ }
+fi
+
+echo "$ac_t""$gawk_cv_sys_largefile_LIBS" 1>&6
+
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ no) ;;
+ -D_FILE_OFFSET_BITS=*) ;;
+ -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+ -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+ -D?* | -I?*)
+ case "$gawk_flag" in
+ no) ;;
+ ?*)
+ case "$CPPFLAGS" in
+ '') CPPFLAGS="$gawk_flag" ;;
+ *) CPPFLAGS=$CPPFLAGS' '"$gawk_flag" ;;
+ esac ;;
+ esac ;;
+ *)
+ case "$gawk_flag" in
+ no) ;;
+ ?*)
+ case "$CFLAGS" in
+ '') CFLAGS="$gawk_flag" ;;
+ *) CFLAGS=$CFLAGS' '"$gawk_flag" ;;
+ esac ;;
+ esac ;;
+ esac
+ done
+ case "$gawk_cv_sys_largefile_LDFLAGS" in
+ no) ;;
+ ?*)
+ case "$LDFLAGS" in
+ '') LDFLAGS="$gawk_cv_sys_largefile_LDFLAGS" ;;
+ *) LDFLAGS=$LDFLAGS' '"$gawk_cv_sys_largefile_LDFLAGS" ;;
+ esac ;;
+ esac
+ case "$gawk_cv_sys_largefile_LIBS" in
+ no) ;;
+ ?*)
+ case "$LIBS" in
+ '') LIBS="$gawk_cv_sys_largefile_LIBS" ;;
+ *) LIBS=$LIBS' '"$gawk_cv_sys_largefile_LIBS" ;;
+ esac ;;
+ esac
+ echo $ac_n "checking for _FILE_OFFSET_BITS""... $ac_c" 1>&6
+echo "configure:1155: checking for _FILE_OFFSET_BITS" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_file_offset_bits'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_file_offset_bits=no
+ case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ gawk_cv_sys_file_offset_bits=64 ;;
+ esac
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ -D_FILE_OFFSET_BITS)
+ gawk_cv_sys_file_offset_bits=1 ;;
+ -D_FILE_OFFSET_BITS=*)
+ gawk_cv_sys_file_offset_bits=`expr " $gawk_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$gawk_cv_sys_file_offset_bits" 1>&6
+ if test "$gawk_cv_sys_file_offset_bits" != no; then
+ cat >> confdefs.h <<EOF
+#define _FILE_OFFSET_BITS $gawk_cv_sys_file_offset_bits
+EOF
+
+ fi
+ echo $ac_n "checking for _LARGEFILE_SOURCE""... $ac_c" 1>&6
+echo "configure:1184: checking for _LARGEFILE_SOURCE" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_largefile_source'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_largefile_source=no
+ case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ gawk_cv_sys_largefile_source=1 ;;
+ esac
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ -D_LARGEFILE_SOURCE)
+ gawk_cv_sys_largefile_source=1 ;;
+ -D_LARGEFILE_SOURCE=*)
+ gawk_cv_sys_largefile_source=`expr " $gawk_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$gawk_cv_sys_largefile_source" 1>&6
+ if test "$gawk_cv_sys_largefile_source" != no; then
+ cat >> confdefs.h <<EOF
+#define _LARGEFILE_SOURCE $gawk_cv_sys_largefile_source
+EOF
+
+ fi
+ echo $ac_n "checking for _LARGE_FILES""... $ac_c" 1>&6
+echo "configure:1213: checking for _LARGE_FILES" >&5
+if eval "test \"`echo '$''{'gawk_cv_sys_large_files'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ gawk_cv_sys_large_files=no
+ case "$host_os" in
+ # AIX 4.2 and later
+ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+ gawk_cv_sys_large_files=1 ;;
+ esac
+ for gawk_flag in $gawk_cv_sys_largefile_CFLAGS no; do
+ case "$gawk_flag" in
+ -D_LARGE_FILES)
+ gawk_cv_sys_large_files=1 ;;
+ -D_LARGE_FILES=*)
+ gawk_cv_sys_large_files=`expr " $gawk_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$gawk_cv_sys_large_files" 1>&6
+ if test "$gawk_cv_sys_large_files" != no; then
+ cat >> confdefs.h <<EOF
+#define _LARGE_FILES $gawk_cv_sys_large_files
+EOF
+
+ fi
+ fi
+
+
echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:958: checking for AIX" >&5
+echo "configure:1245: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
-#line 960 "configure"
+#line 1247 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
@@ -978,7 +1265,7 @@ rm -f conftest*
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:982: checking for POSIXized ISC" >&5
+echo "configure:1269: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -1000,17 +1287,17 @@ fi
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1004: checking for minix/config.h" >&5
+echo "configure:1291: checking for minix/config.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1009 "configure"
+#line 1296 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1048,13 +1335,36 @@ EOF
fi
+echo $ac_n "checking for AIX compilation hacks""... $ac_c" 1>&6
+echo "configure:1340: checking for AIX compilation hacks" >&5
+if eval "test \"`echo '$''{'gawk_cv_aix_hack'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+if test -d /lpp/bos
+then
+ CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
+ gawk_cv_aix_hack=yes
+else
+ gawk_cv_aix_hack=no
+fi
+
+fi
+echo "$ac_t""${gawk_cv_aix_hack}" 1>&6
+
+
+if test "$ISC" = 1 # will be set by test for ISC
+then
+ CFLAGS="$CFLAGS -D_SYSV3"
+fi
+
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1053: checking for ANSI C header files" >&5
+echo "configure:1363: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1058 "configure"
+#line 1368 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1062,7 +1372,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1079,7 +1389,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1083 "configure"
+#line 1393 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1097,7 +1407,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1101 "configure"
+#line 1411 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1118,7 +1428,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1122 "configure"
+#line 1432 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1129,7 +1439,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1443: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1153,12 +1463,12 @@ EOF
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1157: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1467: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1162 "configure"
+#line 1472 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -1174,7 +1484,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:1178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1488: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -1198,17 +1508,17 @@ for ac_hdr in limits.h locale.h stdarg.h unistd.h signum.h sys/param.h string.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1202: checking for $ac_hdr" >&5
+echo "configure:1512: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1207 "configure"
+#line 1517 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1240,17 +1550,17 @@ then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1244: checking for $ac_hdr" >&5
+echo "configure:1554: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1249 "configure"
+#line 1559 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1281,17 +1591,17 @@ else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1285: checking for $ac_hdr" >&5
+echo "configure:1595: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1290 "configure"
+#line 1600 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1320,12 +1630,12 @@ done
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1324: checking for pid_t" >&5
+echo "configure:1634: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1329 "configure"
+#line 1639 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1353,12 +1663,12 @@ EOF
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1357: checking return type of signal handlers" >&5
+echo "configure:1667: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1362 "configure"
+#line 1672 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1375,7 +1685,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1394,12 +1704,12 @@ EOF
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1398: checking for size_t" >&5
+echo "configure:1708: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1403 "configure"
+#line 1713 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1427,12 +1737,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1431: checking for uid_t in sys/types.h" >&5
+echo "configure:1741: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1436 "configure"
+#line 1746 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -1461,7 +1771,7 @@ EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:1465: checking type of array argument to getgroups" >&5
+echo "configure:1775: checking type of array argument to getgroups" >&5
if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1469,7 +1779,7 @@ else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 1473 "configure"
+#line 1783 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
@@ -1494,7 +1804,7 @@ main()
}
EOF
-if { (eval echo configure:1498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_type_getgroups=gid_t
else
@@ -1508,7 +1818,7 @@ fi
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 1512 "configure"
+#line 1822 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -1532,7 +1842,7 @@ EOF
cat > conftest.$ac_ext <<EOF
-#line 1536 "configure"
+#line 1846 "configure"
#include "confdefs.h"
#include <stdio.h>
EOF
@@ -1559,19 +1869,19 @@ then
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:1563: checking for working alloca.h" >&5
+echo "configure:1873: checking for working alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1568 "configure"
+#line 1878 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() {
char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_header_alloca_h=yes
else
@@ -1592,12 +1902,12 @@ EOF
fi
echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:1596: checking for alloca" >&5
+echo "configure:1906: checking for alloca" >&5
if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1601 "configure"
+#line 1911 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -1620,7 +1930,7 @@ int main() {
char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_func_alloca_works=yes
else
@@ -1652,12 +1962,12 @@ EOF
echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:1656: checking whether alloca needs Cray hooks" >&5
+echo "configure:1966: checking whether alloca needs Cray hooks" >&5
if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1661 "configure"
+#line 1971 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -1682,12 +1992,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6
if test $ac_cv_os_cray = yes; then
for ac_func in _getb67 GETB67 getb67; do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1686: checking for $ac_func" >&5
+echo "configure:1996: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1691 "configure"
+#line 2001 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1710,7 +2020,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1737,7 +2047,7 @@ done
fi
echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:1741: checking stack direction for C alloca" >&5
+echo "configure:2051: checking stack direction for C alloca" >&5
if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1745,7 +2055,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1749 "configure"
+#line 2059 "configure"
#include "confdefs.h"
find_stack_direction ()
{
@@ -1764,7 +2074,7 @@ main ()
exit (find_stack_direction() < 0);
}
EOF
-if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_stack_direction=1
else
@@ -1791,12 +2101,12 @@ cat >> confdefs.h <<\EOF
EOF
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1795: checking for vprintf" >&5
+echo "configure:2105: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1800 "configure"
+#line 2110 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
@@ -1819,7 +2129,7 @@ vprintf();
; return 0; }
EOF
-if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
@@ -1843,12 +2153,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1847: checking for _doprnt" >&5
+echo "configure:2157: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1852 "configure"
+#line 2162 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
@@ -1871,7 +2181,7 @@ _doprnt();
; return 0; }
EOF
-if { (eval echo configure:1875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
@@ -1897,7 +2207,7 @@ fi
echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6
-echo "configure:1901: checking for fmod in -lm" >&5
+echo "configure:2211: checking for fmod in -lm" >&5
ac_lib_var=`echo m'_'fmod | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1905,7 +2215,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1909 "configure"
+#line 2219 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1916,7 +2226,7 @@ int main() {
fmod()
; return 0; }
EOF
-if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1947,12 +2257,12 @@ for ac_func in madvise memset memcpy memcmp fmod setlocale strchr strerror \
strftime strncasecmp strtod system tzset
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1951: checking for $ac_func" >&5
+echo "configure:2261: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1956 "configure"
+#line 2266 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1975,7 +2285,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2004,17 +2314,17 @@ for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2008: checking for $ac_hdr" >&5
+echo "configure:2318: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2013 "configure"
+#line 2323 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2328: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2043,12 +2353,12 @@ done
for ac_func in getpagesize
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2047: checking for $ac_func" >&5
+echo "configure:2357: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2052 "configure"
+#line 2362 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2071,7 +2381,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2096,7 +2406,7 @@ fi
done
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2100: checking for working mmap" >&5
+echo "configure:2410: checking for working mmap" >&5
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2104,7 +2414,7 @@ else
ac_cv_func_mmap_fixed_mapped=no
else
cat > conftest.$ac_ext <<EOF
-#line 2108 "configure"
+#line 2418 "configure"
#include "confdefs.h"
/* Thanks to Mike Haertel and Jim Avera for this test.
@@ -2244,7 +2554,7 @@ main()
}
EOF
-if { (eval echo configure:2248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_func_mmap_fixed_mapped=yes
else
@@ -2270,12 +2580,116 @@ fi
if (uname) > /dev/null 2>&1
then
case `uname` in
- *VMS*) cat >> confdefs.h <<\EOF
+ *VMS*|*BeOS*)
+ cat >> confdefs.h <<\EOF
+#define GETPGRP_VOID 1
+EOF
+
+ ;;
+ *HP-UX*) # not getpgrp related
+ if test "$GCC" = yes
+ then
+ :
+ else
+ # stupid HP linker leaves the output file
+ # around even when a link fails. This confuses
+ # the alloca tests, so we have to do this
+ # manually. Sucks big time.
+ LIBS="$LIBS -lPW"
+ fi
+
+ # have to do the getpgrp test since won't
+ # fall into the default
+ echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
+echo "configure:2605: checking whether getpgrp takes no argument" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2613 "configure"
+#include "confdefs.h"
+
+/*
+ * If this system has a BSD-style getpgrp(),
+ * which takes a pid argument, exit unsuccessfully.
+ *
+ * Snarfed from Chet Ramey's bash pgrp.c test program
+ */
+#include <stdio.h>
+#include <sys/types.h>
+
+int pid;
+int pg1, pg2, pg3, pg4;
+int ng, np, s, child;
+
+main()
+{
+ pid = getpid();
+ pg1 = getpgrp(0);
+ pg2 = getpgrp();
+ pg3 = getpgrp(pid);
+ pg4 = getpgrp(1);
+
+ /*
+ * If all of these values are the same, it's pretty sure that
+ * we're on a system that ignores getpgrp's first argument.
+ */
+ if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)
+ exit(0);
+
+ child = fork();
+ if (child < 0)
+ exit(1);
+ else if (child == 0) {
+ np = getpid();
+ /*
+ * If this is Sys V, this will not work; pgrp will be
+ * set to np because setpgrp just changes a pgrp to be
+ * the same as the pid.
+ */
+ setpgrp(np, pg1);
+ ng = getpgrp(0); /* Same result for Sys V and BSD */
+ if (ng == pg1) {
+ exit(1);
+ } else {
+ exit(0);
+ }
+ } else {
+ wait(&s);
+ exit(s>>8);
+ }
+}
+
+EOF
+if { (eval echo configure:2668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_getpgrp_void=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_getpgrp_void=no
+fi
+rm -fr conftest*
+fi
+
+
+fi
+
+echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6
+if test $ac_cv_func_getpgrp_void = yes; then
+ cat >> confdefs.h <<\EOF
#define GETPGRP_VOID 1
EOF
- ;;
+
+fi
+
+ ;;
*) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:2279: checking whether getpgrp takes no argument" >&5
+echo "configure:2693: checking whether getpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2283,7 +2697,7 @@ else
{ echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2287 "configure"
+#line 2701 "configure"
#include "confdefs.h"
/*
@@ -2338,7 +2752,7 @@ main()
}
EOF
-if { (eval echo configure:2342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_func_getpgrp_void=yes
else
@@ -2365,7 +2779,7 @@ fi
esac
else
echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:2369: checking whether getpgrp takes no argument" >&5
+echo "configure:2783: checking whether getpgrp takes no argument" >&5
if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2373,7 +2787,7 @@ else
{ echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2377 "configure"
+#line 2791 "configure"
#include "confdefs.h"
/*
@@ -2428,7 +2842,7 @@ main()
}
EOF
-if { (eval echo configure:2432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_func_getpgrp_void=yes
else
@@ -2454,12 +2868,12 @@ fi
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:2458: checking for st_blksize in struct stat" >&5
+echo "configure:2872: checking for st_blksize in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2463 "configure"
+#line 2877 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -2467,7 +2881,7 @@ int main() {
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:2471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2885: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
@@ -2488,12 +2902,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2492: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2906: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2497 "configure"
+#line 2911 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -2502,7 +2916,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:2506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -2523,12 +2937,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:2527: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:2941: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2532 "configure"
+#line 2946 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -2536,7 +2950,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:2540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -2557,12 +2971,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:2561: checking for tm_zone in struct tm" >&5
+echo "configure:2975: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2566 "configure"
+#line 2980 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -2570,7 +2984,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:2574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@@ -2590,12 +3004,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:2594: checking for tzname" >&5
+echo "configure:3008: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2599 "configure"
+#line 3013 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -2605,7 +3019,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:2609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -2628,14 +3042,14 @@ fi
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:2632: checking whether char is unsigned" >&5
+echo "configure:3046: checking whether char is unsigned" >&5
if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$GCC" = yes; then
# GCC predefines this symbol on systems where it applies.
cat > conftest.$ac_ext <<EOF
-#line 2639 "configure"
+#line 3053 "configure"
#include "confdefs.h"
#ifdef __CHAR_UNSIGNED__
yes
@@ -2657,7 +3071,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2661 "configure"
+#line 3075 "configure"
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1
@@ -2667,7 +3081,7 @@ main() {
volatile char c = 255; exit(c < 0);
}
EOF
-if { (eval echo configure:2671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_char_unsigned=yes
else
@@ -2691,12 +3105,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2695: checking for working const" >&5
+echo "configure:3109: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2700 "configure"
+#line 3114 "configure"
#include "confdefs.h"
int main() {
@@ -2745,7 +3159,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:2749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3163: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -2768,12 +3182,12 @@ fi
echo $ac_n "checking for ANSI stringizing capability""... $ac_c" 1>&6
-echo "configure:2772: checking for ANSI stringizing capability" >&5
+echo "configure:3186: checking for ANSI stringizing capability" >&5
if eval "test \"`echo '$''{'gawk_cv_c_stringize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2777 "configure"
+#line 3191 "configure"
#include "confdefs.h"
#define x(y) #y
@@ -2934,6 +3348,11 @@ s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
s%@YACC@%$YACC%g
s%@LN_S@%$LN_S%g
s%@CC@%$CC%g
@@ -2941,6 +3360,12 @@ s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@SET_MAKE@%$SET_MAKE%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@GETCONF@%$GETCONF%g
s%@ALLOCA@%$ALLOCA%g
CEOF
diff --git a/configure.in b/configure.in
index 27d10b85..7c0cf914 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
dnl
dnl configure.in --- autoconf input file for gawk
dnl
-dnl Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+dnl Copyright (C) 1995-1999 the Free Software Foundation, Inc.
dnl
dnl This file is part of GAWK, the GNU implementation of the
dnl AWK Programming Language.
@@ -30,6 +30,7 @@ dnl This is the configure.in script proper
AC_INIT(awk.h)
AC_PREREQ(2.12)
AC_CONFIG_HEADER(config.h:configh.in)
+AC_CANONICAL_HOST
dnl Additional argument stuff
AC_ARG_ENABLE(bitops, [ --enable-bitops Enable Octal and Hex constants and bit functions], AC_DEFINE(BITOPS))
@@ -61,10 +62,20 @@ dnl go for speed, not debugging. :-)
fi
AC_SUBST(CFLAGS)
+dnl check for Solaris (or other) large file support
+GAWK_AC_SYS_LARGEFILE
+
dnl checks for systems
AC_AIX
AC_ISC_POSIX
AC_MINIX
+GAWK_AC_AIX_TWEAK
+
+if test "$ISC" = 1 # will be set by test for ISC
+then
+dnl need -D_SYSV3 for ISC
+ CFLAGS="$CFLAGS -D_SYSV3"
+fi
dnl checks for header files
AC_HEADER_STDC
@@ -107,7 +118,25 @@ dnl have to hardwire it for VMS POSIX. Sigh.
if (uname) > /dev/null 2>&1
then
case `uname` in
- *VMS*) AC_DEFINE(GETPGRP_VOID) ;;
+ *VMS*|*BeOS*)
+ AC_DEFINE(GETPGRP_VOID)
+ ;;
+ *HP-UX*) # not getpgrp related
+ if test "$GCC" = yes
+ then
+ :
+ else
+ # stupid HP linker leaves the output file
+ # around even when a link fails. This confuses
+ # the alloca tests, so we have to do this
+ # manually. Sucks big time.
+ LIBS="$LIBS -lPW"
+ fi
+
+ # have to do the getpgrp test since won't
+ # fall into the default
+ AC_FUNC_GETPGRP
+ ;;
*) AC_FUNC_GETPGRP
;;
esac
diff --git a/custom.h b/custom.h
index 833bb623..9bc914f6 100644
--- a/custom.h
+++ b/custom.h
@@ -7,11 +7,11 @@
* information.
*
* If you make additions to this file for your system, please send me
- * the information, to arnold@gnu.ai.mit.edu.
+ * the information, to arnold@gnu.org.
*/
/*
- * Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1995-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -57,3 +57,10 @@
#ifdef _SEQUENT_
#undef HAVE_MMAP
#endif
+
+/* For BeOS, from mc@whoever.com */
+#if defined(__dest_os) && __dest_os == __be_os
+#define BROKEN_STRNCASECMP
+#define ELIDE_CODE
+#include <alloca.h>
+#endif
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 660436a1..17f2844b 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,30 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
+Wed Oct 7 21:59:33 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * texinfo.tex: Updated to version 2.227, from Texinfo 3.12.
+
+Sun Oct 19 12:26:08 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * ALL: change references to arnold@gnu.ai.mit.edu to arnold@gnu.org.
+
+Tue Sep 23 10:31:17 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * texinfo.tex: Updated to version 2.218, from Texinfo 3.11.
+
+Fri Jul 4 08:19:00 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in ($(infodir)/gawk.info): Don't make dependent upon
+ gawk.info, in case installed one is newer. Instead, check that
+ an installed gawk.info exists and is identical to current one.
+ If so, just exit; otherwise do the install.
+
+Wed Jul 2 14:55:12 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in ($(infodir)/gawk.info): typo fix.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 293676b5..989903cb 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for GNU Awk documentation.
#
-# Copyright (C) 1993-1997 the Free Software Foundation, Inc.
+# Copyright (C) 1993-1999 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -71,20 +71,25 @@ all: $(DOCS) info
install: $(mandir)/gawk$(manext) $(mandir)/igawk$(manext) $(infodir)/gawk.info
-$(infodir)/gawk.info: gawk.info
+$(infodir)/gawk.info::
-if test -f gawk.info; then d=.; \
else d=$(srcdir); fi; \
+ if [ -f $(infodir)/dir -a -f $(infodir)/gawk.info ] \
+ && cmp $$d/gawk.info $(infodir)/gawk.info > /dev/null \
+ && grep '(gawk\.info)' $(infodir)/dir > /dev/null; then \
+ exit 0; \
+ fi; \
for i in $$d/gawk.info*; do \
- $(INSTALL_DATA) $$i $(infodir)/$i ; \
+ $(INSTALL_DATA) $$i $(infodir)/$$i ; \
done; \
if $(SHELL) -c 'install-info --version' > /dev/null 2>&1 ; \
then install-info --info-dir=$(infodir) gawk.info ; \
else true ; fi; exit 0
-$(mandir)/gawk$(manext): gawk.1
+$(mandir)/gawk$(manext):: gawk.1
$(INSTALL_DATA) $(srcdir)/gawk.1 $(mandir)/gawk$(manext)
-$(mandir)/igawk$(manext): igawk.1
+$(mandir)/igawk$(manext):: igawk.1
$(INSTALL_DATA) $(srcdir)/igawk.1 $(mandir)/igawk$(manext)
uninstall:
diff --git a/doc/ad.block b/doc/ad.block
index 16a4de0f..d31f5d50 100644
--- a/doc/ad.block
+++ b/doc/ad.block
@@ -1,7 +1,7 @@
-.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu
+.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org
.\" This file is the Ad block (included in cover)
.\"
-.\" Copyright (C) 1996 Free Software Foundation, Inc.
+.\" Copyright (C) 1996, 98 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
@@ -27,14 +27,15 @@
.vs 12
.ES
.nf
-.ce 6
+.ce 7
\*(CBFree Software Foundation, Inc.
.ft H
59 Temple Place \(em Suite 330
Boston, MA 02111-1307 USA
Phone: +1-617-542-5942
Fax (including Japan): +1-617-542-2652
-E-mail: gnu@prep.ai.mit.edu
+E-mail: gnu@gnu.org
+URL: http://www.gnu.org
.ce 7
.ft HB
diff --git a/doc/awkcard.in b/doc/awkcard.in
index 4a02c878..c3e262df 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -1,6 +1,6 @@
-.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu
+.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org
.\"
-.\" Copyright (C) 1996, 97 Free Software Foundation, Inc.
+.\" Copyright (C) 1996, 97, 98, 99 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
@@ -95,7 +95,7 @@ for their help.
\*(CD
.SL
.nf
-\*(FR\(co Copyright, 1996, 1997 Free Software Foundation
+\*(FR\(co Copyright 1996-1999, Free Software Foundation
59 Temple Place \(em Suite 330
Boston, MA 02111-1307 USA
.nf
@@ -934,10 +934,12 @@ construction.\*(CB
.EB "\s+2\f(HBLOCALIZATION\*(FR\s0"
..
+.ig
.ps +2
.ce 1
\*(CD\fHISBN: 0-916151-97-2\*(FR
.ps -2
+..
.BT
@@ -1128,7 +1130,10 @@ T}
pad the field to this width. The field is normally
padded with spaces. If the \*(FC0\fP flag has been used,
pad with zeroes.
-The meaning of the \*(FIwidth\*(FR varies by control letter:
+T}
+\*(FC.\fP\*(FIprec\fP T{
+precision.
+The meaning varies by control letter:
T}
\*(FC%d\*(FR, \*(FC%o\*(FR, \*(FC%i\*(FR,
\*(FC%u\*(FR, \*(FC%x\*(FR, \*(FC%X\fP T{
@@ -1433,6 +1438,10 @@ Functions may call each other and may be recursive.
Function parameters used as local variables are initialized
to the null string and the number zero upon function invocation.
.sp .5
+Use \*(FCreturn\fP to return a value from a function. The return value
+is undefined if no value is provided, or if the function returns by
+``falling off'' the end.
+.sp .5
\*(CLThe word
\*(FCfunc\fP
may be used in place of
@@ -1446,7 +1455,7 @@ may be used in place of
.ES
.fi
\*(CDIf you find a bug in this reference card, please report it via electronic
-mail to \*(FCarnold@gnu.ai.mit.edu\*(FR.\*(CX
+mail to \*(FCarnold@gnu.org\*(FR.\*(CX
.EB "\s+2\f(HBBUG REPORTS\*(FR\s0"
.BT
@@ -1493,8 +1502,8 @@ has been specified.\*(CB
.\" --- FTP Information
.ES
.nf
-\*(CDHost: \*(FCftp.gnu.ai.mit.edu\*(FR
-File: \*(FC/pub/gnu/gawk-3.0.3.tar.gz\fP
+\*(CDHost: \*(FCgnudist.gnu.org\*(FR
+File: \*(FC/gnu/gawk/gawk-3.0.4.tar.gz\fP
.in +.2i
.fi
GNU \*(AK (\*(GK). There may be a later version.
@@ -1502,7 +1511,7 @@ GNU \*(AK (\*(GK). There may be a later version.
.nf
.sp .5
Host: \*(FCnetlib.bell-labs.com\*(FR
-File: \*(FC/netlib/research/awk.bundle.Z\fP
+File: \*(FC/netlib/research/awk.bundle.gz\fP
.in +.2i
.fi
\*(NK. This version requires an ANSI C compiler;
diff --git a/doc/cardfonts b/doc/cardfonts
index 66367eef..5529ba98 100644
--- a/doc/cardfonts
+++ b/doc/cardfonts
@@ -1,4 +1,4 @@
-.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu
+.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org
.\" cardfonts --- this file sets the fonts to use for the reference card
.\"
.\" Copyright (C) 1996 Free Software Foundation, Inc.
diff --git a/doc/colors b/doc/colors
index cae1d0eb..933d25ef 100644
--- a/doc/colors
+++ b/doc/colors
@@ -1,7 +1,7 @@
-.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu
+.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org
.\" This file sets the colors to use.
.\"
-.\" Copyright (C) 1996,97 Free Software Foundation, Inc.
+.\" Copyright (C) 1996,97,99 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
diff --git a/doc/gawk.1 b/doc/gawk.1
index 0568c168..f15d4f1d 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -1,7 +1,7 @@
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
.ds AN \s-1ANSI\s+1
-.TH GAWK 1 "Dec 19 1996" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Apr 28 1999" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -2150,6 +2150,12 @@ Functions may call each other and may be recursive.
Function parameters used as local variables are initialized
to the null string and the number zero upon function invocation.
.PP
+Use
+.BI return " expr"
+to return a value from a function. The return value is undefined if no
+value is provided, or if the function returns by ``falling off'' the
+end.
+.PP
If
.B \-\^\-lint
has been provided,
@@ -2535,7 +2541,7 @@ and the effort to do so really is not worth it.
.SH VERSION INFORMATION
This man page documents
.IR gawk ,
-version 3.0.2.
+version 3.0.4.
.SH AUTHORS
The original version of \*(UX
.I awk
@@ -2566,10 +2572,10 @@ help from Darrel Hankerson. Fred Fish supplied support for the Amiga.
If you find a bug in
.IR gawk ,
please send electronic mail to
-.BR bug-gnu-utils@prep.ai.mit.edu ,
+.BR bug-gnu-utils@gnu.org ,
.I with
a carbon copy to
-.BR arnold@gnu.ai.mit.edu .
+.BR arnold@gnu.org .
Please include your operating system and its revision, the version of
.IR gawk ,
what C compiler you used to compile it, and a test program
@@ -2598,7 +2604,7 @@ Brian Kernighan of Bell Labs
provided valuable assistance during testing and debugging.
We thank him.
.SH COPYING PERMISSIONS
-Copyright \(co) 1996 Free Software Foundation, Inc.
+Copyright \(co) 1996,97,98,99 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual page provided the copyright notice and this permission
diff --git a/doc/gawk.info b/doc/gawk.info
index a9242e2b..e39a483b 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -1,4 +1,4 @@
-This is Info file gawk.info, produced by Makeinfo version 1.67 from the
+This is Info file gawk.info, produced by Makeinfo version 1.68 from the
input file ./gawk.texi.
INFO-DIR-SECTION Programming Languages
@@ -9,11 +9,11 @@ END-INFO-DIR-ENTRY
This file documents `awk', a program that you can use to select
particular records in a file and perform operations upon them.
- This is Edition 1.0.3 of `Effective AWK Programming', for the
-3.0.3 version of the GNU implementation of AWK.
+ This is Edition 1.0.4 of `Effective AWK Programming', for the
+3.0.4 version of the GNU implementation of AWK.
- Copyright (C) 1989, 1991, 92, 93, 96, 97 Free Software Foundation,
-Inc.
+ Copyright (C) 1989, 1991, 92, 93, 96, 97, 98, 99 Free Software
+Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
@@ -38,8 +38,8 @@ General Introduction
This file documents `awk', a program that you can use to select
particular records in a file and perform operations upon them.
- This is Edition 1.0.3 of `Effective AWK Programming',
-for the 3.0.3 version of the GNU implementation
+ This is Edition 1.0.4 of `Effective AWK Programming',
+for the 3.0.4 version of the GNU implementation
of AWK.
* Menu:
@@ -382,8 +382,8 @@ to MS-DOS and OS/2 PC's, Atari and Amiga micro-computers, and VMS.
---------- Footnotes ----------
- (1) These commands are available on POSIX compliant systems, as
-well as on traditional Unix based systems. If you are using some other
+ (1) These commands are available on POSIX compliant systems, as well
+as on traditional Unix based systems. If you are using some other
operating system, you still need to be familiar with the ideas of I/O
redirection and pipes.
@@ -849,7 +849,7 @@ specific to the GNU implementation, we use the term `gawk'.
---------- Footnotes ----------
- (1) Often, these systems use `gawk' for their `awk' implementation!
+ (1) Often, these systems use `gawk' for their `awk' implementation!

File: gawk.info, Node: Running gawk, Next: Very Simple, Prev: Names, Up: Getting Started
@@ -1030,6 +1030,12 @@ Self-contained `awk' scripts are useful when you want to write a
program which users can invoke without their having to know that the
program is written in `awk'.
+ *Caution:* You should not put more than one argument on the `#!'
+line after the path to `awk'. This will not work. The operating system
+treats the rest of the line as a single agument, and passes it to `awk'.
+Doing this will lead to confusing behavior: most likely a usage
+diagnostic of some sort from `awk'.
+
Some older systems do not support the `#!' mechanism. You can get a
similar effect using a regular shell script. It would look something
like this:
@@ -1049,11 +1055,11 @@ systems obey this convention, but many do.)
---------- Footnotes ----------
- (1) The `#!' mechanism works on Linux systems, Unix systems derived
+ (1) The `#!' mechanism works on Linux systems, Unix systems derived
from Berkeley Unix, System V Release 4, and some System V Release 3
systems.
- (2) The line beginning with `#!' lists the full file name of an
+ (2) The line beginning with `#!' lists the full file name of an
interpreter to be run, and an optional initial command line argument to
pass to that interpreter. The operating system then runs the
interpreter with the given argument and the full argument list of the
@@ -1088,6 +1094,18 @@ programs also, but this usually isn't very useful; the purpose of a
comment is to help you or another person understand the program at a
later time.
+ *Caution:* As mentioned in *Note One-shot Throw-away `awk' Programs:
+One-shot, you can enclose small to medium programs in single quotes, in
+order to keep your shell scripts self-contained. When doing so,
+*don't* put an apostrophe (i.e., a single quote) into a comment (or
+anywhere else in your program). The shell will interpret the quote as
+the closing quote for the entire program. As a result, usually the
+shell will print a message about mismatched quotes, and if `awk'
+actually runs, it will probably print strange messages about syntax
+errors. For example:
+
+ awk 'BEGIN { print "hello" } # let's be cute'
+

File: gawk.info, Node: Very Simple, Next: Two Rules, Prev: Running gawk, Up: Getting Started
@@ -1670,7 +1688,7 @@ character not listed in the table above.
Another interesting question arises. Suppose you use an octal or
hexadecimal escape to represent a regexp metacharacter (*note Regular
Expression Operators: Regexp Operators.). Does `awk' treat the
-character as literal character, or as a regexp operator?
+character as a literal character, or as a regexp operator?
It turns out that historically, such characters were taken literally
(d.c.). However, the POSIX standard indicates that they should be
@@ -2066,7 +2084,7 @@ current method of using `\y' for the GNU `\b' appears to be the lesser
of two evils.
The various command line options (*note Command Line Options:
-Options.) control how `gawk' interprets characters in regexps.
+Options.) control how `gawk' interprets characters in regexps.
No options
In the default case, `gawk' provide all the facilities of POSIX
@@ -2169,8 +2187,8 @@ How Much Text Matches?
echo aaaabcd | awk '{ sub(/a+/, "<A>"); print }'
This example uses the `sub' function (which we haven't discussed yet,
-*note Built-in Functions for String Manipulation: String Functions.) to
-make a change to the input record. Here, the regexp `/a+/' indicates
+*note Built-in Functions for String Manipulation: String Functions.)
+to make a change to the input record. Here, the regexp `/a+/' indicates
"one or more `a' characters," and the replacement text is `<A>'.
The input contains four `a' characters. What will the output be?
@@ -2512,7 +2530,7 @@ record containing a match.
---------- Footnotes ----------
- (1) In POSIX `awk', newlines are not considered whitespace for
+ (1) In POSIX `awk', newlines are not considered whitespace for
separating fields.

@@ -2584,7 +2602,7 @@ input file.)
The `-' sign represents subtraction, so this program reassigns field
three, `$3', to be the value of field two minus ten, `$2 - 10'. (*Note
-Arithmetic Operators: Arithmetic Ops.) Then field two, and the new
+Arithmetic Operators: Arithmetic Ops.) Then field two, and the new
value for field three, are printed.
In order for this to work, the text in field `$2' must make sense as
@@ -2954,7 +2972,7 @@ should reflect the old value of `FS', not the new one.
However, many implementations of `awk' do not work this way.
Instead, they defer splitting the fields until a field is actually
referenced. The fields will be split using the *current* value of
-`FS'! (d.c.) This behavior can be difficult to diagnose. The following
+`FS'! (d.c.) This behavior can be difficult to diagnose. The following
example illustrates the difference between the two methods. (The
`sed'(1) command prints just the first line of `/etc/passwd'.)
@@ -2992,7 +3010,7 @@ value of `FS'. (`==' means "is equal to.")
---------- Footnotes ----------
- (1) The `sed' utility is a "stream editor." Its behavior is also
+ (1) The `sed' utility is a "stream editor." Its behavior is also
defined by the POSIX standard.

@@ -3512,7 +3530,9 @@ EXPRESSION contains unparenthesized operators other than `$'; for
example, `"echo " "date" | getline' is ambiguous because the
concatenation operator is not parenthesized, and you should write it as
`("echo " "date") | getline' if you want your program to be portable to
-other `awk' implementations.
+other `awk' implementations. (It happens that `gawk' gets it right,
+but you should not rely on this. Parentheses make it easier to read,
+anyway.)

File: gawk.info, Node: Getline/Variable/Pipe, Next: Getline Summary, Prev: Getline/Pipe, Up: Getline
@@ -3540,7 +3560,9 @@ EXPRESSION contains unparenthesized operators other than `$'; for
example, `"echo " "date" | getline VAR' is ambiguous because the
concatenation operator is not parenthesized, and you should write it as
`("echo " "date") | getline VAR' if you want your program to be
-portable to other `awk' implementations.
+portable to other `awk' implementations. (It happens that `gawk' gets
+it right, but you should not rely on this. Parentheses make it easier
+to read, anyway.)

File: gawk.info, Node: Getline Summary, Prev: Getline/Variable/Pipe, Up: Getline
@@ -3640,7 +3662,7 @@ expressions. Numeric values are converted to strings, and then printed.
values to print. However, with two exceptions, you cannot specify *how*
to print them--how many columns, whether to use exponential notation or
not, and so on. (For the exceptions, *note Output Separators::., and
-*Note Controlling Numeric Output with `print': OFMT.) For that, you
+*Note Controlling Numeric Output with `print': OFMT.) For that, you
need the `printf' statement (*note Using `printf' Statements for
Fancier Printing: Printf.).
@@ -3667,7 +3689,7 @@ Examples of `print' Statements
Here is an example of printing a string that contains embedded
newlines (the `\n' is an escape sequence, used to represent the newline
-character; see *Note Escape Sequences::):
+character; *note Escape Sequences::.):
$ awk 'BEGIN { print "line one\nline two\nline three" }'
-| line one
@@ -3699,7 +3721,7 @@ Here is the same program, without the comma:
example's output makes much sense. A heading line at the beginning
would make it clearer. Let's add some headings to our table of months
(`$1') and green crates shipped (`$2'). We do this using the `BEGIN'
-pattern (*note The `BEGIN' and `END' Special Patterns: BEGIN/END.) to
+pattern (*note The `BEGIN' and `END' Special Patterns: BEGIN/END.) to
force the headings to be printed only once:
awk 'BEGIN { print "Month Crates"
@@ -4104,7 +4126,7 @@ last things on their lines. We don't need to put spaces after them.
We could make our table look even nicer by adding headings to the
tops of the columns. To do this, we use the `BEGIN' pattern (*note The
-`BEGIN' and `END' Special Patterns: BEGIN/END.) to force the header to
+`BEGIN' and `END' Special Patterns: BEGIN/END.) to force the header to
be printed only once, at the beginning of the `awk' program:
awk 'BEGIN { print "Name Number"
@@ -4377,7 +4399,7 @@ Closing Input and Output Files and Pipes
========================================
If the same file name or the same shell command is used with
-`getline' (*note Explicit Input with `getline': Getline.) more than
+`getline' (*note Explicit Input with `getline': Getline.) more than
once during the execution of an `awk' program, the file is opened (or
the command is executed) only the first time. At that time, the first
record of input is read from that file or command. The next time the
@@ -4551,9 +4573,8 @@ implementations may have difficulty with some character codes.
---------- Footnotes ----------
- (1) The internal representation uses double-precision floating
-point numbers. If you don't know what that means, then don't worry
-about it.
+ (1) The internal representation uses double-precision floating point
+numbers. If you don't know what that means, then don't worry about it.

File: gawk.info, Node: Regexp Constants, Prev: Scalar Constants, Up: Constants
@@ -5506,7 +5527,8 @@ not. *Note Arrays in `awk': Arrays, for more information about arrays.
`?:' simply by putting a newline after either character. However, you
cannot put a newline in front of either character without using
backslash continuation (*note `awk' Statements Versus Lines:
-Statements/Lines.).
+Statements/Lines.). If `--posix' is specified (*note Command Line
+Options: Options.), then this extension is disabled.

File: gawk.info, Node: Function Calls, Next: Precedence, Prev: Conditional Exp, Up: Expressions
@@ -5789,7 +5811,7 @@ whose first field is precisely `foo'.
$ awk '$1 == "foo" { print $2 }' BBS-list
-(There is no output, since there is no BBS site named "foo".) Contrast
+(There is no output, since there is no BBS site named "foo".) Contrast
this with the following regular expression match, which would accept
any record with a first field that contains `foo':
@@ -6199,7 +6221,7 @@ running.
The first thing the `while' statement does is test CONDITION. If
CONDITION is true, it executes the statement BODY. (The CONDITION is
-true when the value is not zero and not a null string.) After BODY has
+true when the value is not zero and not a null string.) After BODY has
been executed, CONDITION is tested again, and if it is still true, BODY
is executed again. This process repeats until CONDITION is no longer
true. If CONDITION is initially false, the body of the loop is never
@@ -6602,7 +6624,7 @@ by exiting with a non-zero status. Your `awk' program can do this
using an `exit' statement with a non-zero argument. Here is an example:
BEGIN {
- if (("date" | getline date_now) < 0) {
+ if (("date" | getline date_now) <= 0) {
print "Can't get system date" > "/dev/stderr"
exit 1
}
@@ -6743,7 +6765,7 @@ specific to `gawk' are marked with an asterisk, `*'.
---------- Footnotes ----------
- (1) In POSIX `awk', newline does not count as whitespace.
+ (1) In POSIX `awk', newline does not count as whitespace.

File: gawk.info, Node: Auto-set, Next: ARGC and ARGV, Prev: User-modified, Up: Built-in Variables
@@ -6896,7 +6918,7 @@ zero when `FILENAME' changed.
---------- Footnotes ----------
- (1) Some early implementations of Unix `awk' initialized `FILENAME'
+ (1) Some early implementations of Unix `awk' initialized `FILENAME'
to `"-"', even if there were data files to be processed. This behavior
was incorrect, and should not be relied upon in your programs.
@@ -6923,8 +6945,24 @@ In this example, `ARGV[0]' contains `"awk"', `ARGV[1]' contains
Notice that the `awk' program is not entered in `ARGV'. The other
special command line options, with their arguments, are also not
-entered. But variable assignments on the command line *are* treated as
-arguments, and do show up in the `ARGV' array.
+entered. This includes variable assignments done with the `-v' option
+(*note Command Line Options: Options.). Normal variable assignments on
+the command line *are* treated as arguments, and do show up in the
+`ARGV' array.
+
+ $ cat showargs.awk
+ -| BEGIN {
+ -| printf "A=%d, B=%d\n", A, B
+ -| for (i = 0; i < ARGC; i++)
+ -| printf "\tARGV[%d] = %s\n", i, ARGV[i]
+ -| }
+ -| END { printf "A=%d, B=%d\n", A, B }
+ $ awk -v A=1 -f showargs.awk B=2 /dev/null
+ -| A=1, B=0
+ -| ARGV[0] = awk
+ -| ARGV[1] = B=2
+ -| ARGV[2] = /dev/null
+ -| A=1, B=2
Your program can alter `ARGC' and the elements of `ARGV'. Each time
`awk' reaches the end of an input file, it uses the next element of
@@ -7355,11 +7393,17 @@ clear out an array.
split("", array)
The `split' function (*note Built-in Functions for String
-Manipulation: String Functions.) clears out the target array first.
+Manipulation: String Functions.) clears out the target array first.
This call asks it to split apart the null string. Since there is no
data to split out, the function simply clears the array and then
returns.
+ *Caution:* Deleting an array does not change its type; you cannot
+delete an array and then use the array's name as a scalar. For example,
+this will not work:
+
+ a[1] = 3; delete a; a = 3
+

File: gawk.info, Node: Numeric Array Subscripts, Next: Uninitialized Subscripts, Prev: Delete, Up: Arrays
@@ -7748,7 +7792,7 @@ Optional parameters are enclosed in square brackets ("[" and "]").
---------- Footnotes ----------
- (1) Computer generated random numbers really are not truly random.
+ (1) Computer generated random numbers really are not truly random.
They are technically known as "pseudo-random." This means that while
the numbers in a sequence appear to be random, you can in fact generate
the same sequence of random numbers over and over again.
@@ -7873,6 +7917,9 @@ and "]").
Before splitting the string, `split' deletes any previously
existing elements in the array ARRAY (d.c.).
+ If STRING does not match FIELDSEP at all, ARRAY will have one
+ element. The value of that element will be the original STRING.
+
`sprintf(FORMAT, EXPRESSION1,...)'
This returns (without printing) the string that `printf' would
have printed out with the same arguments (*note Using `printf'
@@ -7954,6 +8001,10 @@ and "]").
non-changeable object as the third parameter will cause a fatal
error, and your program will not run.
+ Finally, if the REGEXP is not a regexp constant, it is converted
+ into a string and then the value of that string is treated as the
+ regexp to match.
+
`gsub(REGEXP, REPLACEMENT [, TARGET])'
This is similar to the `sub' function, except `gsub' replaces
*all* of the longest, leftmost, *non-overlapping* matching
@@ -8018,6 +8069,9 @@ and "]").
`G', or if it is a number that is less than zero, only one
substitution is performed.
+ If REGEXP does not match TARGET, `gensub''s return value is the
+ original, unchanged value of TARGET.
+
`gensub' is a `gawk' extension; it is not available in
compatibility mode (*note Command Line Options: Options.).
@@ -8179,10 +8233,10 @@ the use of `gawk' and `gensub' for when you have to do substitutions.
---------- Footnotes ----------
- (1) This consequence was certainly unintended.
+ (1) This consequence was certainly unintended.
- (2) As of February 1997, with final approval and publication
-hopefully sometime in 1997.
+ (2) As of April, 1999, with final approval and publication hopefully
+sometime in 1997.

File: gawk.info, Node: I/O Functions, Next: Time Functions, Prev: String Functions, Up: Built-in
@@ -8231,7 +8285,7 @@ parameters are enclosed in square brackets ("[" and "]").
nonzero otherwise.
`system(COMMAND)'
- The system function allows the user to execute operating system
+ The `system' function allows the user to execute operating system
commands and then return to the `awk' program. The `system'
function executes the command given by the string COMMAND. It
returns, as its value, the status returned by the command that was
@@ -8248,9 +8302,17 @@ parameters are enclosed in square brackets ("[" and "]").
finishes processing input and begins its end-of-input processing.
Note that redirecting `print' or `printf' into a pipe is often
- enough to accomplish your task. However, if your `awk' program is
- interactive, `system' is useful for cranking up large
- self-contained programs, such as a shell or an editor.
+ enough to accomplish your task. If you need to run many commands,
+ it will be more efficient to simply print them to a pipe to the
+ shell:
+
+ while (MORE STUFF TO DO)
+ print COMMAND | "/bin/sh"
+ close("/bin/sh")
+
+ However, if your `awk' program is interactive, `system' is useful
+ for cranking up large self-contained programs, such as a shell or
+ an editor.
Some operating systems cannot implement the `system' function.
`system' causes a fatal error if it is not supported.
@@ -8334,7 +8396,7 @@ latter (undesirable) output is what you would see.
---------- Footnotes ----------
- (1) A program is interactive if the standard output is connected to
+ (1) A program is interactive if the standard output is connected to
a terminal device.

@@ -8590,17 +8652,16 @@ if the time zone was set to UTC.
---------- Footnotes ----------
- (1) Occasionally there are minutes in a year with a leap second,
+ (1) Occasionally there are minutes in a year with a leap second,
which is why the seconds can go up to 60.
- (2) This is because ANSI C leaves the behavior of the C version of
+ (2) This is because ANSI C leaves the behavior of the C version of
`strftime' undefined, and `gawk' will use the system's version of
`strftime' if it's there. Typically, the conversion specifier will
either not appear in the returned string, or it will appear literally.
- (3) If you don't understand any of this, don't worry about it;
-these facilities are meant to make it easier to "internationalize"
-programs.
+ (3) If you don't understand any of this, don't worry about it; these
+facilities are meant to make it easier to "internationalize" programs.

File: gawk.info, Node: User-defined, Next: Invoking Gawk, Prev: Built-in, Up: Top
@@ -8774,7 +8835,7 @@ way:
Here is an example that uses the built-in function `strftime'.
(*Note Functions for Dealing with Time Stamps: Time Functions, for more
-information on `strftime'.) The C `ctime' function takes a timestamp
+information on `strftime'.) The C `ctime' function takes a timestamp
and returns it in a string, formatted in a well known fashion. Here is
an `awk' version:
@@ -8889,8 +8950,8 @@ program calls an undefined function.
Options.), `gawk' will report about calls to undefined functions.
Some `awk' implementations generate a run-time error if you use the
-`next' statement (*note The `next' Statement: Next Statement.) inside a
-user-defined function. `gawk' does not have this problem.
+`next' statement (*note The `next' Statement: Next Statement.) inside
+a user-defined function. `gawk' does not have this problem.

File: gawk.info, Node: Return Statement, Prev: Function Caveats, Up: User-defined
@@ -9222,7 +9283,7 @@ to the `.profile' file in your home directory.
---------- Footnotes ----------
- (1) Not recommended.
+ (1) Not recommended.

File: gawk.info, Node: Other Arguments, Next: AWKPATH Variable, Prev: Options, Up: Invoking Gawk
@@ -9331,7 +9392,7 @@ path `gawk' will use.
---------- Footnotes ----------
- (1) Your version of `gawk' may use a directory that is different
+ (1) Your version of `gawk' may use a directory that is different
than `/usr/local/share/awk'; it will depend upon how `gawk' was built
and installed. The actual directory will be the value of `$(datadir)'
generated when `gawk' was configured. You probably don't need to worry
@@ -9348,7 +9409,7 @@ previous releases of `gawk' that are either not available in the
current version, or that are still supported but deprecated (meaning
that they will *not* be in the next release).
- For version 3.0.3 of `gawk', there are no command line options or
+ For version 3.0.4 of `gawk', there are no command line options or
other deprecated features from the previous version of `gawk'. This
node is thus essentially a place holder, in case some option becomes
obsolete in a future version of `gawk'.
@@ -9371,8 +9432,9 @@ Known Bugs in `gawk'
====================
* The `-F' option for changing the value of `FS' (*note Command Line
- Options: Options.) is not necessary given the command line variable
- assignment feature; it remains only for backwards compatibility.
+ Options: Options.) is not necessary given the command line
+ variable assignment feature; it remains only for backwards
+ compatibility.
* If your system actually has support for `/dev/fd' and the
associated `/dev/stdin', `/dev/stdout', and `/dev/stderr' files,
@@ -9396,7 +9458,7 @@ A Library of `awk' Functions
This chapter presents a library of useful `awk' functions. The
sample programs presented later (*note Practical `awk' Programs: Sample
-Programs.) use these functions. The functions are presented here in a
+Programs.) use these functions. The functions are presented here in a
progression from simple to complex.
*Note Extracting Programs from Texinfo Source Files: Extract Program,
@@ -9519,7 +9581,7 @@ problem.
# nextfile --- skip remaining records in current file
# correctly handle successive occurrences of the same file
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
# this should be read in before the "main" awk program
@@ -9569,9 +9631,9 @@ computations).
---------- Footnotes ----------
- (1) Some implementations of `awk' do not allow you to execute
-`next' from within a function body. Some other work-around will be
-necessary if you use such a version.
+ (1) Some implementations of `awk' do not allow you to execute `next'
+from within a function body. Some other work-around will be necessary
+if you use such a version.

File: gawk.info, Node: Assert Function, Next: Round Function, Prev: Nextfile Function, Up: Library Functions
@@ -9608,7 +9670,7 @@ possible in `awk', so this `assert' function also requires a string
version of the condition that is being tested.
# assert --- assert that a condition is true. Otherwise exit.
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
function assert(condition, string)
@@ -9653,13 +9715,13 @@ If the assertion failed, you would see a message like this:
mydata:1357: assertion failed: a <= 5 && b >= 17
There is a problem with this version of `assert', that it may not be
-possible to work around. An `END' rule is automatically added to the
-program calling `assert'. Normally, if a program consists of just a
-`BEGIN' rule, the input files and/or standard input are not read.
-However, now that the program has an `END' rule, `awk' will attempt to
-read the input data files, or standard input (*note Startup and Cleanup
-Actions: Using BEGIN/END.), most likely causing the program to hang,
-waiting for input.
+possible to work around with standard `awk'. An `END' rule is
+automatically added to the program calling `assert'. Normally, if a
+program consists of just a `BEGIN' rule, the input files and/or
+standard input are not read. However, now that the program has an `END'
+rule, `awk' will attempt to read the input data files, or standard input
+(*note Startup and Cleanup Actions: Using BEGIN/END.), most likely
+causing the program to hang, waiting for input.

File: gawk.info, Node: Round Function, Next: Ordinal Functions, Prev: Assert Function, Up: Library Functions
@@ -9668,7 +9730,7 @@ Rounding Numbers
================
The way `printf' and `sprintf' (*note Using `printf' Statements for
-Fancier Printing: Printf.) do rounding will often depend upon the
+Fancier Printing: Printf.) do rounding will often depend upon the
system's C `sprintf' subroutine. On many machines, `sprintf' rounding
is "unbiased," which means it doesn't always round a trailing `.5' up,
contrary to naive expectations. In unbiased rounding, `.5' rounds to
@@ -9680,7 +9742,7 @@ function does traditional rounding; it might be useful if your awk's
# round --- do normal rounding
#
- # Arnold Robbins, arnold@gnu.ai.mit.edu, August, 1996
+ # Arnold Robbins, arnold@gnu.org, August, 1996
# Public Domain
function round(x, ival, aval, fraction)
@@ -9736,7 +9798,7 @@ reason to build them into the `awk' interpreter.
# _ord_init: function to initialize _ord_
#
# Arnold Robbins
- # arnold@gnu.ai.mit.edu
+ # arnold@gnu.org
# Public Domain
# 16 January, 1992
# 20 July, 1992, revised
@@ -9809,10 +9871,10 @@ function. It is commented out for production use.
---------- Footnotes ----------
- (1) ASCII has been extended in many countries to use the values
-from 128 to 255 for country-specific characters. If your system uses
-these extensions, you can simplify `_ord_init' to simply loop from zero
-to 255.
+ (1) ASCII has been extended in many countries to use the values from
+128 to 255 for country-specific characters. If your system uses these
+extensions, you can simplify `_ord_init' to simply loop from zero to
+255.

File: gawk.info, Node: Join Function, Next: Mktime Function, Prev: Ordinal Functions, Up: Library Functions
@@ -9835,7 +9897,7 @@ created with `split' (*note Built-in Functions for String Manipulation:
String Functions.).
# join.awk --- join an array into a string
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function join(array, start, end, sep, result, i)
@@ -9902,7 +9964,7 @@ multiple assignment.
# mktime.awk --- convert a canonical date representation
# into a timestamp
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN \
@@ -9923,7 +9985,7 @@ multiple assignment.
}
The benefit of merging multiple `BEGIN' rules (*note The `BEGIN' and
-`END' Special Patterns: BEGIN/END.) is particularly clear when writing
+`END' Special Patterns: BEGIN/END.) is particularly clear when writing
library files. Functions in library files can cleanly initialize their
own private data and also provide clean-up actions in private `END'
rules.
@@ -10124,7 +10186,7 @@ output is to standard error, and test output is to standard output.)
as UTC--four hours ahead of the local time zone. The second line shows
that the difference is 14400 seconds, which is four hours. (The
difference is only four hours, since daylight savings time is in effect
-during May.) The final line of test output shows that the timezone
+during May.) The final line of test output shows that the timezone
compensation algorithm works; the returned time is the same as the
entered time.
@@ -10137,7 +10199,7 @@ months, and AM/PM times into 24-hour clocks, to generate the
---------- Footnotes ----------
- (1) This is the Epoch on POSIX systems. It may be different on
+ (1) This is the Epoch on POSIX systems. It may be different on
other systems.

@@ -10158,7 +10220,7 @@ array with pre-formatted time information. It returns a string with
the current time formatted in the same way as the `date' utility.
# gettimeofday --- get the time of day in a usable format
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain, May 1993
+ # Arnold Robbins, arnold@gnu.org, Public Domain, May 1993
#
# Returns a string in the format of output of date(1)
# Populates the array argument time with individual values:
@@ -10258,7 +10320,7 @@ Besides solving the problem in only nine(!) lines of code, it does so
# that each take the name of the file being started or
# finished, respectively.
#
- # Arnold Robbins, arnold@gnu.ai.mit.edu, January 1992
+ # Arnold Robbins, arnold@gnu.org, January 1992
# Public Domain
FILENAME != _oldfilename \
@@ -10302,7 +10364,7 @@ problem.
#
# user supplies beginfile() and endfile() functions
#
- # Arnold Robbins, arnold@gnu.ai.mit.edu. November 1992
+ # Arnold Robbins, arnold@gnu.org, November 1992
# Public Domain
FNR == 1 {
@@ -10428,7 +10490,7 @@ Functions.).
# getopt --- do C library getopt(3) function in awk
#
- # arnold@gnu.ai.mit.edu
+ # arnold@gnu.org
# Public domain
#
# Initial version: March, 1991
@@ -10616,7 +10678,7 @@ Reading the User Database
=========================
The `/dev/user' special file (*note Special File Names in `gawk':
-Special Files.) provides access to the current user's real and
+Special Files.) provides access to the current user's real and
effective user and group id numbers, and if available, the user's
supplementary group set. However, since these are numbers, they do not
provide very useful information to the average user. There needs to be
@@ -10629,7 +10691,7 @@ information from the group database.
The POSIX standard does not define the file where user information is
kept. Instead, it provides the `<pwd.h>' header file and several C
language subroutines for obtaining user information. The primary
-function is `getpwent', for "get password entry." The "password" comes
+function is `getpwent', for "get password entry." The "password" comes
from the original user database file, `/etc/passwd', which kept user
information, along with the encrypted passwords (hence the name).
@@ -10653,7 +10715,7 @@ password database.
* Generate a printable version of the password database
*
* Arnold Robbins
- * arnold@gnu.ai.mit.edu
+ * arnold@gnu.org
* May 1993
* Public Domain
*/
@@ -10724,7 +10786,7 @@ information. There are several functions here, corresponding to the C
functions of the same name.
# passwd.awk --- access password file information
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN {
@@ -10868,7 +10930,7 @@ have a small C program that generates the group database as its output.
*
* Generate a printable version of the group database
*
- * Arnold Robbins, arnold@gnu.ai.mit.edu
+ * Arnold Robbins, arnold@gnu.org
* May 1993
* Public Domain
*/
@@ -10936,7 +10998,7 @@ database. There are several, modeled after the C library functions of
the same names.
# group.awk --- functions for dealing with the group file
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN \
@@ -11059,7 +11121,7 @@ member.
function getgrent()
{
_gr_init()
- if (++gr_count in _gr_bycount)
+ if (++_gr_count in _gr_bycount)
return _gr_bycount[_gr_count]
return ""
}
@@ -11261,7 +11323,7 @@ Function.).
is called if invalid arguments are supplied.
# cut.awk --- implement cut in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
@@ -11531,7 +11593,7 @@ rule that processes the command line arguments with `getopt'. The `-i'
`IGNORECASE' built in variable (*note Built-in Variables::.).
# egrep.awk --- simulate egrep in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
@@ -11736,7 +11798,7 @@ field. Similar code is used for the effective user-id number, and the
group numbers.
# id.awk --- implement id in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# output is:
@@ -11833,7 +11895,7 @@ skipped over, and the final argument is used as the prefix for the
output file names.
# split.awk --- do split in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# usage: split [-num] [file] [outname]
@@ -11930,7 +11992,7 @@ usage message and exits. Finally, `awk' is forced to read the standard
input by setting `ARGV[1]' to `"-"', and `ARGC' to two.
# tee.awk --- tee in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Revised December 1995
@@ -12061,7 +12123,7 @@ assigned to `outputfile'. Earlier, `outputfile' was initialized to the
standard output, `/dev/stdout'.
# uniq.awk --- do uniq in awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
function usage( e)
@@ -12265,7 +12327,7 @@ order.
command line.
# wc.awk --- count lines, words, characters
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
@@ -12355,9 +12417,9 @@ line.(1)
---------- Footnotes ----------
- (1) Examine the code in *Note Noting Data File Boundaries:
-Filetrans Function. Why must `wc' use a separate `lines' variable,
-instead of using the value of `FNR' in `endfile'?
+ (1) Examine the code in *Note Noting Data File Boundaries: Filetrans
+Function. Why must `wc' use a separate `lines' variable, instead of
+using the value of `FNR' in `endfile'?

File: gawk.info, Node: Miscellaneous Programs, Prev: Clones, Up: Sample Programs
@@ -12407,7 +12469,7 @@ comparison either. This sometimes leads to reports of duplicated words
that really are different, but this is unusual.
# dupword --- find duplicate words in text
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# December 1991
{
@@ -12448,7 +12510,7 @@ the system calls attention to itself, in case the user is not looking
at their computer or terminal.)
# alarm --- set an alarm
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# usage: alarm time [ "message" [ count [ delay ] ] ]
@@ -12522,7 +12584,7 @@ between the two is how long to wait before setting off the alarm.
}
Finally, the program uses the `system' function (*note Built-in
-Functions for Input/Output: I/O Functions.) to call the `sleep'
+Functions for Input/Output: I/O Functions.) to call the `sleep'
utility. The `sleep' utility simply pauses for the given number of
seconds. If the exit status is not zero, the program assumes that
`sleep' was interrupted, and exits. If `sleep' exited with an OK status
@@ -12606,7 +12668,7 @@ from the standard input.
record.
# translate --- do tr like stuff
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# August 1989
# bugs: does not handle things like: tr A-Z a-z, it has
@@ -12668,10 +12730,10 @@ program.
---------- Footnotes ----------
- (1) On older, non-POSIX systems, `tr' often does not require that
+ (1) On older, non-POSIX systems, `tr' often does not require that
the lists be enclosed in square brackets and quoted. This is a feature.
- (2) This program was written before `gawk' acquired the ability to
+ (2) This program was written before `gawk' acquired the ability to
split each character in a string into separate array elements. How
might this ability simplify the program?
@@ -12723,7 +12785,7 @@ lines at the bottom.
not have been an even multiple of 20 labels in the data.
# labels.awk
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# June 1992
# Program to print labels. Each label is 5 lines of data
@@ -12778,7 +12840,7 @@ not have been an even multiple of 20 labels in the data.
---------- Footnotes ----------
- (1) "Real world" is defined as "a program actually used to get
+ (1) "Real world" is defined as "a program actually used to get
something done."

@@ -12920,7 +12982,7 @@ indices of `lines' indicate the order in which those lines were
encountered. The `END' rule simply prints out the lines, in order.
# histsort.awk --- compact a shell history file
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Thanks to Byron Rakitzis for the general idea
@@ -12992,7 +13054,27 @@ an Array Into a String: Join Function.).
AWK Programming' (`gawk.texi') have all been bracketed inside `file',
and `endfile' lines. The `gawk' distribution uses a copy of
`extract.awk' to extract the sample programs and install many of them
-in a standard directory, where `gawk' can find them.
+in a standard directory, where `gawk' can find them. The Texinfo file
+looks something like this:
+
+ ...
+ This program has a @code{BEGIN} block,
+ which prints a nice message:
+
+ @example
+ @c file examples/messages.awk
+ BEGIN @{ print "Don't panic!" @}
+ @c end file
+ @end example
+
+ It also prints some final advice:
+
+ @example
+ @c file examples/messages.awk
+ END @{ print "Always avoid bored archeologists!" @}
+ @c end file
+ @end example
+ ...
`extract.awk' begins by setting `IGNORECASE' to one, so that mixed
upper-case and lower-case letters in the directives won't matter.
@@ -13003,7 +13085,7 @@ exited with a zero exit status, signifying OK.
# extract.awk --- extract files and run programs
# from texinfo files
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
BEGIN { IGNORECASE = 1 }
@@ -13039,7 +13121,9 @@ Explicit Input with `getline': Getline.). For an unexpected end of
file, it calls the `unexpected_eof' function. If the line is an
"endfile" line, then it breaks out of the loop. If the line is an
`@group' or `@end group' line, then it ignores it, and goes on to the
-next line.
+next line. (These Texinfo control lines keep blocks of code together
+on one page; unfortunately, TeX isn't always smart enough to do things
+exactly right, and we have to give it some advice.)
Most of the work is in the following few lines. If the line has no
`@' symbols, it can be printed directly. Otherwise, each leading `@'
@@ -13149,7 +13233,7 @@ process. If none are provided, the standard input is used.
# awksed.awk --- do s/foo/bar/g using just print
# Thanks to Michael Brennan for the idea
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# August 1995
function usage()
@@ -13338,7 +13422,7 @@ temporary file names will clash.
#! /bin/sh
# igawk --- like gawk but do @include processing
- # Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
+ # Arnold Robbins, arnold@gnu.org, Public Domain
# July 1993
if [ "$1" = debug ]
@@ -13567,7 +13651,7 @@ for the desired library functions.
---------- Footnotes ----------
- (1) On some very old versions of `awk', the test `getline junk < t'
+ (1) On some very old versions of `awk', the test `getline junk < t'
can loop forever if the file exists but is empty. Caveat Emptor.

@@ -14051,7 +14135,7 @@ matches, the associated ACTION is executed.
---------- Footnotes ----------
- (1) The path may use a directory other than `/usr/local/share/awk',
+ (1) The path may use a directory other than `/usr/local/share/awk',
depending upon how `gawk' was built and installed.

@@ -14087,7 +14171,7 @@ special case that `FS' is a single space, fields are separated by runs
of spaces, tabs and/or newlines.(1) If `FS' is the null string (`""'),
then each individual character in the record becomes a separate field.
Note that the value of `IGNORECASE' (*note Case-sensitivity in
-Matching: Case-sensitivity.) also affects how fields are split when
+Matching: Case-sensitivity.) also affects how fields are split when
`FS' is a regular expression.
Each field in the input line may be referenced by its position, `$1',
@@ -14112,7 +14196,7 @@ Files: Reading Files.
---------- Footnotes ----------
- (1) In POSIX `awk', newline does not separate fields.
+ (1) In POSIX `awk', newline does not separate fields.

File: gawk.info, Node: Built-in Summary, Next: Arrays Summary, Prev: Fields Summary, Up: Variables/Fields
@@ -15207,13 +15291,13 @@ Getting the `gawk' Distribution
Boston, MA 02111-1307 USA
Phone: +1-617-542-5942
Fax (including Japan): +1-617-542-2652
- E-mail: `gnu@prep.ai.mit.edu'
+ E-mail: `gnu@gnu.org'
Ordering from the FSF directly contributes to the support of the
foundation and to the production of more free software.
3. You can get `gawk' by using anonymous `ftp' to the Internet host
- `ftp.gnu.ai.mit.edu', in the directory `/pub/gnu'.
+ `gnudist.gnu.org', in the directory `/gnu/gawk'.
Here is a list of alternate `ftp' sites from which you can obtain
GNU software. When a site is listed as "SITE`:'DIRECTORY" the
@@ -15221,19 +15305,27 @@ Getting the `gawk' Distribution
should use a site that is geographically close to you.
Asia:
+
`cair-archive.kaist.ac.kr:/pub/gnu'
`ftp.cs.titech.ac.jp'
`ftp.nectec.or.th:/pub/mirrors/gnu'
`utsun.s.u-tokyo.ac.jp:/ftpsync/prep'
+
Australia:
+
`archie.au:/gnu'
(`archie.oz' or `archie.oz.au' for ACSnet)
Africa:
+
`ftp.sun.ac.za:/pub/gnu'
+
Middle East:
+
`ftp.technion.ac.il:/pub/unsupported/gnu'
+
Europe:
+
`archive.eu.net'
`ftp.denet.dk'
`ftp.eunet.ch'
@@ -15252,12 +15344,18 @@ Getting the `gawk' Distribution
`nic.switch.ch:/mirror/gnu'
`src.doc.ic.ac.uk:/gnu'
`unix.hensa.ac.uk:/pub/uunet/systems/gnu'
+
South America:
+
`ftp.inf.utfsm.cl:/pub/gnu'
`ftp.unicamp.br:/pub/gnu'
+
Western Canada:
+
`ftp.cs.ubc.ca:/mirror2/gnu'
+
USA:
+
`col.hp.com:/mirrors/gnu'
`f.ms.uky.edu:/pub3/gnu'
`ftp.cc.gatech.edu:/pub/gnu'
@@ -15265,6 +15363,7 @@ Getting the `gawk' Distribution
`ftp.digex.net:/pub/gnu'
`ftp.hawaii.edu:/mirrors/gnu'
`ftp.kpc.com:/pub/mirror/gnu'
+
USA (continued):
`ftp.uu.net:/systems/gnu'
`gatekeeper.dec.com:/pub/GNU'
@@ -15283,21 +15382,21 @@ Extracting the Distribution
`gawk' is distributed as a `tar' file compressed with the GNU Zip
program, `gzip'.
- Once you have the distribution (for example, `gawk-3.0.3.tar.gz'),
+ Once you have the distribution (for example, `gawk-3.0.4.tar.gz'),
first use `gzip' to expand the file, and then use `tar' to extract it.
You can use the following pipeline to produce the `gawk' distribution:
# Under System V, add 'o' to the tar flags
- gzip -d -c gawk-3.0.3.tar.gz | tar -xvpf -
+ gzip -d -c gawk-3.0.4.tar.gz | tar -xvpf -
-This will create a directory named `gawk-3.0.3' in the current
+This will create a directory named `gawk-3.0.4' in the current
directory.
The distribution file name is of the form `gawk-V.R.N.tar.gz'. The
V represents the major version of `gawk', the R represents the current
release of version V, and the N represents a "patch level", meaning
that minor bugs have been fixed in the release. The current patch
-level is 3, but when retrieving distributions, you should get the
+level is 4, but when retrieving distributions, you should get the
version with the highest version, release, and patch level. (Note that
release levels greater than or equal to 90 denote "beta," or
non-production software; you may not wish to retrieve such a version
@@ -15470,7 +15569,7 @@ Compiling `gawk' for Unix
-------------------------
After you have extracted the `gawk' distribution, `cd' to
-`gawk-3.0.3'. Like most GNU software, `gawk' is configured
+`gawk-3.0.4'. Like most GNU software, `gawk' is configured
automatically for your Unix system by running the `configure' program.
This program is a Bourne shell script that was generated automatically
using GNU `autoconf'. (The `autoconf' software is described fully
@@ -15958,15 +16057,15 @@ us decide whether the problem was really in the documentation.
can send mail to.
Internet:
- `bug-gnu-utils@prep.ai.mit.edu'
+ `bug-gnu-utils@gnu.org'
UUCP:
- `uunet!prep.ai.mit.edu!bug-gnu-utils'
+ `uunet!gnu.org!bug-gnu-utils'
Please include the version number of `gawk' you are using. You can
get this information with the command `gawk --version'. You should
send a carbon copy of your mail to Arnold Robbins, who can be reached
-at `arnold@gnu.ai.mit.edu'.
+at `arnold@gnu.org'.
*Important!* Do *not* try to report bugs in `gawk' by posting to the
Usenet/Internet newsgroup `comp.lang.awk'. While the `gawk' developers
@@ -16024,12 +16123,14 @@ section briefly describes where to get them.
Unix `awk'
Brian Kernighan has been able to make his implementation of `awk'
freely available. You can get it via anonymous `ftp' to the host
- `netlib.att.com'. Change directory to `/netlib/research'. Use
- "binary" or "image" mode, and retrieve `awk.bundle.Z'.
+ `netlib.bell-labs.com'. Change directory to `/netlib/research'.
+ Use "binary" or "image" mode, and retrieve `awk.bundle.gz'.
- This is a shell archive that has been compressed with the
- `compress' utility. It can be uncompressed with either
- `uncompress' or the GNU `gunzip' utility.
+ This is a shell archive that has been compressed with the GNU
+ `gzip' utility. It can be uncompressed with the `gunzip' utility.
+
+ You can also retrieve this version via the World Wide Web from
+ Brian Kernighan's home page (http://cm.bell-labs.com/who/bwk).
This version requires an ANSI C compiler; GCC (the GNU C compiler)
works quite nicely.
@@ -16116,7 +16217,7 @@ Adding New Features
You are free to add any new features you like to `gawk'. However,
if you want your changes to be incorporated into the `gawk'
distribution, there are several steps that you need to take in order to
-make it possible for me to include to your changes.
+make it possible for me to include your changes.
1. Get the latest version. It is much easier for me to integrate
changes if they are relative to the most recent distributed
@@ -16125,7 +16226,7 @@ make it possible for me to include to your changes.
Distribution: Getting, for information on getting the latest
version of `gawk'.
- 2. See *note : (Version)Top standards, GNU Coding Standards. This
+ 2. See *note (Version)Top:: standards, GNU Coding Standards. This
document describes how GNU software should be written. If you
haven't read it, please do so, preferably *before* starting to
modify `gawk'. (The `GNU Coding Standards' are available as part
@@ -16194,7 +16295,7 @@ make it possible for me to include to your changes.
effect, or assign the copyright in your changes to the FSF. Both
of these actions are easy to do, and *many* people have done so
already. If you have questions, please contact me (*note Reporting
- Problems and Bugs: Bugs.), or `gnu@prep.ai.mit.edu'.
+ Problems and Bugs: Bugs.), or `gnu@gnu.org'.
5. Update the documentation. Along with your new code, please supply
new sections and or chapters for this Info file. If at all
@@ -16211,10 +16312,10 @@ make it possible for me to include to your changes.
6. Submit changes as context diffs or unified diffs. Use `diff -c -r
-N' or `diff -u -r -N' to compare the original `gawk' source tree
with your version. (I find context diffs to be more readable, but
- unified diffs are more compact.) I recommend using the GNU version
- of `diff'. Send the output produced by either run of `diff' to me
- when you submit your changes. *Note Reporting Problems and Bugs:
- Bugs, for the electronic mail information.
+ unified diffs are more compact.) I recommend using the GNU
+ version of `diff'. Send the output produced by either run of
+ `diff' to me when you submit your changes. *Note Reporting
+ Problems and Bugs: Bugs, for the electronic mail information.
Using this format makes it easy for me to apply your changes to the
master version of the `gawk' source code (using `patch'). If I
@@ -16298,7 +16399,7 @@ several steps to follow.
the public domain, and submit a signed statement to that effect,
or assign the copyright in your code to the FSF. Both of these
actions are easy to do, and *many* people have done so already. If
- you have questions, please contact me, or `gnu@prep.ai.mit.edu'.
+ you have questions, please contact me, or `gnu@gnu.org'.
Following these steps will make it much easier to integrate your
changes into `gawk', and have them co-exist happily with the code for
@@ -16340,9 +16441,9 @@ Databases
A `PROCINFO' Array
The special files that provide process-related information (*note
- Special File Names in `gawk': Special Files.) may be superseded by
- a `PROCINFO' array that would provide the same information, in an
- easier to access fashion.
+ Special File Names in `gawk': Special Files.) may be superseded
+ by a `PROCINFO' array that would provide the same information, in
+ an easier to access fashion.
More `lint' warnings
There are more things that could be checked for portability.
@@ -16363,12 +16464,6 @@ Use of GNU `malloc'
The GNU version of `malloc' could potentially speed up `gawk',
since it relies heavily on the use of dynamic memory allocation.
-Use of the `rx' regexp library
- The `rx' regular expression library could potentially speed up all
- regexp operations that require knowing the exact location of
- matches. This includes record termination, field and array
- splitting, and the `sub', `gsub', `gensub' and `match' functions.
-

File: gawk.info, Node: Improvements, Prev: Future Extensions, Up: Notes
@@ -16515,7 +16610,7 @@ CHEM
A preprocessor for `pic' that reads descriptions of molecules and
produces `pic' input for drawing them. It was written in `awk' by
Brian Kernighan and Jon Bentley, and is available from
- `netlib@research.att.com'.
+ <netlib@research.bell-labs.com>.
Compound Statement
A series of `awk' statements, enclosed in curly braces. Compound
@@ -17200,11 +17295,11 @@ Index
* ! operator: Boolean Ops.
* != operator: Typing and Comparison.
-* !~ operator <1>: Regexp Constants.
-* !~ operator <2>: Typing and Comparison.
-* !~ operator <3>: Regexp Usage.
+* !~ operator <1>: Typing and Comparison.
+* !~ operator <2>: Regexp Constants.
+* !~ operator <3>: Computed Regexps.
* !~ operator <4>: Case-sensitivity.
-* !~ operator: Computed Regexps.
+* !~ operator: Regexp Usage.
* # (comment): Comments.
* #! (executable scripts): Executable Scripts.
* $ (field operator): Fields.
@@ -17223,10 +17318,10 @@ Index
* --traditional option: Options.
* --usage option: Options.
* --version option: Options.
-* -f option: Long.
-* -F option <1>: Command Line Field Separator.
-* -F option: Options.
* -f option: Options.
+* -F option <1>: Options.
+* -F option: Command Line Field Separator.
+* -f option: Long.
* -v option: Options.
* -W option: Options.
* /dev/fd: Special Files.
@@ -17236,8 +17331,8 @@ Index
* /dev/stderr: Special Files.
* /dev/stdin: Special Files.
* /dev/stdout: Special Files.
-* /dev/user <1>: Special Files.
-* /dev/user: Passwd Functions.
+* /dev/user <1>: Passwd Functions.
+* /dev/user: Special Files.
* < operator: Typing and Comparison.
* <= operator: Typing and Comparison.
* == operator: Typing and Comparison.
@@ -17256,8 +17351,8 @@ Index
* _tm_addup: Mktime Function.
* _tm_isleap: Mktime Function.
* accessing fields: Fields.
-* account information <1>: Passwd Functions.
-* account information: Group Functions.
+* account information <1>: Group Functions.
+* account information: Passwd Functions.
* acronym: History.
* action, curly braces: Action Overview.
* action, default: Very Simple.
@@ -17272,17 +17367,17 @@ Index
* amiga: Amiga Installation.
* anchors in regexps: Regexp Operators.
* and operator: Boolean Ops.
-* anonymous ftp <1>: Getting.
-* anonymous ftp: Other Versions.
+* anonymous ftp <1>: Other Versions.
+* anonymous ftp: Getting.
* applications of awk: When.
* ARGC: Auto-set.
-* ARGIND <1>: Auto-set.
-* ARGIND: Other Arguments.
+* ARGIND <1>: Other Arguments.
+* ARGIND: Auto-set.
* argument processing: Getopt Function.
* arguments in function call: Function Calls.
* arguments, command line: Invoking Gawk.
-* ARGV <1>: Auto-set.
-* ARGV: Other Arguments.
+* ARGV <1>: Other Arguments.
+* ARGV: Auto-set.
* arithmetic operators: Arithmetic Ops.
* array assignment: Assigning Elements.
* array reference: Reference to Elements.
@@ -17309,33 +17404,30 @@ Index
* atan2: Numeric Functions.
* atari: Atari Installation.
* automatic initialization: More Complex.
-* awk language, POSIX version <1>: OFMT.
-* awk language, POSIX version <2>: Next Statement.
-* awk language, POSIX version <3>: Continue Statement.
-* awk language, POSIX version <4>: Format Modifiers.
-* awk language, POSIX version <5>: Field Splitting Summary.
-* awk language, POSIX version <6>: Arithmetic Ops.
-* awk language, POSIX version <7>: User-modified.
-* awk language, POSIX version <8>: Precedence.
-* awk language, POSIX version <9>: Assignment Ops.
-* awk language, POSIX version <10>: String Functions.
-* awk language, POSIX version <11>: Regexp Operators.
-* awk language, POSIX version <12>: Escape Sequences.
-* awk language, POSIX version <13>: Regexp Operators.
-* awk language, POSIX version <14>: String Functions.
-* awk language, POSIX version <15>: Definition Syntax.
-* awk language, POSIX version <16>: Break Statement.
-* awk language, POSIX version <17>: Regexp Operators.
-* awk language, POSIX version: Conversion.
+* awk language, POSIX version <1>: Definition Syntax.
+* awk language, POSIX version <2>: String Functions.
+* awk language, POSIX version <3>: User-modified.
+* awk language, POSIX version <4>: Next Statement.
+* awk language, POSIX version <5>: Continue Statement.
+* awk language, POSIX version <6>: Break Statement.
+* awk language, POSIX version <7>: Precedence.
+* awk language, POSIX version <8>: Assignment Ops.
+* awk language, POSIX version <9>: Arithmetic Ops.
+* awk language, POSIX version <10>: Conversion.
+* awk language, POSIX version <11>: Format Modifiers.
+* awk language, POSIX version <12>: OFMT.
+* awk language, POSIX version <13>: Field Splitting Summary.
+* awk language, POSIX version <14>: Regexp Operators.
+* awk language, POSIX version: Escape Sequences.
* awk language, V.4 version <1>: SVR4.
* awk language, V.4 version: Escape Sequences.
* AWKPATH environment variable: AWKPATH Variable.
* awksed: Simple Sed.
-* backslash continuation <1>: Statements/Lines.
-* backslash continuation: Egrep Program.
+* backslash continuation <1>: Egrep Program.
+* backslash continuation: Statements/Lines.
* backslash continuation and comments: Statements/Lines.
-* backslash continuation in csh <1>: More Complex.
-* backslash continuation in csh: Statements/Lines.
+* backslash continuation in csh <1>: Statements/Lines.
+* backslash continuation in csh: More Complex.
* basic function of awk: Getting Started.
* BBS-list file: Sample Data Files.
* BEGIN special pattern: BEGIN/END.
@@ -17347,9 +17439,8 @@ Index
* break statement: Break Statement.
* break, outside of loops: Break Statement.
* Brennan, Michael <1>: Other Versions.
-* Brennan, Michael <2>: Delete.
-* Brennan, Michael <3>: Other Versions.
-* Brennan, Michael: Simple Sed.
+* Brennan, Michael <2>: Simple Sed.
+* Brennan, Michael: Delete.
* buffer matching operators: GNU Regexp Operators.
* buffering output: I/O Functions.
* buffering, interactive vs. non-interactive: I/O Functions.
@@ -17393,8 +17484,8 @@ Index
* comp.lang.awk: Bugs.
* comparison expressions: Typing and Comparison.
* comparisons, string vs. regexp: Typing and Comparison.
-* compatibility mode <1>: Options.
-* compatibility mode: POSIX/GNU.
+* compatibility mode <1>: POSIX/GNU.
+* compatibility mode: Options.
* complemented character list: Regexp Operators.
* compound statement: Statements.
* computed regular expressions: Computed Regexps.
@@ -17411,42 +17502,40 @@ Index
* conversions, during subscripting: Numeric Array Subscripts.
* converting dates to timestamps: Mktime Function.
* CONVFMT <1>: Numeric Array Subscripts.
-* CONVFMT <2>: Conversion.
-* CONVFMT: User-modified.
+* CONVFMT <2>: User-modified.
+* CONVFMT: Conversion.
* cos: Numeric Functions.
-* csh, backslash continuation <1>: More Complex.
-* csh, backslash continuation: Statements/Lines.
+* csh, backslash continuation <1>: Statements/Lines.
+* csh, backslash continuation: More Complex.
* curly braces: Action Overview.
* custom.h configuration file: Configuration Philosophy.
* cut utility: Cut Program.
* cut.awk: Cut Program.
* d.c., see "dark corner": This Manual.
-* dark corner <1>: Control Letters.
-* dark corner <2>: Continue Statement.
-* dark corner <3>: Using Constant Regexps.
-* dark corner <4>: Single Character Fields.
-* dark corner <5>: OFMT.
-* dark corner <6>: Auto-set.
-* dark corner <7>: Truth Values.
-* dark corner <8>: Field Splitting Summary.
-* dark corner <9>: Assignment Options.
-* dark corner <10>: This Manual.
-* dark corner <11>: Escape Sequences.
-* dark corner <12>: Format Modifiers.
-* dark corner <13>: Break Statement.
-* dark corner <14>: Invoking Gawk.
-* dark corner <15>: Plain Getline.
-* dark corner <16>: Using Constant Regexps.
+* dark corner <1>: Other Arguments.
+* dark corner <2>: Invoking Gawk.
+* dark corner <3>: String Functions.
+* dark corner <4>: Uninitialized Subscripts.
+* dark corner <5>: Auto-set.
+* dark corner <6>: Exit Statement.
+* dark corner <7>: Continue Statement.
+* dark corner <8>: Break Statement.
+* dark corner <9>: Using BEGIN/END.
+* dark corner <10>: Truth Values.
+* dark corner <11>: Conversion.
+* dark corner <12>: Assignment Options.
+* dark corner <13>: Using Constant Regexps.
+* dark corner <14>: Format Modifiers.
+* dark corner <15>: Control Letters.
+* dark corner <16>: OFMT.
* dark corner <17>: Getline Summary.
-* dark corner <18>: Multiple Line.
-* dark corner <19>: String Functions.
-* dark corner <20>: Conversion.
-* dark corner <21>: Uninitialized Subscripts.
-* dark corner <22>: Auto-set.
-* dark corner <23>: Records.
-* dark corner <24>: Exit Statement.
-* dark corner <25>: Other Arguments.
-* dark corner: Using BEGIN/END.
+* dark corner <18>: Plain Getline.
+* dark corner <19>: Multiple Line.
+* dark corner <20>: Field Splitting Summary.
+* dark corner <21>: Single Character Fields.
+* dark corner <22>: Records.
+* dark corner <23>: Escape Sequences.
+* dark corner: This Manual.
* data-driven languages: Getting Started.
* dates, converting to timestamps: Mktime Function.
* decrement operators: Increment Ops.
@@ -17460,28 +17549,25 @@ Index
* deleting entire arrays: Delete.
* deprecated features: Obsolete.
* deprecated options: Obsolete.
-* differences between gawk and awk <1>: Records.
-* differences between gawk and awk <2>: Scalar Constants.
-* differences between gawk and awk <3>: Getline Summary.
-* differences between gawk and awk <4>: ARGC and ARGV.
-* differences between gawk and awk <5>: Calling Built-in.
+* differences between gawk and awk <1>: AWKPATH Variable.
+* differences between gawk and awk <2>: String Functions.
+* differences between gawk and awk <3>: Calling Built-in.
+* differences between gawk and awk <4>: Delete.
+* differences between gawk and awk <5>: ARGC and ARGV.
* differences between gawk and awk <6>: Nextfile Statement.
-* differences between gawk and awk <7>: AWKPATH Variable.
-* differences between gawk and awk <8>: Getline Intro.
-* differences between gawk and awk <9>: Special Files.
-* differences between gawk and awk <10>: Conditional Exp.
-* differences between gawk and awk <11>: Arithmetic Ops.
-* differences between gawk and awk <12>: String Functions.
-* differences between gawk and awk <13>: I/O And BEGIN/END.
+* differences between gawk and awk <7>: I/O And BEGIN/END.
+* differences between gawk and awk <8>: Conditional Exp.
+* differences between gawk and awk <9>: Arithmetic Ops.
+* differences between gawk and awk <10>: Using Constant Regexps.
+* differences between gawk and awk <11>: Scalar Constants.
+* differences between gawk and awk <12>: Close Files And Pipes.
+* differences between gawk and awk <13>: Special Files.
* differences between gawk and awk <14>: Redirection.
-* differences between gawk and awk <15>: Case-sensitivity.
-* differences between gawk and awk <16>: Using Constant Regexps.
-* differences between gawk and awk <17>: Close Files And Pipes.
-* differences between gawk and awk <18>: String Functions.
-* differences between gawk and awk <19>: Close Files And Pipes.
-* differences between gawk and awk <20>: Delete.
-* differences between gawk and awk <21>: Single Character Fields.
-* differences between gawk and awk: Records.
+* differences between gawk and awk <15>: Getline Summary.
+* differences between gawk and awk <16>: Getline Intro.
+* differences between gawk and awk <17>: Single Character Fields.
+* differences between gawk and awk <18>: Records.
+* differences between gawk and awk: Case-sensitivity.
* directory search: AWKPATH Variable.
* division: Arithmetic Ops.
* documenting awk programs <1>: Library Names.
@@ -17489,8 +17575,8 @@ Index
* dupword.awk: Dupword Program.
* dynamic regular expressions: Computed Regexps.
* EBCDIC: Ordinal Functions.
-* egrep <1>: One-shot.
-* egrep: Regexp Operators.
+* egrep <1>: Regexp Operators.
+* egrep: One-shot.
* egrep utility: Egrep Program.
* egrep.awk: Egrep Program.
* element assignment: Assigning Elements.
@@ -17510,13 +17596,13 @@ Index
* environment variable, AWKPATH: AWKPATH Variable.
* environment variable, POSIXLY_CORRECT: Options.
* equivalence classes: Regexp Operators.
-* ERRNO <1>: Getline Intro.
+* ERRNO <1>: Auto-set.
* ERRNO <2>: Close Files And Pipes.
-* ERRNO: Auto-set.
+* ERRNO: Getline Intro.
* errors, common <1>: Typing and Comparison.
-* errors, common <2>: Computed Regexps.
+* errors, common <2>: Print Examples.
* errors, common <3>: Basic Field Splitting.
-* errors, common: Print Examples.
+* errors, common: Computed Regexps.
* escape processing, sub et. al.: String Functions.
* escape sequence notation: Escape Sequences.
* evaluation, order of: Calling Built-in.
@@ -17545,9 +17631,9 @@ Index
* FIELDWIDTHS: User-modified.
* file descriptors: Special Files.
* file, awk program: Long.
-* FILENAME <1>: Reading Files.
+* FILENAME <1>: Auto-set.
* FILENAME <2>: Getline Summary.
-* FILENAME: Auto-set.
+* FILENAME: Reading Files.
* FILENAME, being set by getline: Getline Summary.
* Fish, Fred: Bugs.
* flushing buffers: I/O Functions.
@@ -17561,16 +17647,15 @@ Index
* formatted output: Printf.
* formatted timestamps: Gettimeofday Function.
* Free Software Foundation <1>: Getting.
-* Free Software Foundation <2>: Manual History.
-* Free Software Foundation: Getting.
+* Free Software Foundation: Manual History.
* FreeBSD: Manual History.
* Friedl, Jeffrey: Acknowledgements.
-* FS <1>: Basic Field Splitting.
-* FS: User-modified.
-* ftp, anonymous <1>: Getting.
-* ftp, anonymous: Other Versions.
-* function call <1>: Function Calls.
-* function call: Function Caveats.
+* FS <1>: User-modified.
+* FS: Basic Field Splitting.
+* ftp, anonymous <1>: Other Versions.
+* ftp, anonymous: Getting.
+* function call <1>: Function Caveats.
+* function call: Function Calls.
* function definition: Definition Syntax.
* function, recursive: Definition Syntax.
* functions, undefined: Function Caveats.
@@ -17602,11 +17687,11 @@ Index
* gsub, third argument of: String Functions.
* Hankerson, Darrel <1>: Bugs.
* Hankerson, Darrel: Acknowledgements.
-* historical features <1>: Command Line Field Separator.
+* historical features <1>: Historical Features.
* historical features <2>: String Functions.
-* historical features <3>: Break Statement.
-* historical features <4>: Continue Statement.
-* historical features: Historical Features.
+* historical features <3>: Continue Statement.
+* historical features <4>: Break Statement.
+* historical features: Command Line Field Separator.
* history of awk: History.
* histsort.awk: History Sorting.
* how awk works: Two Rules.
@@ -17616,13 +17701,13 @@ Index
* id.awk: Id Program.
* if-else statement: If Statement.
* igawk.sh: Igawk Program.
-* IGNORECASE <1>: User-modified.
-* IGNORECASE <2>: Array Intro.
+* IGNORECASE <1>: Array Intro.
+* IGNORECASE <2>: User-modified.
* IGNORECASE: Case-sensitivity.
* IGNORECASE and array subscripts: Array Intro.
* ignoring case: Case-sensitivity.
-* implementation limits <1>: Getline Summary.
-* implementation limits: Redirection.
+* implementation limits <1>: Redirection.
+* implementation limits: Getline Summary.
* in operator: Typing and Comparison.
* increment operators: Increment Ops.
* index: String Functions.
@@ -17648,17 +17733,17 @@ Index
* inventory-shipped file: Sample Data Files.
* invocation of gawk: Invoking Gawk.
* ISO 8601: Time Functions.
-* ISO 8859-1 <1>: Case-sensitivity.
-* ISO 8859-1: Glossary.
+* ISO 8859-1 <1>: Glossary.
+* ISO 8859-1: Case-sensitivity.
* ISO Latin-1 <1>: Glossary.
* ISO Latin-1: Case-sensitivity.
-* Jaegermann, Michal <1>: Acknowledgements.
-* Jaegermann, Michal: Bugs.
+* Jaegermann, Michal <1>: Bugs.
+* Jaegermann, Michal: Acknowledgements.
* join: Join Function.
-* Kernighan, Brian <1>: Concatenation.
-* Kernighan, Brian <2>: Acknowledgements.
-* Kernighan, Brian <3>: Other Versions.
-* Kernighan, Brian <4>: BTL.
+* Kernighan, Brian <1>: Other Versions.
+* Kernighan, Brian <2>: BTL.
+* Kernighan, Brian <3>: Concatenation.
+* Kernighan, Brian <4>: Acknowledgements.
* Kernighan, Brian: History.
* known bugs: Known Bugs.
* labels.awk: Labels Program.
@@ -17671,12 +17756,12 @@ Index
* limitations <1>: Redirection.
* limitations: Getline Summary.
* line break: Statements/Lines.
-* line continuation <1>: Boolean Ops.
-* line continuation <2>: Print Examples.
-* line continuation <3>: Statements/Lines.
-* line continuation: Conditional Exp.
-* Linux <1>: Manual History.
-* Linux: Atari Compiling.
+* line continuation <1>: Conditional Exp.
+* line continuation <2>: Boolean Ops.
+* line continuation <3>: Print Examples.
+* line continuation: Statements/Lines.
+* Linux <1>: Atari Compiling.
+* Linux: Manual History.
* locale, definition of: Time Functions.
* log: Numeric Functions.
* logical false: Truth Values.
@@ -17695,10 +17780,10 @@ Index
* mawk: Other Versions.
* merging strings: Join Function.
* metacharacters: Regexp Operators.
-* mistakes, common <1>: Basic Field Splitting.
-* mistakes, common <2>: Typing and Comparison.
-* mistakes, common <3>: Computed Regexps.
-* mistakes, common: Print Examples.
+* mistakes, common <1>: Typing and Comparison.
+* mistakes, common <2>: Print Examples.
+* mistakes, common <3>: Basic Field Splitting.
+* mistakes, common: Computed Regexps.
* mktime: Mktime Function.
* modifiers (in format specifiers): Format Modifiers.
* multi-dimensional subscripts: Multi-dimensional.
@@ -17718,15 +17803,15 @@ Index
* next, inside a user-defined function: Next Statement.
* nextfile function: Nextfile Function.
* nextfile statement: Nextfile Statement.
-* NF <1>: Fields.
-* NF: Auto-set.
+* NF <1>: Auto-set.
+* NF: Fields.
* non-interactive buffering vs. interactive: I/O Functions.
* not operator: Boolean Ops.
* NR <1>: Auto-set.
* NR: Records.
-* null string <1>: Conversion.
-* null string <2>: Regexp Field Splitting.
-* null string: Truth Values.
+* null string <1>: Truth Values.
+* null string <2>: Conversion.
+* null string: Regexp Field Splitting.
* null string, as array subscript: Uninitialized Subscripts.
* number of fields, NF: Fields.
* number of records, NR, FNR: Records.
@@ -17739,10 +17824,10 @@ Index
* obsolete features: Obsolete.
* obsolete options: Obsolete.
* OFMT <1>: User-modified.
-* OFMT <2>: OFMT.
-* OFMT: Conversion.
-* OFS <1>: Output Separators.
-* OFS: User-modified.
+* OFMT <2>: Conversion.
+* OFMT: OFMT.
+* OFS <1>: User-modified.
+* OFS: Output Separators.
* old awk: History.
* old awk vs. new awk: Names.
* one-liners: One-liners.
@@ -17763,8 +17848,8 @@ Index
* or operator: Boolean Ops.
* ord: Ordinal Functions.
* order of evaluation: Calling Built-in.
-* ORS <1>: Output Separators.
-* ORS: User-modified.
+* ORS <1>: User-modified.
+* ORS: Output Separators.
* output: Printing.
* output field separator, OFS: Output Separators.
* output format specifier, OFMT: OFMT.
@@ -17788,33 +17873,30 @@ Index
* PERL: Future Extensions.
* pipeline, input: Getline/Pipe.
* pipes for output: Redirection.
-* portability issues <1>: Delete.
-* portability issues <2>: Statements/Lines.
-* portability issues <3>: String Functions.
-* portability issues <4>: Close Files And Pipes.
-* portability issues <5>: Definition Syntax.
-* portability issues <6>: I/O Functions.
-* portability issues <7>: Portability Notes.
-* portability issues: Escape Sequences.
+* portability issues <1>: Portability Notes.
+* portability issues <2>: Definition Syntax.
+* portability issues <3>: I/O Functions.
+* portability issues <4>: String Functions.
+* portability issues <5>: Delete.
+* portability issues <6>: Close Files And Pipes.
+* portability issues <7>: Escape Sequences.
+* portability issues: Statements/Lines.
* porting gawk: New Ports.
-* POSIX awk <1>: Assignment Ops.
-* POSIX awk <2>: Field Splitting Summary.
-* POSIX awk <3>: Format Modifiers.
-* POSIX awk <4>: String Functions.
-* POSIX awk <5>: OFMT.
-* POSIX awk <6>: Escape Sequences.
-* POSIX awk <7>: Definition Syntax.
-* POSIX awk <8>: Arithmetic Ops.
-* POSIX awk <9>: Precedence.
+* POSIX awk <1>: Definition Syntax.
+* POSIX awk <2>: String Functions.
+* POSIX awk <3>: User-modified.
+* POSIX awk <4>: Next Statement.
+* POSIX awk <5>: Continue Statement.
+* POSIX awk <6>: Break Statement.
+* POSIX awk <7>: Precedence.
+* POSIX awk <8>: Assignment Ops.
+* POSIX awk <9>: Arithmetic Ops.
* POSIX awk <10>: Conversion.
-* POSIX awk <11>: User-modified.
-* POSIX awk <12>: Next Statement.
-* POSIX awk <13>: Continue Statement.
-* POSIX awk <14>: Break Statement.
-* POSIX awk <15>: Regexp Operators.
-* POSIX awk <16>: String Functions.
-* POSIX awk <17>: Precedence.
-* POSIX awk: Regexp Operators.
+* POSIX awk <11>: Format Modifiers.
+* POSIX awk <12>: OFMT.
+* POSIX awk <13>: Field Splitting Summary.
+* POSIX awk <14>: Regexp Operators.
+* POSIX awk: Escape Sequences.
* POSIX mode: Options.
* POSIXLY_CORRECT environment variable: Options.
* precedence: Precedence.
@@ -17831,8 +17913,8 @@ Index
* program, awk: This Manual.
* program, definition of: Getting Started.
* program, self contained: Executable Scripts.
-* programs, documenting <1>: Comments.
-* programs, documenting: Library Names.
+* programs, documenting <1>: Library Names.
+* programs, documenting: Comments.
* pwcat program: Passwd Functions.
* pwcat.c: Passwd Functions.
* quotient: Arithmetic Ops.
@@ -17842,9 +17924,9 @@ Index
* rand: Numeric Functions.
* random numbers, seed of: Numeric Functions.
* range pattern: Ranges.
-* Rankin, Pat <1>: Acknowledgements.
-* Rankin, Pat <2>: Bugs.
-* Rankin, Pat: Assignment Ops.
+* Rankin, Pat <1>: Bugs.
+* Rankin, Pat <2>: Assignment Ops.
+* Rankin, Pat: Acknowledgements.
* reading files: Reading Files.
* reading files, getline command: Getline.
* reading files, multiple line records: Multiple Line.
@@ -17861,8 +17943,8 @@ Index
* regexp comparison vs. string comparison: Typing and Comparison.
* regexp constant: Regexp Usage.
* regexp constants, difference between slashes and quotes: Computed Regexps.
-* regexp match/non-match operators <1>: Regexp Usage.
-* regexp match/non-match operators: Typing and Comparison.
+* regexp match/non-match operators <1>: Typing and Comparison.
+* regexp match/non-match operators: Regexp Usage.
* regexp matching operators: Regexp Usage.
* regexp operators: Regexp Operators.
* regexp operators, GNU specific: GNU Regexp Operators.
@@ -17893,9 +17975,9 @@ Index
* RS: Records.
* RSTART <1>: String Functions.
* RSTART: Auto-set.
-* RT <1>: Records.
-* RT <2>: Auto-set.
-* RT: Multiple Line.
+* RT <1>: Auto-set.
+* RT <2>: Multiple Line.
+* RT: Records.
* rule, definition of: Getting Started.
* running awk programs: Running gawk.
* running long programs: Long.
@@ -17907,13 +17989,13 @@ Index
* scripts, shell: Executable Scripts.
* search path: AWKPATH Variable.
* search path, for source files: AWKPATH Variable.
-* sed utility <1>: Simple Sed.
-* sed utility <2>: Igawk Program.
+* sed utility <1>: Igawk Program.
+* sed utility <2>: Simple Sed.
* sed utility: Field Splitting Summary.
* seed for random numbers: Numeric Functions.
* self contained programs: Executable Scripts.
-* shell quoting <1>: Read Terminal.
-* shell quoting: Long.
+* shell quoting <1>: Long.
+* shell quoting: Read Terminal.
* shell scripts: Executable Scripts.
* short-circuit operators: Boolean Ops.
* side effect: Assignment Ops.
@@ -17948,8 +18030,8 @@ Index
* sub: String Functions.
* sub, third argument of: String Functions.
* subscripts in arrays: Multi-dimensional.
-* SUBSEP <1>: User-modified.
-* SUBSEP: Multi-dimensional.
+* SUBSEP <1>: Multi-dimensional.
+* SUBSEP: User-modified.
* substr: String Functions.
* subtraction: Arithmetic Ops.
* system: I/O Functions.
@@ -17996,244 +18078,244 @@ Index
* wordfreq.sh: Word Sorting.
* || operator: Boolean Ops.
* ~ operator <1>: Typing and Comparison.
-* ~ operator <2>: Regexp Usage.
-* ~ operator <3>: Case-sensitivity.
-* ~ operator <4>: Computed Regexps.
-* ~ operator: Regexp Constants.
+* ~ operator <2>: Regexp Constants.
+* ~ operator <3>: Computed Regexps.
+* ~ operator <4>: Case-sensitivity.
+* ~ operator: Regexp Usage.

Tag Table:
-Node: Top1230
-Node: Preface20719
-Node: History22069
-Node: Manual History23427
-Node: Acknowledgements26869
-Node: What Is Awk30496
-Node: This Manual32150
-Node: Conventions34849
-Node: Sample Data Files36141
-Node: Getting Started39224
-Node: Names41532
-Node: Running gawk43102
-Node: One-shot44263
-Node: Read Terminal45650
-Node: Long47262
-Node: Executable Scripts48655
-Node: Comments50910
-Node: Very Simple52070
-Node: Two Rules54117
-Node: More Complex56296
-Node: Statements/Lines59412
-Node: Other Features63685
-Node: When64411
-Node: One-liners66346
-Node: Regexp69233
-Node: Regexp Usage70559
-Node: Escape Sequences72709
-Node: Regexp Operators78161
-Node: GNU Regexp Operators89194
-Node: Case-sensitivity92898
-Node: Leftmost Longest96014
-Node: Computed Regexps97549
-Node: Reading Files100206
-Node: Records101974
-Node: Fields108469
-Node: Non-Constant Fields111538
-Node: Changing Fields113825
-Node: Field Separators118232
-Node: Basic Field Splitting118934
-Node: Regexp Field Splitting122163
-Node: Single Character Fields124730
-Node: Command Line Field Separator125799
-Node: Field Splitting Summary129040
-Node: Constant Size131059
-Node: Multiple Line135096
-Node: Getline140504
-Node: Getline Intro141578
-Node: Plain Getline142541
-Node: Getline/Variable144805
-Node: Getline/File145947
-Node: Getline/Variable/File147257
-Node: Getline/Pipe149231
-Node: Getline/Variable/Pipe151321
-Node: Getline Summary152439
-Node: Printing154033
-Node: Print155101
-Node: Print Examples157201
-Node: Output Separators159811
-Node: OFMT161709
-Node: Printf163111
-Node: Basic Printf164015
-Node: Control Letters165549
-Node: Format Modifiers168237
-Node: Printf Examples172386
-Node: Redirection175164
-Node: Special Files179803
-Node: Close Files And Pipes185040
-Node: Expressions189100
-Node: Constants191296
-Node: Scalar Constants191775
-Node: Regexp Constants192780
-Node: Using Constant Regexps193242
-Node: Variables196443
-Node: Using Variables197097
-Node: Assignment Options198532
-Node: Conversion200477
-Node: Arithmetic Ops203659
-Node: Concatenation205793
-Node: Assignment Ops207215
-Node: Increment Ops212811
-Node: Truth Values215339
-Node: Typing and Comparison216387
-Node: Boolean Ops222394
-Node: Conditional Exp226087
-Node: Function Calls227764
-Node: Precedence230644
-Node: Patterns and Actions234032
-Node: Pattern Overview234458
-Node: Kinds of Patterns235233
-Node: Regexp Patterns236370
-Node: Expression Patterns236924
-Node: Ranges240575
-Node: BEGIN/END243299
-Node: Using BEGIN/END243768
-Node: I/O And BEGIN/END246731
-Node: Empty248747
-Node: Action Overview249046
-Node: Statements251618
-Node: If Statement253324
-Node: While Statement254827
-Node: Do Statement256857
-Node: For Statement257959
-Node: Break Statement261216
-Node: Continue Statement263487
-Node: Next Statement265483
-Node: Nextfile Statement267980
-Node: Exit Statement269894
-Node: Built-in Variables271904
-Node: User-modified273000
-Node: Auto-set277922
-Node: ARGC and ARGV284452
-Node: Arrays287798
-Node: Array Intro289261
-Node: Reference to Elements293301
-Node: Assigning Elements295251
-Node: Array Example295753
-Node: Scanning an Array297472
-Node: Delete299802
-Node: Numeric Array Subscripts301861
-Node: Uninitialized Subscripts303767
-Node: Multi-dimensional305411
-Node: Multi-scanning308506
-Node: Built-in310149
-Node: Calling Built-in311138
-Node: Numeric Functions313109
-Node: String Functions316928
-Node: I/O Functions335860
-Node: Time Functions341445
-Node: User-defined350298
-Node: Definition Syntax351011
-Node: Function Example355260
-Node: Function Caveats357589
-Node: Return Statement361459
-Node: Invoking Gawk364114
-Node: Options365349
-Node: Other Arguments374179
-Node: AWKPATH Variable376827
-Node: Obsolete379576
-Node: Undocumented380242
-Node: Known Bugs380491
-Node: Library Functions381623
-Node: Portability Notes384041
-Node: Nextfile Function385325
-Node: Assert Function390201
-Node: Round Function393540
-Node: Ordinal Functions395184
-Node: Join Function398636
-Node: Mktime Function400688
-Node: Gettimeofday Function412261
-Node: Filetrans Function416273
-Node: Getopt Function419950
-Node: Passwd Functions431306
-Node: Group Functions439639
-Node: Library Names447536
-Node: Sample Programs451461
-Node: Clones451952
-Node: Cut Program453046
-Node: Egrep Program463075
-Node: Id Program470738
-Node: Split Program474009
-Node: Tee Program477377
-Node: Uniq Program480173
-Node: Wc Program487718
-Node: Miscellaneous Programs492136
-Node: Dupword Program493046
-Node: Alarm Program494717
-Node: Translate Program499261
-Node: Labels Program504073
-Node: Word Sorting507617
-Node: History Sorting511962
-Node: Extract Program513931
-Node: Simple Sed520889
-Node: Igawk Program524233
-Node: Language History537554
-Node: V7/SVR3.1538787
-Node: SVR4541442
-Node: POSIX542964
-Node: BTL544584
-Node: POSIX/GNU545347
-Node: Gawk Summary549779
-Node: Command Line Summary550601
-Node: Language Summary553577
-Node: Variables/Fields555958
-Node: Fields Summary556692
-Node: Built-in Summary558478
-Node: Arrays Summary562193
-Node: Data Type Summary563486
-Node: Rules Summary565312
-Node: Pattern Summary566840
-Node: Regexp Summary569025
-Node: Actions Summary572408
-Node: Operator Summary574240
-Node: Control Flow Summary575467
-Node: I/O Summary576024
-Node: Printf Summary579013
-Node: Special File Summary582351
-Node: Built-in Functions Summary584029
-Node: Time Functions Summary588029
-Node: String Constants Summary588920
-Node: Functions Summary590240
-Node: Historical Features591301
-Node: Installation592799
-Node: Gawk Distribution594014
-Node: Getting594517
-Node: Extracting597463
-Node: Distribution contents598850
-Node: Unix Installation603626
-Node: Quick Installation604135
-Node: Configuration Philosophy605653
-Node: VMS Installation608055
-Node: VMS Compilation608594
-Node: VMS Installation Details610198
-Node: VMS Running611840
-Node: VMS POSIX613430
-Node: PC Installation614710
-Node: Atari Installation618113
-Node: Atari Compiling619297
-Node: Atari Using621206
-Node: Amiga Installation624053
-Node: Bugs625164
-Node: Other Versions628240
-Node: Notes629814
-Node: Compatibility Mode630421
-Node: Additions631264
-Node: Adding Code631962
-Node: New Ports637302
-Node: Future Extensions641470
-Node: Improvements643718
-Node: Glossary645586
-Node: Copying662651
-Node: Index681843
+Node: Top1238
+Node: Preface20727
+Node: History22076
+Node: Manual History23434
+Node: Acknowledgements26876
+Node: What Is Awk30503
+Node: This Manual32157
+Node: Conventions34856
+Node: Sample Data Files36148
+Node: Getting Started39231
+Node: Names41539
+Node: Running gawk43108
+Node: One-shot44269
+Node: Read Terminal45656
+Node: Long47268
+Node: Executable Scripts48661
+Node: Comments51227
+Node: Very Simple53009
+Node: Two Rules55056
+Node: More Complex57235
+Node: Statements/Lines60351
+Node: Other Features64624
+Node: When65350
+Node: One-liners67285
+Node: Regexp70172
+Node: Regexp Usage71498
+Node: Escape Sequences73648
+Node: Regexp Operators79102
+Node: GNU Regexp Operators90135
+Node: Case-sensitivity93840
+Node: Leftmost Longest96956
+Node: Computed Regexps98491
+Node: Reading Files101148
+Node: Records102916
+Node: Fields109411
+Node: Non-Constant Fields112479
+Node: Changing Fields114766
+Node: Field Separators119174
+Node: Basic Field Splitting119876
+Node: Regexp Field Splitting123105
+Node: Single Character Fields125672
+Node: Command Line Field Separator126741
+Node: Field Splitting Summary129982
+Node: Constant Size132002
+Node: Multiple Line136039
+Node: Getline141447
+Node: Getline Intro142521
+Node: Plain Getline143484
+Node: Getline/Variable145748
+Node: Getline/File146890
+Node: Getline/Variable/File148200
+Node: Getline/Pipe150174
+Node: Getline/Variable/Pipe152382
+Node: Getline Summary153618
+Node: Printing155212
+Node: Print156280
+Node: Print Examples158381
+Node: Output Separators160989
+Node: OFMT162887
+Node: Printf164289
+Node: Basic Printf165193
+Node: Control Letters166727
+Node: Format Modifiers169415
+Node: Printf Examples173564
+Node: Redirection176343
+Node: Special Files180982
+Node: Close Files And Pipes186219
+Node: Expressions190280
+Node: Constants192476
+Node: Scalar Constants192955
+Node: Regexp Constants193959
+Node: Using Constant Regexps194421
+Node: Variables197622
+Node: Using Variables198276
+Node: Assignment Options199711
+Node: Conversion201656
+Node: Arithmetic Ops204838
+Node: Concatenation206972
+Node: Assignment Ops208394
+Node: Increment Ops213990
+Node: Truth Values216518
+Node: Typing and Comparison217566
+Node: Boolean Ops223573
+Node: Conditional Exp227266
+Node: Function Calls229043
+Node: Precedence231923
+Node: Patterns and Actions235311
+Node: Pattern Overview235737
+Node: Kinds of Patterns236512
+Node: Regexp Patterns237649
+Node: Expression Patterns238203
+Node: Ranges241855
+Node: BEGIN/END244579
+Node: Using BEGIN/END245048
+Node: I/O And BEGIN/END248011
+Node: Empty250027
+Node: Action Overview250326
+Node: Statements252898
+Node: If Statement254604
+Node: While Statement256107
+Node: Do Statement258138
+Node: For Statement259240
+Node: Break Statement262497
+Node: Continue Statement264768
+Node: Next Statement266764
+Node: Nextfile Statement269261
+Node: Exit Statement271175
+Node: Built-in Variables273186
+Node: User-modified274282
+Node: Auto-set279203
+Node: ARGC and ARGV285732
+Node: Arrays289571
+Node: Array Intro291034
+Node: Reference to Elements295074
+Node: Assigning Elements297024
+Node: Array Example297526
+Node: Scanning an Array299245
+Node: Delete301575
+Node: Numeric Array Subscripts303829
+Node: Uninitialized Subscripts305735
+Node: Multi-dimensional307379
+Node: Multi-scanning310474
+Node: Built-in312117
+Node: Calling Built-in313106
+Node: Numeric Functions315077
+Node: String Functions318895
+Node: I/O Functions338236
+Node: Time Functions344046
+Node: User-defined352896
+Node: Definition Syntax353609
+Node: Function Example357858
+Node: Function Caveats360188
+Node: Return Statement364059
+Node: Invoking Gawk366714
+Node: Options367949
+Node: Other Arguments376778
+Node: AWKPATH Variable379426
+Node: Obsolete382174
+Node: Undocumented382840
+Node: Known Bugs383089
+Node: Library Functions384227
+Node: Portability Notes386646
+Node: Nextfile Function387930
+Node: Assert Function392798
+Node: Round Function396150
+Node: Ordinal Functions397788
+Node: Join Function401232
+Node: Mktime Function403277
+Node: Gettimeofday Function414844
+Node: Filetrans Function418849
+Node: Getopt Function422512
+Node: Passwd Functions433861
+Node: Group Functions442182
+Node: Library Names450066
+Node: Sample Programs453991
+Node: Clones454482
+Node: Cut Program455576
+Node: Egrep Program465598
+Node: Id Program473254
+Node: Split Program476518
+Node: Tee Program479879
+Node: Uniq Program482668
+Node: Wc Program490206
+Node: Miscellaneous Programs494616
+Node: Dupword Program495526
+Node: Alarm Program497190
+Node: Translate Program501728
+Node: Labels Program506531
+Node: Word Sorting510067
+Node: History Sorting514412
+Node: Extract Program516374
+Node: Simple Sed523969
+Node: Igawk Program527306
+Node: Language History540619
+Node: V7/SVR3.1541852
+Node: SVR4544507
+Node: POSIX546029
+Node: BTL547649
+Node: POSIX/GNU548412
+Node: Gawk Summary552844
+Node: Command Line Summary553666
+Node: Language Summary556642
+Node: Variables/Fields559022
+Node: Fields Summary559756
+Node: Built-in Summary561542
+Node: Arrays Summary565257
+Node: Data Type Summary566550
+Node: Rules Summary568376
+Node: Pattern Summary569904
+Node: Regexp Summary572089
+Node: Actions Summary575472
+Node: Operator Summary577304
+Node: Control Flow Summary578531
+Node: I/O Summary579088
+Node: Printf Summary582077
+Node: Special File Summary585415
+Node: Built-in Functions Summary587093
+Node: Time Functions Summary591093
+Node: String Constants Summary591984
+Node: Functions Summary593304
+Node: Historical Features594365
+Node: Installation595863
+Node: Gawk Distribution597078
+Node: Getting597581
+Node: Extracting600532
+Node: Distribution contents601919
+Node: Unix Installation606695
+Node: Quick Installation607204
+Node: Configuration Philosophy608722
+Node: VMS Installation611124
+Node: VMS Compilation611663
+Node: VMS Installation Details613267
+Node: VMS Running614909
+Node: VMS POSIX616499
+Node: PC Installation617779
+Node: Atari Installation621182
+Node: Atari Compiling622366
+Node: Atari Using624275
+Node: Amiga Installation627122
+Node: Bugs628233
+Node: Other Versions631286
+Node: Notes632972
+Node: Compatibility Mode633579
+Node: Additions634422
+Node: Adding Code635120
+Node: New Ports640450
+Node: Future Extensions644610
+Node: Improvements646553
+Node: Glossary648421
+Node: Copying665492
+Node: Index684684

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 8c2aad2f..3e8e102f 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -21,10 +21,10 @@
@c applies to, and when the document was updated.
@set TITLE Effective AWK Programming
@set SUBTITLE A User's Guide for GNU Awk
-@set PATCHLEVEL 3
+@set PATCHLEVEL 4
@set EDITION 1.0.@value{PATCHLEVEL}
@set VERSION 3.0
-@set UPDATE-MONTH February 1997
+@set UPDATE-MONTH April, 1999
@iftex
@set DOCUMENT book
@end iftex
@@ -74,7 +74,7 @@ particular records in a file and perform operations upon them.
This is Edition @value{EDITION} of @cite{@value{TITLE}},
for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK.
-Copyright (C) 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc.
+Copyright (C) 1989, 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -138,7 +138,7 @@ Corporation. @*
Registered Trademark of Paramount Pictures Corporation. @*
@c sorry, i couldn't resist
@sp 3
-Copyright @copyright{} 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc.
+Copyright @copyright{} 1989, 1991, 92, 93, 96, 97, 98, 99 Free Software Foundation, Inc.
@sp 2
This is Edition @value{EDITION} of @cite{@value{TITLE}}, @*
@@ -153,16 +153,16 @@ for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU impleme
@item Seattle, WA 98155 USA @tab Boston, MA 02111-1307 USA
@item Phone: +1-206-782-7733 @tab Phone: +1-617-542-5942
@item Fax: +1-206-782-7191 @tab Fax: +1-617-542-2652
-@item E-mail: @code{sales@@ssc.com} @tab E-mail: @code{gnu@@prep.ai.mit.edu}
+@item E-mail: @code{sales@@ssc.com} @tab E-mail: @code{gnu@@gnu.org}
@item URL: @code{http://www.ssc.com/} @tab URL: @code{http://www.fsf.org/}
@end multitable
@sp 1
@c this ISBN can change! Check with SSC
@c This one is correct for gawk 3.0 and edition 1.0 from the FSF
-@c ISBN 1-882114-26-4 @*
+ISBN 1-882114-26-4 @*
@c This one is correct for gawk 3.0.3 and edition 1.0.3 from SSC
-ISBN 1-57831-000-8 @*
+@c ISBN 1-57831-000-8 @*
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -1387,6 +1387,12 @@ Self-contained @code{awk} scripts are useful when you want to write a
program which users can invoke without their having to know that the program is
written in @code{awk}.
+@strong{Caution:} You should not put more than one argument on the @samp{#!}
+line after the path to @code{awk}. This will not work. The operating system
+treats the rest of the line as a single agument, and passes it to @code{awk}.
+Doing this will lead to confusing behavior: most likely a usage diagnostic
+of some sort from @code{awk}.
+
@cindex shell scripts
@cindex scripts, shell
Some older systems do not support the @samp{#!} mechanism. You can get a
@@ -1441,6 +1447,21 @@ programs also, but this usually isn't very useful; the purpose of a
comment is to help you or another person understand the program at
a later time.
+@strong{Caution:} As mentioned in
+@ref{One-shot, ,One-shot Throw-away @code{awk} Programs},
+you can enclose small to medium programs in single quotes, in order to keep
+your shell scripts self-contained. When doing so, @emph{don't} put
+an apostrophe (i.e., a single quote) into a comment (or anywhere else
+in your program). The shell will interpret the quote as the closing
+quote for the entire program. As a result, usually the shell will
+print a message about mismatched quotes, and if @code{awk} actually
+runs, it will probably print strange messages about syntax errors.
+For example:
+
+@example
+awk 'BEGIN @{ print "hello" @} # let's be cute'
+@end example
+
@node Very Simple, Two Rules, Running gawk, Getting Started
@section A Very Simple Example
@@ -2142,7 +2163,7 @@ listed in the table above.
Another interesting question arises. Suppose you use an octal or hexadecimal
escape to represent a regexp metacharacter
(@pxref{Regexp Operators, , Regular Expression Operators}).
-Does @code{awk} treat the character as literal character, or as a regexp
+Does @code{awk} treat the character as a literal character, or as a regexp
operator?
@cindex dark corner
@@ -4450,6 +4471,8 @@ According to POSIX, @samp{@var{expression} | getline} is ambiguous if
because the concatenation operator is not parenthesized, and you should
write it as @samp{("echo " "date") | getline} if you want your program
to be portable to other @code{awk} implementations.
+(It happens that @code{gawk} gets it right, but you should not
+rely on this. Parentheses make it easier to read, anyway.)
@node Getline/Variable/Pipe, Getline Summary, Getline/Pipe, Getline
@subsection Using @code{getline} Into a Variable from a Pipe
@@ -4482,6 +4505,8 @@ According to POSIX, @samp{@var{expression} | getline @var{var}} is ambiguous if
because the concatenation operator is not parenthesized, and you should
write it as @samp{("echo " "date") | getline @var{var}} if you want your
program to be portable to other @code{awk} implementations.
+(It happens that @code{gawk} gets it right, but you should not
+rely on this. Parentheses make it easier to read, anyway.)
@end ifinfo
@node Getline Summary, , Getline/Variable/Pipe, Getline
@@ -4616,7 +4641,7 @@ single @code{print} can make any number of lines this way.
Here is an example of printing a string that contains embedded newlines
(the @samp{\n} is an escape sequence, used to represent the newline
-character; see @ref{Escape Sequences}):
+character; @pxref{Escape Sequences}):
@example
@group
@@ -6975,6 +7000,8 @@ by putting a newline after either character.
However, you cannot put a newline in front
of either character without using backslash continuation
(@pxref{Statements/Lines, ,@code{awk} Statements Versus Lines}).
+If @samp{--posix} is specified
+(@pxref{Options, , Command Line Options}), then this extension is disabled.
@node Function Calls, Precedence, Conditional Exp, Expressions
@section Function Calls
@@ -8264,7 +8291,7 @@ example:
@example
@group
BEGIN @{
- if (("date" | getline date_now) < 0) @{
+ if (("date" | getline date_now) <= 0) @{
print "Can't get system date" > "/dev/stderr"
exit 1
@}
@@ -8627,9 +8654,27 @@ contains @code{"inventory-shipped"}, and @code{ARGV[2]} contains
Notice that the @code{awk} program is not entered in @code{ARGV}. The
other special command line options, with their arguments, are also not
-entered. But variable assignments on the command line @emph{are}
+entered. This includes variable assignments done with the @samp{-v}
+option (@pxref{Options, ,Command Line Options}).
+Normal variable assignments on the command line @emph{are}
treated as arguments, and do show up in the @code{ARGV} array.
+@example
+$ cat showargs.awk
+@print{} BEGIN @{
+@print{} printf "A=%d, B=%d\n", A, B
+@print{} for (i = 0; i < ARGC; i++)
+@print{} printf "\tARGV[%d] = %s\n", i, ARGV[i]
+@print{} @}
+@print{} END @{ printf "A=%d, B=%d\n", A, B @}
+$ awk -v A=1 -f showargs.awk B=2 /dev/null
+@print{} A=1, B=0
+@print{} ARGV[0] = awk
+@print{} ARGV[1] = B=2
+@print{} ARGV[2] = /dev/null
+@print{} A=1, B=2
+@end example
+
Your program can alter @code{ARGC} and the elements of @code{ARGV}.
Each time @code{awk} reaches the end of an input file, it uses the next
element of @code{ARGV} as the name of the next input file. By storing a
@@ -9172,6 +9217,14 @@ clears out the target array first. This call asks it to split
apart the null string. Since there is no data to split out, the
function simply clears the array and then returns.
+@strong{Caution:} Deleting an array does not change its type; you cannot
+delete an array and then use the array's name as a scalar. For
+example, this will not work:
+
+@example
+a[1] = 3; delete a; a = 3
+@end example
+
@node Numeric Array Subscripts, Uninitialized Subscripts, Delete, Arrays
@section Using Numbers to Subscript Arrays
@@ -9785,6 +9838,10 @@ string (d.c.). The POSIX standard allows this as well.
Before splitting the string, @code{split} deletes any previously existing
elements in the array @var{array} (d.c.).
+If @var{string} does not match @var{fieldsep} at all, @var{array} will have
+one element. The value of that element will be the original
+@var{string}.
+
@item sprintf(@var{format}, @var{expression1},@dots{})
@findex sprintf
This returns (without printing) the string that @code{printf} would
@@ -9901,6 +9958,9 @@ such as in the above example. However, using any other non-changeable
object as the third parameter will cause a fatal error, and your program
will not run.
+Finally, if the @var{regexp} is not a regexp constant, it is converted into a
+string and then the value of that string is treated as the regexp to match.
+
@item gsub(@var{regexp}, @var{replacement} @r{[}, @var{target}@r{]})
@findex gsub
This is similar to the @code{sub} function, except @code{gsub} replaces
@@ -9980,6 +10040,9 @@ If the @var{how} argument is a string that does not begin with @samp{g} or
@samp{G}, or if it is a number that is less than zero, only one
substitution is performed.
+If @var{regexp} does not match @var{target}, @code{gensub}'s return value
+is the original, unchanged value of @var{target}.
+
@cindex differences between @code{gawk} and @code{awk}
@code{gensub} is a @code{gawk} extension; it is not available
in compatibility mode (@pxref{Options, ,Command Line Options}).
@@ -10310,7 +10373,7 @@ and nonzero otherwise.
@item system(@var{command})
@findex system
@cindex interaction, @code{awk} and other programs
-The system function allows the user to execute operating system commands
+The @code{system} function allows the user to execute operating system commands
and then return to the @code{awk} program. The @code{system} function
executes the command given by the string @var{command}. It returns, as
its value, the status returned by the command that was executed.
@@ -10329,7 +10392,17 @@ the system administrator will be sent mail when the @code{awk} program
finishes processing input and begins its end-of-input processing.
Note that redirecting @code{print} or @code{printf} into a pipe is often
-enough to accomplish your task. However, if your @code{awk}
+enough to accomplish your task. If you need to run many commands, it
+will be more efficient to simply print them to a pipe to the shell:
+
+@example
+while (@var{more stuff to do})
+ print @var{command} | "/bin/sh"
+close("/bin/sh")
+@end example
+
+@noindent
+However, if your @code{awk}
program is interactive, @code{system} is useful for cranking up large
self-contained programs, such as a shell or an editor.
@@ -11889,7 +11962,7 @@ Here is a second version of @code{nextfile} that remedies this problem.
@c file eg/lib/nextfile.awk
# nextfile --- skip remaining records in current file
# correctly handle successive occurrences of the same file
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May, 1993
# this should be read in before the "main" awk program
@@ -11983,7 +12056,7 @@ that is being tested.
@c @group
@c file eg/lib/assert.awk
# assert --- assert that a condition is true. Otherwise exit.
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May, 1993
function assert(condition, string)
@@ -12038,7 +12111,8 @@ mydata:1357: assertion failed: a <= 5 && b >= 17
@end example
There is a problem with this version of @code{assert}, that it may not
-be possible to work around. An @code{END} rule is automatically added
+be possible to work around with standard @code{awk}.
+An @code{END} rule is automatically added
to the program calling @code{assert}. Normally, if a program consists
of just a @code{BEGIN} rule, the input files and/or standard input are
not read. However, now that the program has an @code{END} rule, @code{awk}
@@ -12069,7 +12143,7 @@ it might be useful if your awk's @code{printf} does unbiased rounding.
@c file eg/lib/round.awk
# round --- do normal rounding
#
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, August, 1996
+# Arnold Robbins, arnold@@gnu.org, August, 1996
# Public Domain
function round(x, ival, aval, fraction)
@@ -12130,7 +12204,7 @@ reason to build them into the @code{awk} interpreter.
# _ord_init: function to initialize _ord_
#
# Arnold Robbins
-# arnold@@gnu.ai.mit.edu
+# arnold@@gnu.org
# Public Domain
# 16 January, 1992
# 20 July, 1992, revised
@@ -12254,7 +12328,7 @@ assumption since the array was likely created with @code{split}
@group
@c file eg/lib/join.awk
# join.awk --- join an array into a string
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
function join(array, start, end, sep, result, i)
@@ -12329,7 +12403,7 @@ assignment.
@c file eg/lib/mktime.awk
# mktime.awk --- convert a canonical date representation
# into a timestamp
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
BEGIN \
@@ -12624,7 +12698,7 @@ time formatted in the same way as the @code{date} utility.
@c @group
@c file eg/lib/gettime.awk
# gettimeofday --- get the time of day in a usable format
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain, May 1993
+# Arnold Robbins, arnold@@gnu.org, Public Domain, May 1993
#
# Returns a string in the format of output of date(1)
# Populates the array argument time with individual values:
@@ -12732,7 +12806,7 @@ Besides solving the problem in only nine(!) lines of code, it does so
# that each take the name of the file being started or
# finished, respectively.
#
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, January 1992
+# Arnold Robbins, arnold@@gnu.org, January 1992
# Public Domain
FILENAME != _oldfilename \
@@ -12784,7 +12858,7 @@ This version solves the problem.
#
# user supplies beginfile() and endfile() functions
#
-# Arnold Robbins, arnold@@gnu.ai.mit.edu. November 1992
+# Arnold Robbins, arnold@@gnu.org, November 1992
# Public Domain
FNR == 1 @{
@@ -12929,7 +13003,7 @@ The discussion walks through the code a bit at a time.
@c file eg/lib/getopt.awk
# getopt --- do C library getopt(3) function in awk
#
-# arnold@@gnu.ai.mit.edu
+# arnold@@gnu.org
# Public domain
#
# Initial version: March, 1991
@@ -13206,7 +13280,7 @@ Here is @code{pwcat}, a C program that ``cats'' the password database.
* Generate a printable version of the password database
*
* Arnold Robbins
- * arnold@@gnu.ai.mit.edu
+ * arnold@@gnu.org
* May 1993
* Public Domain
*/
@@ -13289,7 +13363,7 @@ functions of the same name.
@c file eg/lib/passwdawk.in
@group
# passwd.awk --- access password file information
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
BEGIN @{
@@ -13477,7 +13551,7 @@ Here is @code{grcat}, a C program that ``cats'' the group database.
*
* Generate a printable version of the group database
*
- * Arnold Robbins, arnold@@gnu.ai.mit.edu
+ * Arnold Robbins, arnold@@gnu.org
* May 1993
* Public Domain
*/
@@ -13558,7 +13632,7 @@ There are several, modeled after the C library functions of the same names.
@group
@c file eg/lib/groupawk.in
# group.awk --- functions for dealing with the group file
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
BEGIN \
@@ -13725,7 +13799,7 @@ user name, and returns the list of groups that have the user as a member.
function getgrent()
@{
_gr_init()
- if (++gr_count in _gr_bycount)
+ if (++_gr_count in _gr_bycount)
return _gr_bycount[_gr_count]
return ""
@}
@@ -13947,7 +14021,7 @@ if invalid arguments are supplied.
@c @group
@c file eg/prog/cut.awk
# cut.awk --- implement cut in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# Options:
@@ -14275,7 +14349,7 @@ that processes the command line arguments with @code{getopt}. The @samp{-i}
@c @group
@c file eg/prog/egrep.awk
# egrep.awk --- simulate egrep in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# Options:
@@ -14558,7 +14632,7 @@ numbers.
@c @group
@c file eg/prog/id.awk
# id.awk --- implement id in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# output is:
@@ -14670,7 +14744,7 @@ is used as the prefix for the output file names.
@c @group
@c file eg/prog/split.awk
# split.awk --- do split in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# usage: split [-num] [file] [outname]
@@ -14798,7 +14872,7 @@ Finally, @code{awk} is forced to read the standard input by setting
@group
@c file eg/prog/tee.awk
# tee.awk --- tee in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# Revised December 1995
@end group
@@ -14961,7 +15035,7 @@ standard output, @file{/dev/stdout}.
@c @group
@c file eg/prog/uniq.awk
# uniq.awk --- do uniq in awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
@group
@@ -15197,7 +15271,7 @@ be true if more than one file was named on the command line.
@c @group
@c file eg/prog/wc.awk
# wc.awk --- count lines, words, characters
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# Options:
@@ -15354,7 +15428,7 @@ unusual.
@group
@c file eg/prog/dupword.awk
# dupword --- find duplicate words in text
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# December 1991
@{
@@ -15398,7 +15472,7 @@ to itself, in case the user is not looking at their computer or terminal.)
@c @group
@c file eg/prog/alarm.awk
# alarm --- set an alarm
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# usage: alarm time [ "message" [ count [ delay ] ] ]
@@ -15585,7 +15659,7 @@ Finally, the processing rule simply calls @code{translate} for each record.
@c @group
@c file eg/prog/translate.awk
# translate --- do tr like stuff
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# August 1989
# bugs: does not handle things like: tr A-Z a-z, it has
@@ -15703,7 +15777,7 @@ not have been an even multiple of 20 labels in the data.
@c @group
@c file eg/prog/labels.awk
# labels.awk
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# June 1992
# Program to print labels. Each label is 5 lines of data
@@ -15919,7 +15993,7 @@ The @code{END} rule simply prints out the lines, in order.
@group
@c file eg/prog/histsort.awk
# histsort.awk --- compact a shell history file
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
# Thanks to Byron Rakitzis for the general idea
@@ -16016,6 +16090,28 @@ and @samp{endfile} lines. The @code{gawk} distribution uses a copy of
@file{extract.awk} to extract the sample
programs and install many of them in a standard directory, where
@code{gawk} can find them.
+The Texinfo file looks something like this:
+
+@example
+@dots{}
+This program has a @@code@{BEGIN@} block,
+which prints a nice message:
+
+@@example
+@@c file examples/messages.awk
+BEGIN @@@{ print "Don't panic!" @@@}
+@@c end file
+@@end example
+
+It also prints some final advice:
+
+@@example
+@@c file examples/messages.awk
+END @@@{ print "Always avoid bored archeologists!" @@@}
+@@c end file
+@@end example
+@dots{}
+@end example
@file{extract.awk} begins by setting @code{IGNORECASE} to one, so that
mixed upper-case and lower-case letters in the directives won't matter.
@@ -16030,7 +16126,7 @@ exited with a zero exit status, signifying OK.
@c file eg/prog/extract.awk
# extract.awk --- extract files and run programs
# from texinfo files
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# May 1993
BEGIN @{ IGNORECASE = 1 @}
@@ -16080,6 +16176,9 @@ function. If the line is an ``endfile'' line, then it breaks out of
the loop.
If the line is an @samp{@@group} or @samp{@@end group} line, then it
ignores it, and goes on to the next line.
+(These Texinfo control lines keep blocks of code together on one page;
+unfortunately, @TeX{} isn't always smart enough to do things exactly right,
+and we have to give it some advice.)
Most of the work is in the following few lines. If the line has no @samp{@@}
symbols, it can be printed directly. Otherwise, each leading @samp{@@} must be
@@ -16213,7 +16312,7 @@ are provided, the standard input is used.
# awksed.awk --- do s/foo/bar/g using just print
# Thanks to Michael Brennan for the idea
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# August 1995
@group
@@ -16447,7 +16546,7 @@ Here's the program:
#! /bin/sh
# igawk --- like gawk but do @@include processing
-# Arnold Robbins, arnold@@gnu.ai.mit.edu, Public Domain
+# Arnold Robbins, arnold@@gnu.org, Public Domain
# July 1993
if [ "$1" = debug ]
@@ -18493,7 +18592,7 @@ Free Software Foundation @*
Boston, MA 02111-1307 USA @*
Phone: +1-617-542-5942 @*
Fax (including Japan): +1-617-542-2652 @*
-E-mail: @code{gnu@@prep.ai.mit.edu} @*
+E-mail: @code{gnu@@gnu.org} @*
@end quotation
@noindent
@@ -18502,7 +18601,7 @@ and to the production of more free software.
@item
You can get @code{gawk} by using anonymous @code{ftp} to the Internet host
-@code{ftp.gnu.ai.mit.edu}, in the directory @file{/pub/gnu}.
+@code{gnudist.gnu.org}, in the directory @file{/gnu/gawk}.
Here is a list of alternate @code{ftp} sites from which you can obtain GNU
software. When a site is listed as ``@var{site}@code{:}@var{directory}'' the
@@ -19318,17 +19417,17 @@ can send mail to.
@table @asis
@item Internet:
-@samp{bug-gnu-utils@@prep.ai.mit.edu}
+@samp{bug-gnu-utils@@gnu.org}
@item UUCP:
-@samp{uunet!prep.ai.mit.edu!bug-gnu-utils}
+@samp{uunet!gnu.org!bug-gnu-utils}
@end table
Please include the
version number of @code{gawk} you are using. You can get this information
with the command @samp{gawk --version}.
You should send a carbon copy of your mail to Arnold Robbins, who can
-be reached at @samp{arnold@@gnu.ai.mit.edu}.
+be reached at @samp{arnold@@gnu.org}.
@cindex @code{comp.lang.awk}
@strong{Important!} Do @emph{not} try to report bugs in @code{gawk} by
@@ -19408,13 +19507,15 @@ This section briefly describes where to get them.
@item Unix @code{awk}
Brian Kernighan has been able to make his implementation of
@code{awk} freely available. You can get it via anonymous @code{ftp}
-to the host @code{@w{netlib.att.com}}. Change directory to
+to the host @code{@w{netlib.bell-labs.com}}. Change directory to
@file{/netlib/research}. Use ``binary'' or ``image'' mode, and
-retrieve @file{awk.bundle.Z}.
+retrieve @file{awk.bundle.gz}.
+
+This is a shell archive that has been compressed with the GNU @code{gzip}
+utility. It can be uncompressed with the @code{gunzip} utility.
-This is a shell archive that has been compressed with the @code{compress}
-utility. It can be uncompressed with either @code{uncompress} or the
-GNU @code{gunzip} utility.
+You can also retrieve this version via the World Wide Web from
+@uref{http://cm.bell-labs.com/who/bwk, Brian Kernighan's home page}.
This version requires an ANSI C compiler; GCC (the GNU C compiler)
works quite nicely.
@@ -19496,7 +19597,7 @@ and any considerations you should bear in mind.
You are free to add any new features you like to @code{gawk}.
However, if you want your changes to be incorporated into the @code{gawk}
distribution, there are several steps that you need to take in order to
-make it possible for me to include to your changes.
+make it possible for me to include your changes.
@enumerate 1
@item
@@ -19598,7 +19699,7 @@ effect, or assign the copyright in your changes to the FSF.
Both of these actions are easy to do, and @emph{many} people have done so
already. If you have questions, please contact me
(@pxref{Bugs, , Reporting Problems and Bugs}),
-or @code{gnu@@prep.ai.mit.edu}.
+or @code{gnu@@gnu.org}.
@item
Update the documentation.
@@ -19718,7 +19819,7 @@ effect, or assign the copyright in your code to the FSF.
@ifinfo
Both of these actions are easy to do, and @emph{many} people have done so
already. If you have questions, please contact me, or
-@code{gnu@@prep.ai.mit.edu}.
+@code{gnu@@gnu.org}.
@end ifinfo
@end enumerate
@@ -19855,11 +19956,6 @@ important regexp matching issues.
The GNU version of @code{malloc} could potentially speed up @code{gawk},
since it relies heavily on the use of dynamic memory allocation.
-@item Use of the @code{rx} regexp library
-The @code{rx} regular expression library could potentially speed up
-all regexp operations that require knowing the exact location of matches.
-This includes record termination, field and array splitting,
-and the @code{sub}, @code{gsub}, @code{gensub} and @code{match} functions.
@end table
@node Improvements, , Future Extensions, Notes
@@ -20006,7 +20102,7 @@ countries use an extension of ASCII known as ISO-8859-1 (ISO Latin-1).
A preprocessor for @code{pic} that reads descriptions of molecules
and produces @code{pic} input for drawing them. It was written in @code{awk}
by Brian Kernighan and Jon Bentley, and is available from
-@code{@w{netlib@@research.att.com}}.
+@email{@w{netlib@@research.bell-labs.com}}.
@item Compound Statement
A series of @code{awk} statements, enclosed in curly braces. Compound
diff --git a/doc/igawk.1 b/doc/igawk.1
index b3e19c20..30ca853c 100644
--- a/doc/igawk.1
+++ b/doc/igawk.1
@@ -70,4 +70,4 @@ igawk \-f test.awk
Edition 1.0, published by the Free Software Foundation, 1995.
.SH AUTHOR
Arnold Robbins
-.RB ( arnold@gnu.ai.mit.edu ).
+.RB ( arnold@gnu.org ).
diff --git a/doc/no.colors b/doc/no.colors
index 4e0d0c62..974f985b 100644
--- a/doc/no.colors
+++ b/doc/no.colors
@@ -1,4 +1,4 @@
-.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu
+.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org
.\" This file is for troff which does not know what to do
.\" with a literal Poscript and cannot use macros from 'colors'.
.\"
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index f9254e77..3ce47154 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -1,32 +1,40 @@
-%% TeX macros to handle Texinfo files.
-%% $Id: texinfo.tex,v 2.193 1996/11/19 21:11:43 karl Exp $
-
-% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
-% 94, 95, 1996 Free Software Foundation, Inc.
-
-%This texinfo.tex file 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.
-
-%This texinfo.tex file 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 this texinfo.tex file; see the file COPYING. If not, write
-%to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-%Boston, MA 02111-1307, USA.
-
-
-%In other words, you are welcome to use, share and improve this program.
-%You are forbidden to forbid anyone else to use, share and improve
-%what you give them. Help stamp out software-hoarding!
-
-
-% Send bug reports to bug-texinfo@prep.ai.mit.edu.
-% Please include a *precise* test case in each bug report.
+% texinfo.tex -- TeX macros to handle Texinfo files.
+% $Id: texinfo.tex,v 2.227 1998/02/25 22:54:34 karl Exp $
+%
+% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98
+% Free Software Foundation, Inc.
+%
+% This texinfo.tex file 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.
+%
+% This texinfo.tex file 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 this texinfo.tex file; see the file COPYING. If not, write
+% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+% Boston, MA 02111-1307, USA.
+%
+% In other words, you are welcome to use, share and improve this program.
+% You are forbidden to forbid anyone else to use, share and improve
+% what you give them. Help stamp out software-hoarding!
+%
+% Please try the latest version of texinfo.tex before submitting bug
+% reports; you can get the latest version from:
+% ftp://ftp.cs.umb.edu/pub/tex/texinfo.tex
+% /home/gd/gnu/doc/texinfo.tex on the GNU machines.
+%
+% Send bug reports to bug-texinfo@gnu.org.
+% Please include a precise test case in each bug report,
+% including a complete document with which we can reproduce the problem.
+%
+% Texinfo macros (with @macro) are *not* supported by texinfo.tex. You
+% have to run makeinfo -E to expand macros first; the texi2dvi script
+% does this.
% Make it possible to create a .fmt file just by loading this file:
@@ -36,7 +44,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
-\deftexinfoversion$Revision: 2.193 $
+\deftexinfoversion$Revision: 2.227 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -54,13 +62,13 @@
\let\ptexdot=\.
\let\ptexdots=\dots
\let\ptexend=\end
-\let\ptexequiv = \equiv
+\let\ptexequiv=\equiv
+\let\ptexexclam=\!
\let\ptexi=\i
\let\ptexlbrace=\{
\let\ptexrbrace=\}
\let\ptexstar=\*
\let\ptext=\t
-\let\ptextilde=\~
% Be sure we're in horizontal mode when doing a tie, since we make space
% equivalent to this in @example-like environments. Otherwise, a space
@@ -73,7 +81,6 @@
\global\let\tiepenalty = \@M
\gdef\tie{\leavevmode\penalty\tiepenalty\ }
}
-\let\~ = \tie % And make it available as @~.
\message{Basics,}
@@ -103,10 +110,11 @@
\hyphenation{ap-pen-dix}
\hyphenation{mini-buf-fer mini-buf-fers}
\hyphenation{eshell}
+\hyphenation{white-space}
% Margin to add to right of even pages, to left of odd pages.
-\newdimen \bindingoffset
-\newdimen \normaloffset
+\newdimen \bindingoffset
+\newdimen \normaloffset
\newdimen\pagewidth \newdimen\pageheight
% Sometimes it is convenient to have everything in the transcript file
@@ -120,33 +128,37 @@
\showboxbreadth\maxdimen\showboxdepth\maxdimen
}%
-%---------------------Begin change-----------------------
+% For @cropmarks command.
+% Do @cropmarks to get crop marks.
+%
+\newif\ifcropmarks
+\let\cropmarks = \cropmarkstrue
%
-%%%% For @cropmarks command.
-% Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
+% Dimensions to add cropmarks at corners.
+% Added by P. A. MacKay, 12 Nov. 1986
%
\newdimen\cornerlong \newdimen\cornerthick
-\newdimen \topandbottommargin
-\newdimen \outerhsize \newdimen \outervsize
+\newdimen\topandbottommargin
+\newdimen\outerhsize \newdimen\outervsize
\cornerlong=1pc\cornerthick=.3pt % These set size of cropmarks
\outerhsize=7in
%\outervsize=9.5in
% Alternative @smallbook page size is 9.25in
\outervsize=9.25in
\topandbottommargin=.75in
-%
-%---------------------End change-----------------------
% Main output routine.
\chardef\PAGE = 255
\output = {\onepageout{\pagecontents\PAGE}}
-\newbox\headlinebox \newbox\footlinebox
+\newbox\headlinebox
+\newbox\footlinebox
% \onepageout takes a vbox as an argument. Note that \pagecontents
% does insertions, but you have to call it yourself.
\def\onepageout#1{%
- \hoffset=\normaloffset
+ \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+ %
\ifodd\pageno \advance\hoffset by \bindingoffset
\else \advance\hoffset by -\bindingoffset\fi
%
@@ -165,53 +177,52 @@
\normalturnoffactive % \ in index entries must not stay \, e.g., if
% the page break happens to be in the middle of an example.
\shipout\vbox{%
+ \ifcropmarks \vbox to \outervsize\bgroup
+ \hsize = \outerhsize
+ \line{\ewtop\hfil\ewtop}%
+ \nointerlineskip
+ \line{%
+ \vbox{\moveleft\cornerthick\nstop}%
+ \hfill
+ \vbox{\moveright\cornerthick\nstop}%
+ }%
+ \vskip\topandbottommargin
+ \line\bgroup
+ \hfil % center the page within the outer (page) hsize.
+ \ifodd\pageno\hskip\bindingoffset\fi
+ \vbox\bgroup
+ \fi
+ %
\unvbox\headlinebox
\pagebody{#1}%
- \unvbox\footlinebox
- }%
- }%
+ \ifdim\ht\footlinebox > 0pt
+ % Only leave this space if the footline is nonempty.
+ % (We lessened \vsize for it in \oddfootingxxx.)
+ % The \baselineskip=24pt in plain's \makefootline has no effect.
+ \vskip 2\baselineskip
+ \unvbox\footlinebox
+ \fi
+ %
+ \ifcropmarks
+ \egroup % end of \vbox\bgroup
+ \hfil\egroup % end of (centering) \line\bgroup
+ \vskip\topandbottommargin plus1fill minus1fill
+ \boxmaxdepth = \cornerthick
+ \line{%
+ \vbox{\moveleft\cornerthick\nsbot}%
+ \hfill
+ \vbox{\moveright\cornerthick\nsbot}%
+ }%
+ \nointerlineskip
+ \line{\ewbot\hfil\ewbot}%
+ \egroup % \vbox from first cropmarks clause
+ \fi
+ }% end of \shipout\vbox
+ }% end of group with \turnoffactive
\advancepageno
\ifnum\outputpenalty>-20000 \else\dosupereject\fi
}
-%%%% For @cropmarks command %%%%
-
-% Here is a modification of the main output routine for Near East Publications
-% This provides right-angle cropmarks at all four corners.
-% The contents of the page are centerlined into the cropmarks,
-% and any desired binding offset is added as an \hskip on either
-% site of the centerlined box. (P. A. MacKay, 12 November, 1986)
-%
-\def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
-{\escapechar=`\\\relax % makes sure backslash is used in output files.
- \shipout
- \vbox to \outervsize{\hsize=\outerhsize
- \vbox{\line{\ewtop\hfill\ewtop}}
- \nointerlineskip
- \line{\vbox{\moveleft\cornerthick\nstop}
- \hfill
- \vbox{\moveright\cornerthick\nstop}}
- \vskip \topandbottommargin
- \centerline{\ifodd\pageno\hskip\bindingoffset\fi
- \vbox{
- {\let\hsize=\pagewidth \makeheadline}
- \pagebody{#1}
- {\let\hsize=\pagewidth \makefootline}}
- \ifodd\pageno\else\hskip\bindingoffset\fi}
- \vskip \topandbottommargin plus1fill minus1fill
- \boxmaxdepth\cornerthick
- \line{\vbox{\moveleft\cornerthick\nsbot}
- \hfill
- \vbox{\moveright\cornerthick\nsbot}}
- \nointerlineskip
- \vbox{\line{\ewbot\hfill\ewbot}}
- }}
- \advancepageno
- \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
-%
-% Do @cropmarks to get crop marks
-\def\cropmarks{\let\onepageout=\croppageout }
-
\newinsert\margin \dimen\margin=\maxdimen
\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
@@ -225,7 +236,6 @@
\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
}
-%
% Here are the rules for the cropmarks. Note that they are
% offset so that the space between them is truly \outerhsize or \outervsize
% (P. A. MacKay, 12 November, 1986)
@@ -440,14 +450,11 @@
% @. is an end-of-sentence period.
\def\.{.\spacefactor=3000 }
-% @enddots{} is an end-of-sentence ellipsis.
-\gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
-
% @! is an end-of-sentence bang.
-\gdef\!{!\spacefactor=3000 }
+\def\!{!\spacefactor=3000 }
% @? is an end-of-sentence query.
-\gdef\?{?\spacefactor=3000 }
+\def\?{?\spacefactor=3000 }
% @w prevents a word break. Without the \leavevmode, @w at the
% beginning of a paragraph, when TeX is still in vertical mode, would
@@ -572,9 +579,27 @@ where each line of input produces a line of output.}
\let\br = \par
-% @dots{} output some dots
+% @dots{} output an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in a typewriter
+% font as three actual period characters.
+%
+\def\dots{\hbox to 1.5em{%
+ \hskip 0pt plus 0.25fil minus 0.25fil
+ .\hss.\hss.%
+ \hskip 0pt plus 0.5fil minus 0.5fil
+}}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+ \hbox to 2em{%
+ \hskip 0pt plus 0.25fil minus 0.25fil
+ .\hss.\hss.\hss.%
+ \hskip 0pt plus 0.5fil minus 0.5fil
+ }%
+ \spacefactor=3000
+}
-\def\dots{$\ldots$}
% @page forces the start of a new page
@@ -735,10 +760,11 @@ where each line of input produces a line of output.}
%
\def\ignore{\doignore{ignore}}
-% Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
+% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text.
%
\def\ifinfo{\doignore{ifinfo}}
\def\ifhtml{\doignore{ifhtml}}
+\def\ifnottex{\doignore{ifnottex}}
\def\html{\doignore{html}}
\def\menu{\doignore{menu}}
\def\direntry{\doignore{direntry}}
@@ -765,6 +791,10 @@ where each line of input produces a line of output.}
% Make sure that spaces turn into tokens that match what \doignoretext wants.
\catcode32 = 10
%
+ % Ignore braces, too, so mismatched braces don't cause trouble.
+ \catcode`\{ = 9
+ \catcode`\} = 9
+ %
% And now expand that command.
\doignoretext
}
@@ -856,7 +886,7 @@ where each line of input produces a line of output.}
\pretolerance = 10000
%
% Do not execute instructions in @tex
- \def\tex{\doignore{tex}}
+ \def\tex{\doignore{tex}}%
}
% @set VAR sets the variable VAR to an empty value.
@@ -932,11 +962,16 @@ where each line of input produces a line of output.}
\def\ifclearfail{\nestedignore{ifclear}}
\defineunmatchedend{ifclear}
-% @iftex always succeeds; we read the text following, through @end
-% iftex). But `@end iftex' should be valid only after an @iftex.
+% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text
+% following, through the first @end iftex (etc.). Make `@end iftex'
+% (etc.) valid only after an @iftex.
%
\def\iftex{\conditionalsucceed{iftex}}
+\def\ifnothtml{\conditionalsucceed{ifnothtml}}
+\def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
\defineunmatchedend{iftex}
+\defineunmatchedend{ifnothtml}
+\defineunmatchedend{ifnotinfo}
% We can't just want to start a group at @iftex (for example) and end it
% at @end iftex, since then @set commands inside the conditional have no
@@ -1012,6 +1047,15 @@ where each line of input produces a line of output.}
\openindices
\fixbackslash % Turn off hack to swallow `\input texinfo'.
\global\let\setfilename=\comment % Ignore extra @setfilename cmds.
+ %
+ % If texinfo.cnf is present on the system, read it.
+ % Useful for site-wide @afourpaper, etc.
+ % Just to be on the safe side, close the input stream before the \input.
+ \openin 1 texinfo.cnf
+ \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
+ \closein1
+ \temp
+ %
\comment % Ignore the actual filename.
}
@@ -1047,8 +1091,9 @@ where each line of input produces a line of output.}
% We don't need math for this one.
\def\ttsl{\tenttsl}
-%% Try out Computer Modern fonts at \magstephalf
-\let\mainmagstep=\magstephalf
+% Use Computer Modern fonts at \magstephalf (11pt).
+\newcount\mainmagstep
+\mainmagstep=\magstephalf
% Set the font macro #1 to the font named #2, adding on the
% specified font prefix (normally `cm').
@@ -1120,13 +1165,26 @@ where each line of input produces a line of output.}
\font\indi=cmmi9
\font\indsy=cmsy9
+% Fonts for title page:
+\setfont\titlerm\rmbshape{12}{\magstep3}
+\setfont\titleit\itbshape{10}{\magstep4}
+\setfont\titlesl\slbshape{10}{\magstep4}
+\setfont\titlett\ttbshape{12}{\magstep3}
+\setfont\titlettsl\ttslshape{10}{\magstep4}
+\setfont\titlesf\sfbshape{17}{\magstep1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\authorrm{\secrm}
+
% Chapter (and unnumbered) fonts (17.28pt).
\setfont\chaprm\rmbshape{12}{\magstep2}
\setfont\chapit\itbshape{10}{\magstep3}
\setfont\chapsl\slbshape{10}{\magstep3}
\setfont\chaptt\ttbshape{12}{\magstep2}
\setfont\chapttsl\ttslshape{10}{\magstep3}
-\setfont\chapsf\sfbshape{12}{\magstep2}
+\setfont\chapsf\sfbshape{17}{1000}
\let\chapbf=\chaprm
\setfont\chapsc\scbshape{10}{\magstep3}
\font\chapi=cmmi12 scaled \magstep2
@@ -1163,19 +1221,15 @@ where each line of input produces a line of output.}
\setfont\ssecit\itbshape{10}{1315}
\setfont\ssecsl\slbshape{10}{1315}
\setfont\ssectt\ttbshape{12}{\magstephalf}
-\setfont\ssecttsl\ttslshape{10}{\magstep1}
+\setfont\ssecttsl\ttslshape{10}{1315}
\setfont\ssecsf\sfbshape{12}{\magstephalf}
\let\ssecbf\ssecrm
\setfont\ssecsc\scbshape{10}{\magstep1}
\font\sseci=cmmi12 scaled \magstephalf
-\font\ssecsy=cmsy10 scaled \magstep1
+\font\ssecsy=cmsy10 scaled 1315
% The smallcaps and symbol fonts should actually be scaled \magstep1.5,
% but that is not a standard magnification.
-% Fonts for title page:
-\setfont\titlerm\rmbshape{12}{\magstep3}
-\let\authorrm = \secrm
-
% In order for the font changes to affect most math symbols and letters,
% we have to define the \textfont of the standard families. Since
% texinfo doesn't allow for producing subscripts and superscripts, we
@@ -1200,6 +1254,13 @@ where each line of input produces a line of output.}
\let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
\let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
\resetmathfonts}
+\def\titlefonts{%
+ \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
+ \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
+ \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
+ \let\tenttsl=\titlettsl
+ \resetmathfonts \setleading{25pt}}
+\def\titlefont#1{{\titlefonts\rm #1}}
\def\chapfonts{%
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
@@ -1226,6 +1287,10 @@ where each line of input produces a line of output.}
%
\textfonts
+% Define these so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
% Count depth in font-changes, for error checks
\newcount\fontdepth \fontdepth=0
@@ -1263,22 +1328,20 @@ where each line of input produces a line of output.}
\null
}
\let\ttfont=\t
-\def\samp #1{`\tclose{#1}'\null}
+\def\samp#1{`\tclose{#1}'\null}
\setfont\smallrm\rmshape{8}{1000}
\font\smallsy=cmsy9
\def\key#1{{\smallrm\textfont2=\smallsy \leavevmode\hbox{%
- \raise0.4pt\hbox{$\langle$}\kern-.08em\vtop{%
+ \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
\vbox{\hrule\kern-0.4pt
- \hbox{\raise0.4pt\hbox{\vphantom{$\langle$}}#1}}%
+ \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
\kern-0.4pt\hrule}%
- \kern-.06em\raise0.4pt\hbox{$\rangle$}}}}
+ \kern-.06em\raise0.4pt\hbox{\angleright}}}}
% The old definition, with no lozenge:
%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
\def\ctrl #1{{\tt \rawbackslash \hat}#1}
\let\file=\samp
-\let\url=\samp % perhaps include a hypertex \special eventually
-\def\email#1{$\langle${\tt #1}$\rangle$}
% @code is a modification of @t,
% which makes spaces the same size as normal in the surrounding text.
@@ -1331,25 +1394,69 @@ where each line of input produces a line of output.}
\def\realdash{-}
\def\codedash{-\discretionary{}{}{}}
-\def\codeunder{\normalunderscore\discretionary{}{}{}}
+\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}}
\def\codex #1{\tclose{#1}\endgroup}
%\let\exp=\tclose %Was temporary
% @kbd is like @code, except that if the argument is just one @key command,
% then @kbd has no effect.
-%
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+% `example' (@kbd uses ttsl only inside of @example and friends),
+% or `code' (@kbd uses normal tty font always).
+\def\kbdinputstyle{\parsearg\kbdinputstylexxx}
+\def\kbdinputstylexxx#1{%
+ \def\arg{#1}%
+ \ifx\arg\worddistinct
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+ \else\ifx\arg\wordexample
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+ \else\ifx\arg\wordcode
+ \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+ \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is kbdinputdistinct. (Too much of a hassle to call the macro,
+% the catcodes are wrong for parsearg to work.)
+\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
+
\def\xkey{\key}
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
\ifx\one\xkey\ifx\threex\three \key{#2}%
-\else{\tclose{\ttsl\look}}\fi
-\else{\tclose{\ttsl\look}}\fi}
+\else{\tclose{\kbdfont\look}}\fi
+\else{\tclose{\kbdfont\look}}\fi}
+
+% @url. Quotes do not seem necessary, so use \code.
+\let\url=\code
+
+% @uref (abbreviation for `urlref') takes an optional second argument
+% specifying the text to display. First (mandatory) arg is the url.
+% Perhaps eventually put in a hypertex \special here.
+%
+\def\uref#1{\urefxxx #1,,\finish}
+\def\urefxxx#1,#2,#3\finish{%
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \unhbox0\ (\code{#1})%
+ \else
+ \code{#1}%
+ \fi
+}
+
+% rms does not like the angle brackets --karl, 17may97.
+% So now @email is just like @uref.
+%\def\email#1{\angleleft{\tt #1}\angleright}
+\let\email=\uref
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
% this property, we can check that font parameter.
-%
+%
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
@@ -1380,8 +1487,6 @@ where each line of input produces a line of output.}
\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
% First the title page. Must do @settitle before @titlepage.
-\def\titlefont#1{{\titlerm #1}}
-
\newif\ifseenauthor
\newif\iffinishedtitlepage
@@ -1403,7 +1508,7 @@ where each line of input produces a line of output.}
%
% Now you can print the title using @title.
\def\title{\parsearg\titlezzz}%
- \def\titlezzz##1{\leftline{\titlefont{##1}}
+ \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
% print a rule at the page bottom also.
\finishedtitlepagefalse
\vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
@@ -1492,10 +1597,7 @@ where each line of input produces a line of output.}
\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
-\gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
-\gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
@@ -1503,12 +1605,15 @@ where each line of input produces a line of output.}
\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+ \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
+ %
+ % Leave some space for the footline. Hopefully ok to assume
+ % @evenfooting will not be used by itself.
+ \global\advance\pageheight by -\baselineskip
+ \global\advance\vsize by -\baselineskip
+}
-\gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
-\gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
-\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
-\global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
%
}% unbind the catcode of @.
@@ -1892,7 +1997,7 @@ July\or August\or September\or October\or November\or December\fi
\def\itemizeitem{%
\advance\itemno by 1
{\let\par=\endgraf \smallbreak}%
-\ifhmode \errmessage{\in hmode at itemizeitem}\fi
+\ifhmode \errmessage{In hmode at itemizeitem}\fi
{\parskip=0in \hskip 0pt
\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
\vadjust{\penalty 1200}}%
@@ -1910,7 +2015,7 @@ July\or August\or September\or October\or November\or December\fi
% To make preamble:
%
-% Either define widths of columns in terms of percent of \hsize:
+% Either define widths of columns in terms of percent of \hsize:
% @multitable @columnfractions .25 .3 .45
% @item ...
%
@@ -1928,13 +2033,13 @@ July\or August\or September\or October\or November\or December\fi
% the preamble, break the line within one argument and it
% will parse correctly, i.e.,
%
-% @multitable {Column 1 template} {Column 2 template} {Column 3
+% @multitable {Column 1 template} {Column 2 template} {Column 3
% template}
% Not:
-% @multitable {Column 1 template} {Column 2 template}
+% @multitable {Column 1 template} {Column 2 template}
% {Column 3 template}
-% Each new table line starts with @item, each subsequent new column
+% Each new table line starts with @item, each subsequent new column
% starts with @tab. Empty columns may be produced by supplying @tab's
% with nothing between them for as many times as empty columns are needed,
% ie, @tab@tab@tab will produce two empty columns.
@@ -1946,15 +2051,15 @@ July\or August\or September\or October\or November\or December\fi
% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
% @item first col stuff @tab second col stuff @tab third col
-% @item
-% first col stuff
-% @tab
-% second col stuff
-% @tab
-% third col
-% @item first col stuff @tab second col stuff
+% @item
+% first col stuff
+% @tab
+% second col stuff
+% @tab
+% third col
+% @item first col stuff @tab second col stuff
% @tab Many paragraphs of text may be used in any column.
-%
+%
% They will wrap at the width determined by the template.
% @item@tab@tab This will be in third column.
% @end multitable
@@ -1966,10 +2071,7 @@ July\or August\or September\or October\or November\or December\fi
% @multitablelinespace is space to leave between table items, baseline
% to baseline.
% 0pt means it depends on current normal line spacing.
-
-%%%%
-% Dimensions
-
+%
\newskip\multitableparskip
\newskip\multitableparindent
\newdimen\multitablecolspace
@@ -1979,15 +2081,15 @@ July\or August\or September\or October\or November\or December\fi
\multitablecolspace=12pt
\multitablelinespace=0pt
-%%%%
% Macros used to set up halign preamble:
+%
\let\endsetuptable\relax
\def\xendsetuptable{\endsetuptable}
\let\columnfractions\relax
\def\xcolumnfractions{\columnfractions}
\newif\ifsetpercent
-%% 2/1/96, to allow fractions to be given with more than one digit.
+% 2/1/96, to allow fractions to be given with more than one digit.
\def\pickupwholefraction#1 {\global\advance\colcount by1 %
\expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
\setuptable}
@@ -2013,80 +2115,84 @@ July\or August\or September\or October\or November\or December\fi
\ifx\go\pickupwholefraction\else\let\go\setuptable\fi%
\fi\go}
-%%%%
% multitable syntax
\def\tab{&\hskip1sp\relax} % 2/2/96
% tiny skip here makes sure this column space is
% maintained, even if it is never used.
-
-%%%%
% @multitable ... @end multitable definitions:
\def\multitable{\parsearg\dotable}
-
\def\dotable#1{\bgroup
-\let\item\cr
-\tolerance=9500
-\hbadness=9500
-\setmultitablespacing
-\parskip=\multitableparskip
-\parindent=\multitableparindent
-\overfullrule=0pt
-\global\colcount=0\relax%
-\def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
- % To parse everything between @multitable and @item :
-\setuptable#1 \endsetuptable
- % Need to reset this to 0 after \setuptable.
-\global\colcount=0\relax%
- %
- % This preamble sets up a generic column definition, which will
- % be used as many times as user calls for columns.
- % \vtop will set a single line and will also let text wrap and
- % continue for many paragraphs if desired.
-\halign\bgroup&\global\advance\colcount by 1\relax%
-\multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
- % In order to keep entries from bumping into each other
- % we will add a \leftskip of \multitablecolspace to all columns after
- % the first one.
- % If a template has been used, we will add \multitablecolspace
- % to the width of each template entry.
- % If user has set preamble in terms of percent of \hsize
- % we will use that dimension as the width of the column, and
- % the \leftskip will keep entries from bumping into each other.
- % Table will start at left margin and final column will justify at
- % right margin.
-\ifnum\colcount=1
-\else
- \ifsetpercent
+ \vskip\parskip
+ \let\item\crcr
+ \tolerance=9500
+ \hbadness=9500
+ \setmultitablespacing
+ \parskip=\multitableparskip
+ \parindent=\multitableparindent
+ \overfullrule=0pt
+ \global\colcount=0
+ \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}%
+ %
+ % To parse everything between @multitable and @item:
+ \setuptable#1 \endsetuptable
+ %
+ % \everycr will reset column counter, \colcount, at the end of
+ % each line. Every column entry will cause \colcount to advance by one.
+ % The table preamble
+ % looks at the current \colcount to find the correct column width.
+ \everycr{\noalign{%
+ %
+ % \filbreak%% keeps underfull box messages off when table breaks over pages.
+ % Maybe so, but it also creates really weird page breaks when the table
+ % breaks over pages. Wouldn't \vfil be better? Wait until the problem
+ % manifests itself, so it can be fixed for real --karl.
+ \global\colcount=0\relax}}%
+ %
+ % This preamble sets up a generic column definition, which will
+ % be used as many times as user calls for columns.
+ % \vtop will set a single line and will also let text wrap and
+ % continue for many paragraphs if desired.
+ \halign\bgroup&\global\advance\colcount by 1\relax
+ \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
+ %
+ % In order to keep entries from bumping into each other
+ % we will add a \leftskip of \multitablecolspace to all columns after
+ % the first one.
+ %
+ % If a template has been used, we will add \multitablecolspace
+ % to the width of each template entry.
+ %
+ % If the user has set preamble in terms of percent of \hsize we will
+ % use that dimension as the width of the column, and the \leftskip
+ % will keep entries from bumping into each other. Table will start at
+ % left margin and final column will justify at right margin.
+ %
+ % Make sure we don't inherit \rightskip from the outer environment.
+ \rightskip=0pt
+ \ifnum\colcount=1
+ % The first column will be indented with the surrounding text.
+ \advance\hsize by\leftskip
\else
- % If user has <not> set preamble in terms of percent of \hsize
- % we will advance \hsize by \multitablecolspace
- \advance\hsize by \multitablecolspace
+ \ifsetpercent \else
+ % If user has not set preamble in terms of percent of \hsize
+ % we will advance \hsize by \multitablecolspace.
+ \advance\hsize by \multitablecolspace
+ \fi
+ % In either case we will make \leftskip=\multitablecolspace:
+ \leftskip=\multitablecolspace
\fi
- % In either case we will make \leftskip=\multitablecolspace:
-\leftskip=\multitablecolspace
-\fi
- % Ignoring space at the beginning and end avoids an occasional spurious
- % blank line, when TeX decides to break the line at the space before the
- % box from the multistrut, so the strut ends up on a line by itself.
- % For example:
- % @multitable @columnfractions .11 .89
- % @item @code{#}
- % @tab Legal holiday which is valid in major parts of the whole country.
- % Is automatically provided with highlighing sequences respectively marking
- % characters.
- \noindent\ignorespaces##\unskip\multistrut}\cr
- % \everycr will reset column counter, \colcount, at the end of
- % each line. Every column entry will cause \colcount to advance by one.
- % The table preamble
- % looks at the current \colcount to find the correct column width.
-\global\everycr{\noalign{%
-% \filbreak%% keeps underfull box messages off when table breaks over pages.
-% Maybe so, but it also creates really weird page breaks when the table
-% breaks over pages Wouldn't \vfil be better? Wait until the problem
-% manifests itself, so it can be fixed for real --karl.
-\global\colcount=0\relax}}
+ % Ignoring space at the beginning and end avoids an occasional spurious
+ % blank line, when TeX decides to break the line at the space before the
+ % box from the multistrut, so the strut ends up on a line by itself.
+ % For example:
+ % @multitable @columnfractions .11 .89
+ % @item @code{#}
+ % @tab Legal holiday which is valid in major parts of the whole country.
+ % Is automatically provided with highlighting sequences respectively marking
+ % characters.
+ \noindent\ignorespaces##\unskip\multistrut}\cr
}
\def\setmultitablespacing{% test to see if user has set \multitablelinespace.
@@ -2097,7 +2203,7 @@ July\or August\or September\or October\or November\or December\fi
%% to keep lines equally spaced
\let\multistrut = \strut
%% Test to see if parskip is larger than space between lines of
-%% table. If not, do nothing.
+%% table. If not, do nothing.
%% If so, set to same dimension as multitablelinespace.
\else
\gdef\multistrut{\vrule height\multitablelinespace depth\dp0
@@ -2232,7 +2338,13 @@ width0pt\relax} \fi
%\def\char{\realbackslash char}%
\def\TeX{\realbackslash TeX}%
\def\dots{\realbackslash dots }%
-\def\copyright{\realbackslash copyright }%
+\def\result{\realbackslash result}%
+\def\equiv{\realbackslash equiv}%
+\def\expansion{\realbackslash expansion}%
+\def\print{\realbackslash print}%
+\def\error{\realbackslash error}%
+\def\point{\realbackslash point}%
+\def\copyright{\realbackslash copyright}%
\def\tclose##1{\realbackslash tclose {##1}}%
\def\code##1{\realbackslash code {##1}}%
\def\dotless##1{\realbackslash dotless {##1}}%
@@ -2242,6 +2354,7 @@ width0pt\relax} \fi
\def\r##1{\realbackslash r {##1}}%
\def\i##1{\realbackslash i {##1}}%
\def\b##1{\realbackslash b {##1}}%
+\def\sc##1{\realbackslash sc {##1}}%
\def\cite##1{\realbackslash cite {##1}}%
\def\key##1{\realbackslash key {##1}}%
\def\file##1{\realbackslash file {##1}}%
@@ -2249,6 +2362,7 @@ width0pt\relax} \fi
\def\kbd##1{\realbackslash kbd {##1}}%
\def\dfn##1{\realbackslash dfn {##1}}%
\def\emph##1{\realbackslash emph {##1}}%
+\def\value##1{\realbackslash value {##1}}%
\unsepspaces
}
@@ -2413,29 +2527,23 @@ width0pt\relax} \fi
% Define the macros used in formatting output of the sorted index material.
-% This is what you call to cause a particular index to get printed.
-% Write
-% @unnumbered Function Index
-% @printindex fn
-
+% @printindex causes a particular index (the ??s file) to get printed.
+% It does not print any chapter heading (usually an @unnumbered).
+%
\def\printindex{\parsearg\doprintindex}
-
\def\doprintindex#1{\begingroup
\dobreak \chapheadingskip{10000}%
%
\indexfonts \rm
\tolerance = 9500
\indexbreaks
- \def\indexbackslash{\rawbackslashxx}%
- % Index files are almost Texinfo source, but we use \ as the escape
- % character. It would be better to use @, but that's too big a change
- % to make right now.
- \catcode`\\ = 0
- \catcode`\@ = 11
- \escapechar = `\\
- \begindoublecolumns
%
% See if the index file exists and is nonempty.
+ % Change catcode of @ here so that if the index file contains
+ % \initial {@}
+ % as its first line, TeX doesn't complain about mismatched braces
+ % (because it thinks @} is a control sequence).
+ \catcode`\@ = 11
\openin 1 \jobname.#1s
\ifeof 1
% \enddoublecolumns gets confused if there is no text in the index,
@@ -2452,11 +2560,18 @@ width0pt\relax} \fi
\ifeof 1
(Index is empty)
\else
+ % Index files are almost Texinfo source, but we use \ as the escape
+ % character. It would be better to use @, but that's too big a change
+ % to make right now.
+ \def\indexbackslash{\rawbackslashxx}%
+ \catcode`\\ = 0
+ \escapechar = `\\
+ \begindoublecolumns
\input \jobname.#1s
+ \enddoublecolumns
\fi
\fi
\closein 1
- \enddoublecolumns
\endgroup}
% These macros are used by the sorted index file itself.
@@ -2558,24 +2673,39 @@ width0pt\relax} \fi
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
% Grab any single-column material above us.
- \output = {\global\setbox\partialpage
- =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
+ \output = {\global\setbox\partialpage = \vbox{%
+ %
+ % Here is a possibility not foreseen in manmac: if we accumulate a
+ % whole lot of material, we might end up calling this \output
+ % routine twice in a row (see the doublecol-lose test, which is
+ % essentially a couple of indexes with @setchapternewpage off). In
+ % that case, we must prevent the second \partialpage from
+ % simply overwriting the first, causing us to lose the page.
+ % This will preserve it until a real output routine can ship it
+ % out. Generally, \partialpage will be empty when this runs and
+ % this will be a no-op.
+ \unvbox\partialpage
+ %
+ % Unvbox the main output page.
+ \unvbox255
+ \kern-\topskip \kern\baselineskip
+ }}%
\eject
%
- % Now switch to the double-column output routine.
- \output={\doublecolumnout}%
+ % Use the double-column output routine for subsequent pages.
+ \output = {\doublecolumnout}%
%
% Change the page size parameters. We could do this once outside this
% routine, in each of @smallbook, @afourpaper, and the default 8.5x11
% format, but then we repeat the same computation. Repeating a couple
% of assignments once per index is clearly meaningless for the
- % execution time, so we may as well do it once.
+ % execution time, so we may as well do it in one place.
%
% First we halve the line length, less a little for the gutter between
% the columns. We compute the gutter based on the line length, so it
% changes automatically with the paper format. The magic constant
- % below is chosen so that the gutter has the same value (well, +- <
- % 1pt) as it did when we hard-coded it.
+ % below is chosen so that the gutter has the same value (well, +-<1pt)
+ % as it did when we hard-coded it.
%
% We put the result in a separate register, \doublecolumhsize, so we
% can restore it in \pagesofar, after \hsize itself has (potentially)
@@ -2596,100 +2726,109 @@ width0pt\relax} \fi
% (undoubled) page height minus any material left over from the
% previous page.
\dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
- % box0 will be the left-hand column, box1 the right.
+ % box0 will be the left-hand column, box2 the right.
\setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
\onepageout\pagesofar
- \unvbox255 \penalty\outputpenalty
+ \unvbox255
+ \penalty\outputpenalty
}
\def\pagesofar{%
- % The contents of the output page -- any previous material,
+ % Re-output the contents of the output page -- any previous material,
% followed by the two boxes we just split.
\unvbox\partialpage
\hsize = \doublecolumnhsize
\wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}%
}
\def\enddoublecolumns{%
- \output={\balancecolumns}\eject % split what we have
- \endgroup
+ \output = {\balancecolumns}\eject % split what we have
+ \endgroup % started in \begindoublecolumns
+ %
% Back to normal single-column typesetting, but take account of the
% fact that we just accumulated some stuff on the output page.
- \pagegoal=\vsize
+ \pagegoal = \vsize
}
\def\balancecolumns{%
- % Called on the last page of the double column material.
- \setbox0=\vbox{\unvbox255}%
+ % Called at the end of the double column material.
+ \setbox0 = \vbox{\unvbox255}%
\dimen@ = \ht0
\advance\dimen@ by \topskip
\advance\dimen@ by-\baselineskip
\divide\dimen@ by 2
\splittopskip = \topskip
% Loop until we get a decent breakpoint.
- {\vbadness=10000 \loop \global\setbox3=\copy0
+ {\vbadness=10000 \loop
+ \global\setbox3=\copy0
\global\setbox1=\vsplit3 to\dimen@
- \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}%
+ \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt
+ \repeat}%
\setbox0=\vbox to\dimen@{\unvbox1}%
\setbox2=\vbox to\dimen@{\unvbox3}%
\pagesofar
}
-\catcode `\@=\other
+\catcode`\@ = \other
\message{sectioning,}
% Define chapters, sections, etc.
-\newcount \chapno
-\newcount \secno \secno=0
-\newcount \subsecno \subsecno=0
-\newcount \subsubsecno \subsubsecno=0
+\newcount\chapno
+\newcount\secno \secno=0
+\newcount\subsecno \subsecno=0
+\newcount\subsubsecno \subsubsecno=0
% This counter is funny since it counts through charcodes of letters A, B, ...
-\newcount \appendixno \appendixno = `\@
+\newcount\appendixno \appendixno = `\@
\def\appendixletter{\char\the\appendixno}
-\newwrite \contentsfile
+\newwrite\contentsfile
% This is called from \setfilename.
-\def\opencontents{\openout \contentsfile = \jobname.toc}
+\def\opencontents{\openout\contentsfile = \jobname.toc }
% Each @chapter defines this as the name of the chapter.
% page headings and footings can use it. @section does likewise
\def\thischapter{} \def\thissection{}
-\def\seccheck#1{\if \pageno<0 %
-\errmessage{@#1 not allowed after generating table of contents}\fi
-%
-}
+\def\seccheck#1{\ifnum \pageno<0
+ \errmessage{@#1 not allowed after generating table of contents}%
+\fi}
\def\chapternofonts{%
-\let\rawbackslash=\relax%
-\let\frenchspacing=\relax%
-\def\result{\realbackslash result}
-\def\equiv{\realbackslash equiv}
-\def\expansion{\realbackslash expansion}
-\def\print{\realbackslash print}
-\def\TeX{\realbackslash TeX}
-\def\dots{\realbackslash dots}
-\def\copyright{\realbackslash copyright}
-\def\tt{\realbackslash tt}
-\def\bf{\realbackslash bf }
-\def\w{\realbackslash w}
-\def\less{\realbackslash less}
-\def\gtr{\realbackslash gtr}
-\def\hat{\realbackslash hat}
-\def\char{\realbackslash char}
-\def\tclose##1{\realbackslash tclose {##1}}
-\def\code##1{\realbackslash code {##1}}
-\def\samp##1{\realbackslash samp {##1}}
-\def\r##1{\realbackslash r {##1}}
-\def\b##1{\realbackslash b {##1}}
-\def\key##1{\realbackslash key {##1}}
-\def\file##1{\realbackslash file {##1}}
-\def\kbd##1{\realbackslash kbd {##1}}
-% These are redefined because @smartitalic wouldn't work inside xdef.
-\def\i##1{\realbackslash i {##1}}
-\def\cite##1{\realbackslash cite {##1}}
-\def\var##1{\realbackslash var {##1}}
-\def\emph##1{\realbackslash emph {##1}}
-\def\dfn##1{\realbackslash dfn {##1}}
+ \let\rawbackslash=\relax
+ \let\frenchspacing=\relax
+ \def\result{\realbackslash result}%
+ \def\equiv{\realbackslash equiv}%
+ \def\expansion{\realbackslash expansion}%
+ \def\print{\realbackslash print}%
+ \def\TeX{\realbackslash TeX}%
+ \def\dots{\realbackslash dots}%
+ \def\result{\realbackslash result}%
+ \def\equiv{\realbackslash equiv}%
+ \def\expansion{\realbackslash expansion}%
+ \def\print{\realbackslash print}%
+ \def\error{\realbackslash error}%
+ \def\point{\realbackslash point}%
+ \def\copyright{\realbackslash copyright}%
+ \def\tt{\realbackslash tt}%
+ \def\bf{\realbackslash bf}%
+ \def\w{\realbackslash w}%
+ \def\less{\realbackslash less}%
+ \def\gtr{\realbackslash gtr}%
+ \def\hat{\realbackslash hat}%
+ \def\char{\realbackslash char}%
+ \def\tclose##1{\realbackslash tclose{##1}}%
+ \def\code##1{\realbackslash code{##1}}%
+ \def\samp##1{\realbackslash samp{##1}}%
+ \def\r##1{\realbackslash r{##1}}%
+ \def\b##1{\realbackslash b{##1}}%
+ \def\key##1{\realbackslash key{##1}}%
+ \def\file##1{\realbackslash file{##1}}%
+ \def\kbd##1{\realbackslash kbd{##1}}%
+ % These are redefined because @smartitalic wouldn't work inside xdef.
+ \def\i##1{\realbackslash i{##1}}%
+ \def\cite##1{\realbackslash cite{##1}}%
+ \def\var##1{\realbackslash var{##1}}%
+ \def\emph##1{\realbackslash emph{##1}}%
+ \def\dfn##1{\realbackslash dfn{##1}}%
}
\newcount\absseclevel % used to calculate proper heading level
@@ -2776,7 +2915,8 @@ width0pt\relax} \fi
% because we don't want its macros evaluated now.
\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
{\chapternofonts%
-\edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash chapentry{\the\toks0}{\the\chapno}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\donoderef %
@@ -2795,8 +2935,9 @@ width0pt\relax} \fi
\gdef\thischaptername{#1}%
\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
{\chapternofonts%
-\edef\temp{{\realbackslash chapentry
- {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash chapentry{\the\toks0}%
+ {\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\appendixnoderef %
@@ -2830,7 +2971,8 @@ width0pt\relax} \fi
\unnumbchapmacro {#1}%
\gdef\thischapter{#1}\gdef\thissection{#1}%
{\chapternofonts%
-\edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash unnumbchapentry{\the\toks0}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\unnumbnoderef %
@@ -2845,8 +2987,9 @@ width0pt\relax} \fi
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
{\chapternofonts%
+\toks0 = {#1}%
\edef\temp{{\realbackslash secentry %
-{#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
+{\the\toks0}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\donoderef %
@@ -2860,8 +3003,9 @@ width0pt\relax} \fi
\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
{\chapternofonts%
+\toks0 = {#1}%
\edef\temp{{\realbackslash secentry %
-{#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
+{\the\toks0}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\appendixnoderef %
@@ -2873,7 +3017,8 @@ width0pt\relax} \fi
\def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
\plainsecheading {#1}\gdef\thissection{#1}%
{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash unnumbsecentry{\the\toks0}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\unnumbnoderef %
@@ -2886,8 +3031,9 @@ width0pt\relax} \fi
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
{\chapternofonts%
+\toks0 = {#1}%
\edef\temp{{\realbackslash subsecentry %
-{#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+{\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\donoderef %
@@ -2900,8 +3046,9 @@ width0pt\relax} \fi
\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
{\chapternofonts%
+\toks0 = {#1}%
\edef\temp{{\realbackslash subsecentry %
-{#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
+{\the\toks0}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\appendixnoderef %
@@ -2913,7 +3060,8 @@ width0pt\relax} \fi
\def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
\plainsubsecheading {#1}\gdef\thissection{#1}%
{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash unnumbsubsecentry{\the\toks0}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\unnumbnoderef %
@@ -2927,8 +3075,8 @@ width0pt\relax} \fi
\subsubsecheading {#1}
{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry %
- {#1}
+\toks0 = {#1}%
+\edef\temp{{\realbackslash subsubsecentry{\the\toks0}
{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
{\noexpand\folio}}}%
\escapechar=`\\%
@@ -2944,7 +3092,8 @@ width0pt\relax} \fi
\subsubsecheading {#1}
{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
{\chapternofonts%
-\edef\temp{{\realbackslash subsubsecentry{#1}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash subsubsecentry{\the\toks0}%
{\appendixletter}
{\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
\escapechar=`\\%
@@ -2958,7 +3107,8 @@ width0pt\relax} \fi
\def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
\plainsubsubsecheading {#1}\gdef\thissection{#1}%
{\chapternofonts%
-\edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
+\toks0 = {#1}%
+\edef\temp{{\realbackslash unnumbsubsubsecentry{\the\toks0}{\noexpand\folio}}}%
\escapechar=`\\%
\write \contentsfile \temp %
\unnumbnoderef %
@@ -3139,7 +3289,7 @@ width0pt\relax} \fi
% Print any size section title.
-%
+%
% #1 is the section type (sec/subsec/subsubsec), #2 is the section
% number (maybe empty), #3 the text.
\def\sectionheading#1#2#3{%
@@ -3183,7 +3333,9 @@ width0pt\relax} \fi
\unnumbchapmacro{#1}\def\thischapter{}%
\begingroup % Set up to handle contents files properly.
\catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
- \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
+ % We can't do this, because then an actual ^ in a section
+ % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
+ %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
\raggedbottom % Worry more about breakpoints than the bottom.
\advance\hsize by -\contentsrightmargin % Don't use the full line length.
}
@@ -3308,11 +3460,12 @@ width0pt\relax} \fi
% the index entries, but we want to suppress hyphenation here. (We
% can't do that in the \entry macro, since index entries might consist
% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
-%
-% \turnoffactive is for the sake of @" used for umlauts.
\def\tocentry#1#2{\begingroup
\vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
- \entry{\turnoffactive #1}{\turnoffactive #2}%
+ % Do not use \turnoffactive in these arguments. Since the toc is
+ % typeset in cmr, so characters such as _ would come out wrong; we
+ % have to do the usual translation tricks.
+ \entry{#1}{#2}%
\endgroup}
% Space between chapter (or whatever) number and the title.
@@ -3378,31 +3531,35 @@ width0pt\relax} \fi
% But \@ or @@ will get a plain tex @ character.
\def\tex{\begingroup
-\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
-\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
-\catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
-\catcode `\%=14
-\catcode 43=12 % plus
-\catcode`\"=12
-\catcode`\==12
-\catcode`\|=12
-\catcode`\<=12
-\catcode`\>=12
-\escapechar=`\\
-%
-\let\,=\ptexcomma
-\let\~=\ptextilde
-\let\{=\ptexlbrace
-\let\}=\ptexrbrace
-\let\.=\ptexdot
-\let\*=\ptexstar
-\let\dots=\ptexdots
-\def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}
-\def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}
-\def\@{@}%
-\let\bullet=\ptexbullet
-\let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext
-%
+ \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+ \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+ \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
+ \catcode `\%=14
+ \catcode 43=12 % plus
+ \catcode`\"=12
+ \catcode`\==12
+ \catcode`\|=12
+ \catcode`\<=12
+ \catcode`\>=12
+ \escapechar=`\\
+ %
+ \let\b=\ptexb
+ \let\bullet=\ptexbullet
+ \let\c=\ptexc
+ \let\,=\ptexcomma
+ \let\.=\ptexdot
+ \let\dots=\ptexdots
+ \let\equiv=\ptexequiv
+ \let\!=\ptexexclam
+ \let\i=\ptexi
+ \let\{=\ptexlbrace
+ \let\}=\ptexrbrace
+ \let\*=\ptexstar
+ \let\t=\ptext
+ %
+ \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
+ \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
+ \def\@{@}%
\let\Etex=\endgroup}
% Define @lisp ... @endlisp.
@@ -3539,11 +3696,12 @@ width0pt\relax} \fi
%
\def\nonfillfinish{\afterenvbreak\endgroup}%
-% This macro is
\def\lisp{\begingroup
\nonfillstart
\let\Elisp = \nonfillfinish
\tt
+ % Make @kbd do something special, if requested.
+ \let\kbdfont\kbdexamplefont
\rawbackslash % have \ input char produce \ char from current font
\gobble
}
@@ -3661,16 +3819,17 @@ width0pt\relax} \fi
% Definitions of (, ) and & used in args for functions.
% This is the definition of ( outside of all parentheses.
-\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
-\global\advance\parencount by 1 }
+\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
+ \global\advance\parencount by 1
+}
%
% This is the definition of ( when already inside a level of parens.
\gdef\opnested{\char`\(\global\advance\parencount by 1 }
%
\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
-% also in that case restore the outer-level definition of (.
-\ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
-\global\advance \parencount by -1 }
+ % also in that case restore the outer-level definition of (.
+ \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
+ \global\advance \parencount by -1 }
% If we encounter &foo, then turn on ()-hacking afterwards
\gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
%
@@ -3678,8 +3837,11 @@ width0pt\relax} \fi
} % End of definition inside \activeparens
%% These parens (in \boldbrax) actually are a little bolder than the
%% contained text. This is especially needed for [ and ]
-\def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
-\def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
+\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
+\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
+\def\ampnr{\&}
+\def\lbrb{{\bf\char`\[}}
+\def\rbrb{{\bf\char`\]}}
% First, defname, which formats the header line itself.
% #1 should be the function name.
@@ -3772,7 +3934,7 @@ width0pt\relax} \fi
% This is used for \def{tp,vr}parsebody. It could probably be used for
% some of the others, too, with some judicious conditionals.
-%
+%
\def\parsebodycommon#1#2#3{%
\begingroup\inENV %
\medbreak %
@@ -3807,13 +3969,13 @@ width0pt\relax} \fi
% Fine, but then we have to eventually remove the \empty *and* the
% braces (if any). That's what this does.
-%
+%
\def\removeemptybraces\empty#1\relax{#1}
% After \spacesplit has done its work, this is called -- #1 is the final
% thing to call, #2 the type name (which starts with \empty), and #3
% (which might be empty) the arguments.
-%
+%
\def\parsetpheaderline#1#2#3{%
#1{\removeemptybraces#2\relax}{#3}%
}%
@@ -3856,7 +4018,7 @@ width0pt\relax} \fi
\hyphenchar\tensl=0
#1%
\hyphenchar\tensl=45
-\ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
+\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
\interlinepenalty=10000
\advance\rightskip by 0pt plus 1fil
\endgraf\penalty 10000\vskip -\parskip\penalty 10000%
@@ -3957,6 +4119,7 @@ width0pt\relax} \fi
\def\defmacx #1 {\errmessage{@defmacx in invalid context}}
\def\defspecx #1 {\errmessage{@defspecx in invalid context}}
\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
+\def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}}
\def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
% @defmethod, and so on
@@ -3972,6 +4135,16 @@ width0pt\relax} \fi
\defunargs {#3}\endgroup %
}
+% @deftypemethod foo-class return-type foo-method args
+%
+\def\deftypemethod{%
+ \defmethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
+%
+% #1 is the class name, #2 the data type, #3 the method name, #4 the args.
+\def\deftypemethodheader#1#2#3#4{%
+ \deftypefnheaderx{Method on #1}{#2}#3 #4\relax
+}
+
% @defmethod == @defop Method
\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
@@ -4186,7 +4359,7 @@ width0pt\relax} \fi
% Use \turnoffactive so that punctuation chars such as underscore
% work in node names.
-\def\dosetq #1#2{{\let\folio=0 \turnoffactive
+\def\dosetq #1#2{{\let\folio=0 \turnoffactive
\edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
\next}}
@@ -4239,7 +4412,7 @@ width0pt\relax} \fi
\def\refx#1#2{%
\expandafter\ifx\csname X#1\endcsname\relax
% If not defined, say something at least.
- $\langle$un\-de\-fined$\rangle$%
+ \angleleft un\-de\-fined\angleright
\ifhavexrefs
\message{\linenumber Undefined cross reference `#1'.}%
\else
@@ -4256,37 +4429,38 @@ width0pt\relax} \fi
}
% This is the macro invoked by entries in the aux file.
-\def\xrdef #1#2{{%
- \catcode`\'=\other
- \expandafter\gdef\csname X#1\endcsname{#2}%
-}}
+%
+\def\xrdef#1{\begingroup
+ % Reenable \ as an escape while reading the second argument.
+ \catcode`\\ = 0
+ \afterassignment\endgroup
+ \expandafter\gdef\csname X#1\endcsname
+}
% Read the last existing aux file, if any. No error if none exists.
\def\readauxfile{\begingroup
\catcode`\^^@=\other
- \catcode`\=\other
- \catcode`\=\other
+ \catcode`\^^A=\other
+ \catcode`\^^B=\other
\catcode`\^^C=\other
\catcode`\^^D=\other
\catcode`\^^E=\other
\catcode`\^^F=\other
\catcode`\^^G=\other
\catcode`\^^H=\other
- \catcode`\ =\other
+ \catcode`\^^K=\other
\catcode`\^^L=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode`\=\other
- \catcode26=\other
+ \catcode`\^^N=\other
+ \catcode`\^^P=\other
+ \catcode`\^^Q=\other
+ \catcode`\^^R=\other
+ \catcode`\^^S=\other
+ \catcode`\^^T=\other
+ \catcode`\^^U=\other
+ \catcode`\^^V=\other
+ \catcode`\^^W=\other
+ \catcode`\^^X=\other
+ \catcode`\^^Z=\other
\catcode`\^^[=\other
\catcode`\^^\=\other
\catcode`\^^]=\other
@@ -4302,11 +4476,11 @@ width0pt\relax} \fi
% b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
% argument, and \hat is not an expandable control sequence. It could
% all be worked out, but why? Either we support ^^ or we don't.
- %
+ %
% The other change necessary for this was to define \auxhat:
% \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
% and then to call \auxhat in \setq.
- %
+ %
\catcode`\~=\other
\catcode`\[=\other
\catcode`\]=\other
@@ -4364,7 +4538,7 @@ width0pt\relax} \fi
% space to prevent strange expansion errors.)
\def\supereject{\par\penalty -20000\footnoteno =0 }
-% @footnotestyle is meaningful for info output only..
+% @footnotestyle is meaningful for info output only.
\let\footnotestyle=\comment
\let\ptexfootnote=\footnote
@@ -4389,7 +4563,7 @@ width0pt\relax} \fi
% Don't bother with the trickery in plain.tex to not require the
% footnote text as a parameter. Our footnotes don't need to be so general.
-%
+%
% Oh yes, they do; otherwise, @ifset and anything else that uses
% \parseargline fail inside footnotes because the tokens are fixed when
% the footnote is read. --karl, 16nov96.
@@ -4479,9 +4653,51 @@ width0pt\relax} \fi
%
\def\finalout{\overfullrule=0pt}
+% @image. We use the macros from epsf.tex to support this.
+% If epsf.tex is not installed and @image is used, we complain.
+%
+% Check for and read epsf.tex up front. If we read it only at @image
+% time, we might be inside a group, and then its definitions would get
+% undone and the next image would fail.
+\openin 1 = epsf.tex
+\ifeof 1 \else
+ \closein 1
+ \def\epsfannounce{\toks0 = }% do not bother showing banner
+ \input epsf.tex
+\fi
+%
+\newif\ifwarnednoepsf
+\newhelp\noepsfhelp{epsf.tex must be installed for images to
+ work. It is also included in the Texinfo distribution, or you can get
+ it from ftp://ftp.tug.org/tex/epsf.tex.}
+%
+% Only complain once about lack of epsf.tex.
+\def\image#1{%
+ \ifx\epsfbox\undefined
+ \ifwarnednoepsf \else
+ \errhelp = \noepsfhelp
+ \errmessage{epsf.tex not found, images will be ignored}%
+ \global\warnednoepsftrue
+ \fi
+ \else
+ \imagexxx #1,,,\finish
+ \fi
+}
+%
+% Arguments to @image:
+% #1 is (mandatory) image filename; we tack on .eps extension.
+% #2 is (optional) width, #3 is (optional) height.
+% #4 is just the usual extra ignored arg for parsing this stuff.
+\def\imagexxx#1,#2,#3,#4\finish{%
+ % \epsfbox itself resets \epsf?size at each figure.
+ \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+ \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+ \epsfbox{#1.eps}%
+}
% End of control word definitions.
+
\message{and turning on texinfo input format.}
\def\openindices{%
diff --git a/eval.c b/eval.c
index aa2e8816..b3140194 100644
--- a/eval.c
+++ b/eval.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -25,8 +25,6 @@
#include "awk.h"
-#include <assert.h>
-
extern double pow P((double x, double y));
extern double modf P((double x, double *yp));
extern double fmod P((double x, double y));
@@ -566,14 +564,26 @@ register NODE *volatile tree;
break;
case Node_K_next:
+ if (in_begin_rule)
+ fatal("`next' cannot be called from a BEGIN rule");
+ else if (in_end_rule)
+ fatal("`next' cannot be called from an END rule");
+
if (in_function())
pop_fcall_stack();
+
longjmp(rule_tag, TAG_CONTINUE);
break;
case Node_K_nextfile:
+ if (in_begin_rule)
+ fatal("`nextfile' cannot be called from a BEGIN rule");
+ else if (in_end_rule)
+ fatal("`nextfile' cannot be called from an END rule");
+
if (in_function())
pop_fcall_stack();
+
do_nextfile();
break;
@@ -759,7 +769,8 @@ int iscond;
register size_t len;
char *str;
register char *dest;
- int count;
+ int alloc_count, str_count;
+ int i;
/*
* This is an efficiency hack for multiple adjacent string
@@ -773,16 +784,16 @@ int iscond;
/*
* But first, no arbitrary limits. Count the number of
* nodes and malloc the treelist and strlist arrays.
- * There will be count + 1 items to concatenate. We
+ * There will be alloc_count + 1 items to concatenate. We
* also leave room for an extra pointer at the end to
- * use as a sentinel. Thus, start count at 2.
+ * use as a sentinel. Thus, start alloc_count at 2.
*/
save_tree = tree;
- for (count = 2; tree && tree->type == Node_concat; tree = tree->lnode)
- count++;
+ for (alloc_count = 2; tree && tree->type == Node_concat; tree = tree->lnode)
+ alloc_count++;
tree = save_tree;
- emalloc(treelist, NODE **, sizeof(NODE *) * count, "tree_eval");
- emalloc(strlist, NODE **, sizeof(NODE *) * count, "tree_eval");
+ emalloc(treelist, NODE **, sizeof(NODE *) * alloc_count, "tree_eval");
+ emalloc(strlist, NODE **, sizeof(NODE *) * alloc_count, "tree_eval");
/* Now, here we go. */
treep = treelist;
@@ -795,15 +806,26 @@ int iscond;
* Now, evaluate to strings in LIFO order, accumulating
* the string length, so we can do a single malloc at the
* end.
+ *
+ * Evaluate the expressions first, then get their
+ * lengthes, in case one of the expressions has a
+ * side effect that changes one of the others.
+ * See test/nasty.awk.
*/
strp = strlist;
len = 0;
while (treep >= treelist) {
*strp = force_string(tree_eval(*treep--));
- len += (*strp)->stlen;
strp++;
}
*strp = NULL;
+
+ str_count = strp - strlist;
+ strp = strlist;
+ for (i = 0; i < str_count; i++) {
+ len += (*strp)->stlen;
+ strp++;
+ }
emalloc(str, char *, len+2, "tree_eval");
str[len] = str[len+1] = '\0'; /* for good measure */
dest = str;
@@ -1397,6 +1419,11 @@ NODE *arg_list; /* Node_expression_list of calling args. */
* r_get_lhs:
* This returns a POINTER to a node pointer. get_lhs(ptr) is the current
* value of the var, or where to store the var's new value
+ *
+ * For the special variables, don't unref their current value if it's
+ * the same as the internal copy; perhaps the current one is used in
+ * a concatenation or some other expression somewhere higher up in the
+ * call chain. Ouch.
*/
NODE **
@@ -1409,8 +1436,11 @@ Func_ptr *assign;
if (assign)
*assign = NULL; /* for safety */
- if (ptr->type == Node_param_list)
+ if (ptr->type == Node_param_list) {
+ if ((ptr->flags & FUNC) != 0)
+ fatal("can't use function name `%s' as variable or array", ptr->vname);
ptr = stack_ptr[ptr->param_cnt];
+ }
switch (ptr->type) {
case Node_var_array:
@@ -1444,26 +1474,32 @@ Func_ptr *assign;
break;
case Node_FNR:
- unref(FNR_node->var_value);
- FNR_node->var_value = make_number((AWKNUM) FNR);
+ if (FNR_node->var_value->numbr != FNR) {
+ unref(FNR_node->var_value);
+ FNR_node->var_value = make_number((AWKNUM) FNR);
+ }
aptr = &(FNR_node->var_value);
if (assign != NULL)
*assign = set_FNR;
break;
case Node_NR:
- unref(NR_node->var_value);
- NR_node->var_value = make_number((AWKNUM) NR);
+ if (NR_node->var_value->numbr != NR) {
+ unref(NR_node->var_value);
+ NR_node->var_value = make_number((AWKNUM) NR);
+ }
aptr = &(NR_node->var_value);
if (assign != NULL)
*assign = set_NR;
break;
case Node_NF:
- if (NF == -1)
- (void) get_field(HUGE-1, assign); /* parse record */
- unref(NF_node->var_value);
- NF_node->var_value = make_number((AWKNUM) NF);
+ if (NF == -1 || NF_node->var_value->numbr != NF) {
+ if (NF == -1)
+ (void) get_field(HUGE-1, assign); /* parse record */
+ unref(NF_node->var_value);
+ NF_node->var_value = make_number((AWKNUM) NF);
+ }
aptr = &(NF_node->var_value);
if (assign != NULL)
*assign = set_NF;
diff --git a/field.c b/field.c
index 31c96287..052c0c12 100644
--- a/field.c
+++ b/field.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -24,7 +24,6 @@
*/
#include "awk.h"
-#include <assert.h>
typedef void (* Setfunc) P((long, char *, long, NODE *));
@@ -63,6 +62,9 @@ int default_FS; /* TRUE when FS == " " */
Regexp *FS_regexp = NULL;
static NODE *Null_field = NULL;
+/* using_FIELDWIDTHS --- static function, macro to avoid overhead */
+#define using_FIELDWIDTHS() (parse_field == fw_parse_field)
+
/* init_fields --- set up the fields array to start with */
void
@@ -140,7 +142,6 @@ rebuild_record()
char *ops;
register char *cops;
long i;
- char *f0start, *f0end;
assert(NF != -1);
@@ -184,15 +185,27 @@ rebuild_record()
* any fields that still point into it, and have them point
* into the new field zero.
*/
- f0start = fields_arr[0]->stptr;
- f0end = fields_arr[0]->stptr + fields_arr[0]->stlen;
for (cops = ops, i = 1; i <= NF; i++) {
- char *field_data = fields_arr[i]->stptr;
-
- if (fields_arr[i]->stlen > 0
- && f0start <= field_data && field_data < f0end)
- fields_arr[i]->stptr = cops;
+ if (fields_arr[i]->stlen > 0) {
+ NODE *n;
+ getnode(n);
+
+ if ((fields_arr[i]->flags & FIELD) == 0) {
+ *n = *Null_field;
+ n->stlen = fields_arr[i]->stlen;
+ if ((fields_arr[i]->flags & (NUM|NUMBER)) != 0) {
+ n->flags |= (fields_arr[i]->flags & (NUM|NUMBER));
+ n->numbr = fields_arr[i]->numbr;
+ }
+ } else {
+ *n = *(fields_arr[i]);
+ n->flags &= ~(MALLOC|TEMP|PERM|STRING);
+ }
+ n->stptr = cops;
+ unref(fields_arr[i]);
+ fields_arr[i] = n;
+ }
cops += fields_arr[i]->stlen + ofslen;
}
@@ -751,7 +764,7 @@ NODE *tree;
arr->type = Node_var_array;
assoc_clear(arr);
- if (sep->re_flags & FS_DFLT) {
+ if ((sep->re_flags & FS_DFLT) != 0 && ! using_FIELDWIDTHS()) {
parseit = parse_field;
fs = force_string(FS_node->var_value);
rp = FS_regexp;
@@ -851,20 +864,20 @@ set_FS()
if (fields_arr != NULL)
(void) get_field(HUGE - 1, 0);
- if (save_fs && cmp_nodes(FS_node->var_value, save_fs) == 0
- && save_rs && cmp_nodes(RS_node->var_value, save_rs) == 0)
- return;
- unref(save_fs);
- save_fs = dupnode(FS_node->var_value);
- unref(save_rs);
- save_rs = dupnode(RS_node->var_value);
- resave_fs = TRUE;
- buf[0] = '\0';
- default_FS = FALSE;
- if (FS_regexp) {
- refree(FS_regexp);
- FS_regexp = NULL;
+ if (! (save_fs && cmp_nodes(FS_node->var_value, save_fs) == 0
+ && save_rs && cmp_nodes(RS_node->var_value, save_rs) == 0)) {
+ unref(save_fs);
+ save_fs = dupnode(FS_node->var_value);
+ unref(save_rs);
+ save_rs = dupnode(RS_node->var_value);
+ resave_fs = TRUE;
+ if (FS_regexp) {
+ refree(FS_regexp);
+ FS_regexp = NULL;
+ }
}
+ buf[0] = '\0';
+ default_FS = FALSE;
fs = force_string(FS_node->var_value);
if (! do_traditional && fs->stlen == 0)
parse_field = null_parse_field;
@@ -887,7 +900,7 @@ set_FS()
if (fs->stptr[0] == ' ' && fs->stlen == 1)
default_FS = TRUE;
else if (fs->stptr[0] != ' ' && fs->stlen == 1) {
- if (! IGNORECASE)
+ if (! IGNORECASE || ! isalpha(fs->stptr[0]))
parse_field = sc_parse_field;
else if (fs->stptr[0] == '\\')
/* yet another special case */
@@ -910,6 +923,5 @@ set_FS()
int
using_fieldwidths()
{
- return parse_field == fw_parse_field;
+ return using_FIELDWIDTHS();
}
-
diff --git a/gawkmisc.c b/gawkmisc.c
index 07079714..c2be751b 100644
--- a/gawkmisc.c
+++ b/gawkmisc.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991 - 97 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/io.c b/io.c
index 74d9a8d7..5000aa94 100644
--- a/io.c
+++ b/io.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1976, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -49,8 +49,6 @@
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
-#include <assert.h>
-
#if ! defined(S_ISREG) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
@@ -95,19 +93,8 @@ static int specfdopen P((IOBUF *iop, const char *name, const char *mode));
static int pidopen P((IOBUF *iop, const char *name, const char *mode));
static int useropen P((IOBUF *iop, const char *name, const char *mode));
-#if defined (MSDOS) && !defined (__GO32__)
+#if defined (HAVE_POPEN_H)
#include "popen.h"
-#define popen(c, m) os_popen(c, m)
-#define pclose(f) os_pclose(f)
-#else
-#if defined (OS2) /* OS/2, but not family mode */
-#if defined (_MSC_VER)
-#define popen(c, m) _popen(c, m)
-#define pclose(f) _pclose(f)
-#endif
-#else
-extern FILE *popen();
-#endif
#endif
static struct redirect *red_head = NULL;
@@ -125,6 +112,15 @@ extern NODE **fields_arr;
static jmp_buf filebuf; /* for do_nextfile() */
+#ifdef VMS
+/* File pointers have an extra level of indirection, and there are cases where
+ `stdin' can be null. That can crash gawk if fileno() is used as-is. */
+static int vmsrtl_fileno P((FILE *));
+static int vmsrtl_fileno(fp) FILE *fp; { return fileno(fp); }
+#undef fileno
+#define fileno(FP) (((FP) && *(FP)) ? vmsrtl_fileno(FP) : -1)
+#endif /* VMS */
+
/* do_nextfile --- implement gawk "nextfile" extension */
void
@@ -487,9 +483,10 @@ int *errflg;
/* too many files open -- close one and try again */
if (errno == EMFILE || errno == ENFILE)
close_one();
-#ifdef HAVE_MMAP
+#if defined __MINGW32__ || defined HAVE_MMAP
/* this works for solaris 2.5, not sunos */
- else if (errno == 0) /* HACK! */
+ /* it is also needed for MINGW32 */
+ else if (errno == 0) /* HACK! */
close_one();
#endif
else {
@@ -573,24 +570,22 @@ NODE *tree;
tmp = force_string(tree_eval(tree->subnode));
- /* icky special case: close(FILENAME) called. */
- if (tree->subnode == FILENAME_node
- || (tmp->stlen == FILENAME_node->var_value->stlen
- && STREQN(tmp->stptr, FILENAME_node->var_value->stptr, tmp->stlen))) {
- (void) nextfile(TRUE);
- free_temp(tmp);
- return tmp_number((AWKNUM) 0.0);
- }
-
for (rp = red_head; rp != NULL; rp = rp->next) {
if (strlen(rp->value) == tmp->stlen
&& STREQN(rp->value, tmp->stptr, tmp->stlen))
break;
}
+
if (rp == NULL) { /* no match */
- if (do_lint)
+ /* icky special case: close(FILENAME) called. */
+ if (tree->subnode == FILENAME_node
+ || (tmp->stlen == FILENAME_node->var_value->stlen
+ && STREQN(tmp->stptr, FILENAME_node->var_value->stptr, tmp->stlen))) {
+ (void) nextfile(TRUE);
+ } else if (do_lint)
warning("close: `%.*s' is not an open file or pipe",
tmp->stlen, tmp->stptr);
+
free_temp(tmp);
return tmp_number((AWKNUM) 0.0);
}
@@ -888,11 +883,11 @@ const char *name, *mode;
int i;
if (name[6] == 'g')
- sprintf(tbuf, "%d\n", getpgrp(getpgrp_arg()));
+ sprintf(tbuf, "%d\n", (int) getpgrp(getpgrp_arg()));
else if (name[6] == 'i')
- sprintf(tbuf, "%d\n", getpid());
+ sprintf(tbuf, "%d\n", (int) getpid());
else
- sprintf(tbuf, "%d\n", getppid());
+ sprintf(tbuf, "%d\n", (int) getppid());
i = strlen(tbuf);
spec_setup(iop, i, TRUE);
strcpy(iop->buf, tbuf);
@@ -923,7 +918,7 @@ const char *name, *mode;
int ngroups;
#endif
- sprintf(tbuf, "%d %d %d %d", getuid(), geteuid(), getgid(), getegid());
+ sprintf(tbuf, "%d %d %d %d", (int) getuid(), (int) geteuid(), (int) getgid(), (int) getegid());
cp = tbuf + strlen(tbuf);
#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0
@@ -1008,7 +1003,7 @@ strictopen:
if (openfd == INVALID_HANDLE)
openfd = open(name, flag, 0666);
if (openfd != INVALID_HANDLE && fstat(openfd, &buf) > 0)
- if ((buf.st_mode & S_IFMT) == S_IFDIR)
+ if (S_ISDIR(buf.st_mode))
fatal("file `%s' is a directory", name);
return iop_alloc(openfd, name, iop);
}
@@ -1120,7 +1115,7 @@ struct redirect *rp;
* except if popen() provides real pipes too
*/
-#if defined(VMS) || defined(OS2) || defined (MSDOS)
+#if defined(VMS) || defined(OS2) || defined (MSDOS) || defined(WIN32)
/* gawk_popen --- open an IOBUF on a child process */
@@ -1135,7 +1130,7 @@ struct redirect *rp;
return NULL;
rp->iop = iop_alloc(fileno(current), cmd, NULL);
if (rp->iop == NULL) {
- (void) fclose(current);
+ (void) pclose(current);
current = NULL;
}
rp->ifp = current;
@@ -1434,7 +1429,12 @@ IOBUF *iop;
iop->name = name;
iop->getrec = get_a_record;
#ifdef HAVE_MMAP
- if (S_ISREG(sbuf.st_mode) && sbuf.st_size > 0) {
+ /* Use mmap only for regular files with positive sizes.
+ The size must fit into size_t, so that mmap works correctly.
+ Also, it must fit into int, so that iop->cnt won't overflow. */
+ if (S_ISREG(sbuf.st_mode) && sbuf.st_size > 0
+ && sbuf.st_size == (size_t) sbuf.st_size
+ && sbuf.st_size == (int) sbuf.st_size) {
register char *cp;
iop->buf = iop->off = mmap((caddr_t) 0, sbuf.st_size,
@@ -1535,7 +1535,7 @@ int *errcode; /* pointer to error variable */
return EOF;
}
- if (grRS == FALSE) /* special case: RS == "" */
+ if (RS_is_null) /* special case: RS == "" */
rs = '\n';
else
rs = (char) grRS;
@@ -1648,7 +1648,7 @@ int *errcode; /* pointer to error variable */
*/
if (! do_traditional && RSre != NULL) /* regexp */
rsre = RSre;
- else if (grRS == FALSE) /* RS = "" */
+ else if (RS_is_null) /* RS = "" */
rsre = RS_null_re;
else
rsre = NULL;
@@ -1675,6 +1675,21 @@ int *errcode; /* pointer to error variable */
/* cases 1 and 2 are simple, just keep going */
if (research(rsre, start, 0, iop->end - start, TRUE) == -1
|| RESTART(rsre, start) == REEND(rsre, start)) {
+ /*
+ * Leading newlines at the beginning of the file
+ * should be ignored. Whew!
+ */
+ if (RS_is_null && *start == '\n') {
+ /*
+ * have to catch the case of a
+ * single newline at the front of
+ * the record, which the regex
+ * doesn't. gurr.
+ */
+ while (*start == '\n' && start < iop->end)
+ start++;
+ goto again;
+ }
bp = iop->end;
continue;
}
@@ -1690,8 +1705,10 @@ int *errcode; /* pointer to error variable */
/*
* Leading newlines at the beginning of the file
* should be ignored. Whew!
+ *
+ * Is this code ever executed?
*/
- if (grRS == FALSE && RESTART(rsre, start) == 0) {
+ if (RS_is_null && RESTART(rsre, start) == 0) {
start += REEND(rsre, start);
goto again;
}
@@ -1737,7 +1754,7 @@ int *errcode; /* pointer to error variable */
bstart = bp;
}
*bp = '\0';
- } else if (grRS == FALSE && iop->cnt == EOF) {
+ } else if (RS_is_null && iop->cnt == EOF) {
/*
* special case, delete trailing newlines,
* should never be more than one.
@@ -1811,7 +1828,7 @@ int *errcode; /* pointer to error variable */
return EOF;
}
- if (grRS == FALSE) /* special case: RS == "" */
+ if (RS_is_null) /* special case: RS == "" */
rs = '\n';
else
rs = (char) grRS;
@@ -1821,7 +1838,7 @@ int *errcode; /* pointer to error variable */
rs = casetable[rs];
/* if RS = "", skip leading newlines at the front of the file */
- if (grRS == FALSE && iop->off == iop->buf) {
+ if (RS_is_null && iop->off == iop->buf) {
for (bp = iop->off; *bp == '\n'; bp++)
continue;
@@ -1835,7 +1852,7 @@ int *errcode; /* pointer to error variable */
*/
if (! do_traditional && RSre != NULL) /* regexp */
rsre = RSre;
- else if (grRS == FALSE) /* RS = "" */
+ else if (RS_is_null) /* RS = "" */
rsre = RS_null_re;
else
rsre = NULL;
@@ -1862,7 +1879,7 @@ int *errcode; /* pointer to error variable */
iop->off = iop->end; /* all done with the record */
set_RT_to_null();
/* special case, don't allow trailing newlines */
- if (grRS == FALSE && *(iop->end - 1) == '\n')
+ if (RS_is_null && *(iop->end - 1) == '\n')
return iop->end - start - 1;
else
return iop->end - start;
diff --git a/main.c b/main.c
index 92445de4..4ef2eb7e 100644
--- a/main.c
+++ b/main.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -439,8 +439,8 @@ FILE *fp;
fputs("\t-W traditional\t\t--traditional\n", fp);
fputs("\t-W usage\t\t--usage\n", fp);
fputs("\t-W version\t\t--version\n", fp);
- fputs("\nReport bugs to bug-gnu-utils@prep.ai.mit.edu,\n", fp);
- fputs("with a Cc: to arnold@gnu.ai.mit.edu\n", fp);
+ fputs("\nReport bugs to bug-gnu-utils@gnu.org,\n", fp);
+ fputs("with a Cc: to arnold@gnu.org\n", fp);
exit(exitval);
}
@@ -450,7 +450,7 @@ static void
copyleft()
{
static char blurb_part1[] =
-"Copyright (C) 1989, 1991-1997 Free Software Foundation.\n\
+"Copyright (C) 1989, 1991-1999 Free Software Foundation.\n\
\n\
This program is free software; you can redistribute it and/or modify\n\
it under the terms of the GNU General Public License as published by\n\
diff --git a/missing/strftime.3 b/missing/strftime.3
index 92d25b2c..e6b270c8 100644
--- a/missing/strftime.3
+++ b/missing/strftime.3
@@ -340,7 +340,7 @@ then there may be some performance improvements by not defining
.nf
Arnold Robbins
.sp
-INTERNET: arnold@gnu.ai.mit.edu
+INTERNET: arnold@gnu.org
.fi
.SH ACKNOWLEDGEMENTS
Thanks to Geoff Clare <gwc@root.co.uk> for helping debug earlier
diff --git a/missing/strftime.c b/missing/strftime.c
index 18a6a7bf..6e6872b5 100644
--- a/missing/strftime.c
+++ b/missing/strftime.c
@@ -32,6 +32,7 @@
* Updated January, 1995
* Updated September, 1995
* Updated January, 1996
+ * Updated July, 1997
*
* Fixes from ado@elsie.nci.nih.gov
* February 1991, May 1992
@@ -43,6 +44,8 @@
* Applied September 1995
* %V code fixed (again) and %G, %g added,
* January 1996
+ * %v code fixed, better configuration
+ * July 1997
*/
#ifndef GAWK
@@ -122,7 +125,7 @@ extern char *strchr();
#if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
extern char *tzname[2];
extern int daylight;
-#ifdef SOLARIS
+#if defined(SOLARIS) || defined(mips)
extern long timezone, altzone;
#else
extern int timezone, altzone;
diff --git a/msg.c b/msg.c
index 82fa422e..c5aaa067 100644
--- a/msg.c
+++ b/msg.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
diff --git a/node.c b/node.c
index 6f10b9f3..af899b6b 100644
--- a/node.c
+++ b/node.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -36,6 +36,7 @@ register NODE *n;
char save;
char *ptr;
unsigned int newflags;
+ extern double strtod();
#ifdef DEBUG
if (n == NULL)
@@ -140,7 +141,16 @@ register NODE *s;
/* not an integral value, or out of range */
if ((val = double_to_int(s->numbr)) != s->numbr
|| val < LONG_MIN || val > LONG_MAX) {
-#ifdef GFMT_WORKAROUND
+ /*
+ * Once upon a time, if GFMT_WORKAROUND wasn't defined,
+ * we just blindly did this:
+ * sprintf(sp, format, s->numbr);
+ * s->stlen = strlen(sp);
+ * s->stfmt = (char) index;
+ * but that's no good if, e.g., OFMT is %s. So we punt,
+ * and just always format the value ourselves.
+ */
+
NODE *dummy, *r;
unsigned short oflags;
extern NODE *format_tree P((const char *, int, NODE *));
@@ -161,15 +171,6 @@ register NODE *s;
freenode(dummy); /* to keep s->stptr == r->stpr. */
goto no_malloc;
-#else
- /*
- * no need for a "replacement" formatting by gawk,
- * just use sprintf
- */
- sprintf(sp, format, s->numbr);
- s->stlen = strlen(sp);
- s->stfmt = (char) index;
-#endif /* GFMT_WORKAROUND */
} else {
/* integral value */
/* force conversion to long only once */
@@ -183,11 +184,9 @@ register NODE *s;
}
s->stfmt = -1;
}
- emalloc(s->stptr, char *, s->stlen + 2, "force_string");
+ emalloc(s->stptr, char *, s->stlen + 2, "format_val");
memcpy(s->stptr, sp, s->stlen+1);
-#ifdef GFMT_WORKAROUND
no_malloc:
-#endif /* GFMT_WORKAROUND */
s->stref = 1;
s->flags |= STR;
return s;
@@ -495,7 +494,9 @@ char **string_ptr;
}
i = 0;
for (;;) {
- if (ISXDIGIT((c = *(*string_ptr)++))) {
+ /* do outside test to avoid multiple side effects */
+ c = *(*string_ptr)++;
+ if (ISXDIGIT(c)) {
i *= 16;
if (ISDIGIT(c))
i += c - '0';
diff --git a/patchlevel.h b/patchlevel.h
index f3608240..ccb0c85f 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1 +1 @@
-#define PATCHLEVEL 3
+#define PATCHLEVEL 4
diff --git a/pc/ChangeLog b/pc/ChangeLog
index f1386886..7663bb06 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,61 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
+Sun Jun 27 12:27:00 1999 Darrel Hankerson <hankedr@mail.auburn.edu>
+
+ * Makefile, Makefile.tst, ../README_d/README.pc: finalized.
+ * include/process.h: new file
+
+Fri May 21 00:00:00 1999 Darrel Hankerson <hankedr@mail.auburn.edu>
+
+ * popen.c: MSC (on DOS/Win32) and MINGW32 now honor SHELL.
+ * io.c: MINGW32 reports errno==0 after failure in redirect();
+ assume close_one() in this case.
+ * io.c: Add HAVE_POPEN_H and let pc/config.h deal with the mess.
+ (Can't move everything to config.h because of popen define.)
+
+Sun May 9 09:12:33 1999 Darrel Hankerson <hankedr@mail.auburn.edu>
+
+ * Add 1999-04-30 changes from Eli Zaretskii <eliz@is.elta.co.il>
+ 1. Makefile (TAGS, tags): New targets.
+ 2. Makefile.tst (regtes): Pass the value of $CMP to the
+ regtest script.
+
+Thu Nov 18 03:48:32 1998 Scott Deifik <scottd@amgen.com>
+
+ * Readme.pc: More LFN-based comments.
+
+Thu Nov 12 21:01:24 1998 Darrel Hankerson <hankedr@mail.auburn.edu>
+
+ * mingw32 target added with corresponding minor changes to getid.c,
+ io.c, and config.h.
+
+ * vcWin32 needed popen defines in config.h which were inadvertently
+ omitted from 3.0.3.
+
+ * README.pc updated to clarify the procedure for building
+ non-LFN versions on LFN systems, and to note that Win32 gawk
+ may require Win32 utilities.
+
+ * emxbnd target modified to accomodate older versions of emx.
+
+Thu Nov 08 09:11:44 1998 Scott Deifik <scottd@amgen.com>
+
+ * pc/Makefile: Stack reduced again for 16bit MSC versions.
+
+ * pc/Makefile.tst: Updated to keep in sync with new
+ test/Makefile.in. In addition, made to work in Windows 9x
+ with non-LFN tools.
+
+Wed Nov 4 11:32:24 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.41: Release tar file made.
+
+Thu Oct 8 19:36:57 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * BETA Release 3.0.40: Release tar file made.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/pc/Makefile b/pc/Makefile
index b7fe1e43..8aeede86 100644
--- a/pc/Makefile
+++ b/pc/Makefile
@@ -1,8 +1,9 @@
-# Makefile for gawk (GNU awk) 2 Jan 1997
+# Makefile for gawk (GNU awk) 31 Oct 1998
#
# - for GNU C (djgpp) [32bit executable for DOS]
# - for GNU C (emx) [32bit executable for OS/2 or DOS or Win32]
-# - for MS-Visual C/C++ 4.x [Win32 executable for Windows 95 & NT]
+# - for GNU C (mingw32) [Win32 executable for Windows 9x/NT]
+# - for MS-Visual C/C++ 4.x [Win32 executable for Windows 9x/NT]
# - for Microsoft C 7 [16bit ececutable for DOS]
# - for Microsoft C 6.00A [16bit executable for OS/2 or DOS]
@@ -19,6 +20,7 @@ default:
@echo " emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] "
@echo " emxnt ... NT exe [emx/gcc with RSXNT] "
@echo " emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc] "
+ @echo " mingw32 . Win32 exe [Mingw32 GNU C] "
@echo " msc ..... DOS exe [Microsoft C 7 & 8 (AKA 1.52)] "
@echo " msc6 .... DOS exe [Microsoft C 6.00a] "
@echo " msc6os2 . OS/2 exe [Microsoft C 6.00a] "
@@ -86,7 +88,6 @@ DO_BIND= $($(BIND))
# End of general configuration. Some platform-specific configuration
# notes appear below.
-
#========================================================================
#========================== DJGPP =======================================
#========================================================================
@@ -125,8 +126,12 @@ LEMX = $(CC) $(LF) -o $@ $(GAWKOBJS) gawk.def -lbsd $(LF2)
# Link and bind for DOS and OS/2 versions.
# emx-09 needs '-p' emx option here or in EMXOPT environ var.
-LEMXBND = $(CC) $(LF) -o a.out $(LDRSP) gawk.def -lbsd $(LF2)
-BEMX = emxbind -bs -o $@ a.out -p
+# The following works with 0.9a or newer
+LEMXBND = $(CC) $(LF) -o gawk $(LDRSP) gawk.def -lbsd $(LF2)
+BEMX = emxbind -bs gawk -p
+# The following works with 0.9c or newer
+#LEMXBND = $(CC) $(LF) -o a.out $(LDRSP) gawk.def -lbsd $(LF2)
+#BEMX = emxbind -bs -o $@ a.out -p
#BEMX = emxbind -bs /emx/bin/emx.exe a.out $@ -p
BEMXD = emxbind -b -o $@ a.out -p
@@ -153,6 +158,19 @@ emxbnd-debug:
BIND=BEMXD "P=|tr \" \" \"\n\""
#========================================================================
+#========================== MINGW32 =====================================
+#========================================================================
+
+LMINGW32 = $(CC) $(LF) -o $@ $(GAWKOBJS) $(LF2)
+# The following might work around command-line length limitations:
+#LMINGW32 = $(CC) $(LF) -o $@ *.o $(LF2)
+
+mingw32:
+ $(MAK) all \
+ CC=gcc O=.o CF=-O OBJ=popen.o \
+ LNK=LMINGW32 LF=-s RSP=
+
+#========================================================================
#========================== MSC =========================================
#========================================================================
@@ -174,7 +192,7 @@ MSCLIB = llibce
MSCCL = -FPi
#MSCCL = -FPc
-LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x5420,nul
+LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x5270,nul
# CLMSC-linking works when building under OS/2
CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00
@@ -235,12 +253,13 @@ Lmsc6bnd = $(LMSC) # for broken makes (nmake) which cannot expand $($X)
Bmsc6bnd = $(BMSC)
-# Windows '95 / NT
+# Windows '9x / NT
LvcWin32 = link -nologo -subsystem:console -release -out:$@ $(LNKRSP)
vcWin32:
$(MAK) all \
"CC=cl -nologo" O=.obj "CF=-o2 -DWIN32 -D__STDC__=0" \
+ OBJ=popen.obj \
LNK=LvcWin32
@@ -338,7 +357,7 @@ install2:
gawk -v prefix=$(prefix) -f install.awk
clean:
- rm -rf gawk gawk.exe *.o *.obj core a.out $(RSPFILE)
+ rm -rf gawk gawk.exe gawk.map *.o *.obj core a.out $(RSPFILE)
# cd doc && $(MAKE) clean
# cd test && $(MAKE) clean
# cd awklib && $(MAKE) clean
@@ -352,7 +371,14 @@ check:
@echo "recommendation is to copy pc/Makefile.tst to test/Makefile. Under"
@echo "DOS, it may be necessary to run make from the test directory."
# The `-k' option to make should be unnecessary if using pc/Makefile.tst.
-# sh -c "cd test && $(MAK) -k AWK=../gawk.exe"
- sh -c "cd test && $(MAK) AWK=../gawk.exe bigtest extra"
+ sh -c "cd test && $(MAK) -k AWK=../gawk.exe"
+# sh -c "cd test && $(MAK) AWK=../gawk.exe bigtest extra"
test: check
+
+# for those who have the necessary tools:
+TAGS:
+ etags awk.h *.y custom.h *.c *.h
+
+tags:
+ ctags awk.h *.y custom.h *.c *.h
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index f530a300..14166958 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -1,6 +1,6 @@
# Makefile for GNU Awk test suite.
#
-# Copyright (C) 1988-1997 the Free Software Foundation, Inc.
+# Copyright (C) 1988-1999 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -70,7 +70,7 @@
# Using EMXSHELL=/bin/sh with emx versions can exhaust lower mem.
# Lower mem can also be exhausted on some of the tests even with MSC gawk.
# The .SWAP setting forces (DOS-only) dmake to swap itself out.
-.SWAP: childin fflush getlnhd tweakfld pipeio1
+.SWAP: childin fflush getlnhd tweakfld pipeio1 pipeio2
# This won't work unless you have "sh" and set SHELL equal to it (Make 3.74
# or later which comes with DJGPP will work with SHELL=/bin/sh if you have
@@ -83,15 +83,27 @@ AWK = ../gawk.exe
# Set your cmp command here (you can use most versions of diff instead of cmp
# if you don't want to convert the .ok files to the DOS CR/LF format).
+#
+# The following comment is for users of OSs which support long file names
+# (such as Windows 95) for all versions of gawk (both 16 & 32-bit).
+# If you use a shell which doesn't support long filenames, temporary files
+# created by this makefile will be truncated by your shell. "_argarra" is an
+# example of this. If $(CMP) is a DJGPP-compiled program, then it will fail
+# because it looks for the long filename (eg. _argarray). To fix this, you
+# need to set LFN=n in your shell's environment.
+# NOTE: Setting LFN in the makefile most probably won't help you because LFN
+# needs to be an environment variable.
#CMP = cmp
+# See the comment above for why you might want to set CMP to "env LFN=n diff"
+CMP = env LFN=n diff
CMP = diff
#CMP = diff -c
#CMP = gcmp
-# Set your "cp" and "mkdir" commands here. Note: cp must take forward
+# Set your "cp" and "mkdir" commands here. Note: cp must take forward
# slashes. Using "command -c" may work for MS-DOS with Stewartson's shell
# (but not bash) if "command=noexpand switch export" is set in extend.lst.
-# `true &&' is needed to force DJGPP Make to call the shell, or else the
+# `true &&' is needed to force DJGPP Make to call the shell, or else the
# conversion of `command -c' won't work.
CP = cp
#CP = true && command -c copy
@@ -120,21 +132,26 @@ basic: msg swaplns messages argarray longwrds \
sprintfc backgsub tweakfld clsflnam mmap8k fnarray \
dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \
back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \
- noparms funstack clobber delarprm prdupval
+ noparms funstack delarprm prdupval nasty zeroflag \
+ getnr2tm getnr2tb
+
+# clobber removed
unix-tests: poundba fflush getlnhd pipeio1 pipeio2 strftlng pid
gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \
- badargs strftime gensub gnureops reint nondec
+ badargs strftime gensub gnureops reint
+# add this back for 3.1
+# nondec
extra: regtes inftest
poundba::
# The need for "basename" has been removed for MS-DOS & OS/2 systems which
# lack it.
-# cp $(AWK) /tmp/gawk && $(srcdir)/poundbang $(srcdir)/poundbang >_`basename $@`
+# @cp $(AWK) /tmp/gawk && $(srcdir)/poundbang $(srcdir)/poundbang >_`basename $@`
$(CP) $(AWK) /tmp/gawk.exe && $(srcdir)/poundbang $(srcdir)/poundbang >_$@
-# rm -f /tmp/gawk
+# @rm -f /tmp/gawk
rm -f /tmp/gawk.exe
# $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@`
$(CMP) $(srcdir)/poundbang.ok _$@ && rm -f _$@
@@ -153,8 +170,12 @@ swaplns::
messages::
@echo 'If messages fails, set sh to swap to disk only (in sh.rc).'
@$(AWK) -f $(srcdir)/messages.awk >out2 2>out3
-# { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3; } || { test -d /dev/fd && echo IT IS OK THAT THIS TEST FAILED; }
- { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3; } || { test -d /dev/fd && echo OK TEST FAILED; }
+# { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && \
+# $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3; } || \
+# { { test -d /dev/fd || test -d /proc/self/fd; } && \
+# echo IT IS OK THAT THIS TEST FAILED; }
+ { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && \
+ $(CMP) $(srcdir)/out3.ok out3; } || test -d /dev/fd
rm -f out1 out2 out3
argarray::
@@ -163,6 +184,10 @@ argarray::
*) cp $(srcdir)/argarray.in . ;; \
esac
@TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@
+ @echo 'If argarray fails, set try setting LFN=n in your environment'
+ @echo "before running make. If that still doesn't work, read the"
+ @echo 'the comment in this makefile about setting CMP for information'
+ @echo 'about what may be happenning.'
$(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@
fstabplus::
@@ -193,7 +218,7 @@ regtes::
@echo 'Some of the output from regtest is very system specific, do not'
@echo 'be distressed if your output differs from that distributed.'
@echo 'Manual inspection is called for.'
- AWK=`pwd`/$(AWK) $(srcdir)/regtest
+ AWK=`pwd`/$(AWK) CMP="$(CMP)" $(srcdir)/regtest
posix::
@echo 'posix test may fail due to 1.500000e+000 not being equal to'
@@ -213,8 +238,8 @@ manyfiles::
@echo 'without quoting the "junk/*" argument.'
# @echo "This number better be 1 ->" | tr -d '\012'
@echo "This number better be 1 ->" | tr -d '\012\015'
-# @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l
- @wc -l "junk/*" | $(AWK) '$$1 != 2' | wc -l
+ @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l
+# @wc -l "junk/*" | $(AWK) '$$1 != 2' | wc -l
# The quotes above are for people with a "wc" that doesn't support sh's "@"
# argument passing.
@rm -rf junk _$@
@@ -322,10 +347,10 @@ nofmtch::
strftime::
: this test could fail on slow machines or on a second boundary,
: so if it does, double check the actual results
-# @LC_ALL=C; export LC_ALL; LANC=C; export LANG; \
+# @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \
# date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \
# This was changed for DOS to avoid the command-line length limit.
- @LC_ALL=C; export LC_ALL; LANC=C; export LANG; $(DATE) > strf
+ @LC_ALL=C; export LC_ALL; LANG=C; export LANG; $(DATE) > strf
@cat strf | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \
print > "strftime.ok" ; \
print strftime() > "'_$@'" }'
@@ -414,15 +439,15 @@ sprintfc::
$(CMP) $(srcdir)/sprintfc.ok _$@ && rm -f _$@
getlnhd::
-# We need to set COMSPEC to a UNIX-like shell for the here doc in getlnhd.awk
-# to work.
-# @$(AWK) -f $(srcdir)/getlnhd.awk >_$@
@echo 'Getlnhd is set to ignore errors. However, there should not be any.'
@echo 'If getlnhd fails, set sh to swap to disk only (in sh.rc).'
@echo 'If it still hangs with EMX gawk type ^C, then try the test when'
@echo 'not using DPMI and RSX (in particular, run outside MS-Windows).'
@echo 'If it fails with MSC, run make from the test directory.'
- COMSPEC=$(SHELL) $(AWK) -f $(srcdir)/getlnhd.awk >_$@
+# In 3.0.3, COMSPEC=$(SHELL) was used for MSC and MINGW32 which do
+# not honor SHELL.
+# COMSPEC=$(SHELL) $(AWK) -f $(srcdir)/getlnhd.awk >_$@
+ @$(AWK) -f $(srcdir)/getlnhd.awk >_$@
-$(CMP) $(srcdir)/getlnhd.ok _$@ && rm -f _$@
backgsub::
@@ -509,8 +534,11 @@ pid::
strftlng::
@echo 'Edit test/Makefile if you use MSC6, since strftlng will fail.'
@TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@
+# @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \
+# TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \
+# fi
@if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \
- TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \
+ env TZ=UTC0; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \
fi
$(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@
@@ -547,6 +575,8 @@ pipeio1::
pipeio2::
# This would fail were it not for the "cat" line due to DOS's ECHO command.
@echo 'pipeio may fail due to the way that your tr & echo work in DOS'
+ @echo 'You may also need to set tr=noexpand switch if you use'
+ @echo "Stewartson's sh."
@$(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@
@cat _$@ | $(AWK) '{ sub("ECHO is.*","",$$0); print $$0 } ' > _$@.2
# $(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@
@@ -554,12 +584,15 @@ pipeio2::
funstack::
@echo 'Expect funstack to fail with MSC DOS versions.'
- -@$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@ && $(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@
+# @$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@
+ @-$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@
+# $(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@
+ -$(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@
clobber::
- @$(AWK) -f $(srcdir)/clobber.awk >_$@
- $(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@
- @rm -f seq
+# @$(AWK) -f $(srcdir)/clobber.awk >_$@
+# $(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@
+# @rm -f seq
delarprm::
@$(AWK) -f $(srcdir)/delarprm.awk >_$@
@@ -570,16 +603,29 @@ prdupval::
$(CMP) $(srcdir)/prdupval.ok _$@ && rm -f _$@
nondec::
-# This was changed for DOS to avoid the command-line length limit.
-# @if grep BITOP ../config.h | grep define > /dev/null; \
-# then \
-# $(AWK) -f $(srcdir)/nondec.awk >_$@; \
-# else \
-# cp $(srcdir)/nondec.ok _$@; \
-# fi
- @echo "Don't worry if nondec fails"
- $(AWK) -f $(srcdir)/nondec.awk >_$@;
- -$(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@
+ @if grep BITOP ../config.h | grep define > /dev/null; \
+ then \
+ $(AWK) -f $(srcdir)/nondec.awk >_$@; \
+ else \
+ cp $(srcdir)/nondec.ok _$@; \
+ fi
+ $(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@
+
+nasty::
+ @$(AWK) -f $(srcdir)/nasty.awk >_$@
+ $(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@
+
+zeroflag::
+ @$(AWK) -f $(srcdir)/zeroflag.awk >_$@
+ $(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@
+
+getnr2tm::
+ @$(AWK) -f $(srcdir)/getnr2tm.awk $(srcdir)/getnr2tm.in >_$@
+ $(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@
+
+getnr2tb::
+ @$(AWK) -f $(srcdir)/getnr2tb.awk $(srcdir)/getnr2tb.in >_$@
+ $(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@
clean:
rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~
diff --git a/pc/config.h b/pc/config.h
index 7140ac80..fa0abf51 100644
--- a/pc/config.h
+++ b/pc/config.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 1995-1997 the Free Software Foundation, Inc.
+ * Copyright (C) 1995-1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Progamming Language.
@@ -128,8 +128,8 @@
#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */
#define SPRINTF_RET int /* return type of sprintf */
-/* #define BITOPS 1 */ /* bitwise ops (undocumented feature) */
-/* #define NONDECDATA 1 */ /* non-decimal input data (undocumented feature) */
+/* #undef BITOPS */ /* bitwise ops (undocumented feature) */
+/* #undef NONDECDATA */ /* non-decimal input data (undocumented feature) */
/* Define if you have the fmod function. */
#define HAVE_FMOD 1
@@ -206,6 +206,12 @@ void * alloca(unsigned);
#endif
#endif
+# define HAVE_POPEN_H
+
+#if (defined(_MSC_VER) && defined(MSDOS)) || defined(__MINGW32__)
+# define system(s) os_system(s)
+#endif
+
#if defined (_MSC_VER) || defined(__EMX__)
#define strcasecmp stricmp
#define strncasecmp strnicmp
@@ -213,8 +219,19 @@ void * alloca(unsigned);
#if defined(DJGPP)
# define HAVE_LIMITS_H
+# undef HAVE_POPEN_H
#endif
#if defined(__WIN32__) && defined(__CRTRSXNT__)
#include <crtrsxnt.h>
#endif
+
+/* For vcWin32 */
+#if defined(WIN32) && defined(_MSC_VER)
+#define alloca _alloca
+#define system(s) os_system(s)
+#endif
+
+#if defined(__MINGW32__)
+#undef HAVE_SYS_PARAM_H
+#endif
diff --git a/pc/getid.c b/pc/getid.c
index 20cec884..82cfd6cb 100644
--- a/pc/getid.c
+++ b/pc/getid.c
@@ -1,4 +1,4 @@
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#ifdef OS2
# define INCL_DOSPROCESS
@@ -47,7 +47,7 @@ int getpgrp(void)
return (0);
}
-#if defined(_MSC_VER) || defined(__GO32__)
+#if defined(_MSC_VER) || defined(__GO32__) || defined(__MINGW32__)
int getppid(void)
{
#ifdef OS2
diff --git a/pc/include/process.h b/pc/include/process.h
new file mode 100644
index 00000000..f511d5f7
--- /dev/null
+++ b/pc/include/process.h
@@ -0,0 +1,3 @@
+#undef __STDC__
+#include <process.h>
+#define __STDC__ 1
diff --git a/pc/popen.c b/pc/popen.c
index c2eca24d..88de3e29 100644
--- a/pc/popen.c
+++ b/pc/popen.c
@@ -1,4 +1,4 @@
-#include "popen.h"
+#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <string.h>
@@ -11,6 +11,11 @@
#endif
#endif
+#if defined(WIN32) && defined(_MSC_VER)
+#define popen _popen
+#define pclose _pclose
+#endif
+
#ifndef _NFILE
#define _NFILE 40
#endif
@@ -24,6 +29,121 @@ struct {
pipemode pmode;
} pipes[_NFILE];
+
+/*
+ * For systems where system() and popen() do not follow SHELL:
+ * 1. Write command to temp file. Temp filename must have slashes
+ * compatible with SHELL (if set) or COMSPEC.
+ * 2. Convert slashes in SHELL (if present) to be compatible with COMSPEC.
+ * Currently, only MSC (running under DOS) and MINGW versions are managed.
+ */
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+
+static int
+unixshell(p)
+char *p;
+{
+ static char *shell[] = {"sh", "bash", "csh", "tcsh", "sh32", "sh16", "ksh", NULL};
+ char **shellp = shell, *s, *q;
+
+ if (p == NULL) return (0);
+ s = p = strdup(p);
+ if ((q = strrchr(p, '\\')) != NULL)
+ p = q + 1;
+ if ((q = strrchr(p, '/')) != NULL)
+ p = q + 1;
+ if ((q = strchr(p, '.')) != NULL)
+ *q = '\0';
+ strlwr(p);
+ do {
+ if (strcmp(*shellp, p) == 0) break;
+ } while (*++shellp);
+ free(s);
+ return(*shellp ? 1 : 0);
+}
+
+static char *
+slashify(p, s)
+char *p, *s;
+{
+ if (unixshell(s))
+ while (s = strchr(p, '\\')) *s = '/';
+ else
+ while (s = strchr(p, '/')) *s = '\\';
+ return(p);
+}
+
+static char *
+scriptify(command)
+char *command;
+{
+ FILE *fp;
+ char *cmd, *name, *s, *p;
+ int i;
+
+ if((name = tempnam(".", "pip")) == NULL) return(NULL);
+ p = getenv("COMSPEC"); s = getenv("SHELL");
+ cmd = malloc(strlen(name) + (s ? strlen(s) : 0) + 9); *cmd = '\0';
+ if (s) {
+ slashify(strcpy(cmd, s), p);
+ p = s;
+ }
+ slashify(name, p);
+ if (! unixshell(p)) {
+ realloc(name, strlen(name) + 5);
+ strcat(name, ".bat");
+ }
+ if (s) sprintf(cmd + strlen(cmd), " %cc ", unixshell(s) ? '-' : '/');
+ strcpy(p = cmd + strlen(cmd), name); free(name);
+
+ i = strlen(command);
+ if ( ((fp = fopen(p, "wb")) == NULL) || (fwrite(command, 1, i, fp) < i)
+ || (fputc('\n', fp) == EOF)) {
+ cmd = NULL;
+ }
+ if (fp) fclose(fp);
+ return(cmd);
+}
+
+static void
+unlink_and_free(cmd)
+char *cmd;
+{
+ char *s;
+
+ if (s = strrchr(cmd, ' '))
+ s++;
+ else
+ s = cmd;
+ unlink(s); free(cmd);
+}
+
+int
+os_system(cmd)
+char *cmd;
+{
+ char *s;
+ int i;
+
+#if defined(OS2)
+ if (_osmode == OS2_MODE)
+ return(system(cmd));
+#endif
+
+ if ((cmd = scriptify(cmd)) == NULL) return(1);
+ if (s = getenv("SHELL"))
+ i = spawnlp(P_WAIT, s, s, cmd + strlen(s), NULL);
+ else
+ i = system(cmd);
+ unlink_and_free(cmd);
+ return(i);
+}
+#else
+#define os_system(cmd) system(cmd)
+#endif
+
+
FILE *
os_popen( char *command, char *mode ) {
FILE *current;
@@ -45,6 +165,15 @@ os_popen( char *command, char *mode ) {
curmode = writing;
else
return NULL;
+
+#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32))
+ current = popen(command = scriptify(command), mode);
+ cur = fileno(current);
+ pipes[cur].pmode = curmode;
+ pipes[cur].command = command;
+ return(current);
+#endif
+
/*
** get a name to use.
*/
@@ -55,11 +184,12 @@ os_popen( char *command, char *mode ) {
** output.
*/
if(curmode == reading) {
+ FILE *fp;
if ((cur = dup(fileno(stdout))) == -1)
return NULL;
if ((current = freopen(name, "w", stdout)) == NULL)
return NULL;
- system(command);
+ os_system(command);
if (dup2(cur, fileno(stdout)) == -1)
return NULL;
close(cur);
@@ -85,6 +215,13 @@ os_pclose( FILE * current) {
return(pclose(current));
#endif
+#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32))
+ rval = pclose(current);
+ pipes[cur].pmode = unopened;
+ unlink_and_free(pipes[cur].command);
+ return rval;
+#endif
+
/*
** check for an open file.
*/
@@ -106,7 +243,7 @@ os_pclose( FILE * current) {
rval = -1;
if ((fd = dup(fileno(stdin))) != -1) {
if (current = freopen(pipes[cur].name, "r", stdin)) {
- rval = system(pipes[cur].command);
+ rval = os_system(pipes[cur].command);
fclose(current);
if (dup2(fd, fileno(stdin)) == -1) rval = -1;
close(fd);
diff --git a/pc/popen.h b/pc/popen.h
index e8cd1b9b..3735f455 100644
--- a/pc/popen.h
+++ b/pc/popen.h
@@ -1,9 +1,21 @@
-/*
-** popen.h -- prototypes for pipe functions
-*/
-#if !defined(FILE)
-#include <stdio.h>
-#endif
-
-extern FILE *os_popen( char *, char * );
-extern int os_pclose( FILE * );
+/*
+** popen.h -- prototypes for pipe functions
+*/
+
+#if defined (OS2) && !defined(MSDOS) /* OS/2, but not family mode */
+# if defined (_MSC_VER)
+# define popen(c, m) _popen(c, m)
+# define pclose(f) _pclose(f)
+# endif
+#else
+# if !defined (__GO32__)
+# if defined (popen)
+# undef popen
+# undef pclose
+# endif
+# define popen(c, m) os_popen(c, m)
+# define pclose(f) os_pclose(f)
+ extern FILE *os_popen( char *, char * );
+ extern int os_pclose( FILE * );
+# endif
+#endif
diff --git a/posix/ChangeLog b/posix/ChangeLog
index 575baa17..00c39a47 100644
--- a/posix/ChangeLog
+++ b/posix/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/regex.c b/regex.c
index 221c9b5d..c83615d1 100644
--- a/regex.c
+++ b/regex.c
@@ -3,7 +3,7 @@
(Implements POSIX draft P1003.2/D11.2, except for some of the
internationalization features.)
- Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1993,1994,1995,1996,1997,1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -124,15 +124,15 @@ char *realloc ();
#define SWITCH_ENUM_CAST(x) (x)
#endif
+/* How many characters in the character set. */
+#define CHAR_SET_SIZE 256
+
#ifdef SYNTAX_TABLE
extern char *re_syntax_table;
#else /* not SYNTAX_TABLE */
-/* How many characters in the character set. */
-#define CHAR_SET_SIZE 256
-
static char re_syntax_table[CHAR_SET_SIZE];
static void
@@ -3077,8 +3077,6 @@ re_compile_fastmap (bufp)
#ifndef REGEX_MALLOC
char *destination;
#endif
- /* We don't push any register information onto the failure stack. */
- unsigned num_regs = 0;
register char *fastmap = bufp->fastmap;
unsigned char *pattern = bufp->buffer;
@@ -5511,6 +5509,9 @@ re_exec (s)
It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for
the return codes and their meanings.) */
+#ifdef __APPLE__
+__private_extern__
+#endif
int
regcomp (preg, pattern, cflags)
regex_t *preg;
@@ -5589,6 +5590,9 @@ regcomp (preg, pattern, cflags)
We return 0 if we find a match and REG_NOMATCH if not. */
+#ifdef __APPLE__
+__private_extern__
+#endif
int
regexec (preg, string, nmatch, pmatch, eflags)
const regex_t *preg;
@@ -5694,6 +5698,9 @@ regerror (errcode, preg, errbuf, errbuf_size)
/* Free dynamically allocated space used by PREG. */
+#ifdef __APPLE__
+__private_extern__
+#endif
void
regfree (preg)
regex_t *preg;
diff --git a/stamp-h.in b/stamp-h.in
index 518d8dc5..763a3356 100644
--- a/stamp-h.in
+++ b/stamp-h.in
@@ -1 +1 @@
-Tue May 13 20:58:45 EDT 1997
+Wed Jun 9 11:37:17 IDT 1999
diff --git a/test/ChangeLog b/test/ChangeLog
index 8efafaad..7d7aeb84 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,47 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
+Tue May 25 16:37:50 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (printf1): new test case.
+ * printf1.awk, printf1.ok: new files.
+
+Wed May 19 15:32:09 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * reg/*: moved exp and log tests to new `Obsolete' directory; they
+ would only succeed under SunOS 4.x.
+
+Mon May 3 11:53:33 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (gawk.extensions): removed `nondec' until the
+ associated features get documented in 3.1.
+
+Tue Nov 3 16:46:39 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (getnr2tm, getnr2tb): new test cases.
+ * getnr2tm.awk, getnr2tm.in, getnr2tm.ok: new files.
+ * getnr2tb.awk, getnr2tb.in, getnr2tb.ok: new files.
+
+Sun Nov 1 13:20:08 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (zeroflag): new test case.
+ * zeroflag.awk, zeroflag.ok: new files
+
+Wed Oct 28 18:44:19 1998 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (nasty): new test case.
+ * nasty.awk, nasty.ok: new files
+
+Sun Nov 16 20:08:59 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * gsubtest.awk, gsubtest.ok: fix for count of matches in gsub
+ from Geert.Debyser@esat.kuleuven.ac.be.
+
+Sun Nov 16 19:54:50 1997 Arnold D. Robbins <arnold@gnu.org>
+
+ * Makefile.in (strftime): fix a typo (LANC -> LANG).
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/test/Makefile.in b/test/Makefile.in
index 07d0cbcf..0a4ad8c3 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for GNU Awk test suite.
#
-# Copyright (C) 1988-1997 the Free Software Foundation, Inc.
+# Copyright (C) 1988-1998 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -37,12 +37,15 @@ basic: msg swaplns messages argarray longwrds \
sprintfc backgsub tweakfld clsflnam mmap8k fnarray \
dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \
back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \
- noparms funstack clobber delarprm prdupval
+ noparms funstack clobber delarprm prdupval nasty zeroflag \
+ getnr2tm getnr2tb printf1
unix-tests: poundbang fflush getlnhd pipeio1 pipeio2 strftlng pid
gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \
- badargs strftime gensub gnureops reint nondec
+ badargs strftime gensub gnureops reint
+# add this back for 3.1
+# nondec
extra: regtest inftest
@@ -211,7 +214,7 @@ nofmtch::
strftime::
: this test could fail on slow machines or on a second boundary,
: so if it does, double check the actual results
- @LC_ALL=C; export LC_ALL; LANC=C; export LANG; \
+ @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \
date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \
print > "strftime.ok" ; \
print strftime() > "'_$@'" }'
@@ -442,6 +445,26 @@ nondec::
fi
$(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@
+nasty::
+ @$(AWK) -f $(srcdir)/nasty.awk >_$@
+ $(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@
+
+zeroflag::
+ @$(AWK) -f $(srcdir)/zeroflag.awk >_$@
+ $(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@
+
+getnr2tm::
+ @$(AWK) -f $(srcdir)/getnr2tm.awk $(srcdir)/getnr2tm.in >_$@
+ $(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@
+
+getnr2tb::
+ @$(AWK) -f $(srcdir)/getnr2tb.awk $(srcdir)/getnr2tb.in >_$@
+ $(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@
+
+printf1::
+ @$(AWK) -f $(srcdir)/printf1.awk >_$@
+ $(CMP) $(srcdir)/printf1.ok _$@ && rm -f _$@
+
clean:
rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~
diff --git a/test/badargs.ok b/test/badargs.ok
index c89e520f..2278702c 100644
--- a/test/badargs.ok
+++ b/test/badargs.ok
@@ -19,5 +19,5 @@ POSIX options: GNU long options:
-W usage --usage
-W version --version
-Report bugs to bug-gnu-utils@prep.ai.mit.edu,
-with a Cc: to arnold@gnu.ai.mit.edu
+Report bugs to bug-gnu-utils@gnu.org,
+with a Cc: to arnold@gnu.org
diff --git a/test/getnr2tb.awk b/test/getnr2tb.awk
new file mode 100644
index 00000000..204acf46
--- /dev/null
+++ b/test/getnr2tb.awk
@@ -0,0 +1,111 @@
+#From vp@dmat.uevora.pt Thu Jun 18 09:10 EDT 1998
+#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id JAA23649 for <arnold@mathcs.emory.edu>; Thu, 18 Jun 1998 09:10:54 -0400 (EDT)
+#Received: from khromeleque.dmat.uevora.pt by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id JAA21732 for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 09:11:19 -0400
+#Received: from khromeleque.dmat.uevora.pt (vp@localhost [127.0.0.1])
+# by khromeleque.dmat.uevora.pt (8.8.8/8.8.8/Debian/GNU) with ESMTP id OAA11817
+# for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 14:13:57 +0100
+#Message-Id: <199806181313.OAA11817@khromeleque.dmat.uevora.pt>
+#To: arnold@gnu.org
+#Subject: concatenation bug in gawk 3.0.3
+#Date: Thu, 18 Jun 1998 14:13:57 +0200
+#From: Vasco Pedro <vp@dmat.uevora.pt>
+#Content-Type: text
+#Content-Length: 2285
+#Status: RO
+#
+#Hi,
+#
+#The gawk program '{print NR " " 10/NR}' will print:
+#
+#1 10
+#5 5
+#3 3.33333
+#2 2.5
+#2 2
+#1 1.66667
+#
+#instead of the correct:
+#
+#1 10
+#2 5
+#3 3.33333
+#4 2.5
+#5 2
+#6 1.66667
+#
+#You'll notice, on the incorrect output, that the first column is
+#the first digit of the second.
+#
+#I think the problem comes from the way builtin variables are handled.
+#Since the items to be concatenated are processed in reverse order and
+#the return value of tree_eval(``NR'') is a pointer to the value part
+#of `NR_node', the `unref()' of `NR_node' due to its second occurrence
+#will leave a dangling pointer in `strlist'. The reason that it doesn't
+#reuse the freed space with objects of the same type. (Using Electric
+#Fence with EF_PROTECT_FREE set confirms that freed space is being
+#accessed.)
+#
+#The enclosed patch (hack would be a better word to describe it) is
+#all I could come up with. With it installed, things seem to work ok,
+#but I doubt this is the correct way to do it. (If I treated the
+#case for `Node_field_spec' as the I did others, `make check' would
+#fail in several places.)
+#
+#Regards,
+#vasco
+#
+#*** eval.c~ Tue May 6 21:39:55 1997
+#--- eval.c Thu Jun 18 13:39:25 1998
+#***************
+#*** 685,697 ****
+# return func_call(tree->rnode, tree->lnode);
+#
+# /* unary operations */
+# case Node_NR:
+# case Node_FNR:
+# case Node_NF:
+# case Node_FIELDWIDTHS:
+# case Node_FS:
+# case Node_RS:
+#- case Node_field_spec:
+# case Node_subscript:
+# case Node_IGNORECASE:
+# case Node_OFS:
+#--- 685,700 ----
+# return func_call(tree->rnode, tree->lnode);
+#
+# /* unary operations */
+#+ case Node_field_spec:
+#+ lhs = get_lhs(tree, (Func_ptr *) NULL);
+#+ return *lhs;
+#+
+# case Node_NR:
+# case Node_FNR:
+# case Node_NF:
+# case Node_FIELDWIDTHS:
+# case Node_FS:
+# case Node_RS:
+# case Node_subscript:
+# case Node_IGNORECASE:
+# case Node_OFS:
+#***************
+#*** 699,705 ****
+# case Node_OFMT:
+# case Node_CONVFMT:
+# lhs = get_lhs(tree, (Func_ptr *) NULL);
+#! return *lhs;
+#
+# case Node_var_array:
+# fatal("attempt to use array `%s' in a scalar context",
+#--- 702,710 ----
+# case Node_OFMT:
+# case Node_CONVFMT:
+# lhs = get_lhs(tree, (Func_ptr *) NULL);
+#! r = dupnode(*lhs);
+#! r->flags |= TEMP;
+#! return r;
+#
+# case Node_var_array:
+# fatal("attempt to use array `%s' in a scalar context",
+#
+{ print NR " " 10/NR }
diff --git a/test/getnr2tb.in b/test/getnr2tb.in
new file mode 100644
index 00000000..f9858572
--- /dev/null
+++ b/test/getnr2tb.in
@@ -0,0 +1,6 @@
+line 1
+line 2
+line 3
+line 4
+line 5
+line 6
diff --git a/test/getnr2tb.ok b/test/getnr2tb.ok
new file mode 100644
index 00000000..7b40e8d7
--- /dev/null
+++ b/test/getnr2tb.ok
@@ -0,0 +1,6 @@
+1 10
+2 5
+3 3.33333
+4 2.5
+5 2
+6 1.66667
diff --git a/test/getnr2tm.awk b/test/getnr2tm.awk
new file mode 100644
index 00000000..dfe377a8
--- /dev/null
+++ b/test/getnr2tm.awk
@@ -0,0 +1,75 @@
+#From dhw@gamgee.acad.emich.edu Sat Oct 31 22:54:07 1998
+#Return-Path: <dhw@gamgee.acad.emich.edu>
+#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
+# by amx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id HAA08891
+# for <arobbins@netvision.net.il>; Sat, 31 Oct 1998 07:14:07 +0200 (IST)
+#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id AAA14947 for <arnold@mathcs.emory.edu>; Sat, 31 Oct 1998 00:14:32 -0500 (EST)
+#Received: from gamgee.acad.emich.edu (gamgee.acad.emich.edu [164.76.102.76])
+# by mescaline.gnu.org (8.9.1a/8.9.1) with SMTP id AAA20645
+# for <arnold@gnu.ai.mit.edu>; Sat, 31 Oct 1998 00:17:54 -0500
+#Received: by gamgee.acad.emich.edu (Smail3.1.29.1 #57)
+# id m0zZUKY-000IDSC; Sat, 31 Oct 98 00:16 CST
+#Message-Id: <m0zZUKY-000IDSC@gamgee.acad.emich.edu>
+#Date: Sat, 31 Oct 98 00:16 CST
+#From: dhw@gamgee.acad.emich.edu (David H. West)
+#To: bug-gnu-utils@gnu.org
+#Subject: gawk 3.0.3 bug report
+#Cc: arnold@gnu.org
+#X-UIDL: 7474b825cff989adf38f13883d84fdd7
+#Status: RO
+#
+#gawk version: 3.03
+#System used: Linux, kernel 2.0.28, libc 5.4.33, AMD K5PR133 (i586 clone)
+#Remark: There seems to be at least one bug shown by the demo below.
+# There may also be a Dark Corner involving the value of NR in an
+# END block, a topic on which the info file is silent. In gawk
+# 3.0.3, NR often seems to have the least-surprise value in an
+# END block, but sometimes it doesn't - see example below.
+#Problem descr: the log below shows a case where:
+# a) (this may be a red herring) the output of the gawk script
+# is different depending on whether its input file is named on
+# the command line or catted to stdin, without any use of the
+# legitimate means which could produce this effect.
+# b) NR is clearly getting clobbered; I have tried to simplify
+# the 19-line script "awkerr1" below, but seemingly unrelated
+# changes, like shortening constant strings which appear only in
+# print statements, or removing unexecuted or irrelevant code,
+# cause the clobbering to go away. Some previous (larger)
+# versions of this code would clobber NR also when reading from
+# stdin, but I thought you'd prefer a shorter example :-).
+#Reproduce-By: using the gawk script "awkerr1", the contents of
+# which appear in the transcript below as the output of the
+# command "cat awkerr1". Comments following # were added
+# to the transcript later as explanation.
+#---------------------------------------------- Script started on Fri
+#Oct 30 20:04:16 1998 chipmunk:/ram0# ls -l a1 awkerr1 -rw-r--r-- 1
+#root root 2 Oct 30 18:42 a1 -rwxr-xr-x 1 root root
+#389 Oct 30 19:54 awkerr1 chipmunk:/ram0# cat a1 #a1 contains
+#one printable char and a newline a chipmunk:/ram0# od -c xc a1
+#0000000 0a61
+# a \n
+#0000002 chipmunk:/ram0# cat a1 | awkerr1 #no surprises here
+#1 lines in 1 sec: 1 lines/sec; nlines=1 chipmunk:/ram0# awkerr1 a1 È
+#lines in 1 sec: 1 lines/sec; nlines=1 #?! first char is an uppercase
+#E-grave chipmunk:/ram0# awkerr1 a1 | od -N1 -xc 0000000 00c8
+# 310 \0
+#0000001 chipmunk:/ram0# cat awkerr1 #the apparent ^M's are not
+#actually in the file
+#!/usr/bin/awk -f
+function process(w) {
+ if(w in ws) {
+ printf " : found\n"; lc[p " " w]++; rc[w " " n]++; }
+ }
+BEGIN {IGNORECASE=1;
+ }
+/^/ {if(NR % 10 ==0)print "processing line " NR;
+ process($1); nlines++;
+ }
+END {p=w; w=n; n="";
+ if(w)process(w); t=1; print NR " lines in " t " sec: " NR+0 " lines/sec; nlines=" nlines;
+ }
+#chipmunk:/ram0# exit Script done on Fri Oct 30 20:07:31 1998
+#---------------------------------------------
+#
+#-David West dhw@gamgee.acad.emich.edu
+#
diff --git a/test/getnr2tm.in b/test/getnr2tm.in
new file mode 100644
index 00000000..78981922
--- /dev/null
+++ b/test/getnr2tm.in
@@ -0,0 +1 @@
+a
diff --git a/test/getnr2tm.ok b/test/getnr2tm.ok
new file mode 100644
index 00000000..d63fca09
--- /dev/null
+++ b/test/getnr2tm.ok
@@ -0,0 +1 @@
+1 lines in 1 sec: 1 lines/sec; nlines=1
diff --git a/test/gsubtest.awk b/test/gsubtest.awk
index 31374795..5dfefe93 100755
--- a/test/gsubtest.awk
+++ b/test/gsubtest.awk
@@ -1,8 +1,8 @@
BEGIN {
- str = "abc"; gsub("b+", "FOO", str); print str
- str = "abc"; gsub("x*", "X", str); print str
- str = "abc"; gsub("b*", "X", str); print str
- str = "abc"; gsub("c", "X", str); print str
- str = "abc"; gsub("c+", "X", str); print str
- str = "abc"; gsub("x*$", "X", str); print str
+ str = "abc"; print gsub("b+", "FOO", str), str
+ str = "abc"; print gsub("x*", "X", str), str
+ str = "abc"; print gsub("b*", "X", str), str
+ str = "abc"; print gsub("c", "X", str), str
+ str = "abc"; print gsub("c+", "X", str), str
+ str = "abc"; print gsub("x*$", "X", str), str
}
diff --git a/test/gsubtest.ok b/test/gsubtest.ok
index 191bebda..7c18f431 100644
--- a/test/gsubtest.ok
+++ b/test/gsubtest.ok
@@ -1,6 +1,6 @@
-aFOOc
-XaXbXcX
-XaXcX
-abX
-abX
-abcX
+1 aFOOc
+4 XaXbXcX
+3 XaXcX
+1 abX
+1 abX
+1 abcX
diff --git a/test/nasty.awk b/test/nasty.awk
new file mode 100644
index 00000000..b9c20c8b
--- /dev/null
+++ b/test/nasty.awk
@@ -0,0 +1,92 @@
+#From hankedr@manatee.dms.auburn.edu Tue Oct 13 22:15:59 1998
+#Return-Path: <hankedr@manatee.dms.auburn.edu>
+#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
+# by dmx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id PAA03924
+# for <arobbins@netvision.net.il>; Tue, 13 Oct 1998 15:32:13 +0200 (IST)
+#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id KAA11644 for <arnold@mathcs.emory.edu>; Tue, 13 Oct 1998 10:22:32 -0400 (EDT)
+#Received: from manatee.dms.auburn.edu (manatee.dms.auburn.edu [131.204.53.104])
+# by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id KAA03250
+# for <arnold@gnu.org>; Tue, 13 Oct 1998 10:25:32 -0400
+#Received: (from hankedr@localhost)
+# by manatee.dms.auburn.edu (8.9.1a/8.9.1) id JAA13348;
+# Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
+#Date: Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
+#Message-Id: <199810131422.JAA13348@manatee.dms.auburn.edu>
+#From: Darrel Hankerson <hankedr@dms.auburn.edu>
+#To: arnold@gnu.org
+#In-reply-to: <199810131313.QAA31784@alpha.netvision.net.il> (message from
+# Aharon Robbins on Tue, 13 Oct 1998 16:10:36 +0200)
+#Subject: Re: full text of bug report?
+#Mime-Version: 1.0
+#Content-Type: text/plain; charset=US-ASCII
+#X-UIDL: bf3fce492dad4ab030c561e7b2f27d0a
+#Status: RO
+#
+# Do you have the full text of the a = a "\n" f() bug report?
+# I can't find it.... I'm not sure there really is a bug.
+#
+#Yes, see below.
+#
+#His example has unnecessary fragments (in particular, the use of
+#gensub is irrelevant). As I wrote to you earlier, the interesting
+#question for me is:
+#
+# Is the concatenation result undefined? If the result is defined or
+# implementation-dependent, then gawk has a bug.
+#
+#
+#=== Original report =====================================================
+#From: Attila Torcsvari <arcdev@mail.matav.hu>
+#To: "'bug-gnu-utils@prep.ai.mit.edu'" <bug-gnu-utils@gnu.org>
+#Subject: gawk 3.0.3 bug
+#Date: Thu, 17 Sep 1998 18:12:13 +0200
+#MIME-Version: 1.0
+#Content-Transfer-Encoding: 7bit
+#Resent-From: bug-gnu-utils@gnu.org
+#X-Mailing-List: <bug-gnu-utils@gnu.org> archive/latest/3396
+#X-Loop: bug-gnu-utils@gnu.org
+#Precedence: list
+#Resent-Sender: bug-gnu-utils-request@gnu.org
+#Content-Transfer-Encoding: 7bit
+#Content-Type: text/plain; charset="us-ascii"
+#Content-Length: 618
+#
+#Bug-gnuers,
+#please pass it to the responsible.
+#
+#The following generates something interesting:
+#
+BEGIN{
+a="aaaaa"
+a=a a #10
+a=a a #20
+a=a a #40
+a=a a #80
+a=a a #160
+a=a a # i.e. a is long enough
+
+a=a"\n"f() # this causes the trouble
+print a # guess the result
+}
+
+function f()
+{
+#print "a before: ", a
+#a=gensub("a","123,","g",a) # 'a' will be just a bit longer (4 times, but still should fit: 4*160=640)
+gsub(/a/, "123", a)
+#print "a after: ", a
+return "X"
+}
+#
+#Possible reason:
+#during f the a is modified,
+#it can be even freed, because gensub modifies its size
+#the printout contains trash.
+#
+#Used version: VC compiled WinNT 32 bit Intel.
+#
+#Regards,
+#
+#Attila Torcsvari
+#Arcanum Development
+#
diff --git a/test/nasty.ok b/test/nasty.ok
new file mode 100644
index 00000000..5189cf81
--- /dev/null
+++ b/test/nasty.ok
@@ -0,0 +1,2 @@
+123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123
+X
diff --git a/test/printf1.awk b/test/printf1.awk
new file mode 100644
index 00000000..1cd7b99f
--- /dev/null
+++ b/test/printf1.awk
@@ -0,0 +1,19 @@
+# Tue May 25 16:36:16 IDT 1999
+#
+# Test cases based on email from Andreas Schwab, schwab@gnu.org
+
+BEGIN {
+ fmt[1] = "%8.5d"; data[1] = 100
+ fmt[2] = "%#o"; data[2] = 0
+ fmt[3] = "%#.1o"; data[3] = 0
+ fmt[4] = "%#.0o"; data[4] = 0
+ fmt[5] = "%#x"; data[5] = 0
+ fmt[6] = "%.0d"; data[6] = 0
+ fmt[7] = "%5.0d"; data[7] = 0
+
+ for (i = 1; i <= 7; i++) {
+ format = "%s, %d --- |" fmt[i] "|\n"
+ printf(format, fmt[i], data[i], data[i])
+ }
+
+}
diff --git a/test/printf1.ok b/test/printf1.ok
new file mode 100644
index 00000000..32b3a7d8
--- /dev/null
+++ b/test/printf1.ok
@@ -0,0 +1,7 @@
+%8.5d, 100 --- | 00100|
+%#o, 0 --- |0|
+%#.1o, 0 --- |0|
+%#.0o, 0 --- |0|
+%#x, 0 --- |0|
+%.0d, 0 --- ||
+%5.0d, 0 --- | |
diff --git a/test/reg/exp.awk b/test/reg/Obsolete/exp.awk
index 4e707f89..4e707f89 100644
--- a/test/reg/exp.awk
+++ b/test/reg/Obsolete/exp.awk
diff --git a/test/reg/exp.good b/test/reg/Obsolete/exp.good
index 07b88537..07b88537 100644
--- a/test/reg/exp.good
+++ b/test/reg/Obsolete/exp.good
diff --git a/test/reg/exp.in b/test/reg/Obsolete/exp.in
index e69de29b..e69de29b 100644
--- a/test/reg/exp.in
+++ b/test/reg/Obsolete/exp.in
diff --git a/test/reg/log.awk b/test/reg/Obsolete/log.awk
index bcae90b8..bcae90b8 100644
--- a/test/reg/log.awk
+++ b/test/reg/Obsolete/log.awk
diff --git a/test/reg/log.good b/test/reg/Obsolete/log.good
index 857ab770..857ab770 100644
--- a/test/reg/log.good
+++ b/test/reg/Obsolete/log.good
diff --git a/test/reg/log.in b/test/reg/Obsolete/log.in
index e69de29b..e69de29b 100644
--- a/test/reg/log.in
+++ b/test/reg/Obsolete/log.in
diff --git a/test/zeroflag.awk b/test/zeroflag.awk
new file mode 100644
index 00000000..526ed0e8
--- /dev/null
+++ b/test/zeroflag.awk
@@ -0,0 +1 @@
+BEGIN { printf("%2.1d---%02.1d\n", 2, 2) }
diff --git a/test/zeroflag.ok b/test/zeroflag.ok
new file mode 100644
index 00000000..937c0ede
--- /dev/null
+++ b/test/zeroflag.ok
@@ -0,0 +1 @@
+ 2--- 2
diff --git a/vms/ChangeLog b/vms/ChangeLog
index 2d19a8d3..e84ab85a 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,20 @@
+Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
+
+ * Release 3.0.4: Release tar file made. This time for sure.
+
+Fri May 7 20:29:04 1999 Pat Rankin <rankin@eql.caltech.edu>
+
+ * vms-conf.h (__CRTL_VER): Add same override as __VMS_VER.
+
+Wed May 5 19:10:15 1999 Pat Rankin <rankin@eql.caltech.edu>
+
+ * vmstest.com (nasty, zeroflag, getnr2tm, getnr2tb): New tests.
+
+Wed Nov 25 17:24:26 1998 Pat Rankin <rankin@eql.caltech.edu>
+
+ * vmstest.com (vms_tests): New general target.
+ (vms_io1): New specific test.
+
Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Release 3.0.3: Release tar file made.
diff --git a/vms/descrip.mms b/vms/descrip.mms
index ec00eb9a..e7e1fc40 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -129,7 +129,7 @@ DOCS= $(DOCDIR)gawk.1,$(DOCDIR)gawk.texi,$(DOCDIR)texinfo.tex
# Release of gawk
REL=3.0
-PATCHLVL=3
+PATCHLVL=4
# generic target
all : gawk
diff --git a/vms/gawk.hlp b/vms/gawk.hlp
index 9a3f2269..0d1645a6 100644
--- a/vms/gawk.hlp
+++ b/vms/gawk.hlp
@@ -1084,9 +1084,9 @@
published by SSC and the FSF (http://www.ssc.com).
Source text for it is present in the file GAWK.TEXI. A postscript
- version is available via anonymous FTP from host prep.ai.mit.edu in
- directory pub/gnu/, file gawk-{version}-doc.tar.gz where {version}
- would be the current version number, such as 3.0.3.
+ version is available via anonymous FTP from host gnudist.gnu.org in
+ directory /gnu/gawk, file gawk-{version}-doc.tar.gz where {version}
+ would be the current version number, such as 3.0.4.
Another source of documentation is "The AWK Programming Language"
by Aho, Weinberger, and Kernighan (1988), published by Addison-Wesley.
@@ -1200,7 +1200,7 @@
failure. The final exit status will be 1 (VMS success) if 0 is
used, or even (VMS non-success) if non-zero is used.
3 changes
- Changes between version 3.0.3 and 2.15.6
+ Changes between version 3.0.4 and 2.15.6
General
RS can contain multiple characters or be a regexp
diff --git a/vms/vms-conf.h b/vms/vms-conf.h
index b8b98de1..e655ef24 100644
--- a/vms/vms-conf.h
+++ b/vms/vms-conf.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (C) 1991, 1992, 1995, 1996 the Free Software Foundation, Inc.
+ * Copyright (C) 1991, 1992, 1995, 1996, 1999 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -135,6 +135,10 @@
# undef __VMS_VER
# define __VMS_VER 60100000
#endif
+#if __CRTL_VER >= 60200000
+# undef __CRTL_VER
+# define __CRTL_VER 60100000
+#endif
#endif
/*
diff --git a/vms/vmsbuild.com b/vms/vmsbuild.com
index 477bf4d2..29f2eb66 100644
--- a/vms/vmsbuild.com
+++ b/vms/vmsbuild.com
@@ -7,7 +7,7 @@ $! gawk 3.0 revised, Dec'95
$! gawk 3.0.1 revised, Nov'96
$!
$ REL = "3.0" !release version number
-$ PATCHLVL = "3"
+$ PATCHLVL = "4"
$!
$!
$ CCFLAGS = "/noList" ! "/noOpt/Debug"
diff --git a/vms/vmstest.com b/vms/vmstest.com
index d6e652d4..bc2a987c 100644
--- a/vms/vmstest.com
+++ b/vms/vmstest.com
@@ -23,7 +23,7 @@ $ if p8.nes."" then gosub 'p8'
$ exit
$
$all:
-$bigtest: bigtest_list = "basic unix_tests gawk_ext"
+$bigtest: bigtest_list = "basic unix_tests gawk_ext vms_tests"
$ echo "bigtest"
$bigtest_loop: bigtest_test = f$element(0," ",bigtest_list)
$ bigtest_list = bigtest_list - bigtest_test - " "
@@ -41,7 +41,8 @@ $basic: basic_lst1 = "msg swaplns messages argarray longwrds" -
+ " backgsub tweakfld clsflnam mmap8k fnarray dynlj" -
+ " substr eofsplit prt1eval splitwht back89 tradanch"
$ basic_lst2 = "nlfldsep splitvar intest nfldstr nors" -
- + " fnarydel noparms funstack clobber delarprm prdupval"
+ + " fnarydel noparms funstack clobber delarprm prdupval" -
+ + " nasty zeroflag getnr2tm getnr2tb"
$ echo "basic"
$basic_loop1: basic_test = f$element(0," ",basic_lst1)
$ basic_lst1 = basic_lst1 - basic_test - " "
@@ -72,6 +73,14 @@ $ if gawk_ext_test.nes." " then gosub 'gawk_ext_test'
$ if gawk_ext_list.nes."" then goto gawk_ext_loop
$ return
$
+$vms_tests: vms_tst_list = "vms_io1"
+$ echo "vms_tests"
+$vms_tst_loop: vms_tst_test = f$element(0," ",vms_tst_list)
+$ vms_tst_list = vms_tst_list - vms_tst_test - " "
+$ if vms_tst_test.nes." " then gosub 'vms_tst_test'
+$ if vms_tst_list.nes."" then goto vms_tst_loop
+$ return
+$
$extra: extra_list = "regtest inftest"
$ echo "extra"
$ gosub "regtest"
@@ -710,12 +719,51 @@ $ cmp prdupval.ok tmp.
$ if $status then rm tmp.;
$ return
$
+$nasty: echo "nasty"
+$ gawk -f nasty.awk >tmp.
+$ if f$file_attrib("nasty.ok","LRL").eq.0 then convert nasty.ok *.*
+$ if f$file_attrib("tmp.", "LRL").eq.0 then convert tmp. *.*
+$ cmp nasty.ok tmp.
+$ if $status then rm tmp.;
+$ return
+$
+$zeroflag: echo "zeroflag"
+$ gawk -f zeroflag.awk >tmp.
+$ cmp zeroflag.ok tmp.
+$ if $status then rm tmp.;
+$ return
+$
+$getnr2tm: echo "getnr2tm"
+$ gawk -f getnr2tm.awk getnr2tm.in >tmp.
+$ cmp getnr2tm.ok tmp.
+$ if $status then rm tmp.;
+$ return
+$
+$getnr2tb: echo "getnr2tb"
+$ gawk -f getnr2tb.awk getnr2tb.in >tmp.
+$ cmp getnr2tb.ok tmp.
+$ if $status then rm tmp.;
+$ return
+$
$nondec: echo "nondec"
$ ! gawk -f nondec.awk >tmp.
$ ! cmp nondec.ok tmp.
$ ! if $status then rm tmp.;
$ return
$
+$vms_io1: echo "vms_io1"
+$ if f$search("vms_io1.ok").eqs.""
+$ then create vms_io1.ok
+Hello
+$ endif
+$ ! define/User dbg$input sys$command:
+$ gawk /Input=sys$input _NL: /Output=tmp.
+# prior to 3.0.4, gawk crashed doing any redirection after closing stdin
+BEGIN { print "Hello" >"/dev/stdout" }
+$ cmp vms_io1.ok tmp.
+$ if $status then rm tmp.;
+$ return
+$
$clean:
$ if f$search("tmp.") .nes."" then rm tmp.;*
$ if f$search("tmp.too") .nes."" then rm tmp.too;*