aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-11-02 21:06:08 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-11-02 21:06:08 +0000
commitce83bef85e2e23eb8d5b30b9f4987d323094c3f4 (patch)
treecd2c7fd87952f47d303b90e49b90c14bccf7e292
parent4192247c04a09b9f83953a0d00f7992e8afaf976 (diff)
downloadsrc-ce83bef85e2e23eb8d5b30b9f4987d323094c3f4.tar.gz
src-ce83bef85e2e23eb8d5b30b9f4987d323094c3f4.zip
Update vendor branch to gawk-3.1.0.
Notes
Notes: svn path=/vendor/awk/dist/; revision=85898
-rw-r--r--contrib/awk/AUTHORS9
-rw-r--r--contrib/awk/COPYING6
-rw-r--r--contrib/awk/ChangeLog1224
-rw-r--r--contrib/awk/FUTURES95
-rw-r--r--contrib/awk/Makefile.am161
-rw-r--r--contrib/awk/Makefile.in1023
-rw-r--r--contrib/awk/NEWS130
-rw-r--r--contrib/awk/POSIX.STD5
-rw-r--r--contrib/awk/PROBLEMS7
-rw-r--r--contrib/awk/README124
-rw-r--r--contrib/awk/acconfig.h24
-rw-r--r--contrib/awk/array.c395
-rw-r--r--contrib/awk/awk.h295
-rw-r--r--contrib/awk/awkgram.y2875
-rw-r--r--contrib/awk/awklib/ChangeLog26
-rw-r--r--contrib/awk/awklib/Makefile.am75
-rw-r--r--contrib/awk/awklib/Makefile.in440
-rw-r--r--contrib/awk/awklib/eg/lib/assert.awk2
-rw-r--r--contrib/awk/awklib/eg/lib/bits2str.awk16
-rw-r--r--contrib/awk/awklib/eg/lib/cliff_rand.awk14
-rw-r--r--contrib/awk/awklib/eg/lib/ftrans.awk4
-rw-r--r--contrib/awk/awklib/eg/lib/getopt.awk20
-rw-r--r--contrib/awk/awklib/eg/lib/gettime.awk15
-rw-r--r--contrib/awk/awklib/eg/lib/grcat.c6
-rw-r--r--contrib/awk/awklib/eg/lib/groupawk.in9
-rw-r--r--contrib/awk/awklib/eg/lib/join.awk1
-rw-r--r--contrib/awk/awklib/eg/lib/libintl.awk9
-rw-r--r--contrib/awk/awklib/eg/lib/nextfile.awk1
-rw-r--r--contrib/awk/awklib/eg/lib/noassign.awk17
-rw-r--r--contrib/awk/awklib/eg/lib/ord.awk18
-rw-r--r--contrib/awk/awklib/eg/lib/passwdawk.in9
-rw-r--r--contrib/awk/awklib/eg/lib/pwcat.c7
-rw-r--r--contrib/awk/awklib/eg/lib/readable.awk16
-rw-r--r--contrib/awk/awklib/eg/lib/rewind.awk20
-rw-r--r--contrib/awk/awklib/eg/lib/round.awk4
-rw-r--r--contrib/awk/awklib/eg/misc/findpat.awk10
-rw-r--r--contrib/awk/awklib/eg/network/PostAgent.sh9
-rw-r--r--contrib/awk/awklib/eg/network/coreserv.awk113
-rw-r--r--contrib/awk/awklib/eg/network/eliza.awk270
-rw-r--r--contrib/awk/awklib/eg/network/fingerclient.awk7
-rw-r--r--contrib/awk/awklib/eg/network/geturl.awk24
-rw-r--r--contrib/awk/awklib/eg/network/hello-serv.awk14
-rw-r--r--contrib/awk/awklib/eg/network/maze.awk73
-rw-r--r--contrib/awk/awklib/eg/network/mobag.awk72
-rw-r--r--contrib/awk/awklib/eg/network/panic.awk18
-rw-r--r--contrib/awk/awklib/eg/network/protbase.awk11
-rw-r--r--contrib/awk/awklib/eg/network/protbase.request7
-rw-r--r--contrib/awk/awklib/eg/network/protbase.result9
-rw-r--r--contrib/awk/awklib/eg/network/remconf.awk54
-rw-r--r--contrib/awk/awklib/eg/network/statist.awk85
-rw-r--r--contrib/awk/awklib/eg/network/stoxdata.txt4
-rw-r--r--contrib/awk/awklib/eg/network/stoxpred.awk116
-rw-r--r--contrib/awk/awklib/eg/network/testserv.awk12
-rw-r--r--contrib/awk/awklib/eg/network/urlchk.awk28
-rw-r--r--contrib/awk/awklib/eg/network/webgrab.awk6
-rw-r--r--contrib/awk/awklib/eg/prog/alarm.awk10
-rw-r--r--contrib/awk/awklib/eg/prog/awksed.awk2
-rw-r--r--contrib/awk/awklib/eg/prog/cut.awk13
-rw-r--r--contrib/awk/awklib/eg/prog/dupword.awk9
-rw-r--r--contrib/awk/awklib/eg/prog/egrep.awk26
-rw-r--r--contrib/awk/awklib/eg/prog/extract.awk12
-rw-r--r--contrib/awk/awklib/eg/prog/guide.awk7
-rw-r--r--contrib/awk/awklib/eg/prog/histsort.awk3
-rw-r--r--contrib/awk/awklib/eg/prog/id.awk42
-rw-r--r--contrib/awk/awklib/eg/prog/igawk.sh19
-rw-r--r--contrib/awk/awklib/eg/prog/labels.awk9
-rw-r--r--contrib/awk/awklib/eg/prog/split.awk8
-rw-r--r--contrib/awk/awklib/eg/prog/tee.awk1
-rw-r--r--contrib/awk/awklib/eg/prog/testbits.awk27
-rw-r--r--contrib/awk/awklib/eg/prog/translate.awk5
-rw-r--r--contrib/awk/awklib/eg/prog/uniq.awk5
-rw-r--r--contrib/awk/awklib/eg/prog/wc.awk8
-rw-r--r--contrib/awk/awklib/eg/prog/wordfreq.awk11
-rw-r--r--contrib/awk/awklib/extract.awk7
-rw-r--r--contrib/awk/builtin.c818
-rw-r--r--contrib/awk/configh.in136
-rwxr-xr-xcontrib/awk/configure4405
-rw-r--r--contrib/awk/configure.in159
-rw-r--r--contrib/awk/custom.h33
-rw-r--r--contrib/awk/dfa.c556
-rw-r--r--contrib/awk/dfa.h48
-rw-r--r--contrib/awk/doc/ChangeLog43
-rw-r--r--contrib/awk/doc/Makefile.am80
-rw-r--r--contrib/awk/doc/Makefile.in480
-rw-r--r--contrib/awk/doc/ad.block7
-rw-r--r--contrib/awk/doc/awkcard.in919
-rw-r--r--contrib/awk/doc/cardfonts2
-rw-r--r--contrib/awk/doc/gawk.11453
-rw-r--r--contrib/awk/doc/gawk.texi23639
-rw-r--r--contrib/awk/doc/gawkinet.texi5075
-rw-r--r--contrib/awk/doc/no.colors2
-rw-r--r--contrib/awk/doc/texinfo.tex368
-rw-r--r--contrib/awk/eval.c815
-rw-r--r--contrib/awk/eval_p.c27
-rw-r--r--contrib/awk/ext.c186
-rw-r--r--contrib/awk/extension/dl.c96
-rwxr-xr-xcontrib/awk/extension/doit1
-rw-r--r--contrib/awk/extension/filefuncs.c339
-rw-r--r--contrib/awk/extension/foo.awk9
-rw-r--r--contrib/awk/extension/fork.c106
-rwxr-xr-xcontrib/awk/extension/steps9
-rw-r--r--contrib/awk/extension/testff.awk30
-rw-r--r--contrib/awk/extension/testfork.awk20
-rw-r--r--contrib/awk/field.c214
-rwxr-xr-xcontrib/awk/fixvers58
-rw-r--r--contrib/awk/gawkmisc.c27
-rw-r--r--contrib/awk/getopt.c244
-rw-r--r--contrib/awk/getopt.h99
-rw-r--r--contrib/awk/getopt1.c11
-rw-r--r--contrib/awk/io.c1303
-rw-r--r--contrib/awk/main.c461
-rw-r--r--contrib/awk/msg.c67
-rw-r--r--contrib/awk/node.c175
-rw-r--r--contrib/awk/patchlev.h1
-rw-r--r--contrib/awk/po/POTFILES.in23
-rw-r--r--contrib/awk/po/cat-id-tbl.c411
-rw-r--r--contrib/awk/po/gawk.pot1696
-rw-r--r--contrib/awk/po/he.gmobin0 -> 33953 bytes
-rw-r--r--contrib/awk/po/stamp-cat-id1
-rw-r--r--contrib/awk/posix/ChangeLog28
-rw-r--r--contrib/awk/posix/gawkmisc.c65
-rw-r--r--contrib/awk/profile.c1381
-rw-r--r--contrib/awk/profile_p.c27
-rw-r--r--contrib/awk/protos.h2
-rw-r--r--contrib/awk/random.c661
-rw-r--r--contrib/awk/random.h15
-rw-r--r--contrib/awk/re.c75
-rw-r--r--contrib/awk/regex.c628
-rw-r--r--contrib/awk/regex.h51
-rw-r--r--contrib/awk/replace.c70
-rw-r--r--contrib/awk/stamp-h.in2
-rw-r--r--contrib/awk/test/ChangeLog208
-rw-r--r--contrib/awk/test/Makefile.am1036
-rw-r--r--contrib/awk/test/Makefile.in1012
-rw-r--r--contrib/awk/test/addcomma.awk15
-rw-r--r--contrib/awk/test/addcomma.in7
-rw-r--r--contrib/awk/test/addcomma.ok7
-rw-r--r--contrib/awk/test/arrayparm.ok2
-rw-r--r--contrib/awk/test/arynasty.awk16
-rw-r--r--contrib/awk/test/arynasty.ok1
-rw-r--r--contrib/awk/test/badargs.ok13
-rw-r--r--contrib/awk/test/clos1way.awk21
-rw-r--r--contrib/awk/test/clos1way.ok26
-rw-r--r--contrib/awk/test/clsflnam.awk2
-rw-r--r--contrib/awk/test/clsflnam.ok1
-rw-r--r--contrib/awk/test/datanonl.awk3
-rw-r--r--contrib/awk/test/datanonl.in1
-rw-r--r--contrib/awk/test/datanonl.ok1
-rw-r--r--contrib/awk/test/fnaryscl.awk10
-rw-r--r--contrib/awk/test/fnaryscl.ok1
-rw-r--r--contrib/awk/test/fnasgnm.awk14
-rw-r--r--contrib/awk/test/fnasgnm.in1
-rw-r--r--contrib/awk/test/fnasgnm.ok1
-rw-r--r--contrib/awk/test/fsfwfs.awk1
-rw-r--r--contrib/awk/test/fsfwfs.in16
-rw-r--r--contrib/awk/test/fsfwfs.ok16
-rw-r--r--contrib/awk/test/funsemnl.awk3
-rw-r--r--contrib/awk/test/funsemnl.ok1
-rw-r--r--contrib/awk/test/gnuops2.awk72
-rw-r--r--contrib/awk/test/gnuops2.ok7
-rw-r--r--contrib/awk/test/hsprint.awk74
-rw-r--r--contrib/awk/test/hsprint.ok66
-rw-r--r--contrib/awk/test/inftest.awk2
-rw-r--r--contrib/awk/test/leaddig.awk7
-rw-r--r--contrib/awk/test/leaddig.ok1
-rw-r--r--contrib/awk/test/leadnl.awk10
-rw-r--r--contrib/awk/test/leadnl.in9
-rw-r--r--contrib/awk/test/leadnl.ok8
-rw-r--r--contrib/awk/test/lint.awk14
-rw-r--r--contrib/awk/test/lint.ok5
-rw-r--r--contrib/awk/test/nasty.ok2
-rw-r--r--contrib/awk/test/nasty2.awk20
-rw-r--r--contrib/awk/test/nasty2.ok2
-rw-r--r--contrib/awk/test/nlinstr.awk8
-rw-r--r--contrib/awk/test/nlinstr.in2
-rw-r--r--contrib/awk/test/nlinstr.ok1
-rw-r--r--contrib/awk/test/noeffect.ok2
-rw-r--r--contrib/awk/test/nofmtch.ok2
-rw-r--r--contrib/awk/test/octsub.awk1
-rw-r--r--contrib/awk/test/octsub.ok1
-rw-r--r--contrib/awk/test/ofmt.awk53
-rw-r--r--contrib/awk/test/ofmt.in136
-rw-r--r--contrib/awk/test/ofmt.ok6
-rw-r--r--contrib/awk/test/ofmtbig.awk125
-rw-r--r--contrib/awk/test/ofmtbig.in3
-rw-r--r--contrib/awk/test/ofmtbig.ok2
-rw-r--r--contrib/awk/test/ofmts.awk2
-rw-r--r--contrib/awk/test/ofmts.in1
-rw-r--r--contrib/awk/test/ofmts.ok1
-rw-r--r--contrib/awk/test/paramtyp.awk20
-rw-r--r--contrib/awk/test/paramtyp.ok6
-rw-r--r--contrib/awk/test/parseme.awk1
-rw-r--r--contrib/awk/test/parseme.ok3
-rwxr-xr-xcontrib/awk/test/pid.sh2
-rw-r--r--contrib/awk/test/pipeio2.awk3
-rwxr-xr-xcontrib/awk/test/poundbang.awk3
-rw-r--r--contrib/awk/test/printfloat.awk62
-rw-r--r--contrib/awk/test/prmarscl.ok2
-rw-r--r--contrib/awk/test/procinfs.awk7
-rw-r--r--contrib/awk/test/procinfs.ok3
-rw-r--r--contrib/awk/test/psx96sub.awk7
-rw-r--r--contrib/awk/test/psx96sub.ok2
-rw-r--r--contrib/awk/test/rand.ok2
-rw-r--r--contrib/awk/test/rebt8b1.awk138
-rw-r--r--contrib/awk/test/rebt8b1.ok16
-rw-r--r--contrib/awk/test/rebt8b2.awk88
-rw-r--r--contrib/awk/test/rebt8b2.ok511
-rw-r--r--contrib/awk/test/redfilnm.awk98
-rw-r--r--contrib/awk/test/redfilnm.in1
-rw-r--r--contrib/awk/test/redfilnm.ok9
-rw-r--r--contrib/awk/test/regeq.awk29
-rw-r--r--contrib/awk/test/regeq.in2
-rw-r--r--contrib/awk/test/regeq.ok2
-rwxr-xr-xcontrib/awk/test/regtest.sh18
-rw-r--r--contrib/awk/test/regx8bit.awk26
-rw-r--r--contrib/awk/test/regx8bit.ok7
-rw-r--r--contrib/awk/test/rsnul1nl.awk2
-rw-r--r--contrib/awk/test/rsnul1nl.in3
-rw-r--r--contrib/awk/test/rsnul1nl.ok2
-rw-r--r--contrib/awk/test/sclforin.ok2
-rw-r--r--contrib/awk/test/sclifin.ok2
-rw-r--r--contrib/awk/test/shadow.awk21
-rw-r--r--contrib/awk/test/shadow.ok7
-rw-r--r--contrib/awk/test/sort1.awk31
-rw-r--r--contrib/awk/test/sort1.ok11
-rw-r--r--contrib/awk/test/splitdef.awk7
-rw-r--r--contrib/awk/test/splitdef.ok1
-rw-r--r--contrib/awk/test/strtod.awk1
-rw-r--r--contrib/awk/test/strtod.in1
-rw-r--r--contrib/awk/test/strtod.ok1
-rw-r--r--contrib/awk/version.c5
-rw-r--r--contrib/awk/version.in53
232 files changed, 46131 insertions, 14093 deletions
diff --git a/contrib/awk/AUTHORS b/contrib/awk/AUTHORS
new file mode 100644
index 000000000000..c6e25079a11e
--- /dev/null
+++ b/contrib/awk/AUTHORS
@@ -0,0 +1,9 @@
+Wed Feb 16 10:06:17 IST 2000
+
+Gawk was written by Paul Rubin, and finished by Paul Finlason and
+Richard Stallman.
+
+David Trueman and Arnold Robbins took it over, with David doing most
+of the work to make it compatible with new awk.
+
+Circa 1994, Arnold Robbins took over maintenance.
diff --git a/contrib/awk/COPYING b/contrib/awk/COPYING
index 60549be514af..d60c31a97a54 100644
--- a/contrib/awk/COPYING
+++ b/contrib/awk/COPYING
@@ -2,7 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
+ Copyright (C) <year> <name of author>
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
@@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
diff --git a/contrib/awk/ChangeLog b/contrib/awk/ChangeLog
index 95f9aeae77a8..ec85759bb445 100644
--- a/contrib/awk/ChangeLog
+++ b/contrib/awk/ChangeLog
@@ -1,3 +1,1223 @@
+Sun Jun 3 13:04:44 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Release 3.1.0: Release tar file made. And there was
+ rejoicing.
+
+Wed Apr 25 11:44:07 2001 Arnold Robbins <arnold@skeeve.com>
+
+ * Makefile.am (AM_MAKEFLAGS): Add definition per advice from
+ Nelson Beebe.
+
+Tue Apr 24 14:28:00 2001 Arnold Robbins <arnold@skeeve.com>
+
+ * io.c (devopen): Patch from Jeurgen to robustify pulling
+ out hostname, port numbers, etc, to avoid any buffer overrun
+ problems.
+
+Mon Apr 23 10:26:38 2001 Arnold Robbins <arnold@skeeve.com>
+
+ * awkgram.y: Fix grammar so that `print ... |& ".." |& getline'
+ dies with a parse-time error message.
+
+Sun Apr 22 16:46:48 2001 Arnold Robbins <arnold@skeeve.com>
+
+ * io.c (socketopen): Fix from Juergen in recursive call.
+
+Thu Apr 19 18:39:20 2001 Pat Rankin <rankin@eql.caltech.edu>
+
+ * awk.h: Really fix logic around include of <sys/types.h>.
+
+ * awk.h (callresult): New name for `result' macro.
+ * eval.c (r_get_lhs, case Node_builtin): Use it.
+
+Thu Apr 19 16:31:09 2001 Pat Rankin <rankin@eql.caltech.edu>
+
+ * io.c: Move code around to allow compilation with DEC C.
+
+Thu Apr 19 16:21:56 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * random.h: Move decl of random() here.
+ * random.c: Remove decl of random().
+
+Mon Apr 9 11:41:58 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dfa.c (dfainit): Initialize more members in the structure,
+ based on bug report in bug.gnu.utils by aaronl@vitelus.com
+ (Aaron Lehmann).
+ * awk.h: Fix logic around include of <sys/types.h>.
+
+Thu Apr 5 20:12:05 2001 Pat Rankin <rankin@eql.caltech.edu>
+
+ * dfa.c: for VMS, #include <stddef.h> instead of <sys/types.h>.
+ * missing_d/mktime.c: likewise.
+
+ * random.c: reorder include directives to get gawk config info
+ from random.h sooner.
+ [fcntl.h]: guard #include with HAVE_FCNTL_H test.
+ [unistd.h]: guard #include with HAVE_UNISTD_H test.
+
+ * random.c (srandomdev): skip /dev/urandom usage if O_RDONLY
+ is not defined.
+
+Tue Mar 20 11:07:11 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (function_body): Add opt_nls to end of production.
+
+Tue Mar 20 09:30:32 2001 Pat Rankin <rankin@eql.caltech.edu>
+
+ * awk.h (BROKEN_STRNCASECMP): Add decl of strcasecmp.
+ * io.c (two_way_open): Add `return FALSE;' for fussy compilers.
+
+Sun Mar 18 15:10:56 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (gawk_pclose): Set the exit value for close correctly
+ if the pipe died with a signal.
+
+Wed Mar 7 11:28:52 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (get_a_record): Correctly handle the case of a leading
+ single newline at the front of the file when RS = "".
+
+2001-02-26 Paul Eggert <eggert@twinsun.com>
+
+ * COPYING: Incorporate latest version from FSF, which fixes a Y2k bug.
+
+ * builtin.c (do_mktime): Allow the user to specify the
+ tm_isdst member as an optional trailing integer, and to
+ specify "out-of-range" members. Check for overflow when
+ subtracting 1 from month or 1900 from year. Allow years just
+ past INT_MAX, as they work on some hosts when INT_MAX - 1900
+ is representable as an int.
+
+ * doc/gawk.1, doc/gawk.texi: Document the above changes.
+ Also, document that the origin-zero Gregorian calendar is used.
+ Fix confusing wording about "midnight" by replacing it with 00:00
+ ("midnight" is also 24:00, the end of the day).
+ Mention the typical range for time stamps.
+ Do not assume that years are nonnegative and are less than 10,000.
+ Suggest TZ=UTC0 instead of TZ=GMT0, as that's how recent versions
+ of GNU date behave.
+ GMT is not always the time of day in Greenwich these days.
+ Fix typos: "Emporer/Era", "1980's", "1970's".
+
+ * m4/largefile.m4: Synchronized with latest version.
+
+Tue Feb 27 12:10:11 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile.c (pp_in_array): Change test to tree->type == Node_expression_list.
+
+Wed Feb 7 14:46:50 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (LEX_FOR): Allow newline after `;' in for loops.
+ Per bug report from Brian Kernighan, bwk@research.bell-labs.com.
+
+Tue Feb 6 18:35:27 2001 Martin C. Brown <mc@whoever.com>
+
+ * io.c (socket_open): Conditionalize various options based on
+ ifdef. Needed for BeOS port.
+
+Tue Feb 6 18:17:13 2001 Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
+
+ * regex.c (re_match_2_internal): Case maybe_pop_jump, for
+ charset and not_charset: change cast from (unsigned char)
+ to (unsigned). Catches last 8 chars with high bit set
+ if backtracking. See test/rebt8b1.awk, test/rebt8b2.awk.
+
+Tue Feb 6 11:20:21 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ Have `for (iggy in foo)' save the elements and loop over them.
+ Make sorted for loops a dynamic test instead of a compile time test.
+ Still requires being Strong In The Ways Of The Source.
+
+ * awk.h: (struct search): removed.
+ (assoc_scan, assoc_next): removed declarations.
+ * array.c (assoc_scan, assoc_next): removed functions.
+ * eval.c (interpret): remove Node_K_array_sorted_for. Change code
+ at Node_K_arrayfor.
+ (nodetypes): remove Node_K_array_sorted_for.
+ * configure.in: removed array sorting test.
+ * awkgram.y: removed sorted_in keyword and associated code.
+
+Sun Feb 4 14:57:49 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (interpret): use tree->rnode->exec_count to hold count of
+ times if was true.
+ profile.c (interpret): ditto.
+ * main.c (pre_assign): gross hack. malloc fresh copy of assign so can
+ clear the '=', otherwise screws up profiling print out.
+
+Sun Jan 28 16:16:02 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ Per request from Nelson Beebe, SIGHUP to pgawk dumps profile
+ and function call stack and exits, SIGUSR1 dumps and continues
+ running.
+
+ * eval.c (dump_fcall_stack): New function, dumps awk function call
+ stack.
+ * awk.h (dump_fcall_stack): Add declaration.
+ (init_profiling_signals): Ditto.
+ * main.c (main): Call init_profiling_signals.
+ * profile.c (init_profiling_signals, dump_and_exit, just_dump): new
+ functions.
+
+Sun Jan 28 15:50:02 2001 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * io.c (gawk_popen): Restore the mode of stdin before running the
+ child process and switch it back if BINMODE is in effect after the
+ child returns.
+ (redirect): Restore the mode of stdin before running the child
+ process.
+ (close_redir): Switch mode of stdin back to binary if BINMODE is
+ in effect, after the child returns.
+
+ * builtin.c (do_system): Restore the mode of stdin before running
+ the child process and switch it back if BINMODE is in effect after
+ the child returns.
+
+ * awk.h (os_restore_mode): Add prototype.
+
+Thu Jan 18 14:03:06 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * custom.h, README_d/README.ultrix: Fixes for Ultrix
+ from Juergen Kahrs.
+
+Wed Jan 17 11:03:40 2001 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * io.c (redirect) [F_GETFL && O_APPEND]: Use binmode in the call
+ to fdopen.
+
+Mon Jan 15 16:29:52 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile.c (prec_level): Made Node_K_getline higher than <
+ but lower than others. Allows use of getline with redirection
+ inside an if.
+
+Wed Jan 10 15:35:06 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (set_BINMODE): Rationalized string assignment.
+
+Sun Jan 7 15:26:16 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * getopt.h: Removed names in prototypes for getopt_long
+ and getopt_long_only, fixes problems on MINGW32.
+
+Thu Jan 4 10:13:46 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: Add check for mcheck.h
+ * main.c: Include mcheck.h if have it.
+ (main): If TIDYMEM turned on in environment, also call mtrace().
+
+Wed Jan 3 16:41:33 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fixed minor memory leaks.
+ * re.c (re_update): When IGNORECASE changed, unref(t->re_text).
+ * eval.c (pop_fcall): Fix the logic to correctly free the vname
+ when copying array args back to their underlying source.
+
+ Fixed massive memory leaks.
+ * node.c (dupnode): If PERM is set, do nothing.
+ (unref): Fix logic. Always turn off TEMP. Check just for MALLOC
+ when incrementing the stref.
+ * array.c (assoc_lookup): Turn off PERM also when saving subscript.
+ * builtin.c (sub_common): Turn off PERM also when making private copy
+ of string.
+
+ Add a minor memory cleanup facility (undocumented):
+ * awk.h (do_tidy_mem, release_all_vars): Add declarations.
+ * main.c (do_tidy_mem): Add declaration.
+ (main): if $TIDYMEM exists, do_tidy_mem is true, and call mtrace().
+ * awkgram.y (release_all_vars): New function.
+
+Sun Dec 31 10:47:37 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (in_end_rule): Renamed `parsing_end_rule' to avoid
+ conflict with global var of same name.
+
+Sun Dec 24 10:36:54 2000 Eli Zaretskii <eliz@is.elta.co.il>
+
+ * awkgram.y (snode): Reword the error message about the number of
+ arguments for a builtin, so as not to use the English `s' as a
+ plural suffix.
+
+Tue Dec 12 08:38:03 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * ext.c (do_ext): ifdef out use of `dummy'. Duh.
+ * regex.c (re_error_msgid): Revert to array of `char *' so that can
+ compile on K&R compilers. Fix all uses appropriately.
+ (re_error_msgid_idx): Removed.
+
+Fri Dec 8 11:47:26 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * ext.c (dummy): Make gcc specific via ifdef.
+ * builtin.c (do_dcgettext): make conditional compilation smarter.
+ * msg.c (warning, error, r_fatal): Finish switching back to
+ multi-version function header.
+
+Wed Dec 6 13:28:58 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * random.h: include <config.h> to get ssize_t definition.
+ * awkgram.y (yyerror): Restore multi-version function header,
+ it seems that what ansi2knr produces doesn't quite do the
+ job on old compilers.
+ msg.c (msg): Ditto.
+
+Tue Dec 5 15:05:35 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in (AC_C_INLINE): Added macro call.
+ * Makefile.am (LN): Define it for install hooks.
+
+Sun Dec 3 17:28:53 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (os_setbinmode): Declare new function.
+ (setmode): Remove definition: conflicts with MacOS X.
+ * main.c (main): Change call of setmode to os_setbindmode.
+
+ * builtin.c (do_dcgettext): Improve ifdef for code, fixes MacOS X.
+ * custom.h (__APPLE__): Force definition of HAVE_MKTIME, won't
+ link otherwise. Harumph.
+
+Sun Nov 26 11:58:52 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_dcgettext, do_bindtextdomain): Add calls to
+ free_temp the various arguments. Sigh.
+ * io.c (yylex): nuked bstart variable, put all uses of mend variable
+ into TANDEM ifdef.
+ * main.c (load_environ): removed cp variable, value never used.
+ * random.c: Remvoed uses of `inline' keyword.
+ * Makefile.am (install-exec-hook, uninstall-local): new targets.
+ Adds creation of gawk-X.Y.Z and awk links, as in 3.0.x.
+ * configure.in (GAWK_AC_TYPE_SSIZE_T): Added.
+ m4/ssize_t.m4: new file.
+
+Wed Nov 22 14:47:18 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ After consultation with Brian Kernighan and Michael Brennan,
+ nuked the abort keyword.
+
+ * awk.h (Node_K_abort): removed.
+ * eval.c (aborting): removed decl.
+ (interpret): Removed Node_K_abort case.
+ * io.c (do_input): Removed checks for aborting.
+ * main.c (aborting): removed.
+ (main): Removed checks for aborting.
+ * profile.c (pprint): Removed Node_K_abort case.
+ * awk.y (LEX_ABORT): All stuff removed.
+
+Wed Nov 22 10:45:57 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * ext.c (dummy): Move inside #ifdef DYNAMIC. Helps on
+ PCs and other platforms that don't do dynamic loading.
+ * awk.h (RED_TCP): New flag, means use shutdown.
+ io.c (redflags2str): Add RED_TCP.
+ (SHUT_RD, SHUT_WR, SHUT_RDWR): Add conditional defines.
+ (redirect): Add RED_TCP to tflag if appropriate. Add more
+ #ifdef HAVE_SOCKETS as needed.
+ (close_redir): If RED_TCP set, shutdown(2) on each end of the socket.
+
+Tue Nov 21 16:25:41 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y: for (iggy in foo) loops: add test that index
+ in delete statement is a simple variable.
+
+Tue Nov 14 16:11:39 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h: Add appropriate conditional versions of the gettext
+ functions if we don't have <libintl.h> or if ENABLE_NLS
+ is not defined or zero.
+ * configure.in: Add check for libintl.h header.
+
+ From Scott Deifik for PCs.
+ * awk.h (lintwarn): Call set_loc unconditionally, makes
+ compilation work on PCs.
+ * builtin.c (do_dcgettext): Compile out cat_tab and code
+ if not ENABLE_NLS.
+ * ext.c: for MSC, no long long variable.
+ * random.c: use clock() instead of gettimeofday().
+ * builtin.c: Fixed prototypes for new random functions (ADR).
+
+Sun Nov 12 17:45:44 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (parse_next_arg): Fix call to >= num_args so
+ running out of args check is correct, instead of core dumping.
+ (format_tree): Save and restore `the_args' and `args_size'
+ if a nested call is in progress, see explanatory comment.
+ See also tests/addcomma.
+ * Makefile.am: Fix things so that gawk/pgawk built first,
+ even if `make check' called before make. Add some
+ commentary.
+
+Wed Nov 8 14:39:20 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: Only add -rdynamic for linux.
+ * dfa.h, dfa.c: upgraded to versions in grep 2.4.2.
+
+Tue Nov 7 18:17:17 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * All: Switched to ANSI function headers and added
+ `ansi2knr' automake option. Really cool.
+
+Tue Nov 7 16:57:49 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (redirect): Check for O_APPEND in flags when doing
+ fdopen() of /dev/fd/N. Thanks to bug report from
+ "John H. DuBois III" <spcecdt@armory.com>.
+
+Tue Nov 7 14:09:14 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (os_is_setuid): declare function.
+ * main.c (main): call it if do_lint and warn if true.
+ * awkgram.y (tokentab):
+ - Made sure all extensions are actually marked as such. Ouch.
+ - Changed "sort" to "asort". Potential to break too much old code.
+ * getopt.h, getopt.c, getopt1.c: replaced with current versions
+ from glibc CVS archive.
+
+Mon Nov 6 18:14:33 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * random.c: Replaced with recent version from FreeBSD.
+
+Mon Nov 6 15:37:12 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ Major simplification of automake machinery.
+
+ * configure.in:
+ - INSTALL is forced only if not provided in environment
+ - lots of Makefile.in files removed since move to automake 1.4a
+ * Makefile.am, */Makefile.am: Moved directories that don't need
+ the automake machinery into EXTRA_DIST as appropriate and
+ removed the Makefile{,.am,.in} files as needed.
+ * eval_p.c, profile_p.c: New files to make it easier with automake
+ to compile pgawk.
+
+Tue Oct 24 12:20:18 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (valinfo, var_comp, dump_vars): New functions to dump
+ the list of global variables.
+ * awk.h: Declare dump_vars.
+ * main.c (optab): new option "dump-variables".
+ (main): Code to handle it, set the output file and then call
+ dump_vars() at the end.
+ (usage): New option added to usage message.
+
+Sat Oct 21 22:59:59 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (parms_shadow): For a function, check if any
+ parameters shadow global variables and print a warning.
+ (shadow_funcs): Go through all functions and call parms_shadow().
+ (isnoeffect, isassignable): Add Node_LINT and NODE_BINMODE.
+ * main.c (main): If do_lint, call shadow_funcs().
+ * awk.h: add declaration of shadow_funcs().
+ * configure.in: added m4/Makefile and awklib/eg/network/Makefile
+ to list of generated makefiles.
+
+Tue Oct 17 10:47:35 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (assoc_lookup): Reverted change that did dupnode of
+ array indices. Creates significant problems if index is
+ numeric value and CONVFMT changes. Added fix to set
+ bucket->ahname->stfmt to -1 so that force_string never recalculates
+ the string value, and also turned off NUM and turned on STR.
+ See test/arynasty.awk.
+
+Mon Oct 16 12:21:26 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * All: Cleaned up various lint warnings for consistent phrasing.
+ * awk.y (in_end_rule): New variable for warning about unredirected
+ getline. It's ok in a BEGIN, but not in an END.
+
+Sun Oct 15 14:14:05 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (set_FS): Add lint warning for FS = "".
+ (do_split): Ditto for 3rd arg = "".
+
+Fri Oct 13 09:17:04 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (close_redir): Clear rp->fp on all closes. Remove
+ rp from list if either closing both ends or both ends
+ have been closed separately. Add exitwarn message for
+ co-process.
+ (flush_io): Add warning message if fflush of co-process
+ fails. Rationalize return value to either 0 or -1.
+ * builtin.c (do_gensub): 3rd arg of zero generates a
+ warning.
+ (do_fflush): rationalize return value: -1 for unopen or read-only
+ redirection, status of fflush otherwise.
+
+Wed Oct 11 22:11:19 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y (for loop): Check that there is a body as
+ part of the `is it a delete statement' check.
+
+Thu Oct 5 11:56:42 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h, awkgram.y, configure.in, eval.c: enabled
+ `for (i in_sorted array)' loops for those who
+ are Strong In The Way Of The Source. So there.
+
+Mon Oct 2 10:09:32 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (do_close): make close(x) for non-open x return -1
+ and update ERRNO. close(FILENAME) no longer does anything
+ magic; this is all for better consistency with other awks
+ and is more logical, anyway.
+
+Thu Sep 28 17:27:16 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (close_one): Added a lint warning if it becomes
+ necessary to start multiplexing fd's, per ancient suggestion
+ from Scott Deifik, <scottd@amgen.com>.
+
+Tue Sep 26 14:41:41 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile.c: Move enum for redirection placement to top
+ of file, and make the value a parameter to pp_redir.
+ Fix all the calls. This gets `|&' right everywhere.
+
+Sun Sep 24 16:38:04 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (freenode): set the flags straight to UNINITIALIZED.
+ * node.c (unref): Fix test for MALLOC|TEMP to test the
+ actual flags, not zero.
+ * builtin.c (format_tree): ala print and concat, dupnode
+ the temp nodes from tree_evaling the arguments. See
+ test/nasty2.awk.
+
+Mon Sep 18 10:16:58 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (snode): Make match 3rd arg and close 2nd arg fatal
+ errors if --tradtional.
+
+Thu Sep 14 12:22:42 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (update_ERRNO): Call gettext on result of strerror.
+ i18n rules.
+
+Wed Sep 13 14:56:11 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (r_tree_eval): Case for Node_concat. Dupnode the
+ strings ala do_print to get more consistent results.
+ Compare gawk 3.0.6 to nawk/mawk on test/nasty.awk.
+ Thanks to Andrew Sumner (andrewsumner@yahoo.com) for
+ pointing this one out.
+
+Wed Sep 13 10:06:47 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (two_way_close_type): New enumerated type.
+ (close_redir): New third param of type two_way_close_type.
+ Add smarts to two-way case for different close types.
+ Only remove it from the redir list if closing is for both ends.
+ (gawk_pclose): Check that rp->iop != NULL before closing,
+ all three versions.
+ * awkgram.y (tokentab): Allow 2nd argument to close.
+ (snode): Add lint warning.
+
+Sun Sep 10 14:16:10 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (set_FIELDWIDTHS): Generate a fatal error upon
+ encountering a negative width.
+
+Sun Sep 10 10:37:35 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (snode): If first argument to dcgettext is a
+ string constant and --gen-po, dump the string constant to
+ the .po file too.
+ * main.c (nostalgia): Add call to fflush(stderr).
+ * eval.c (r_tree_eval): Add entries for Node_LINT and for
+ NODE_TEXTDOMAIN.
+
+Thu Sep 7 10:46:20 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_dcgettext): Per suggestion from Ulrich Drepper,
+ make the awk interface:
+
+ str = dcgettext(string [, domain [, category]])
+
+Wed Sep 6 16:28:12 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ Bring gettext features out to the awk level!
+
+ * awk.h: Add declarations of new functions `do_dcgettext'
+ `do_bindtextdomain', `set_TEXTDOMAIN' and variables
+ `TEXTDOMAIN', `TEXTDOMAIN_node'. New NODETYPE enum
+ `Node_TEXTDOMAIN'.
+ * eval.c (nodetypes): add Node_TEXTDOMAIN at end.
+ (set_TEXTDOMAIN): new function.
+ (r_get_lhs): add case for Node_TEXTDOMAIN.
+ * main.c (varinit): add entry for TEXTDOMAIN.
+ * node.c (format_val): If INTLSTR use dcgettext of string
+ and TEXTDOMAIN.
+ * awkgram.y (tokentab): Add entries for "dcgettext" and
+ "bindtextdomain".
+ * builtin.c (do_dcgettext, do_bindtextdomain): new functions.
+
+Tue Sep 5 17:01:34 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * profile.c (pp_string_fp): Use lower case versions of
+ isascii and isprint to avoid printing high-bit-set
+ characters. Make it smarter to break strings at 70
+ chars or after embedded newline, for --gen-po.
+ Fix the calls to it everywhere for new boolean option
+ to yes/no break lines.
+ * m4/strtod.m4: new file, defines GAWK_AC_FUNC_STRTOD_C89.
+ * configure.in: GAWK_AC_FUNC_STRTOD_C89 call added
+ * acinclude.m4: include strtod.m4.
+ * acconfig.h: add entry for STRTOD_NOT_C89.
+ Remove entries for BITOPS and NON_DEC_DATA.
+ * missing/missing.c: add check for STRTOD_NOT_C89, use ours
+ if set.
+ * missing/strtod.c: make smarter for input like 0x345.
+ * awk.h: [STRTOD_NOT_C89]: define strtod gawk_strtod to get
+ our version. Avoids linker weirdness.
+
+Mon Sep 4 09:16:43 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (set_record): fix from Utz-Uwe Haus
+ <haus@saturn.Math.Uni-Magdeburg.DE> to make sure there's
+ always enough room in the record.
+ * builtin.c (nondec2awknum): Fix octal conversions to exit
+ when hitting a non-digit, and not go to decimal. Make
+ check for non-octal better. Based on bug report from
+ Morris_Lee@tvratings.com.
+
+Sun Sep 3 13:52:11 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (format_tree): Allow positional parameters for
+ %*.* kinds of things.
+
+ Made octal/hex constants and strtonum on by default. Made
+ --enable-non-decimal-data a runtime switch `--non-decimal-data'.
+
+ * configure.in: Removed AC_ARG_ENABLE for --enable-bitops and
+ --enable-non-decimal-data.
+ In .developing check, remove the AC_DEFINEs.
+ * awk.h: Decls for bitwise functions now there by default.
+ Add decl of `do_non_decimal_data'.
+ * main.c (do_non_decimal_data): new variable
+ (optlist): add new entry for `--non-decimal-data'.
+ (main): turn off `do_non_decimal_data' if `do_traditional'.
+ (usage): add the new option.
+ * node.c (r_force_number): make check for non-decimal data a
+ runtime check based on do_non_decimal_data.
+ * awkgram.y (yylex): make non-decimal constants a runtime check.
+ * builtin.c: remove the ifdefs around the bit functions and
+ nondec2awknum.
+
+Tue Aug 29 18:45:56 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: go back to ARRAYDEBUG if .developing set.
+ * awkgram.y: use ARRAYDEBUG for adump(), use multiple tests
+ for stopme().
+
+Mon Aug 28 17:09:06 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (do_split): Add check for first arg is null string,
+ if so, skip the work and return zero.
+
+Mon Aug 14 23:01:55 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Add %COUNT$... handling to printf.
+ awk.h (printf_count): new define in NODE structure.
+ (format_tree): added decl.
+ awkgram.y (count_args): new function to set printf_count in
+ a node.
+ [print productions]: call the function.
+ (snode): for do_sprintf, call count_args, set the count
+ in the lnode.
+ builtin.c (format_tree): new fourth arg is argument count.
+ Add smarts to handle the `$' in a format.
+ (do_sprintf): use new argument to format_tree.
+ node.c (format_val): ditto.
+
+Sun Aug 13 11:10:41 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ Changes from Alan J. Broder (ajb@woti.com):
+ - Array third arg to match puts subtexts into the array:
+ * awk.y (tokentab): "match" gets third arg, and lint warning
+ * builtin.c (do_match): if third arg there, fill it with subtexts
+ - New builtin sort function:
+ * awk.h (do_sort): declared.
+ * array.c (do_sort, dup_table, merge, merge_sort, assoc_from_list,
+ assoc_sort_inplace): new functions.
+
+ * eval.c (tree_eval): in debug code, make uninitialized var
+ a warning, not a fatal error. Breaks too many things.
+
+Wed Aug 9 10:51:41 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (func_call): Increment the exec_count on the
+ function's node; this allows printing a call count for
+ functions.
+ profile.c (pp_func): print the count for functions.
+ * ALL: Changed DEBUG to GAWKDEBUG in all gawk files, so that
+ I don't get regex/dfa debugging. In some cases, changed
+ memory-related stuff to MEMDEBUG. Still have work to do.
+ * awk.h, node.c, profile.c: removed exec_count_init variable;
+ code has been cleaned up to not need different values for
+ profiling/not profiling.
+
+Thu Jul 5 21:10:59 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (casetable): Removed the USE_PURE_ASCII stuff; it
+ was never documented. Latin 1 forever.
+ * main.c (main): only call `init_profiling' after arg parsing
+ if `do_profiling' is still false. Avoids resetting `prof_fp'
+ back to stderr.
+
+2000-02-17 Akim Demaille <akim@epita.fr>
+
+ * m4: New directory.
+ * acinclude.m4: Removed, replaced by m4/*.m4.
+ * Makefile.am: Adjusted.
+ Added ACLOCAL_AMFLAGS.
+ * configure.in Adjusted.
+ Use AC_SYS_LARGEFILE not GAWK_AC_SYS_LARGEFILE, jm_FUNC_MKTIME,
+ not GAWK_FUNC_MKTIME.
+ * acconfig.h: Removed _FILE_OFFSET_BITS, _LARGEFILE_SOURCE and
+ _LARGE_FILES now templated by m4/largefile.m4.
+
+2000-02-15 Arnold Robbins <arnold@skeeve.com>
+
+ * MOVED TO AUTOMAKE AND GETTEXT.
+ Just about every file touched. Work done by Arno Peters.
+
+Sun Jan 2 14:48:23 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ First edit of the new millenium!
+ * awk.y (yylex): if lint checking, be obnoxious about gotos.
+
+Mon Oct 25 19:12:02 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h: remove C_ALLOCA ifdef.
+ * main.c (main): remove C_ALLOCA code.
+ * io.c (do_input): ditto.
+
+Mon Aug 9 17:36:24 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * bisonfix.sed: unconditionally #undef YYSTACK_USE_ALLOCA.
+ * configure.in: remove all alloca and ALLOCA related stuff.
+ * Makefile.in: ditto
+
+Thu Jul 29 18:32:05 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (NODE): exec_count now in #ifndef NO_PROFILING.
+ * Makefile.in: changes to only recompile eval.c and profile.c to a
+ special version for profiling.
+ * custom.h [MSC_VER]: turn on NO_PROFILING to omit the exec_count
+ and save space.
+ * node.c (more_nodes): move setting of exec_count to
+ #ifndef NO_PROFILING.
+
+Thu Jul 1 12:12:05 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in (AC_PREREQ): update to 2.13.
+ GAWK_AC_C_STRINGIZE: convert to AC_C_STRINGIZE.
+ * aclocal.m4 (GAWK_AC_C_STRINGIZE): remove definition, now
+ part of autoconf.
+ * acconfig.h (HAVE_STRINGIZE): ditto.
+
+Wed Apr 28 11:08:05 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (assoc_lookup): fix call to free_temp(subs) to after
+ last use of subs.
+
+Sun Apr 25 16:48:06 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (redirect): add lint warning when same file is used for
+ > and >>.
+
+Thu Apr 22 15:05:30 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (assoc_lookup): Fix call to fatal to lintwarn instead.
+ * node.c (r_force_number): Use `0 &&' to disable warnings about
+ conversions: they're overzealous, methinks.
+
+Thu Apr 8 14:27:58 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ New features for profiling:
+ * awk.h (NODE): add `exec_count' member.
+ (freenode): clear `exec_count' upon free.
+ * awk.y (func_count): new variable, counts total number of functions.
+ (func_install): increment func_count.
+ (struct finfo): information for use in sorting functions when
+ pretty printing.
+ (fcompare): compare two finfo structures.
+ (dump_funcs): print the functions in sorted order for profiling.
+ (getfname): return the name of a builtin function.
+ * eval.c (INCREMENT): new macro for counting execution of nodes.
+ (interpret): call INCREMENT() appropriately.
+ * main.c (do_profiling): new flag if doing profiling.
+ `--profiling': new option added to getopt_long machinery.
+ (main): For profiled version, set do_profile and output file.
+ Call `dump_prog' and `dump_funcs' if do_profiling at end.
+ (usage): add new argument.
+ * node.c (more_nodes, freenode): set exec_count to zero.
+ * profile.c: new file, does pretty printing and prints counts.
+ * Makefile.in: update to create two versions of gawk, regular
+ and `pgawk' which does profiling.
+
+Wed Mar 10 21:38:14 1999 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (close_redir): use update_ERRNO() instead of manually
+ doing it.
+
+Mon Dec 21 15:58:21 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: add BeOS to list of cases where we hardwire
+ GETPGRP_VOID.
+ custom.h: remove the #define from __be_os case. Cleaner to
+ do it all in configure. Based on email from Martin C. Brown,
+ mc@whoever.com.
+
+Mon Nov 30 20:52:52 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (update_ERRNO): new function, mainly for use by
+ extension functions.
+ * awk.h: add decl.
+
+Tue Nov 24 18:13:29 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Changes based on submission from Christos Zoulas at D.E. Shaw
+ that adds the following features:
+ - checking for use of uninitialized variables
+ - checking if a string that's not a number converts to 0
+ - ability to load a dynamic library to add built-ins
+ - VERSION variable (may or may not stay)
+ Additional change:
+ - --lint=fatal makes lint errors become fatal
+ - LINT="fatal" has the same effect, any other positive
+ value makes lint errors be just warnings
+ * Makefile.in (includedir): new variable for gawk header files
+ (ext.c, ext.o): new source and object files
+ (OTHERS, extension): new directory for macro with example extension
+ (install): install header files
+ * acconfig.h (DYNAMIC): new macro, true if can do dynamic loading
+ * array.c (assoc_lookup): new parameter `reference' is true if we
+ want to do reference checking. Add appropriate reference checking
+ code.
+ * awk.h (UNITITIALIZED): new flag
+ (lintfunc): function pointer for correct function to use
+ (lintwarn): new macro to produce warnings
+ (result): new macro for func call result, used in commented out
+ code in eval.c.
+ (getnode, freenode): revised to set UNINITIALIZED.
+ (get_lhs): third arg for reference checking, change all calls
+ -- Add appropriate decls of new/changed functions
+ * awk.y (tokentab): new builtin "extension" for adding extensions
+ (node_common): set flags to UNINITIALIZED for Node_var.
+ * configure.in (dynamic linking): new check. Probably should
+ be a separate macro.
+ * eval.c (flag2str): add UNINITIALIZED to the table.
+ (r_tree_eval): add checks for UNINITIALIZED.
+ (push_args): appropriate changes for UNINITIALIZED to work.
+ (r_get_lhs): new third argument for reference checking.
+ (set_LINT): add code to handle setting `lintfunc' appropriately.
+ * ext.c: new file, for doing dynamic library extensions.
+ * extension/*: new directory with simple example code.
+ * main.c (VERSION_node, EXTENSION_node): new nodes for new vars.
+ (optab): change for "lint" to allow optional argument.
+ (lintfunc): definition.
+ (main): add case in option processing for --lint.
+ (varinit): add entries for VERSION and EXTENSION.
+ * node.c (r_force_number): checks that string really is a number.
+ (morenodes): set UNITIALIZED in the flags.
+ * re.c (all): change `result' to `res' globally to avoid conflict
+ with new macro.
+ * GLOBAL: change lint calls to warning() to lintwarn().
+ * GLOBAL: change all calls to get_lhs() to have 3rd arg.
+ * GLOBAL: change all calls to assoc_lookup() to have 3rd arg.
+
+Sun Nov 22 17:07:39 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * patchlev.h: renamed from patchlevel.h to make life
+ easier for the PC guys.
+ (main.c): changed to include patchlev.h.
+ (Makefile.in): changed to ref patchlev.h where needed.
+
+Sat Nov 7 21:29:52 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (r_get_lhs): case Node_field_spec. Fix the lint
+ warnings for field reference of null string or non-numeric value.
+ When turned on, $0 generated a warning! Oops.
+
+Thu Nov 5 16:58:38 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * main.c (init_fds): new function to pre-open 0, 1, and 2 on
+ /dev/null if they're not open. Robustness, more or less.
+ (main): call init_fds.
+ * io.c (str2mode): add smarts for two-letter strings
+ such as "rw", "r+", "wr", "w+" and "a+".
+
+Mon Nov 2 16:55:46 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_*): added lint checks for non-numeric
+ and/or non-string arguments, as appropriate. This should
+ have been done long ago.
+
+Tue Oct 20 21:56:06 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (LINT_node): new variable for LINT special var
+ (Node_LINT): new node type.
+ (set_LINT): declare function.
+ * main.c (varinit): add LINT variable.
+ (usage): print an emphatic pointer to the manual for bug reports.
+ * eval.c (nodetypes): new entry for Node_LINT.
+ (r_get_lhs): case added for Node_LINT.
+ (set_LINT): set do_lint from LINT variable.
+
+Mon Oct 19 22:35:46 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: for GCC, add -Wall to get warnings for development.
+ * Makefile.in (awktab.c): move sed stuff to separate script.
+ * bisonfix.sed: new script, with old fix and Solaris x86 fix.
+ * awk.h (nodetype2str): add declaration.
+ (load_procinfo): add declaration.
+
+Tue Oct 13 22:28:56 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Changes to make PROCINFO["FS"] reflect the use of FIELDWIDTHS or FS.
+ eval.c (assign_val): new function that does the mechanics of
+ assignment
+ main.c (load_procinfo): add setting of PROCINFO["FS"] to "FS".
+ field.c (update_PROCINFO): new function to update the array.
+ (set_FS): call update_PROCINFO.
+ (set_FIELDWIDTHS): ditto.
+
+Sun Sep 27 10:18:05 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (reisstring): new prototype.
+ * re.c (reisstring): new function, returns true if the re did
+ a simple string match. This is rather simplistic in its logic.
+ * io.c (get_a_record): in the case that RS is a regexp, AND
+ the re matched at the exact end of the buffer, add a call to
+ `reisstring' in case it's a simple string match. If so, we
+ don't need to read more into the buffer because we don't
+ have a regex like `x.*y' that might extend longer.
+ This should be very helpful for interactive /inet clients
+ where something like `RS = "\r\n"' happens.
+
+Thu Aug 13 22:07:40 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (socketopen): fixes from Juergen Kahrs to socket
+ opening code for "any host".
+
+Tue Jul 14 19:02:33 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * aclocal.m4 (GAWK_AC_LIB_SOCKETS): removed the caching;
+ configure gave different results the second time it was run!
+
+Fri Jul 10 09:11:06 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (interpret): minor cleanups: add variable name to
+ fatal error Node_K_array_for and other minor changes.
+
+Mon Jun 22 16:53:34 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.in (tags, TAGS): add $(LIBSRC).
+
+Tue Jun 2 15:23:05 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (devopen): relax previous change, don't require "any",
+ just that a port be there. The user can put 0 if they
+ don't care.
+
+Wed May 27 21:33:45 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (devopen): for /inet, require that local and remote
+ ports and the remote hostname be there, and that `any'
+ be used for a port if they don't care.
+
+Thu May 21 14:13:46 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * node.c (parse_escape): Add warning that is always on
+ for \q for any unknown q inside string or regex constant.
+ I got bit by this myself once too often. Or else I'm
+ just getting old and senile.
+
+Mon May 4 12:42:49 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (NODETYPE): Sorted the Node_xxx entries for the
+ builtin variables. Gotta look nice, don't we?
+ * eval.c (nodetypes): ditto.
+ (genflags2str): added code to check that we don't
+ overflow the static buffer. This is just a debugging
+ routine, not worth the hassle of dynamic allocation.
+
+Mon Mar 2 16:06:16 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.in (dist): remove any embedded copied RCS or CVS
+ directories.
+
+Mon Feb 23 00:09:52 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (genflags2str): add declaration.
+ * eval.c (genflags2str): new function.
+ (flags2str): use new general purpose function.
+ * io.c (redflags2str): same.
+
+Sun Feb 22 23:57:29 1998 Arnold D. Robbins <arnold@skeeve.com>
+
+ Significant changes to add two-way i/o and sockets!!!
+
+ * Makefile.in: add @SOCKET_LIBS@ to LIBS variable.
+ * acconfig.h: add HAVE_SOCKETS and HAVE_PORTALS defs.
+ * aclocal.m4: new macro GAWK_AC_LIB_SOCKETS.
+ * awk.h: new node type, Node_redirect_twoway, and new redirection
+ flags: RED_TWOWAY, and RED_SOCKET.
+ * awk.y (parser): add TWOWAYIO token and appropriate productions.
+ (yylex): recognize `|&' token if not traditional.
+ * builtin.c (do_print, do_printf): flush buffer if TWOWAYIO.
+ * configure.in: add header checks for networking header files,
+ add --enable-portals switch, call GAWK_AC_LIB_SOCKETS
+ * eval.c (nodetypes): add string constant for Node_redirect_twoway.
+ * io.c (redflags2str): new function.
+ (redirect): better error message in default case, add code for
+ Node_redirect_twoway.
+ (socketopen): new function.
+ (iop_open, devopen): add recognition of `/inet/...'.
+ (two_way_open): new function.
+
+Sat Dec 13 21:15:07 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (struct node): new member, `param_list' in union `x', becomes
+ `node->parmlist' in the code.
+ * awk.y (func_install): rearranged a bit, to build up a list of
+ the function parameter names and to save it in the `parmlist' field.
+ * eval.c (push_args): new parameter, `varnames', which is the list
+ of variable names. Use this to set the vname field of each
+ parameter's value as it's created. Special case arrays to include
+ where they came from, mainly for array vs. scalar diagnostics.
+ (r_tree_eval): don't set the `vname' field for parameters.
+ (pop_fcall): free the `vname' field if it's an array.
+ (func_call): pass in the `parmlist' field to call of push_args().
+ (r_get_lhs): for Node_subscript, change error message to use
+ the `vname' field.
+ (stopme): new do-nothing function for use with debugging code
+ and setting breakpoints.
+
+Thu Dec 4 15:18:17 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y: fixed several lint checks and moved some into
+ test for do_lint_old.
+ * eval.c (fmt_index): add value of bad format spec to
+ error message.
+
+Tue Nov 18 22:19:02 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.in (install): strip the installed binary.
+ From Anatoly A. Orehovsky (tolik@mpeks.tomsk.su).
+
+Sun Nov 16 22:12:39 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (in_array, assoc_lookup): add symbol->vname to
+ fatal calls for scalar in array context.
+
+Wed Nov 12 22:18:33 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h [ISASCII]: on all IS* macros, add cast to unsigned char.
+ [TOUPPER, TOLOWER]: new macros using unsigned char.
+ * awk.y: change to use of IS* vs. is* macros.
+ * builtin.c (nondec2awknum): change to use of IS* vs. is* macros,
+ change casts for casetable[] from int to unsigned char.
+ use new TOLOWER, TOUPPER macros
+ * dfa.c [ISASCII]: on all IS* macros, add cast to unsigned char.
+ (lex): change isdigit to ISDIGIT.
+ [TOUPPER, TOLOWER]: new macros using unsigned char, now used.
+ * eval.c (fmt_ok): change to use of IS* vs. is* macros.
+ * field.c (sc_parse_field): change to use of IS* vs. is* macros,
+ change casts for casetable[] from int to unsigned char.
+ (set_FS): change to use of IS* vs. is* macros.
+ * io.c (get_a_record): change to use of IS* vs. is* macros,
+ change casts for casetable[] from int to unsigned char.
+ * main.c (main): change to use of IS* vs. is* macros.
+ * node.c (r_force_number, parse_escape): change to use of IS* vs.
+ is* macros.
+ * re.c (make_regexp): change to use of IS* vs. is* macros.
+ * regex.c [ISASCII]: on all IS* macros, add cast to unsigned char.
+
+Sun Oct 19 12:36:47 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * ALL: Change email address to arnold@gnu.org in all relevant places.
+
+Wed Oct 15 03:38:12 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y (yylex): Don't allow newlines after ? or : if do_posix.
+
+Thu Oct 9 19:28:39 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * custom.h [SEQUENT]: removed; not needed any more since the
+ mmap code was ripped out.
+
+Wed Oct 8 17:22:03 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in: remove check for madvise; don't need it any more
+ after nuking use of mmap.
+
+Tue Oct 7 11:14:21 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (flags2str): made the code table driven. Shortened a lot.
+
+Tue Sep 30 20:59:17 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (r_get_lhs): case Node_field_spec. Add lint warnings
+ for field reference of null string or non-numeric value.
+ Based on patch submitted by Alan Broder, ajb@dtmr.com.
+
+Wed Sep 24 20:47:59 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * custom.h [TANDEM]: new changes. Finishes up Tandem
+ integration.
+
+Mon Sep 22 00:42:34 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * custom.h [__be_os]: remove BROKEN_TOKEN definition.
+ dfa.c, dfa.h: change `token' to `dfa_token' to avoid BeOS
+ compile problems.
+
+Thu Aug 7 22:35:17 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Changes for BeOS from mc@whoever.com
+ awk.h (strncasecmp): bracket prototype.
+ custom.h [__be_os]: new stuff.
+ dfa.h, dfa.c [BROKEN_TOK]: new ifdefs to use dfa_token, not token.
+
+Fri Aug 1 13:32:49 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Tandem changes:
+ awk.h [TANDEM]: misc additions, as needed.
+ io.c (get_a_record): changes for fixed length records; not used
+ on other systems.
+ main.c (MRL): new variable, TANDEM specific.
+ (main): update handling -mr option for TANDEM.
+ (load_environ): comment out whole routine if TANDEM.
+ missing.c [TANDEM]: new includes.
+ gawkmisc.c [TANDEM]: include `tmiscc'.
+
+Wed Jul 30 19:53:52 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Close-on-exec changes:
+ awk.h: (os_close_on_exec, os_isdir): new functions.
+ gawkmisc.c: add include fcntl.h.
+ configure.in [AC_CHECK_HEADERS]: add fcntl.h.
+ io.c (devopen, iop_open): change to use os_isdir(), not S_IFDIR().
+ (redirect, devopen, iop_open, gawk_popen): change all calls to
+ fcntl() to os_close_on_exec().
+
+Tue Jul 29 11:09:45 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (set_BINMODE): fixed check for digits to use isdigit()
+ instead of looping over digits and using strchr(). Duh.
+
+Sat Jul 26 22:52:08 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (set_BINMODE): fix so that `-v BINMODE=w' works.
+ * node.c (r_force_number): add decl of strtod(); makes things
+ work on MIPS.
+ * Makefile.in (install-strip): new target.
+
+Fri Jul 18 13:28:05 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (redirect, devopen, iop_open, gawk_popen): set the
+ close-on-exec flag on all files and pipes opened for I/O.
+ Keeps children run via system() or other pipes from running out
+ of file descriptors.
+
+ (Reported by Kenny McCormack, gazelle@yin.interaccess.com.)
+
+Tue Jul 8 22:18:00 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y [LEX_NEXT]: Removed support for `next file' as two words.
+
+Tue Jul 8 06:46:32 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dfa.c: changes from pjr@jet.UK (Paul J Rippin) from an old
+ bug report against 2.14.0 that speed up initialization and
+ rewrite the inner loop into readable code.
+
+Thu Jul 3 11:44:50 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Atari support moved into new `unsupported' directory.
+ awk.h, Makefile.in, gawkmisc.c, and missing.c modified.
+
+Sun Jun 29 14:17:37 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.y (exp): fixed warning about `x = /foo/'.
+
+Wed Jun 25 09:07:57 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * PORTS: removed from distribution.
+ * Makefile.in (MISC): removed PORTS.
+
+Sun Jun 22 11:52:57 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * BINMODE changes
+ awk.h (Node_BINMODE): added.
+ (struct redirect): added mode field to save for io.c:close_one().
+ (BINMODE, BINMODE_node, set_BINMODE): add declarations.
+ awk.y (isnoeffect): add Node_BINMODE.
+ eval.c (nodetypes): add Node_BINMODE string.
+ (r_tree_eval, r_get_lhs): add cases for Node_BINMODE.
+ (set_BINMODE): new function.
+ io.c (binmode): new function.
+ (nextfile, redirect, gawk_popen): add calls to binmode().
+ main.c (BINMODE, BINMODE_node): add decls.
+ (main): add call to setmode() if BINMODE is set.
+ (varinit): add entry for BINMODE.
+
+Wed Jun 4 21:52:25 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.in [AC_FUNC_MMAP]: removed call.
+ * awk.h [struct iobuf]: removed IOP_MMAPED flag and `getrec' member.
+ * io.c: removed all mmap related code.
+
+Sun Apr 27 16:23:56 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * aclocal.m4 [GAWK_AC_FUNC_MKTIME]: new macro.
+ * configure.in (GAWK_AC_FUNC_MKTIME): call it.
+
+Thu Apr 24 23:25:06 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (devopen): remove stat test for /dev/foo files. Finally.
+
+Fri Jul 26 09:23:15 1996 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Changes to add an abort statement, a la tawk
+ awk.h (Node_K_abort): new enum value for NODETYPE.
+ main.c (aborting): new flag variable.
+ (main): add logic to handle aborting.
+ eval.c (interpret): add case for Node_K_abort.
+ io.c (do_input): if aborting, break loop.
+ awk.y (tokentab): add entry for "abort" keyword
+ (PRODUCTIONS): add production for LEX_ABORT.
+
+Wed Jul 24 12:49:52 1996 Arnold D. Robbins <arnold@skeeve.com>
+
+ * First cut at changes for i18n.
+ awk.h (do_intl): declare new flag variable.
+ [INTLSTR]: new flag def.
+ (m_tree_eval): fix definitions for INTLSTR.
+ (force_string): fix definitions for INTLSTR.
+ awk.y (yylex): add _"..." for international strings.
+ (dumpintlstr): new function.
+ main.c (do_intl): define new flag variable.
+ (optab): add "gen-po" entry.
+ (main): if do_intl, exit, don't run the program.
+ (gawkoption): add "gen-po" entry.
+ node.c (r_force_string): call gettext if flags indicate INTLSTR.
+
+Thu Mar 14 06:29:42 1996 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (do_mktime): added declaration of new function.
+ * builtin.c (do_mktime): new function.
+ * awk.y (tokentab): added "mktime" to list of gawk extensions.
+ * missing.c [HAVE_MKTIME]: added include of mktime.c if needed.
+
+Mon Feb 26 22:32:19 1996 Arnold D. Robbins <arnold@skeeve.com>
+
+ * io.c (pidopen, useropen): added warnings to use PROCINFO[],
+ not special files.
+ * main.c (load_procinfo): new function.
+ * awk.y (variable): added call to load_procinfo() function.
+
Mon Aug 7 15:23:00 2000 Arnold D. Robbins <arnold@skeeve.com>
* Release 3.0.6: Release tar file made.
@@ -802,7 +2022,7 @@ Fri Feb 21 06:23:19 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* Misc changes from Katsuyuki Okabe <HGC02147@niftyserve.or.jp>:
* builtin.c (do_substr): change a %d to %ld in warning message.
* eval.c (op_assign): fix format string for warning about %=.
-
+
Wed Feb 19 23:29:02 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* main.c (main): add do_intervals to condition that causes
@@ -1323,7 +2543,7 @@ Thu Mar 7 08:08:51 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
fields between parse_high_water and NF.
* eval.c (nodetype2str): new function, used for diagnostics.
eval.c (interpret): use nodetype2str when finding invalid node.
-
+
Mon Mar 4 09:02:28 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
* builtin.c (do_toupper, do_tolower): use isascii along with
diff --git a/contrib/awk/FUTURES b/contrib/awk/FUTURES
index 829f16838643..b2f7575f4b13 100644
--- a/contrib/awk/FUTURES
+++ b/contrib/awk/FUTURES
@@ -10,97 +10,76 @@ know where to get it.")
The focus on the future is thus narrowed to performance and functional
enhancements, with only minor plans for significant new features.
-For 3.0
-=======
- DONE: Move to autoconf-based configure system.
+(OK, so 3.1 had a bad case of feature-itis. I think I'm mostly over it
+now, though. :-)
- DONE: Allow RS to be a regexp.
+In 3.1
+======
+ DONE: A PROCINFO array to replace /dev/pid, /dev/user, et al.
- DONE: RT variable to hold text of record terminator
+ DONE: Add `abort' statement a la Thompson awk.
- DONE: split() with null string as third arg to split up strings
+ DONE: Provide awk profiling.
- DONE: Analogously, setting FS="" would split the input record into
- individual characters.
+ DONE: Integrate GNU NLS support.
- DONE: Generalize IGNORECASE
- - any value makes it work, not just numeric non-zero
- - make it apply to *all* string comparisons
+ DONE: Bring out hooks for NLS support into gawk itself.
- DONE: Incorporate newer dfa.c and regex.c
+ DONE: Do a reference card.
- DONE: Go to POSIX regexps
+ DONE: Switch to full ANSI C and use ansi2kr.
- DONE: Make regex + dfa less dependant on gawk header file includes
+ Additional manual features:
+ DONE: Document NLS support
- DONE: Source code formatting cleaned up and regularized
+For 3.2
+=======
+ Move the loadable modules interface to libtool.
- DONE: Clean up code by isolating system-specific functions in
- separate files.
+ Redo the loadable modules interface from the awk level.
- DONE: General sub function:
- gensub(pat, sub, global_flag[, line])
- that return the substituted strings and allow \1 etc.
- in the sub string.
+ Rework management of array index storage.
- DONE: Add AWKPATH to ENVIRON if it's not there
+ A RECLEN variable for fixed-length record input. PROCINFO["RS"]
+ would be "RS" or "RECLEN" depending upon what's in use.
- DONE: Undertake significant directory reorganization.
+ DBM storage of awk arrays. Try to allow multiple dbm packages.
- DONE: Extensive manual cleanup:
- Use of texinfo 2.0 features
- Lots more examples
- Document posix regexps
- Document all of the above.
+ Look at ISO C 99 printf features.
-In 3.1
-======
- A PROCINFO array to replace /dev/pid, /dev/user, et al.
-
- DONE: Use mmap to read input files on systems that support it.
+ Add %'d for putting in commas in formatting?
- Add `abort' statement a la Thompson awk.
+ Consider integrating Fred Fish's DBUG library into gawk.
Consider removing use of and/or need for the protos.h file.
- Use a new or improved dfa.
-
- Integrate GNU NLS support.
-
- Bring out hooks for NLS support into gawk itself.
-
- DBM storage of awk arrays. Try to allow multiple dbm packages.
-
- Use GNU malloc.
+ Additional manual features:
+ ? Add exercises
+ Document use of dbm arrays
+ ? Add an error messages section to the manual
- DONE: Do a reference card.
+For 3.3
+=======
+ Use a new or improved dfa and/or regex library.
? Have strftime() pay attention to the value of ENVIRON["TZ"]
+ Add a lint check if the return value of a function is used but
+ the function did not supply a value.
+
Additional manual features:
- Document use of dbm arrays
- Document NLS support
- ? Add exercises
- ? Add an error messages section to the manual
? A section on where gawk is bounded
regex
i/o
sun fp conversions
-For 3.2
+For 3.4
=======
- Add a lint check if the return value of a function is used but
- the function did not supply a value.
-
Do an optimization pass over parse tree?
- Make awk '/foo/' files... run at egrep speeds
+ Make awk '/foo/' files... run at egrep speeds (how?)
For 4.x:
========
-Create a gawk compiler?
-
-Create a gawk-to-C translator? (or C++??)
-
-Provide awk profiling and debugging.
+Provide awk debugging.
diff --git a/contrib/awk/Makefile.am b/contrib/awk/Makefile.am
new file mode 100644
index 000000000000..08809d32a005
--- /dev/null
+++ b/contrib/awk/Makefile.am
@@ -0,0 +1,161 @@
+#
+# Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 2000-2001 the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK 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.
+#
+# GAWK 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
+#
+
+## process this file with automake to produce Makefile.in
+
+# Automatic de-ANSI-fication if needed
+AUTOMAKE_OPTIONS = ansi2knr
+
+# This undocumented variable insures that aclocal runs
+# correctly after changing configure.in
+ACLOCAL_AMFLAGS = -I m4
+
+# This insures that make flags get passed down to child makes.
+AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
+
+# Stuff to include in the dist that doesn't need it's own
+# Makefile.am files
+EXTRA_DIST = \
+ COPYING \
+ FUTURES \
+ INSTALL \
+ LIMITATIONS \
+ NEWS \
+ POSIX.STD \
+ PROBLEMS \
+ README_d \
+ bisonfix.sed \
+ depcomp \
+ extension \
+ fixvers \
+ m4 \
+ missing \
+ missing_d \
+ pc \
+ posix \
+ unsupported \
+ vms
+
+# The order to do things in.
+# Build in intl first in case we need the local gettext version.
+# Build explicitly "." next in order to build gawk first, so
+# that `make check' without a prior `make' works.
+SUBDIRS = \
+ intl \
+ . \
+ awklib \
+ doc \
+ po \
+ test
+
+# what to make and install
+bin_PROGRAMS = gawk pgawk
+
+# sources for both gawk and pgawk
+base_sources = \
+ array.c \
+ awk.h \
+ awkgram.y \
+ builtin.c \
+ custom.h \
+ dfa.c \
+ dfa.h \
+ ext.c \
+ field.c \
+ gawkmisc.c \
+ getopt.c \
+ getopt.h \
+ getopt1.c \
+ io.c \
+ main.c \
+ msg.c \
+ node.c \
+ patchlev.h \
+ protos.h \
+ random.c \
+ random.h \
+ re.c \
+ regex.c \
+ regex.h \
+ replace.c \
+ version.in \
+ version.c
+
+gawk_SOURCES = $(base_sources) eval.c profile.c
+pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c
+
+# Get extra libs as needed
+LDADD = @INTLLIBS@ @SOCKET_LIBS@
+
+# stuff for compiling gawk/pgawk
+DEFPATH="\".:$(datadir)\""
+
+DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\""
+
+INCLUDES = -I. -I$(srcdir) -I$(srcdir)/intl
+
+# We want hard links for install-exec-hook, below
+LN= ln
+
+# First, add a link from gawk to gawk-X.Y.Z
+# For systems where gawk is awk, add a link to awk
+install-exec-hook:
+ (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \
+ cd $(DESTDIR)$(bindir); \
+ $(LN) gawk $$fullname ; \
+ if [ ! -f awk ]; \
+ then $(LN_S) gawk awk; \
+ fi; exit 0)
+
+# Undo the above when uninstalling
+uninstall-links:
+ (cd $(DESTDIR)$(bindir); \
+ if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi ; \
+ fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \
+ rm -f $$fullname; exit 0)
+
+uninstall-recursive: uninstall-links
+
+# force there to be a gawk executable before running tests
+check-local: gawk pgawk
+
+# A little extra clean up when making distributions.
+# FIXME: most of this rule should go away upon switching to libtool.
+dist-hook:
+ cd $(distdir)/extension ; rm -f *.o *.so
+
+# Special rules for individual files
+awkgram.c: awkgram.y
+ $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && sed -f $(srcdir)/bisonfix.sed < y.tab.c > $*.c && $(RM) y.tab.c
+ if test -f y.tab.h; then \
+ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
+ else :; fi
+
+# these force version and patchlevel to be up to date based
+# on what's in configure.in. No-one else but me should have
+# to use them. So there.
+patchlev.h: configure.in
+ ./fixvers -p
+
+version.c: configure.in version.in
+ ./fixvers -v
diff --git a/contrib/awk/Makefile.in b/contrib/awk/Makefile.in
index 2b464168c739..c4a7bce716d2 100644
--- a/contrib/awk/Makefile.in
+++ b/contrib/awk/Makefile.in
@@ -1,286 +1,797 @@
-# Makefile for GNU Awk.
-#
-# Copyright (C) 1986, 1988-2000 the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK 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.
-#
-# GAWK 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
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
-@SET_MAKE@
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
-MAKEINFO = makeinfo --no-split
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+SHELL = @SHELL@
srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-
-CC = @CC@
-YACC = @YACC@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-
-ALLOCA = @ALLOCA@
-
-LN = ln
-LN_S = @LN_S@
-
-exec_prefix = @exec_prefix@
prefix = @prefix@
-binprefix =
-manprefix =
+exec_prefix = @exec_prefix@
bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
libdir = @libdir@
-manexta = 1
-mandir = @mandir@/man$(manexta)
-manext = .$(manexta)
infodir = @infodir@
-datadir = @datadir@/awk
-libexecdir = @libexecdir@/awk
-
-DEFPATH = ".:$(datadir)"
-
-SHELL = /bin/sh
-CPPFLAGS = @CPPFLAGS@
-CFLAGS = @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 \
- missing.o msg.o node.o re.o version.o
-
-ALLOBJS = $(AWKOBJS) awktab.o
-
-# LIBOBJS
-# GNU and other stuff that gawk uses as library routines.
-LIBOBJS= getopt.o getopt1.o regex.o dfa.o random.o $(ALLOCA)
-
-# source and documentation files
-SRC = array.c builtin.c eval.c field.c gawkmisc.c io.c main.c \
- missing.c msg.c node.c re.c version.c
-
-ALLSRC= $(SRC) awktab.c
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
-AWKSRC= awk.h awk.y custom.h $(ALLSRC) patchlevel.h protos.h random.h
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
-LIBSRC = alloca.c dfa.c dfa.h regex.c regex.h getopt.h getopt.c getopt1.c random.c
+top_builddir = .
-COPIES = missing/system.c missing/tzset.c \
- missing/memcmp.c missing/memcpy.c missing/memset.c \
- missing/strncasecmp.c missing/strchr.c \
- missing/strerror.c missing/strtod.c \
- missing/strftime.c missing/strftime.3
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
-DOCS= doc/gawk.1 doc/gawk.texi doc/texinfo.tex
-
-TEXFILES= doc/gawk.aux doc/gawk.cp doc/gawk.cps doc/gawk.fn doc/gawk.fns \
- doc/gawk.ky doc/gawk.kys doc/gawk.pg doc/gawk.pgs doc/gawk.toc \
- doc/gawk.tp doc/gawk.tps doc/gawk.vr doc/gawk.vrs
-
-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
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
-OTHERS= doc pc atari vms README_d posix awklib
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
-ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info*
+@SET_MAKE@
+AMDEP = @AMDEP@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DATADIRNAME = @DATADIRNAME@
+DEPDIR = @DEPDIR@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LN_S = @LN_S@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SOCKET_LIBS = @SOCKET_LIBS@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+YACC = @YACC@
+install_sh = @install_sh@
+l = @l@
-MAKEFILEIN = Makefile.in awklib/Makefile.in doc/Makefile.in test/Makefile.in
+#
+# Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 2000-2001 the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK 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.
+#
+# GAWK 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
+#
-# Release of gawk. There can be no leading or trailing white space here!
-REL=3.0
+# Automatic de-ANSI-fication if needed
+
+
+AUTOMAKE_OPTIONS = ansi2knr
+
+# This undocumented variable insures that aclocal runs
+# correctly after changing configure.in
+ACLOCAL_AMFLAGS = -I m4
+
+# This insures that make flags get passed down to child makes.
+AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)'
+
+# Stuff to include in the dist that doesn't need it's own
+# Makefile.am files
+EXTRA_DIST = \
+ COPYING \
+ FUTURES \
+ INSTALL \
+ LIMITATIONS \
+ NEWS \
+ POSIX.STD \
+ PROBLEMS \
+ README_d \
+ bisonfix.sed \
+ depcomp \
+ extension \
+ fixvers \
+ m4 \
+ missing \
+ missing_d \
+ pc \
+ posix \
+ unsupported \
+ vms
+
+
+# The order to do things in.
+# Build in intl first in case we need the local gettext version.
+# Build explicitly "." next in order to build gawk first, so
+# that `make check' without a prior `make' works.
+SUBDIRS = \
+ intl \
+ . \
+ awklib \
+ doc \
+ po \
+ test
+
+
+# what to make and install
+bin_PROGRAMS = gawk pgawk
+
+# sources for both gawk and pgawk
+base_sources = \
+ array.c \
+ awk.h \
+ awkgram.y \
+ builtin.c \
+ custom.h \
+ dfa.c \
+ dfa.h \
+ ext.c \
+ field.c \
+ gawkmisc.c \
+ getopt.c \
+ getopt.h \
+ getopt1.c \
+ io.c \
+ main.c \
+ msg.c \
+ node.c \
+ patchlev.h \
+ protos.h \
+ random.c \
+ random.h \
+ re.c \
+ regex.c \
+ regex.h \
+ replace.c \
+ version.in \
+ version.c
+
+
+gawk_SOURCES = $(base_sources) eval.c profile.c
+pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c
+
+# Get extra libs as needed
+LDADD = @INTLLIBS@ @SOCKET_LIBS@
+
+# stuff for compiling gawk/pgawk
+DEFPATH = "\".:$(datadir)\""
+
+DEFS = -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\""
+
+INCLUDES = -I. -I$(srcdir) -I$(srcdir)/intl
+
+# We want hard links for install-exec-hook, below
+LN = ln
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(bin_PROGRAMS)
-# clear out suffixes list
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+ANSI2KNR = @ANSI2KNR@
+am_gawk_OBJECTS = array$U.o awkgram$U.o builtin$U.o dfa$U.o ext$U.o \
+field$U.o gawkmisc$U.o getopt$U.o getopt1$U.o io$U.o main$U.o msg$U.o \
+node$U.o random$U.o re$U.o regex$U.o replace$U.o version$U.o eval$U.o \
+profile$U.o
+gawk_OBJECTS = $(am_gawk_OBJECTS)
+gawk_LDADD = $(LDADD)
+gawk_DEPENDENCIES =
+gawk_LDFLAGS =
+am_pgawk_OBJECTS = array$U.o awkgram$U.o builtin$U.o dfa$U.o ext$U.o \
+field$U.o gawkmisc$U.o getopt$U.o getopt1$U.o io$U.o main$U.o msg$U.o \
+node$U.o random$U.o re$U.o regex$U.o replace$U.o version$U.o eval_p$U.o \
+profile_p$U.o
+pgawk_OBJECTS = $(am_pgawk_OBJECTS)
+pgawk_LDADD = $(LDADD)
+pgawk_DEPENDENCIES =
+pgawk_LDFLAGS =
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+DEP_FILES = @AMDEP@ $(DEPDIR)/array$U.Po $(DEPDIR)/awkgram$U.Po \
+$(DEPDIR)/builtin$U.Po $(DEPDIR)/dfa$U.Po $(DEPDIR)/eval$U.Po \
+$(DEPDIR)/eval_p$U.Po $(DEPDIR)/ext$U.Po $(DEPDIR)/field$U.Po \
+$(DEPDIR)/gawkmisc$U.Po $(DEPDIR)/getopt$U.Po $(DEPDIR)/getopt1$U.Po \
+$(DEPDIR)/io$U.Po $(DEPDIR)/main$U.Po $(DEPDIR)/msg$U.Po \
+$(DEPDIR)/node$U.Po $(DEPDIR)/profile$U.Po $(DEPDIR)/profile_p$U.Po \
+$(DEPDIR)/random$U.Po $(DEPDIR)/re$U.Po $(DEPDIR)/regex$U.Po \
+$(DEPDIR)/replace$U.Po $(DEPDIR)/version$U.Po
+DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \
+INSTALL Makefile.am Makefile.in NEWS acconfig.h acinclude.m4 aclocal.m4 \
+ansi2knr.1 ansi2knr.c awkgram.c configh.in configure configure.in \
+depcomp install-sh missing mkinstalldirs
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+GZIP_ENV = --best
+SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES)
+OBJECTS = $(am_gawk_OBJECTS) $(am_pgawk_OBJECTS)
+
+all: all-redirect
.SUFFIXES:
-.SUFFIXES: .c .o
-
-.c.o:
- $(CC) -c $(COMPFLAGS) $<
+.SUFFIXES: .c .h .o .y
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
-# rules to build gawk
-all: gawk awklib/all doc/all
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-# stuff to make sure that configure has been run.
-$(srcdir)/configure: configure.in aclocal.m4
- cd $(srcdir) && autoconf
+$(ACLOCAL_M4): configure.in acinclude.m4 m4/arch.m4 m4/gettext.m4 \
+ m4/jm-mktime.m4 m4/largefile.m4 m4/lcmessage.m4 \
+ m4/progtest.m4 m4/socket.m4 m4/ssize_t.m4 m4/strtod.m4
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-# autoheader might not change confh.in, so touch a stamp file
-$(srcdir)/configh.in: stamp-h.in
-$(srcdir)/stamp-h.in: configure.in aclocal.m4 acconfig.h
- cd $(srcdir) && autoheader
- date > $(srcdir)/stamp-h.in
-
-config.h: stamp-h
-stamp-h: configh.in config.status
- $(SHELL) ./config.status
-
-Makefile: $(MAKEFILEIN) config.status
- $(SHELL) ./config.status
-
-config.status: configure
+config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
+$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+ cd $(srcdir) && $(AUTOCONF)
-# 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 $(CFLAGS) $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
-
-$(ALLOBJS): awk.h dfa.h regex.h config.h custom.h
-
-$(LIBOBJS): config.h custom.h
-
-# SunOS make's (at least) VPATH doesn't do subdirectories...
-# Solaris make doesn't allow $< in the actual rule
-gawkmisc.o: $(srcdir)/atari/gawkmisc.atr \
- $(srcdir)/pc/gawkmisc.pc $(srcdir)/posix/gawkmisc.c \
- $(srcdir)/vms/gawkmisc.vms
- $(CC) -c $(COMPFLAGS) -DDEFPATH='$(DEFPATH)' $(srcdir)/gawkmisc.c
+config.h: stamp-h
+ @if test ! -f $@; then \
+ rm -f stamp-h; \
+ $(MAKE) stamp-h; \
+ else :; fi
+stamp-h: $(srcdir)/configh.in $(top_builddir)/config.status
+ @rm -f stamp-h stamp-hT
+ @echo timestamp > stamp-hT 2> /dev/null
+ cd $(top_builddir) \
+ && CONFIG_FILES= CONFIG_HEADERS=config.h:configh.in \
+ $(SHELL) ./config.status
+ @mv stamp-hT stamp-h
+$(srcdir)/configh.in: $(srcdir)/./stamp-h.in
+ @if test ! -f $@; then \
+ rm -f $(srcdir)/./stamp-h.in; \
+ $(MAKE) $(srcdir)/./stamp-h.in; \
+ else :; fi
+$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
+ @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT
+ @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null
+ cd $(top_srcdir) && $(AUTOHEADER)
+ @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in
+
+mostlyclean-hdr:
+
+clean-hdr:
+
+distclean-hdr:
+ -rm -f config.h
+
+maintainer-clean-hdr:
+
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+distclean-binPROGRAMS:
+
+maintainer-clean-binPROGRAMS:
+
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(bindir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
+ done
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+mostlyclean-krextra:
+
+clean-krextra:
+ -rm -f ansi2knr
+
+distclean-krextra:
+
+maintainer-clean-krextra:
+ansi2knr: ansi2knr.o
+ $(LINK) ansi2knr.o $(LIBS)
+ansi2knr.o: $(CONFIG_HEADER)
+
+
+mostlyclean-kr:
+ -rm -f *_.c
+
+clean-kr:
+
+distclean-kr:
+
+maintainer-clean-kr:
+
+gawk: $(gawk_OBJECTS) $(gawk_DEPENDENCIES)
+ @rm -f gawk
+ $(LINK) $(gawk_LDFLAGS) $(gawk_OBJECTS) $(gawk_LDADD) $(LIBS)
+
+pgawk: $(pgawk_OBJECTS) $(pgawk_DEPENDENCIES)
+ @rm -f pgawk
+ $(LINK) $(pgawk_LDFLAGS) $(pgawk_OBJECTS) $(pgawk_LDADD) $(LIBS)
+array_.c: array.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array.c; then echo $(srcdir)/array.c; else echo array.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > array_.c
+awkgram_.c: awkgram.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/awkgram.c; then echo $(srcdir)/awkgram.c; else echo awkgram.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > awkgram_.c
+builtin_.c: builtin.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/builtin.c; then echo $(srcdir)/builtin.c; else echo builtin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > builtin_.c
+dfa_.c: dfa.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dfa.c; then echo $(srcdir)/dfa.c; else echo dfa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > dfa_.c
+eval_.c: eval.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eval.c; then echo $(srcdir)/eval.c; else echo eval.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eval_.c
+eval_p_.c: eval_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eval_p.c; then echo $(srcdir)/eval_p.c; else echo eval_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eval_p_.c
+ext_.c: ext.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ext.c; then echo $(srcdir)/ext.c; else echo ext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ext_.c
+field_.c: field.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/field.c; then echo $(srcdir)/field.c; else echo field.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > field_.c
+gawkmisc_.c: gawkmisc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gawkmisc.c; then echo $(srcdir)/gawkmisc.c; else echo gawkmisc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gawkmisc_.c
+getopt_.c: getopt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c
+getopt1_.c: getopt1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c
+io_.c: io.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > io_.c
+main_.c: main.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/main.c; then echo $(srcdir)/main.c; else echo main.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > main_.c
+msg_.c: msg.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/msg.c; then echo $(srcdir)/msg.c; else echo msg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > msg_.c
+node_.c: node.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/node.c; then echo $(srcdir)/node.c; else echo node.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > node_.c
+profile_.c: profile.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/profile.c; then echo $(srcdir)/profile.c; else echo profile.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > profile_.c
+profile_p_.c: profile_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/profile_p.c; then echo $(srcdir)/profile_p.c; else echo profile_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > profile_p_.c
+random_.c: random.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > random_.c
+re_.c: re.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/re.c; then echo $(srcdir)/re.c; else echo re.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > re_.c
+regex_.c: regex.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > regex_.c
+replace_.c: replace.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/replace.c; then echo $(srcdir)/replace.c; else echo replace.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > replace_.c
+version_.c: version.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > version_.c
+array_.o awkgram_.o builtin_.o dfa_.o eval_.o eval_p_.o ext_.o field_.o \
+gawkmisc_.o getopt_.o getopt1_.o io_.o main_.o msg_.o node_.o \
+profile_.o profile_p_.o random_.o re_.o regex_.o replace_.o version_.o \
+: $(ANSI2KNR)
+.y.c:
+ $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
+ if test -f y.tab.h; then \
+ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
+ else :; fi
+
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+# (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+
+all-recursive install-data-recursive install-exec-recursive \
+installdirs-recursive install-recursive uninstall-recursive \
+check-recursive installcheck-recursive info-recursive dvi-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $(MAKEFLAGS); amf=$$2; \
+ dot_seen=no; \
+ rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) configh.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)configh.in$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags configh.in $$unique $(LISP)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+@AMDEP@include $(DEPDIR)/array$U.Po
+@AMDEP@include $(DEPDIR)/awkgram$U.Po
+@AMDEP@include $(DEPDIR)/builtin$U.Po
+@AMDEP@include $(DEPDIR)/dfa$U.Po
+@AMDEP@include $(DEPDIR)/eval$U.Po
+@AMDEP@include $(DEPDIR)/eval_p$U.Po
+@AMDEP@include $(DEPDIR)/ext$U.Po
+@AMDEP@include $(DEPDIR)/field$U.Po
+@AMDEP@include $(DEPDIR)/gawkmisc$U.Po
+@AMDEP@include $(DEPDIR)/getopt$U.Po
+@AMDEP@include $(DEPDIR)/getopt1$U.Po
+@AMDEP@include $(DEPDIR)/io$U.Po
+@AMDEP@include $(DEPDIR)/main$U.Po
+@AMDEP@include $(DEPDIR)/msg$U.Po
+@AMDEP@include $(DEPDIR)/node$U.Po
+@AMDEP@include $(DEPDIR)/profile$U.Po
+@AMDEP@include $(DEPDIR)/profile_p$U.Po
+@AMDEP@include $(DEPDIR)/random$U.Po
+@AMDEP@include $(DEPDIR)/re$U.Po
+@AMDEP@include $(DEPDIR)/regex$U.Po
+@AMDEP@include $(DEPDIR)/replace$U.Po
+@AMDEP@include $(DEPDIR)/version$U.Po
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+maintainer-clean-depend:
+
+@AMDEP@CCDEPMODE = @CCDEPMODE@
-getopt.o: getopt.h
-
-getopt1.o: getopt.h
-
-builtin.o: random.h
-
-main.o: patchlevel.h
-
-awktab.c: awk.y
- $(YACC) -v $(srcdir)/awk.y && \
- if test -f y.tab.c ; then mv y.tab.c ytab.c ; else true ; fi && \
- sed '/^extern char .malloc(), .realloc();$$/d' ytab.c >awktab.c && \
- rm ytab.c
-
-# VMS POSIX make won't apply the default .c.o rule to awktab.o for some reason
-awktab.o: awktab.c awk.h
- $(CC) -c $(COMPFLAGS) $(srcdir)/awktab.c
-
-alloca.o: alloca.c
-
-install: gawk info installdirs
- -rm -f $(bindir)/gawk
- fullname=gawk-$(REL).`./gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
- $(INSTALL_PROGRAM) gawk $(bindir)/$$fullname ; \
- (cd $(bindir); $(LN) $$fullname gawk)
- (cd $(bindir); \
+.c.o:
+@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/=build
+ mkdir $(distdir)/=inst
+ chmod a-w $(distdir)
+ dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+ && cd $(distdir)/=build \
+ && ../configure --srcdir=.. --prefix=$$dc_install_base \
+ --with-included-gettext \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && $(MAKE) $(AM_MAKEFLAGS) distclean \
+ && rm -f $(distdir).tar.gz \
+ && test `find . -type f -print | wc -l` -eq 0
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ @banner="$(distdir).tar.gz is ready for distribution"; \
+ dashes=`echo "$$banner" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ echo "$$dashes"
+dist: distdir
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+dist-all: distdir
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+distdir: $(DISTFILES)
+ -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+ mkdir $(distdir)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ for subdir in $(SUBDIRS); do \
+ if test "$$subdir" = .; then :; else \
+ test -d $(distdir)/$$subdir \
+ || mkdir $(distdir)/$$subdir \
+ || exit 1; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook
+info-am:
+info: info-recursive
+dvi-am:
+dvi: dvi-recursive
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-local
+check: check-recursive
+installcheck-am:
+installcheck: installcheck-recursive
+all-recursive-am: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+install-exec-am: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-exec: install-exec-recursive
+
+install-data-am:
+install-data: install-data-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-recursive
+uninstall-am: uninstall-binPROGRAMS
+uninstall: uninstall-recursive
+all-am: Makefile $(ANSI2KNR) $(PROGRAMS) config.h
+all-redirect: all-recursive-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs: installdirs-recursive
+installdirs-am:
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ -rm -f Makefile.in
+ -test -z "awkgram.c" || rm -f awkgram.c
+mostlyclean-am: mostlyclean-hdr mostlyclean-binPROGRAMS \
+ mostlyclean-compile mostlyclean-krextra mostlyclean-kr \
+ mostlyclean-tags mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-recursive
+
+clean-am: clean-hdr clean-binPROGRAMS clean-compile clean-krextra \
+ clean-kr clean-tags clean-depend clean-generic \
+ mostlyclean-am
+
+clean: clean-recursive
+
+distclean-am: distclean-hdr distclean-binPROGRAMS distclean-compile \
+ distclean-krextra distclean-kr distclean-tags \
+ distclean-depend distclean-generic clean-am
+
+distclean: distclean-recursive
+ -rm -f config.status
+
+maintainer-clean-am: maintainer-clean-hdr maintainer-clean-binPROGRAMS \
+ maintainer-clean-compile maintainer-clean-krextra \
+ maintainer-clean-kr maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f config.status
+
+.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
+mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
+maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile mostlyclean-krextra distclean-krextra \
+clean-krextra maintainer-clean-krextra mostlyclean-kr distclean-kr \
+clean-kr maintainer-clean-kr install-recursive uninstall-recursive \
+install-data-recursive uninstall-data-recursive install-exec-recursive \
+uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
+all-recursive check-recursive installcheck-recursive info-recursive \
+dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
+maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend distdir info-am \
+info dvi-am dvi check-local check check-am installcheck-am installcheck \
+all-recursive-am install-exec-am install-exec install-data-am \
+install-data install-am install uninstall-am uninstall all-redirect \
+all-am all install-strip installdirs-am installdirs mostlyclean-generic \
+distclean-generic clean-generic maintainer-clean-generic clean \
+mostlyclean distclean maintainer-clean
+
+
+# First, add a link from gawk to gawk-X.Y.Z
+# For systems where gawk is awk, add a link to awk
+install-exec-hook:
+ (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \
+ cd $(DESTDIR)$(bindir); \
+ $(LN) gawk $$fullname ; \
if [ ! -f awk ]; \
then $(LN_S) gawk awk; \
fi; exit 0)
- cd doc && $(MAKE) install
- cd awklib && $(MAKE) install
-
-installdirs: mkinstalldirs
- $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
- $(libdir) $(infodir) $(mandir) $(libexecdir)
-
-install-strip:
- $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
-
-uninstall:
- (cd $(bindir); \
- if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi)
- (fullname=gawk-$(REL).`gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
- cd $(bindir); \
- if cmp gawk $$fullname; then rm -f gawk; fi ; \
- rm -f $(bindir)/$$fullname)
- cd doc && $(MAKE) uninstall
- cd awklib && $(MAKE) uninstall
- -rmdir $(datadir) $(libexecdir)
-
-# auxiliary rules for release maintenance
-lint: $(ALLSRC)
- lint -hcbax $(COMPFLAGS) $(ALLSRC)
-
-xref:
- cxref -c $(COMPFLAGS) $(ALLSRC) | grep -v ' /' >xref
-
-mostlyclean:
- : mostly clean does nothing for gawk
- : use "make clean" to really clean things out
-
-clean:
- rm -rf gawk *.o core */core y.output
- cd doc && $(MAKE) clean
- cd test && $(MAKE) clean
- cd awklib && $(MAKE) clean
-
-local-distclean:
- rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output \
- gmon.out make.out config.h config.status config.cache \
- config.log stamp-h tags TAGS *~
-
-distclean: clean local-distclean
- cd doc && $(MAKE) distclean
- cd awklib && $(MAKE) distclean
- cd test && $(MAKE) distclean
-
-maintainer-clean: clean local-distclean
- @echo "This command is intended for maintainers to use; it"
- @echo "deletes files that may require special tools to rebuild."
- rm -f awktab.c
- cd doc && $(MAKE) maintainer-clean
- cd test && $(MAKE) maintainer-clean
- cd awklib && $(MAKE) maintainer-clean
-
-clobber: maintainer-clean
-
-TAGS:
- etags $(AWKSRC)
-
-tags:
- ctags $(AWKSRC)
-
-dvi: $(srcdir)/doc/gawk.texi
- cd doc && $(MAKE) dvi
-
-info: $(srcdir)/doc/gawk.texi
- cd doc && $(MAKE) info
-
-doc/all:
- cd doc && $(MAKE) all
-
-awklib/all: gawk
- cd awklib && $(MAKE) CFLAGS="$(CFLAGS)" all
-
-dist: $(AWKSRC) $(LIBSRC) $(DOCS) $(MISC) $(COPIES) awklib/stamp-eg info distclean
- -rm -rf gawk-$(REL)*
- dir=gawk-$(REL).`gawk '{print $$3}' patchlevel.h` && \
- mkdir $$dir && \
- cp -pr $(AWKSRC) $(LIBSRC) $(MISC) $$dir && \
- mkdir $$dir/missing && \
- cp -p $(COPIES) $$dir/missing && \
- for i in $(OTHERS); \
- do \
- cp -pr $$i $$dir ; \
- done && \
- cp -pr test $$dir && \
- find $$dir -type d -exec chmod 777 {} ';' && \
- find $$dir -print | doschk && \
- tar -cf - $$dir | gzip > $$dir.tar.gz && \
- rm -fr $$dir
-
-awklib/stamp-eg:
- cd awklib ; $(MAKE) stamp-eg
-
-check: gawk
- cd test; $(MAKE) -k
-
-test: check
+# Undo the above when uninstalling
+uninstall-links:
+ (cd $(DESTDIR)$(bindir); \
+ if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi ; \
+ fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \
+ rm -f $$fullname; exit 0)
+
+uninstall-recursive: uninstall-links
+
+# force there to be a gawk executable before running tests
+check-local: gawk pgawk
+
+# A little extra clean up when making distributions.
+# FIXME: most of this rule should go away upon switching to libtool.
+dist-hook:
+ cd $(distdir)/extension ; rm -f *.o *.so
+
+# Special rules for individual files
+awkgram.c: awkgram.y
+ $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && sed -f $(srcdir)/bisonfix.sed < y.tab.c > $*.c && $(RM) y.tab.c
+ if test -f y.tab.h; then \
+ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
+ else :; fi
+
+# these force version and patchlevel to be up to date based
+# on what's in configure.in. No-one else but me should have
+# to use them. So there.
+patchlev.h: configure.in
+ ./fixvers -p
+
+version.c: configure.in version.in
+ ./fixvers -v
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/awk/NEWS b/contrib/awk/NEWS
index fc8798ff9f8b..ab0aa8475c3a 100644
--- a/contrib/awk/NEWS
+++ b/contrib/awk/NEWS
@@ -1,3 +1,131 @@
+Changes from 3.0.6 to 3.1.0
+---------------------------
+
+1. A new PROCINFO array provides info about the process. The non-I/O /dev/xxx
+ files are now obsolete, and their use always generates a warning.
+
+2. A new `mktime' builtin function was added for creating time stamps. The
+ `mktime' function written in awk was removed from the user's guide.
+
+3. New `--gen-po' option creates GNU gettext .po files for strings marked
+ with a leading underscore.
+
+4. Gawk now completely interprets special file names internally, ignoring the
+ existence of real /dev/stdin, /dev/stdout files, etc.
+
+5. The mmap code was removed. It was a worthwhile experiment that just
+ didn't work out.
+
+6. The BINMODE variable is new; on non-UNIX systems it affects how gawk
+ opens files for text vs. binary.
+
+7. The atari port is now unsupported.
+
+8. Gawk no longer supports `next file' as two words.
+
+9. On systems that support it, gawk now sets the `close on exec' flag on all
+ files and pipes it opens. This makes sure that child processes run via
+ system() or pipes have plenty of file descriptors available.
+
+10. New ports: Tandem and BeOS. The Tandem port is unsupported.
+
+11. If `--posix' is in effect, newlines are not allowed after ?:.
+
+12. Weird OFMT/CONVFMT formats no longer cause fatal errors.
+
+13. Diagnostics about array parameters now include the parameter's name,
+ not just its number.
+
+14. configure should now automatically add -D_SYSV3 for ISC Unix.
+ (This seems to have made it into the gawk 3.0.x line long ago.)
+
+15. It is now possible to open a two-way pipe via the `|&' operator.
+ See the discussion in the manual about putting `sort' into such a pipeline,
+ though. (NOTE! This is borrowed from ksh: it is not the same as
+ the same operator in csh!)
+
+16. The close() function now takes an optional second string argument
+ that allows closing one or the other end of the two-way pipe to
+ a co-process. This is needed to use `sort' in a co-process, see
+ the doc.
+
+17. If TCP/IP is available, special file names beginning with `/inet'
+ can be used with `|&' for IPC. Thanks to Juergen Kahrs for the initial
+ code.
+
+18. With `--enable-portals' on the configure command line, gawk will also
+ treat file names that start with `/p/' as a 4.4 BSD type portal file,
+ i.e., a two-way pipe for `|&'.
+
+19. Unrecognized escapes, such as "\q" now always generate a warning.
+
+20. The LINT variable is new; it provides dynamic control over the --lint
+ option.
+
+21. Lint warnings can be made fatal by using --lint=fatal or `LINT = "fatal"'.
+ Use this if you're really serious about portable code.
+
+22. Due to an enhanced sed script, there is no longer any need to worry
+ about finding or using alloca. alloca.c is thus now gone.
+
+23. A number of lint warnings have been added. Most notably, gawk will
+ detect if a variable is used before assigned to. Warnings for
+ when a string that isn't a number gets converted to a number are
+ in the code but disabled; they seem to be too picky in practice.
+
+ Also, gawk will now warn about function parameter names that shadow
+ global variable names.
+
+24. It is now possible to dynamically add builtin functions on systems
+ that support dlopen. This facility is not (yet) as portable or well
+ integrated as it might be. *** WARNING *** THIS FEATURE WILL EVOLVE!
+
+25. There are *many* new tests in the test suite.
+
+26. Profiling has been added! A separate version of gawk, named pgawk, is
+ built and generates a run-time execution profile. The --profile option
+ can be used to change the default output file. In regular gawk, this
+ option pretty-prints the parse tree.
+
+27. Gawk has been internationalized, using GNU gettext. Translations for
+ future distributions are most welcome. Simultaneously, gawk was switched
+ over to using automake. You need Automake 1.4a (from the CVS archive)
+ if you want to muck with the Makefile.am files.
+
+28. New asort() function for sorting arrays. See the doc for details.
+
+29. The match function takes an optional array third argument to hold
+ the text matched by parenthesized sub-expressions.
+
+30. The bit op functions and octal and hex source code constants are on by
+ default, no longer a configure-time option. Recognition of non-decimal
+ data is now enabled at runtime with --non-decimal-data command line option.
+
+31. Internationalization features available at the awk level: new TEXTDOMAIN
+ variable and bindtextdomain() and dcgettext() functions. printf formats
+ may contain the "%2$3.5d" kind of notation for use in translations. See
+ the texinfo manual for details.
+
+32. The return value from close() has been rationalized. Most notably,
+ closing something that wasn't open returns -1 but remains non-fatal.
+
+33. The array effeciency change from 3.0.5 was reverted; the semantics were
+ not right. Additionally, index values of previously stored elements
+ can no longer change dynamically.
+
+34. The new option --dump-variables dumps a list of all global variables and
+ their final types and values to a file you give, or to `awkvars.out'.
+
+35. Gawk now uses a recent version of random.c courtesy of the FreeBSD
+ project.
+
+36. The gawk source code now uses ANSI C function definitions (new style),
+ with ansi2knr to translate code for old compilers.
+
+37. `for (iggy in foo)' loops should be more robust now in the face of
+ adding/deleting elements in the middle; they loop over just the elements
+ that are present in the array when the loop starts.
+
Changes from 3.0.5 to 3.0.6
---------------------------
@@ -11,7 +139,7 @@ Bugs fixed and changes made:
2. Similarly, running a `for (iggy in foo)' loop where `foo' is a
function parameter now works correctly.
-3. Similarly, `i = ""; v[i] = a; if (v in a) ...' now works again.
+3. Similarly, `i = ""; v[i] = a; if (i in v) ...' now works again.
4. Gawk now special cases `for (iggy in foo) delete foo[iggy]' and
treats it as the moral equivalent of `delete foo'. This should be
diff --git a/contrib/awk/POSIX.STD b/contrib/awk/POSIX.STD
index 05129b65dd69..04d31fcf32b6 100644
--- a/contrib/awk/POSIX.STD
+++ b/contrib/awk/POSIX.STD
@@ -1,3 +1,8 @@
+March 2001:
+
+It looks like the revised 1003.2 standard will actually follow the
+rules given below. Hallelujah!
+
October 1998:
The 1003.2 work has been at a stand-still for ages. Who knows if or
diff --git a/contrib/awk/PROBLEMS b/contrib/awk/PROBLEMS
index 8f7d954a9a88..0a2f77d5233f 100644
--- a/contrib/awk/PROBLEMS
+++ b/contrib/awk/PROBLEMS
@@ -1,7 +1,6 @@
-This is a list of known problems in gawk 3.0.
-Hopefully they will all be fixed in the next major release of gawk.
-
-Please keep in mind that the code is still undergoing significant evolution.
+This is a list of known problems in gawk 3.1.
+I don't know when this will be fixed, if ever. See also FUTURES
+and the gawk.texi doc for other things that need doing.
1. The interactions with the lexer and yyerror need reworking. It is possible
to get line numbers that are one line off if --compat or --posix is
diff --git a/contrib/awk/README b/contrib/awk/README
index bc36f4cf6512..a07db5179553 100644
--- a/contrib/awk/README
+++ b/contrib/awk/README
@@ -1,74 +1,84 @@
README:
-This is GNU Awk 3.0.6. 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.)
+This is GNU Awk 3.1.0. It is 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 5 just fix bugs -- see NEWS and ChangeLog for details.
+There are lots of new features -- see NEWS and ChangeLog for details.
-See the file INSTALL for installation instructions.
+Work to be done is described briefly in the FUTURES file. Changes in this
+version are summarized in the NEWS file. Please read the LIMITATIONS file.
-Known problems are given in the PROBLEMS file. Work to be done is
-described briefly in the FUTURES file. Verified ports are listed in
-the PORTS file. Changes in this version are summarized in the NEWS file.
-Please read the LIMITATIONS and ACKNOWLEDGMENT files.
+Read the file POSIX.STD for a discussion of how the standard says
+comparisons should be done vs. how they really should be done and how
+gawk does them.
-Read the file POSIX for a discussion of how the standard says comparisons
-should be done vs. how they really should be done and how gawk does them.
-
-To format the documentation with TeX, use at least version 2.151 of
-texinfo.tex. There is a usable copy of texinfo.tex in the doc directory.
+To format the documentation with TeX, use at least version 2000-10-27.17
+of texinfo.tex. There is a usable copy of texinfo.tex in the doc directory.
-The Info file now comes with the distribution.
+INSTALLATION:
-The man page is up to date.
+Check whether there is a system-specific README file for your system under
+the `README_d' directory. If there's something there that you should
+have read and didn't, and you bug me about it, I'm going to yell at you.
-INSTALLATION:
+See the file INSTALL for installation instructions.
-Check whether there is a system-specific README file for your system
-under the `README_d' directory. If there's something there that you
-should have read and didn't, and you bug me about it, I'm going to yell
-at you.
+If you have neither bison nor yacc, use the awkgram.c file here. It was
+generated with bison, and has no proprietary code in it. (Note that
+modifying awkgram.y without bison or yacc will be difficult, at best.
+You might want to get a copy of bison from the FSF too.)
-See the file INSTALL.
+If you have a Win32, MS-DOS or OS/2 system, use the stuff in the `pc'
+directory. Similarly, there is a separate directory for VMS.
-If you have neither bison nor yacc, use the awktab.c file here. It was
-generated with bison, and has no proprietary code in it. (Note that modifying
-awk.y without bison or yacc will be difficult, at best. You might want
-to get a copy of bison from the FSF too.)
-
-If you have an MS-DOS or OS/2 system, use the stuff in the `pc' directory.
-Similarly, there are separate directories for Ataris, Amigas, and VMS.
+Ports for the Atari and Tandem are supplied, but they are unsupported.
+Thus, their code appears in the `unsupported' directory.
-Appendix B of The GNU Awk User's Guide discusses configuration in detail. The
-configuration process is now based on Autoconf, so the whole business
-should be considerably simpler than it was in gawk 2.X.Y.
+Appendix B of ``GAWK: Effective Awk Programming'' discusses configuration
+in detail. The configuration process is based on GNU Autoconf and
+Automake.
-After successful compilation, do 'make check' to run a small test
-suite. There should be no output from the 'cmp' invocations except in
-the cases where there are small differences in floating point values,
-and possibly in the case of strftime. Several of the tests ignore
-errors on purpose; those are not a problem. If there are other
-differences, please investigate and report the problem.
+After successful compilation, do `make check' to run the test suite.
+There should be no output from the `cmp' invocations except in the
+cases where there are small differences in floating point values, and
+possibly in the case of strftime. Several of the tests ignore errors
+on purpose; those are not a problem. If there are other differences,
+please investigate and report the problem.
PRINTING THE MANUAL
-The 'doc' directory contains a recent version of texinfo.tex, which will be
-necessary for printing the manual. Use `make dvi' to get a DVI file from
-the manual. In the `doc' directory, use `make postscript' to get a PostScript
-version of the manual.
+The `doc' directory contains a recent version of texinfo.tex, which will
+be necessary for printing the manual. Use `make dvi' to get a DVI file
+from the manual. In the `doc' directory, use `make postscript' to get
+PostScript versions of the manual, the man page, and the reference card.
BUG REPORTS AND FIXES (Un*x systems):
Please coordinate changes through Arnold Robbins. In particular, see
-the section in the manual on reporting bugs. Note that comp.lang.awk is
-about the worst place to post a gawk bug report. Please, use the mechanisms
-outlined in the manual.
+the section in the manual on reporting bugs. Note that comp.lang.awk
+is about the worst place to post a gawk bug report. Please, use the
+mechanisms outlined in the manual.
+
+Email should be sent to bug-gawk@gnu.org. This address sends mail to
+Arnold Robbins and the general GNU utilities bug list. The advantage
+to using this address is that bug reports are archived at GNU Central.
Arnold Robbins
-INTERNET: arnold@gnu.org
-BUG REPORTS AND FIXES (non-Unix ports):
+BUG REPORTS AND FIXES, non-Unix systems:
+
+Amiga:
+ Fred Fish
+ fnf@ninemoons.com
+
+Alpha/Linux:
+ Michal Jaegermann
+ michal@gortel.phys.ualberta.ca
+
+BeOS:
+ Martin Brown
+ mc@whoever.com
MS-DOS:
Scott Deifik
@@ -77,18 +87,18 @@ MS-DOS:
Darrel Hankerson
hankedr@mail.auburn.edu
-VMS:
- Pat Rankin
- rankin@eql.caltech.edu
-
-Alpha/Linux:
- Michal Jaegermann
- michal@gortel.phys.ualberta.ca
+MS-Windows:
+ Juan Grigera
+ juan@biophnet.unlp.edu.ar
OS/2:
Kai Uwe Rommel
rommel@ars.de
-Amiga:
- Fred Fish
- fnf@ninemoons.com
+Tandem:
+ Stephen Davies
+ scldad@sdc.com.au
+
+VMS:
+ Pat Rankin
+ rankin@eql.caltech.edu
diff --git a/contrib/awk/acconfig.h b/contrib/awk/acconfig.h
index ceba8afc0b00..10ad23a084dc 100644
--- a/contrib/awk/acconfig.h
+++ b/contrib/awk/acconfig.h
@@ -2,22 +2,22 @@
* acconfig.h -- configuration definitions for gawk.
*/
-/*
- * Copyright (C) 1995-2000 the Free Software Foundation, Inc.
- *
+/*
+ * Copyright (C) 1995-2001 the Free Software Foundation, Inc.
+ *
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
- *
+ *
* GAWK 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.
- *
+ *
* GAWK 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
@@ -25,14 +25,14 @@
@TOP@
-#undef HAVE_STRINGIZE /* can use ANSI # operator in cpp */
#undef REGEX_MALLOC /* use malloc instead of alloca in regex.c */
#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 */
+#undef HAVE_MKTIME /* we have the mktime function */
+#undef HAVE_SOCKETS /* we have sockets on this system */
+#undef HAVE_PORTALS /* we have portals on /p on this system */
+#undef DYNAMIC /* allow dynamic addition of builtins */
+#undef STRTOD_NOT_C89 /* strtod doesn't have C89 semantics */
+#undef ssize_t /* signed version of size_t */
@BOTTOM@
diff --git a/contrib/awk/array.c b/contrib/awk/array.c
index da1ac3ff9ae0..905f3badd0a1 100644
--- a/contrib/awk/array.c
+++ b/contrib/awk/array.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -45,8 +45,7 @@ static void grow_table P((NODE *symbol));
/* concat_exp --- concatenate expression list into a single string */
NODE *
-concat_exp(tree)
-register NODE *tree;
+concat_exp(register NODE *tree)
{
register NODE *r;
char *str;
@@ -92,8 +91,7 @@ register NODE *tree;
/* assoc_clear --- flush all the values in symbol[] before doing a split() */
void
-assoc_clear(symbol)
-NODE *symbol;
+assoc_clear(NODE *symbol)
{
int i;
NODE *bucket, *next;
@@ -118,10 +116,7 @@ NODE *symbol;
/* hash --- calculate the hash function of the string in subs */
unsigned int
-hash(s, len, hsize)
-register const char *s;
-register size_t len;
-unsigned long hsize;
+hash(register const char *s, register size_t len, unsigned long hsize)
{
register unsigned long h = 0;
@@ -208,10 +203,7 @@ unsigned long hsize;
/* assoc_find --- locate symbol[subs] */
static NODE * /* NULL if not found */
-assoc_find(symbol, subs, hash1)
-NODE *symbol;
-register NODE *subs;
-int hash1;
+assoc_find(NODE *symbol, register NODE *subs, int hash1)
{
register NODE *bucket;
NODE *s1, *s2;
@@ -238,8 +230,7 @@ int hash1;
/* in_array --- test whether the array element symbol[subs] exists or not */
int
-in_array(symbol, subs)
-NODE *symbol, *subs;
+in_array(NODE *symbol, NODE *subs)
{
register int hash1;
int ret;
@@ -249,7 +240,7 @@ NODE *symbol, *subs;
if (symbol->type == Node_array_ref)
symbol = symbol->orig_array;
if ((symbol->flags & SCALAR) != 0)
- fatal("attempt to use scalar as array");
+ fatal(_("attempt to use scalar `%s' as array"), symbol->vname);
/*
* evaluate subscript first, it could have side effects
*/
@@ -274,8 +265,7 @@ NODE *symbol, *subs;
*/
NODE **
-assoc_lookup(symbol, subs)
-NODE *symbol, *subs;
+assoc_lookup(NODE *symbol, NODE *subs, int reference)
{
register int hash1;
register NODE *bucket;
@@ -285,7 +275,7 @@ NODE *symbol, *subs;
(void) force_string(subs);
if ((symbol->flags & SCALAR) != 0)
- fatal("attempt to use scalar as array");
+ fatal(_("attempt to use scalar `%s' as array"), symbol->vname);
if (symbol->var_array == NULL) {
if (symbol->type != Node_var_array) {
@@ -307,15 +297,21 @@ NODE *symbol, *subs;
}
}
+ if (do_lint && reference) {
+ subs->stptr[subs->stlen] = '\0';
+ lintwarn(_("reference to uninitialized element `%s[\"%s\"]'"),
+ symbol->vname, subs->stptr);
+ }
+
/* It's not there, install it. */
if (do_lint && subs->stlen == 0)
- warning("subscript of array `%s' is null string",
+ lintwarn(_("subscript of array `%s' is null string"),
symbol->vname);
/* first see if we would need to grow the array, before installing */
symbol->table_size++;
if ((symbol->flags & ARRAYMAXED) == 0
- && symbol->table_size/symbol->array_size > AVG_CHAIN_MAX) {
+ && (symbol->table_size / symbol->array_size) > AVG_CHAIN_MAX) {
grow_table(symbol);
/* have to recompute hash value for new size */
hash1 = hash(subs->stptr, subs->stlen,
@@ -324,9 +320,28 @@ NODE *symbol, *subs;
getnode(bucket);
bucket->type = Node_ahash;
- bucket->ahname = dupnode(subs);
+
+ /*
+ * Freeze this string value --- it must never
+ * change, no matter what happens to the value
+ * that created it or to CONVFMT, etc.
+ *
+ * One day: Use an atom table to track array indices,
+ * and avoid the extra memory overhead.
+ */
+ if (subs->flags & TEMP)
+ bucket->ahname = dupnode(subs);
+ else
+ bucket->ahname = copynode(subs);
+
free_temp(subs);
+ /* array subscripts are strings */
+ bucket->ahname->flags &= ~(NUMBER|NUM);
+ bucket->ahname->flags |= (STRING|STR);
+ /* ensure that this string value never changes */
+ bucket->ahname->stfmt = -1;
+
bucket->ahvalue = Nnull_string;
bucket->ahnext = symbol->var_array[hash1];
symbol->var_array[hash1] = bucket;
@@ -336,8 +351,7 @@ NODE *symbol, *subs;
/* do_delete --- perform `delete array[s]' */
void
-do_delete(symbol, tree)
-NODE *symbol, *tree;
+do_delete(NODE *symbol, NODE *tree)
{
register int hash1;
register NODE *bucket, *last;
@@ -354,7 +368,7 @@ NODE *symbol, *tree;
if (symbol->var_array == NULL)
return;
} else
- fatal("delete: illegal use of variable `%s' as array",
+ fatal(_("delete: illegal use of variable `%s' as array"),
symbol->vname);
if (tree == NULL) { /* delete array */
@@ -387,7 +401,7 @@ NODE *symbol, *tree;
if (bucket == NULL) {
if (do_lint)
- warning("delete: index `%s' not in array `%s'",
+ lintwarn(_("delete: index `%s' not in array `%s'"),
subs->stptr, symbol->vname);
free_temp(subs);
return;
@@ -420,11 +434,10 @@ NODE *symbol, *tree;
*/
void
-do_delete_loop(symbol, tree)
-NODE *symbol, *tree;
+do_delete_loop(NODE *symbol, NODE *tree)
{
size_t i;
- NODE *n, **lhs;
+ NODE **lhs;
Func_ptr after_assign = NULL;
if (symbol->type == Node_param_list) {
@@ -438,13 +451,13 @@ NODE *symbol, *tree;
if (symbol->var_array == NULL)
return;
} else
- fatal("delete: illegal use of variable `%s' as array",
+ fatal(_("delete: illegal use of variable `%s' as array"),
symbol->vname);
/* get first index value */
for (i = 0; i < symbol->array_size; i++) {
if (symbol->var_array[i] != NULL) {
- lhs = get_lhs(tree->lnode, & after_assign);
+ lhs = get_lhs(tree->lnode, & after_assign, FALSE);
unref(*lhs);
*lhs = dupnode(symbol->var_array[i]->ahname);
break;
@@ -455,71 +468,10 @@ NODE *symbol, *tree;
assoc_clear(symbol);
}
-/* assoc_scan --- start a ``for (iggy in foo)'' loop */
-
-void
-assoc_scan(symbol, lookat)
-NODE *symbol;
-struct search *lookat;
-{
- lookat->sym = symbol;
- lookat->idx = 0;
- lookat->bucket = NULL;
- lookat->retval = NULL;
- if (symbol->var_array != NULL)
- assoc_next(lookat);
-}
-
-/* assoc_next --- actually find the next element in array */
-
-void
-assoc_next(lookat)
-struct search *lookat;
-{
- register NODE *symbol = lookat->sym;
-
- if (symbol == NULL)
- fatal("null symbol in assoc_next");
- if (symbol->var_array == NULL || lookat->idx > symbol->array_size) {
- lookat->retval = NULL;
- return;
- }
- /*
- * This is theoretically unsafe. The element bucket might have
- * been freed if the body of the scan did a delete on the next
- * element of the bucket. The only way to do that is by array
- * reference, which is unlikely. Basically, if the user is doing
- * anything other than an operation on the current element of an
- * assoc array while walking through it sequentially, all bets are
- * off. (The safe way is to register all search structs on an
- * array with the array, and update all of them on a delete or
- * insert)
- */
- if (lookat->bucket != NULL) {
- lookat->retval = lookat->bucket->ahname;
- lookat->bucket = lookat->bucket->ahnext;
- return;
- }
- for (; lookat->idx < symbol->array_size; lookat->idx++) {
- NODE *bucket;
-
- if ((bucket = symbol->var_array[lookat->idx]) != NULL) {
- lookat->retval = bucket->ahname;
- lookat->bucket = bucket->ahnext;
- lookat->idx++;
- return;
- }
- }
- lookat->retval = NULL;
- lookat->bucket = NULL;
- return;
-}
-
/* grow_table --- grow a hash table */
static void
-grow_table(symbol)
-NODE *symbol;
+grow_table(NODE *symbol)
{
NODE **old, **new, *chain, *next;
int i, j;
@@ -581,7 +533,6 @@ NODE *symbol;
/* remove from old list, add to new */
chain->ahnext = new[hash1];
new[hash1] = chain;
-
}
}
free(old);
@@ -598,8 +549,7 @@ done:
/* pr_node --- print simple node info */
static void
-pr_node(n)
-NODE *n;
+pr_node(NODE *n)
{
if ((n->flags & (NUM|NUMBER)) != 0)
printf("%g", n->numbr);
@@ -610,24 +560,23 @@ NODE *n;
/* assoc_dump --- dump the contents of an array */
NODE *
-assoc_dump(symbol)
-NODE *symbol;
+assoc_dump(NODE *symbol)
{
int i;
NODE *bucket;
if (symbol->var_array == NULL) {
- printf("%s: empty (null)\n", symbol->vname);
+ printf(_("%s: empty (null)\n"), symbol->vname);
return tmp_number((AWKNUM) 0);
}
if (symbol->table_size == 0) {
- printf("%s: empty (zero)\n", symbol->vname);
+ printf(_("%s: empty (zero)\n"), symbol->vname);
return tmp_number((AWKNUM) 0);
}
- printf("%s: table_size = %d, array_size = %d\n", symbol->vname,
- symbol->table_size, symbol->array_size);
+ printf(_("%s: table_size = %d, array_size = %d\n"), symbol->vname,
+ (int) symbol->table_size, (int) symbol->array_size);
for (i = 0; i < symbol->array_size; i++) {
for (bucket = symbol->var_array[i]; bucket != NULL;
@@ -651,20 +600,19 @@ NODE *symbol;
/* do_adump --- dump an array: interface to assoc_dump */
NODE *
-do_adump(tree)
-NODE *tree;
+do_adump(NODE *tree)
{
NODE *r, *a;
a = tree->lnode;
if (a->type == Node_param_list) {
- printf("%s: is paramater\n", a->vname);
+ printf(_("%s: is paramater\n"), a->vname);
a = stack_ptr[a->param_cnt];
}
if (a->type == Node_array_ref) {
- printf("%s: array_ref to %s\n", a->vname,
+ printf(_("%s: array_ref to %s\n"), a->vname,
a->orig_array->vname);
a = a->orig_array;
}
@@ -673,3 +621,238 @@ NODE *tree;
return r;
}
+
+/*
+ * The following functions implement the builtin
+ * asort function. Initial work by Alan J. Broder,
+ * ajb@woti.com.
+ */
+
+/* dup_table --- duplicate input symbol table "symbol" */
+
+static void
+dup_table(NODE *symbol, NODE *newsymb)
+{
+ NODE **old, **new, *chain, *bucket;
+ int i;
+ unsigned long cursize;
+
+ /* find the current hash size */
+ cursize = symbol->array_size;
+
+ new = NULL;
+
+ /* input is a brand new hash table, so there's nothing to copy */
+ if (symbol->var_array == NULL)
+ newsymb->table_size = 0;
+ else {
+ /* old hash table there, dupnode stuff into a new table */
+
+ /* allocate new table */
+ emalloc(new, NODE **, cursize * sizeof(NODE *), "dup_table");
+ memset(new, '\0', cursize * sizeof(NODE *));
+
+ /* do the copying/dupnode'ing */
+ old = symbol->var_array;
+ for (i = 0; i < cursize; i++) {
+ if (old[i] != NULL) {
+ for (chain = old[i]; chain != NULL;
+ chain = chain->ahnext) {
+ /* get a node for the linked list */
+ getnode(bucket);
+ bucket->type = Node_ahash;
+
+ /*
+ * copy the corresponding name and
+ * value from the original input list
+ */
+ bucket->ahname = dupnode(chain->ahname);
+ bucket->ahvalue = dupnode(chain->ahvalue);
+
+ /*
+ * put the node on the corresponding
+ * linked list in the new table
+ */
+ bucket->ahnext = new[i];
+ new[i] = bucket;
+ }
+ }
+ }
+ newsymb->table_size = symbol->table_size;
+ }
+
+ newsymb->var_array = new;
+ newsymb->array_size = cursize;
+}
+
+/* merge --- do a merge of two sorted lists */
+
+static NODE *
+merge(NODE *left, NODE *right)
+{
+ NODE *ans, *cur;
+
+ if (cmp_nodes(left->ahvalue, right->ahvalue) <= 0) {
+ ans = cur = left;
+ left = left->ahnext;
+ } else {
+ ans = cur = right;
+ right = right->ahnext;
+ }
+
+ while (left != NULL && right != NULL) {
+ if (cmp_nodes(left->ahvalue, right->ahvalue) <= 0) {
+ cur->ahnext = left;
+ cur = left;
+ left = left->ahnext;
+ } else {
+ cur->ahnext = right;
+ cur = right;
+ right = right->ahnext;
+ }
+ }
+
+ cur->ahnext = (left != NULL ? left : right);
+
+ return ans;
+}
+
+/* merge_sort --- recursively sort the left and right sides of a list */
+
+static NODE *
+merge_sort(NODE *left, int size)
+{
+ NODE *right, *tmp;
+ int i, half;
+
+ if (size <= 1)
+ return left;
+
+ /* walk down the list, till just one before the midpoint */
+ tmp = left;
+ half = size / 2;
+ for (i = 0; i < half-1; i++)
+ tmp = tmp->ahnext;
+
+ /* split the list into two parts */
+ right = tmp->ahnext;
+ tmp->ahnext = NULL;
+
+ /* sort the left and right parts of the list */
+ left = merge_sort(left, half);
+ right = merge_sort(right, size-half);
+
+ /* merge the two sorted parts of the list */
+ return merge(left, right);
+}
+
+
+/*
+ * assoc_from_list -- Populate an array with the contents of a list of NODEs,
+ * using increasing integers as the key.
+ */
+
+static void
+assoc_from_list(NODE *symbol, NODE *list)
+{
+ NODE *next;
+ int i = 0;
+ register int hash1;
+
+ for (; list != NULL; list = next) {
+ next = list->ahnext;
+
+ /* make an int out of i++ */
+ i++;
+ list->ahname = make_number((AWKNUM) i);
+ (void) force_string(list->ahname);
+
+ /* find the bucket where it belongs */
+ hash1 = hash(list->ahname->stptr, list->ahname->stlen,
+ symbol->array_size);
+
+ /* link the node into the chain at that bucket */
+ list->ahnext = symbol->var_array[hash1];
+ symbol->var_array[hash1] = list;
+ }
+}
+
+/*
+ * assoc_sort_inplace --- sort all the values in symbol[], replacing
+ * the sorted values back into symbol[], indexed by integers starting with 1.
+ */
+
+static NODE *
+assoc_sort_inplace(NODE *symbol)
+{
+ int i, num;
+ NODE *bucket, *next, *list;
+
+ if (symbol->var_array == NULL
+ || symbol->array_size <= 0
+ || symbol->table_size <= 0)
+ return tmp_number((AWKNUM) 0);
+
+ /* build a linked list out of all the entries in the table */
+ list = NULL;
+ num = 0;
+ for (i = 0; i < symbol->array_size; i++) {
+ for (bucket = symbol->var_array[i]; bucket != NULL; bucket = next) {
+ next = bucket->ahnext;
+ unref(bucket->ahname);
+ bucket->ahnext = list;
+ list = bucket;
+ num++;
+ }
+ symbol->var_array[i] = NULL;
+ }
+
+ /*
+ * Sort the linked list of NODEs.
+ * (The especially nice thing about using a merge sort here is that
+ * we require absolutely no additional storage. This is handy if the
+ * array has grown to be very large.)
+ */
+ list = merge_sort(list, num);
+
+ /*
+ * now repopulate the original array, using increasing
+ * integers as the key
+ */
+ assoc_from_list(symbol, list);
+
+ return tmp_number((AWKNUM) num);
+}
+
+/* do_asort --- do the actual work to sort the input array */
+
+NODE *
+do_asort(NODE *tree)
+{
+ NODE *src, *dest;
+
+ src = tree->lnode;
+ dest = NULL;
+
+ if (src->type == Node_param_list)
+ src = stack_ptr[src->param_cnt];
+ if (src->type == Node_array_ref)
+ src = src->orig_array;
+ if (src->type != Node_var_array)
+ fatal(_("asort: first argument is not an array"));
+
+ if (tree->rnode != NULL) { /* 2nd optional arg */
+ dest = tree->rnode->lnode;
+ if (dest->type == Node_param_list)
+ dest = stack_ptr[dest->param_cnt];
+ if (dest->type == Node_array_ref)
+ dest = dest->orig_array;
+ if (dest->type != Node_var && dest->type != Node_var_array)
+ fatal(_("asort: second argument is not an array"));
+ dest->type = Node_var_array;
+ assoc_clear(dest);
+ dup_table(src, dest);
+ }
+
+ return dest != NULL ? assoc_sort_inplace(dest) : assoc_sort_inplace(src);
+}
diff --git a/contrib/awk/awk.h b/contrib/awk/awk.h
index 246c6ef57d05..9e872a7ac7f5 100644
--- a/contrib/awk/awk.h
+++ b/contrib/awk/awk.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -48,6 +48,23 @@
#endif /* HAVE_LIMITS_H */
#include <ctype.h>
#include <setjmp.h>
+
+#if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS) && ENABLE_NLS > 0
+#include <libintl.h>
+#else /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */
+#define gettext(msgid) (msgid)
+#define gettext_noop(msgid) msgid
+#define dgettext(domain, msgid) (msgid)
+#define dcgettext(domain, msgid, cat) (msgid)
+#define bindtextdomain(domain, directory) (directory)
+#define textdomain(package) /* nothing */
+#ifndef LOCALEDIR
+#define LOCALEDIR NULL
+#endif /* LOCALEDIR */
+#endif /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif /* HAVE_LOCALE_H */
@@ -72,32 +89,35 @@ extern int errno;
/* First, get the ctype stuff right; from Jim Meyering */
#if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII))
-#define ISASCII(c) 1
+#define IN_CTYPE_DOMAIN(c) 1
#else
-#define ISASCII(c) isascii(c)
+#define IN_CTYPE_DOMAIN(c) isascii((unsigned char) c)
#endif
#ifdef isblank
-#define ISBLANK(c) (ISASCII(c) && isblank(c))
+#define ISBLANK(c) (IN_CTYPE_DOMAIN(c) && isblank((unsigned char) c))
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
-#define ISGRAPH(c) (ISASCII(c) && isgraph(c))
+#define ISGRAPH(c) (IN_CTYPE_DOMAIN(c) && isgraph((unsigned char) c))
#else
-#define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c))
+#define ISGRAPH(c) (IN_CTYPE_DOMAIN(c) && isprint((unsigned char) c) && !isspace((unsigned char) c))
#endif
-#define ISPRINT(c) (ISASCII (c) && isprint (c))
-#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
-#define ISALNUM(c) (ISASCII (c) && isalnum (c))
-#define ISALPHA(c) (ISASCII (c) && isalpha (c))
-#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
-#define ISLOWER(c) (ISASCII (c) && islower (c))
-#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
-#define ISSPACE(c) (ISASCII (c) && isspace (c))
-#define ISUPPER(c) (ISASCII (c) && isupper (c))
-#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char) c))
+#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char) c))
+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char) c))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char) c))
+#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl ((unsigned char) c))
+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char) c))
+#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (unsigned char) (c))
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace ((unsigned char) c))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char) c))
+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char) c))
+
+#define TOUPPER(c) toupper((unsigned char) c)
+#define TOLOWER(c) tolower((unsigned char) c)
#ifdef __STDC__
@@ -110,18 +130,14 @@ extern int errno;
#define const
#endif /* not __STDC__ */
-#if ! defined(VMS) || (! defined(VAXC) && ! defined(__DECC))
+#ifndef VMS
#include <sys/types.h>
#include <sys/stat.h>
-#else /* VMS w/ VAXC or DECC */
-#include <types.h>
+#else /* VMS */
+#include <stddef.h>
#include <stat.h>
#include <file.h> /* avoid <fcntl.h> in io.c */
-#ifdef __DECC
-/* DEC C implies DECC$SHR, which doesn't have the %g problem of VAXCRTL */
-#undef GFMT_WORKAROUND
-#endif
-#endif /* VMS w/ VAXC or DECC */
+#endif /* VMS */
#ifdef STDC_HEADERS
#include <stdlib.h>
@@ -153,6 +169,15 @@ extern int errno;
#include <unixlib.h>
#endif /* atarist || VMS */
+#if ! defined(MSDOS) && ! defined(OS2) && ! defined(WIN32)
+#define O_BINARY 0
+#endif
+
+#if defined(TANDEM)
+#define variable variabl
+#define open(name, how, mode) open(name, how) /* !!! ANSI C !!! */
+#endif
+
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -171,12 +196,17 @@ lose
#define setlocale(locale, val) /* nothing */
#endif /* HAVE_SETLOCALE */
+/* use this as lintwarn("...")
+ this is a hack but it gives us the right semantics */
+#define lintwarn (*(set_loc(__FILE__, __LINE__),lintfunc))
+extern void set_prof_file P((const char *filename));
+
#ifdef VMS
#include "vms/redirect.h"
#endif /*VMS*/
#ifdef atarist
-#include "atari/redirect.h"
+#include "unsupported/atari/redirect.h"
#endif
#define GNU_REGEX
@@ -195,6 +225,12 @@ typedef struct Regexp {
#define SUBPATEND(rp,s,n) (rp)->regs.end[n]
#endif /* GNU_REGEX */
+/* Stuff for losing systems. */
+#ifdef STRTOD_NOT_C89
+extern double gawk_strtod();
+#define strtod gawk_strtod
+#endif
+
/* ------------------ Constants, Structures, Typedefs ------------------ */
#ifndef AWKNUM
@@ -304,6 +340,7 @@ typedef enum nodevals {
Node_redirect_pipe, /* subnode is where to redirect */
Node_redirect_pipein, /* subnode is where to redirect */
Node_redirect_input, /* subnode is where to redirect */
+ Node_redirect_twoway, /* subnode is where to redirect */
/* Variables */
Node_var, /* rnode is value, lnode is array stuff */
@@ -321,8 +358,8 @@ typedef enum nodevals {
Node_line_range,
/*
- * boolean test of membership in array lnode is string-valued
- * expression rnode is array name
+ * boolean test of membership in array
+ * lnode is string-valued, expression rnode is array name
*/
Node_in_array,
@@ -334,17 +371,20 @@ typedef enum nodevals {
Node_hashnode, /* an identifier in the symbol table */
Node_ahash, /* an array element */
Node_array_ref, /* array passed by ref as parameter */
- Node_NF, /* variables recognized in the grammar */
- Node_NR,
+ Node_BINMODE, /* variables recognized in the grammar */
+ Node_CONVFMT,
+ Node_FIELDWIDTHS,
Node_FNR,
Node_FS,
- Node_RS,
- Node_FIELDWIDTHS,
Node_IGNORECASE,
+ Node_LINT,
+ Node_NF,
+ Node_NR,
+ Node_OFMT,
Node_OFS,
Node_ORS,
- Node_OFMT,
- Node_CONVFMT,
+ Node_RS,
+ Node_TEXTDOMAIN,
Node_final /* sentry value, not legal */
} NODETYPE;
@@ -371,6 +411,7 @@ typedef struct exp_node {
union {
struct exp_node *extra;
long xl;
+ char **param_list;
} x;
char *name;
short number;
@@ -423,8 +464,12 @@ typedef struct exp_node {
# define FUNC 1024 /* this parameter is really a
* function name; see awk.y */
# define FIELD 2048 /* this is a field */
-
- char *vname; /* variable's name */
+# define INTLSTR 4096 /* use localized version */
+# define UNINITIALIZED 8192 /* value used before set */
+ char *vname;
+#ifndef NO_PROFILING
+ long exec_count;
+#endif
} NODE;
#define lnode sub.nodep.l.lptr
@@ -434,9 +479,11 @@ typedef struct exp_node {
#define source_line sub.nodep.number
#define param_cnt sub.nodep.number
#define param sub.nodep.l.param_name
+#define parmlist sub.nodep.x.param_list
#define subnode lnode
#define proc sub.nodep.r.pptr
+#define callresult sub.nodep.x.extra
#define re_reg sub.nodep.r.preg
#define re_flags sub.nodep.reflags
@@ -461,6 +508,8 @@ typedef struct exp_node {
#define orig_array sub.nodep.x.extra
+#define printf_count sub.nodep.x.xl
+
#define condpair lnode
#define triggered sub.nodep.r.r_ent
@@ -471,14 +520,6 @@ typedef struct for_loop_header {
NODE *incr;
} FOR_LOOP_HEADER;
-/* for "for(iggy in foo) {" */
-struct search {
- NODE *sym;
- size_t idx;
- NODE *bucket;
- NODE *retval;
-};
-
/* for faster input, bypass stdio */
typedef struct iobuf {
const char *name;
@@ -493,9 +534,7 @@ typedef struct iobuf {
# define IOP_IS_TTY 1
# define IOP_IS_INTERNAL 2
# define IOP_NO_FREE 4
-# define IOP_MMAPPED 8
-# define IOP_NOFREE_OBJ 16
- int (*getrec)();
+# define IOP_NOFREE_OBJ 8
} IOBUF;
typedef void (*Func_ptr)();
@@ -511,6 +550,9 @@ struct redirect {
# define RED_NOBUF 32
# define RED_USED 64 /* closed temporarily to reuse fd */
# define RED_EOF 128
+# define RED_TWOWAY 256
+# define RED_SOCKET 512
+# define RED_TCP 1024
char *value;
FILE *fp;
FILE *ifp; /* input fp, needed for PIPES_SIMULATED */
@@ -519,6 +561,7 @@ struct redirect {
int status;
struct redirect *prev;
struct redirect *next;
+ char *mode;
};
/* structure for our source, either a command line string or a source file */
@@ -527,6 +570,12 @@ struct src {
char *val;
};
+/* for debugging purposes */
+struct flagtab {
+ int val;
+ char *name;
+};
+
/* longjmp return codes, must be nonzero */
/* Continue means either for loop/while continue, or next input record */
#define TAG_CONTINUE 1
@@ -551,6 +600,7 @@ struct src {
extern long NF;
extern long NR;
extern long FNR;
+extern int BINMODE;
extern int IGNORECASE;
extern int RS_is_null;
extern char *OFS;
@@ -561,10 +611,12 @@ extern char *OFMT;
extern char *CONVFMT;
extern int CONVFMTidx;
extern int OFMTidx;
-extern NODE *CONVFMT_node, *FIELDWIDTHS_node, *FILENAME_node;
+extern char *TEXTDOMAIN;
+extern NODE *BINMODE_node, *CONVFMT_node, *FIELDWIDTHS_node, *FILENAME_node;
extern NODE *FNR_node, *FS_node, *IGNORECASE_node, *NF_node;
extern NODE *NR_node, *OFMT_node, *OFS_node, *ORS_node, *RLENGTH_node;
-extern NODE *RSTART_node, *RS_node, *RT_node, *SUBSEP_node;
+extern NODE *RSTART_node, *RS_node, *RT_node, *SUBSEP_node, *PROCINFO_node;
+extern NODE *LINT_node, *ERRNO_node, *TEXTDOMAIN_node;
extern NODE **stack_ptr;
extern NODE *Nnull_string;
extern NODE **fields_arr;
@@ -583,6 +635,10 @@ extern int do_posix;
extern int do_lint;
extern int do_lint_old;
extern int do_intervals;
+extern int do_intl;
+extern int do_non_decimal_data;
+extern int do_dump_vars;
+extern int do_tidy_mem;
extern int in_begin_rule;
extern int in_end_rule;
@@ -601,21 +657,29 @@ extern char casetable[]; /* for case-independent regexp matching */
|| (str)[1] == 'x' || (str)[1] == 'X'))
#ifdef MPROF
-#define getnode(n) emalloc(n, NODE *, sizeof(NODE), "getnode")
+#define getnode(n) emalloc((n), NODE *, sizeof(NODE), "getnode"), (n)->flags = UNINITIALIZED, (n)-exec_count = 0;
#define freenode(n) free(n)
#else /* not MPROF */
#define getnode(n) if (nextfree) n = nextfree, nextfree = nextfree->nextp;\
else n = more_nodes()
-#define freenode(n) ((n)->flags &= ~SCALAR, (n)->nextp = nextfree, nextfree = (n))
+#ifndef NO_PROFILING
+#define freenode(n) ((n)->flags = UNINITIALIZED,\
+ (n)->exec_count = 0, (n)->nextp = nextfree, nextfree = (n))
+#else /* not PROFILING */
+#define freenode(n) ((n)->flags = UNINITIALIZED,\
+ (n)->nextp = nextfree, nextfree = (n))
+#endif /* not PROFILING */
#endif /* not MPROF */
-#ifdef DEBUG
+#ifdef MEMDEBUG
#undef freenode
-#define get_lhs(p, a) r_get_lhs((p), (a))
+#define get_lhs(p, a, r) r_get_lhs((p), (a), (r))
#define m_tree_eval(t, iscond) r_tree_eval(t, iscond)
#else
-#define get_lhs(p, a) ((p)->type == Node_var ? (&(p)->var_value) : \
- r_get_lhs((p), (a)))
+#define get_lhs(p, a, r) ((p)->type == Node_var && \
+ ((p)->flags & UNINITIALIZED) == 0 && (r) ? \
+ (&(p)->var_value): \
+ r_get_lhs((p), (a), (r)))
#if __GNUC__ >= 2
#define m_tree_eval(t, iscond) \
({NODE * _t = (t); \
@@ -624,10 +688,15 @@ extern char casetable[]; /* for case-independent regexp matching */
else { \
switch(_t->type) { \
case Node_val: \
+ if (_t->flags&INTLSTR) \
+ _t = r_force_string(_t); \
break; \
case Node_var: \
- _t = _t->var_value; \
- break; \
+ if ((_t->flags & UNINITIALIZED) == 0) { \
+ _t = _t->var_value; \
+ break; \
+ } \
+ /*FALLTHROUGH*/ \
default: \
_t = r_tree_eval(_t, iscond);\
break; \
@@ -638,11 +707,14 @@ extern char casetable[]; /* for case-independent regexp matching */
#define m_tree_eval(t, iscond) (_t = (t), _t == NULL ? Nnull_string : \
(_t->type == Node_param_list ? \
r_tree_eval(_t, iscond) : \
+ ((_t->type == Node_val && (_t->flags&INTLSTR)) ? \
+ r_force_string(_t) : \
(_t->type == Node_val ? _t : \
- (_t->type == Node_var ? _t->var_value : \
- r_tree_eval(_t, iscond)))))
+ (_t->type == Node_var && \
+ (_t->flags & UNINITIALIZED) == 0 ? _t->var_value : \
+ r_tree_eval(_t, iscond))))))
#endif /* __GNUC__ */
-#endif /* not DEBUG */
+#endif /* not MEMDEBUG */
#define tree_eval(t) m_tree_eval(t, FALSE)
#define make_number(x) mk_number((x), (unsigned int)(MALLOC|NUM|NUMBER))
@@ -654,7 +726,7 @@ extern char casetable[]; /* for case-independent regexp matching */
#define ALREADY_MALLOCED 2
#define cant_happen() r_fatal("internal error line %d, file: %s", \
- __LINE__, __FILE__);
+ __LINE__, __FILE__)
#ifdef HAVE_STRINGIZE
#define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\
@@ -674,10 +746,10 @@ extern char casetable[]; /* for case-independent regexp matching */
(str), "var", strerror(errno)),0))
#endif /* HAVE_STRINGIZE */
-#ifdef DEBUG
+#ifdef GAWKDEBUG
#define force_number r_force_number
#define force_string r_force_string
-#else /* not DEBUG */
+#else /* not GAWKDEBUG */
#ifdef lint
extern AWKNUM force_number();
#endif
@@ -685,9 +757,11 @@ extern AWKNUM force_number();
#define force_number(n) ({NODE *_tn = (n);\
(_tn->flags & NUM) ?_tn->numbr : r_force_number(_tn);})
#define force_string(s) ({NODE *_ts = (s);\
+ ((_ts->flags & INTLSTR) ? \
+ r_force_string(_ts) : \
((_ts->flags & STR) && \
(_ts->stfmt == -1 || _ts->stfmt == CONVFMTidx)) ?\
- _ts : r_force_string(_ts);})
+ _ts : r_force_string(_ts));})
#else
#ifdef MSDOS
extern double _msc51bug;
@@ -697,12 +771,15 @@ extern double _msc51bug;
#define force_number(n) (_t = (n),\
(_t->flags & NUM) ? _t->numbr : r_force_number(_t))
#endif /* not MSDOS */
-#define force_string(s) (_t = (s),((_t->flags & STR) && \
- (_t->stfmt == -1 || \
- _t->stfmt == CONVFMTidx))? \
+#define force_string(s) (_t = (s),(_t->flags & INTLSTR) ? \
+ r_force_string(_t) :\
+ ((_t->flags & STR) && \
+ (_t->stfmt == -1 || \
+ _t->stfmt == CONVFMTidx))? \
_t : r_force_string(_t))
+
#endif /* not __GNUC__ */
-#endif /* not DEBUG */
+#endif /* not GAWKDEBUG */
#define STREQ(a,b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#define STREQN(a,b,n) ((n) && *(a)== *(b) && \
@@ -717,21 +794,25 @@ extern NODE *concat_exp P((NODE *tree));
extern void assoc_clear P((NODE *symbol));
extern unsigned int hash P((const char *s, size_t len, unsigned long hsize));
extern int in_array P((NODE *symbol, NODE *subs));
-extern NODE **assoc_lookup P((NODE *symbol, NODE *subs));
+extern NODE **assoc_lookup P((NODE *symbol, NODE *subs, int reference));
extern void do_delete P((NODE *symbol, NODE *tree));
extern void do_delete_loop P((NODE *symbol, NODE *tree));
-extern void assoc_scan P((NODE *symbol, struct search *lookat));
-extern void assoc_next P((struct search *lookat));
extern NODE *assoc_dump P((NODE *symbol));
extern NODE *do_adump P((NODE *tree));
-/* awktab.c */
+extern NODE *do_asort P((NODE *tree));
+/* awkgram.c */
extern char *tokexpand P((void));
extern NODE *node P((NODE *left, NODETYPE op, NODE *right));
extern NODE *install P((char *name, NODE *value));
extern NODE *lookup P((const char *name));
extern NODE *variable P((char *name, int can_free, NODETYPE type));
extern int yyparse P((void));
+extern void dump_funcs P((void));
+extern void dump_vars P((const char *fname));
+extern void release_all_vars P((void));
+extern const char *getfname P((NODE *(*)()));
extern NODE *stopme P((NODE *tree));
+extern void shadow_funcs();
/* builtin.c */
extern double double_to_int P((double d));
extern NODE *do_exp P((NODE *tree));
@@ -740,6 +821,7 @@ extern NODE *do_index P((NODE *tree));
extern NODE *do_int P((NODE *tree));
extern NODE *do_length P((NODE *tree));
extern NODE *do_log P((NODE *tree));
+extern NODE *do_mktime P((NODE *tree));
extern NODE *do_sprintf P((NODE *tree));
extern void do_printf P((NODE *tree));
extern void print_simple P((NODE *tree, FILE *fp));
@@ -760,7 +842,7 @@ extern NODE *do_match P((NODE *tree));
extern NODE *do_gsub P((NODE *tree));
extern NODE *do_sub P((NODE *tree));
extern NODE *do_gensub P((NODE *tree));
-#ifdef BITOPS
+extern NODE *format_tree P((const char *, int, NODE *, int));
extern NODE *do_lshift P((NODE *tree));
extern NODE *do_rshift P((NODE *tree));
extern NODE *do_and P((NODE *tree));
@@ -768,21 +850,37 @@ extern NODE *do_or P((NODE *tree));
extern NODE *do_xor P((NODE *tree));
extern NODE *do_compl P((NODE *tree));
extern NODE *do_strtonum P((NODE *tree));
-#endif /* BITOPS */
-#if defined(BITOPS) || defined(NONDECDATA)
extern AWKNUM nondec2awknum P((char *str, size_t len));
-#endif /* defined(BITOPS) || defined(NONDECDATA) */
+extern NODE *do_dcgettext P((NODE *tree));
+extern NODE *do_bindtextdomain P((NODE *tree));
/* eval.c */
extern int interpret P((NODE *volatile tree));
extern NODE *r_tree_eval P((NODE *tree, int iscond));
extern int cmp_nodes P((NODE *t1, NODE *t2));
-extern NODE **r_get_lhs P((NODE *ptr, Func_ptr *assign));
+extern NODE **r_get_lhs P((NODE *ptr, Func_ptr *assign, int reference));
extern void set_IGNORECASE P((void));
-void set_OFS P((void));
-void set_ORS P((void));
-void set_OFMT P((void));
-void set_CONVFMT P((void));
+extern void set_OFS P((void));
+extern void set_ORS P((void));
+extern void set_OFMT P((void));
+extern void set_CONVFMT P((void));
+extern void set_BINMODE P((void));
+extern void set_LINT P((void));
+extern void set_TEXTDOMAIN P((void));
+extern void update_ERRNO P((void));
extern char *flags2str P((int));
+extern char *genflags2str P((int flagval, struct flagtab *tab));
+extern char *nodetype2str P((NODETYPE type));
+extern NODE *assign_val P((NODE **lhs_p, NODE *rhs));
+#ifdef PROFILING
+extern void dump_fcall_stack P((FILE *fp));
+#endif
+/* ext.c */
+NODE *do_ext P((NODE *));
+#ifdef DYNAMIC
+void make_builtin P((char *, NODE *(*)(NODE *), int));
+NODE *get_argument P((NODE *, int));
+void set_value P((NODE *));
+#endif
/* field.c */
extern void init_fields P((void));
extern void set_record P((char *buf, int cnt, int freeold));
@@ -799,6 +897,12 @@ extern int using_fieldwidths P((void));
extern char *gawk_name P((const char *filespec));
extern void os_arg_fixup P((int *argcp, char ***argvp));
extern int os_devopen P((const char *name, int flag));
+extern void os_close_on_exec P((int fd, const char *name, const char *what,
+ const char *dir));
+extern int os_isdir P((int fd));
+extern int os_is_setuid P((void));
+extern int os_setbinmode P((int fd, int mode));
+extern void os_restore_mode P((int fd));
extern int optimal_bufsize P((int fd, struct stat *sbuf));
extern int ispath P((const char *file));
extern int isdirpunct P((int c));
@@ -818,6 +922,7 @@ extern struct redirect *getredirect P((char *str, int len));
/* main.c */
extern int main P((int argc, char **argv));
extern void load_environ P((void));
+extern void load_procinfo P((void));
extern char *arg_assign P((char *arg));
extern RETSIGTYPE catchsig P((int sig, int code));
/* msg.c */
@@ -828,6 +933,7 @@ extern void error P((va_list va_alist, ...));
extern void warning P((va_list va_alist, ...));
extern void set_loc P((char *file, int line));
extern void r_fatal P((va_list va_alist, ...));
+extern void (*lintfunc) P((va_list va_alist, ...));
#else
#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
extern void msg (char *mesg, ...);
@@ -835,24 +941,35 @@ extern void error (char *mesg, ...);
extern void warning (char *mesg, ...);
extern void set_loc (char *file, int line);
extern void r_fatal (char *mesg, ...);
+extern void (*lintfunc) (char *mesg, ...);
#else
extern void msg ();
extern void error ();
extern void warning ();
extern void set_loc ();
extern void r_fatal ();
+extern void (*lintfunc) ();
#endif
#endif
+/* profile.c */
+extern void init_profiling P((int *flag, const char *def_file));
+extern void init_profiling_signals P((void));
+extern void set_prof_file P((const char *filename));
+extern void dump_prog P((NODE *begin, NODE *prog, NODE *end));
+extern void pp_func P((char *name, size_t namelen, NODE *f));
+extern void pp_string_fp P((FILE *fp, char *str, size_t namelen,
+ int delim, int breaklines));
/* node.c */
extern AWKNUM r_force_number P((NODE *n));
extern NODE *format_val P((char *format, int index, NODE *s));
extern NODE *r_force_string P((NODE *s));
extern NODE *dupnode P((NODE *n));
+extern NODE *copynode P((NODE *n));
extern NODE *mk_number P((AWKNUM x, unsigned int flags));
extern NODE *make_str_node P((char *s, size_t len, int scan ));
extern NODE *tmp_string P((char *s, size_t len ));
extern NODE *more_nodes P((void));
-#ifdef DEBUG
+#ifdef MEMDEBUG
extern void freenode P((NODE *it));
#endif
extern void unref P((NODE *tmp));
@@ -867,13 +984,17 @@ extern Regexp *re_update P((NODE *t));
extern void resyntax P((int syntax));
extern void resetup P((void));
extern int avoid_dfa P((NODE *re, char *str, size_t len)); /* temporary */
+extern int reisstring P((char *text, size_t len, Regexp *re, char *buf));
/* strncasecmp.c */
+#ifndef BROKEN_STRNCASECMP
+extern int strcasecmp P((const char *s1, const char *s2));
extern int strncasecmp P((const char *s1, const char *s2, register size_t n));
+#endif
#if defined(atarist)
#if defined(PIPES_SIMULATED)
-/* atari/tmpnam.c */
+/* unsupported/atari/tmpnam.c */
extern char *tmpnam P((char *buf));
extern char *tempnam P((const char *path, const char *base));
#else
@@ -888,13 +1009,3 @@ extern char *tempnam P((const char *path, const char *base));
#ifndef STATIC
#define STATIC static
#endif
-
-#ifdef C_ALLOCA
-/* The __hpux check is to avoid conflicts with bison's definition of
- alloca() in awktab.c.*/
-#if (defined(__STDC__) && __STDC__) || defined (__hpux)
-extern void *alloca P((unsigned));
-#else
-extern char *alloca P((unsigned));
-#endif
-#endif
diff --git a/contrib/awk/awkgram.y b/contrib/awk/awkgram.y
new file mode 100644
index 000000000000..649ccac4406f
--- /dev/null
+++ b/contrib/awk/awkgram.y
@@ -0,0 +1,2875 @@
+/*
+ * awk.y --- yacc/bison parser
+ */
+
+/*
+ * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ *
+ * This file is part of GAWK, the GNU implementation of the
+ * AWK Programming Language.
+ *
+ * GAWK 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.
+ *
+ * GAWK 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
+ */
+
+%{
+#ifdef GAWKDEBUG
+#define YYDEBUG 12
+#endif
+
+#include "awk.h"
+
+#define CAN_FREE TRUE
+#define DONT_FREE FALSE
+
+#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
+static void yyerror(const char *m, ...) ;
+#else
+static void yyerror(); /* va_alist */
+#endif
+static char *get_src_buf P((void));
+static int yylex P((void));
+static NODE *node_common P((NODETYPE op));
+static NODE *snode P((NODE *subn, NODETYPE op, int sindex));
+static NODE *mkrangenode P((NODE *cpair));
+static NODE *make_for_loop P((NODE *init, NODE *cond, NODE *incr));
+static NODE *append_right P((NODE *list, NODE *new));
+static void func_install P((NODE *params, NODE *def));
+static void pop_var P((NODE *np, int freeit));
+static void pop_params P((NODE *params));
+static NODE *make_param P((char *name));
+static NODE *mk_rexp P((NODE *exp));
+static int dup_parms P((NODE *func));
+static void param_sanity P((NODE *arglist));
+static void parms_shadow P((const char *fname, NODE *func));
+static int isnoeffect P((NODETYPE t));
+static int isassignable P((NODE *n));
+static void dumpintlstr P((char *str, size_t len));
+static void count_args P((NODE *n));
+
+enum defref { FUNC_DEFINE, FUNC_USE };
+static void func_use P((char *name, enum defref how));
+static void check_funcs P((void));
+
+static int want_assign; /* lexical scanning kludge */
+static int want_regexp; /* lexical scanning kludge */
+static int can_return; /* lexical scanning kludge */
+static int io_allowed = TRUE; /* lexical scanning kludge */
+static int parsing_end_rule = FALSE; /* for warnings */
+static char *lexptr; /* pointer to next char during parsing */
+static char *lexend;
+static char *lexptr_begin; /* keep track of where we were for error msgs */
+static char *lexeme; /* beginning of lexeme for debugging */
+static char *thisline = NULL;
+#define YYDEBUG_LEXER_TEXT (lexeme)
+static int param_counter;
+static char *tokstart = NULL;
+static char *tok = NULL;
+static char *tokend;
+
+static long func_count; /* total number of functions */
+
+#define HASHSIZE 1021 /* this constant only used here */
+NODE *variables[HASHSIZE];
+static int var_count; /* total number of global variables */
+
+extern char *source;
+extern int sourceline;
+extern struct src *srcfiles;
+extern int numfiles;
+extern int errcount;
+extern NODE *begin_block;
+extern NODE *end_block;
+%}
+
+%union {
+ long lval;
+ AWKNUM fval;
+ NODE *nodeval;
+ NODETYPE nodetypeval;
+ char *sval;
+ NODE *(*ptrval)();
+}
+
+%type <nodeval> function_prologue function_body
+%type <nodeval> rexp exp start program rule simp_exp
+%type <nodeval> non_post_simp_exp
+%type <nodeval> pattern
+%type <nodeval> action variable param_list
+%type <nodeval> rexpression_list opt_rexpression_list
+%type <nodeval> expression_list opt_expression_list
+%type <nodeval> statements statement if_statement opt_param_list
+%type <nodeval> opt_exp opt_variable regexp
+%type <nodeval> input_redir output_redir
+%type <nodetypeval> print
+%type <sval> func_name
+%type <lval> lex_builtin
+
+%token <sval> FUNC_CALL NAME REGEXP
+%token <lval> ERROR
+%token <nodeval> YNUMBER YSTRING
+%token <nodetypeval> RELOP APPEND_OP
+%token <nodetypeval> ASSIGNOP MATCHOP NEWLINE CONCAT_OP
+%token <nodetypeval> LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE
+%token <nodetypeval> LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE
+%token <nodetypeval> LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION
+%token <nodetypeval> LEX_GETLINE LEX_NEXTFILE
+%token <nodetypeval> LEX_IN
+%token <lval> LEX_AND LEX_OR INCREMENT DECREMENT
+%token <lval> LEX_BUILTIN LEX_LENGTH
+
+/* these are just yylval numbers */
+
+/* Lowest to highest */
+%right ASSIGNOP
+%right '?' ':'
+%left LEX_OR
+%left LEX_AND
+%left LEX_GETLINE
+%nonassoc LEX_IN
+%left FUNC_CALL LEX_BUILTIN LEX_LENGTH
+%nonassoc ','
+%nonassoc MATCHOP
+%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO
+%left CONCAT_OP
+%left YSTRING YNUMBER
+%left '+' '-'
+%left '*' '/' '%'
+%right '!' UNARY
+%right '^'
+%left INCREMENT DECREMENT
+%left '$'
+%left '(' ')'
+%%
+
+start
+ : opt_nls program opt_nls
+ {
+ expression_value = $2;
+ check_funcs();
+ }
+ ;
+
+program
+ : rule
+ {
+ if ($1 != NULL)
+ $$ = $1;
+ else
+ $$ = NULL;
+ yyerrok;
+ }
+ | program rule
+ /* add the rule to the tail of list */
+ {
+ if ($2 == NULL)
+ $$ = $1;
+ else if ($1 == NULL)
+ $$ = $2;
+ else {
+ if ($1->type != Node_rule_list)
+ $1 = node($1, Node_rule_list,
+ (NODE*) NULL);
+ $$ = append_right($1,
+ node($2, Node_rule_list, (NODE *) NULL));
+ }
+ yyerrok;
+ }
+ | error { $$ = NULL; }
+ | program error { $$ = NULL; }
+ | /* empty */ { $$ = NULL; }
+ ;
+
+rule
+ : LEX_BEGIN { io_allowed = FALSE; }
+ action
+ {
+ if (begin_block != NULL) {
+ if (begin_block->type != Node_rule_list)
+ begin_block = node(begin_block, Node_rule_list,
+ (NODE *) NULL);
+ (void) append_right(begin_block, node(
+ node((NODE *) NULL, Node_rule_node, $3),
+ Node_rule_list, (NODE *) NULL) );
+ } else
+ begin_block = node((NODE *) NULL, Node_rule_node, $3);
+ $$ = NULL;
+ io_allowed = TRUE;
+ yyerrok;
+ }
+ | LEX_END { io_allowed = FALSE; parsing_end_rule = TRUE; }
+ action
+ {
+ if (end_block != NULL) {
+ if (end_block->type != Node_rule_list)
+ end_block = node(end_block, Node_rule_list,
+ (NODE *) NULL);
+ (void) append_right (end_block, node(
+ node((NODE *) NULL, Node_rule_node, $3),
+ Node_rule_list, (NODE *) NULL));
+ } else
+ end_block = node((NODE *) NULL, Node_rule_node, $3);
+ $$ = NULL;
+ io_allowed = TRUE;
+ parsing_end_rule = FALSE;
+ yyerrok;
+ }
+ | LEX_BEGIN statement_term
+ {
+ warning(_("BEGIN blocks must have an action part"));
+ errcount++;
+ yyerrok;
+ }
+ | LEX_END statement_term
+ {
+ warning(_("END blocks must have an action part"));
+ errcount++;
+ yyerrok;
+ }
+ | pattern action
+ { $$ = node($1, Node_rule_node, $2); yyerrok; }
+ | action
+ { $$ = node((NODE *) NULL, Node_rule_node, $1); yyerrok; }
+ | pattern statement_term
+ {
+ $$ = node($1,
+ Node_rule_node,
+ node(node(node(make_number(0.0),
+ Node_field_spec,
+ (NODE *) NULL),
+ Node_expression_list,
+ (NODE *) NULL),
+ Node_K_print,
+ (NODE *) NULL));
+ yyerrok;
+ }
+ | function_prologue function_body
+ {
+ func_install($1, $2);
+ $$ = NULL;
+ yyerrok;
+ }
+ ;
+
+func_name
+ : NAME
+ { $$ = $1; }
+ | FUNC_CALL
+ { $$ = $1; }
+ | lex_builtin
+ {
+ yyerror(_("`%s' is a built-in function, it cannot be redefined"),
+ tokstart);
+ errcount++;
+ /* yyerrok; */
+ }
+ ;
+
+lex_builtin
+ : LEX_BUILTIN
+ | LEX_LENGTH
+ ;
+
+function_prologue
+ : LEX_FUNCTION
+ {
+ param_counter = 0;
+ }
+ func_name '(' opt_param_list r_paren opt_nls
+ {
+ NODE *t;
+
+ t = make_param($3);
+ t->flags |= FUNC;
+ $$ = append_right(t, $5);
+ can_return = TRUE;
+ /* check for duplicate parameter names */
+ if (dup_parms($$))
+ errcount++;
+ }
+ ;
+
+function_body
+ : l_brace statements r_brace opt_semi opt_nls
+ {
+ $$ = $2;
+ can_return = FALSE;
+ }
+ | l_brace r_brace opt_semi opt_nls
+ {
+ $$ = node((NODE *) NULL, Node_K_return, (NODE *) NULL);
+ can_return = FALSE;
+ }
+ ;
+
+
+pattern
+ : exp
+ { $$ = $1; }
+ | exp ',' exp
+ { $$ = mkrangenode(node($1, Node_cond_pair, $3)); }
+ ;
+
+regexp
+ /*
+ * In this rule, want_regexp tells yylex that the next thing
+ * is a regexp so it should read up to the closing slash.
+ */
+ : '/'
+ { ++want_regexp; }
+ REGEXP '/'
+ {
+ NODE *n;
+ size_t len;
+
+ getnode(n);
+ n->type = Node_regex;
+ len = strlen($3);
+ n->re_exp = make_string($3, len);
+ n->re_reg = make_regexp($3, len, FALSE, TRUE);
+ n->re_text = NULL;
+ n->re_flags = CONST;
+ n->re_cnt = 1;
+ $$ = n;
+ }
+ ;
+
+action
+ : l_brace statements r_brace opt_semi opt_nls
+ { $$ = $2; }
+ | l_brace r_brace opt_semi opt_nls
+ { $$ = NULL; }
+ ;
+
+statements
+ : statement
+ {
+ $$ = $1;
+ if (do_lint && isnoeffect($$->type))
+ lintwarn(_("statement may have no effect"));
+ }
+ | statements statement
+ {
+ if ($1 == NULL || $1->type != Node_statement_list)
+ $1 = node($1, Node_statement_list, (NODE *) NULL);
+ $$ = append_right($1,
+ node($2, Node_statement_list, (NODE *) NULL));
+ yyerrok;
+ }
+ | error
+ { $$ = NULL; }
+ | statements error
+ { $$ = NULL; }
+ ;
+
+statement_term
+ : nls
+ | semi opt_nls
+ ;
+
+statement
+ : semi opt_nls
+ { $$ = NULL; }
+ | l_brace r_brace
+ { $$ = NULL; }
+ | l_brace statements r_brace
+ { $$ = $2; }
+ | if_statement
+ { $$ = $1; }
+ | LEX_WHILE '(' exp r_paren opt_nls statement
+ { $$ = node($3, Node_K_while, $6); }
+ | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
+ { $$ = node($6, Node_K_do, $3); }
+ | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
+ {
+ /*
+ * Efficiency hack. Recognize the special case of
+ *
+ * for (iggy in foo)
+ * delete foo[iggy]
+ *
+ * and treat it as if it were
+ *
+ * delete foo
+ *
+ * Check that the body is a `delete a[i]' statement,
+ * and that both the loop var and array names match.
+ */
+ if ($8 != NULL && $8->type == Node_K_delete
+ && $8->rnode != NULL
+ && ($8->rnode->type == Node_var || $8->rnode->type == Node_param_list)
+ && strcmp($3, $8->rnode->var_value->vname) == 0
+ && strcmp($5, $8->lnode->vname) == 0) {
+ $8->type = Node_K_delete_loop;
+ $$ = $8;
+ } else {
+ $$ = node($8, Node_K_arrayfor,
+ make_for_loop(variable($3, CAN_FREE, Node_var),
+ (NODE *) NULL, variable($5, CAN_FREE, Node_var_array)));
+ }
+ }
+ | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
+ {
+ $$ = node($12, Node_K_for, (NODE *) make_for_loop($3, $6, $9));
+ }
+ | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
+ {
+ $$ = node($11, Node_K_for,
+ (NODE *) make_for_loop($3, (NODE *) NULL, $8));
+ }
+ | LEX_BREAK statement_term
+ /* for break, maybe we'll have to remember where to break to */
+ { $$ = node((NODE *) NULL, Node_K_break, (NODE *) NULL); }
+ | LEX_CONTINUE statement_term
+ /* similarly */
+ { $$ = node((NODE *) NULL, Node_K_continue, (NODE *) NULL); }
+ | print '(' expression_list r_paren output_redir statement_term
+ {
+ $$ = node($3, $1, $5);
+ if ($$->type == Node_K_printf)
+ count_args($$)
+ }
+ | print opt_rexpression_list output_redir statement_term
+ {
+ if ($1 == Node_K_print && $2 == NULL) {
+ static int warned = FALSE;
+
+ $2 = node(node(make_number(0.0),
+ Node_field_spec,
+ (NODE *) NULL),
+ Node_expression_list,
+ (NODE *) NULL);
+
+ if (do_lint && ! io_allowed && ! warned) {
+ warned = TRUE;
+ lintwarn(
+ _("plain `print' in BEGIN or END rule should probably be `print \"\"'"));
+ }
+ }
+
+ $$ = node($2, $1, $3);
+ if ($$->type == Node_K_printf)
+ count_args($$)
+ }
+ | LEX_NEXT statement_term
+ { NODETYPE type;
+
+ if (! io_allowed)
+ yyerror(_("`next' used in BEGIN or END action"));
+ type = Node_K_next;
+ $$ = node((NODE *) NULL, type, (NODE *) NULL);
+ }
+ | LEX_NEXTFILE statement_term
+ {
+ if (do_lint)
+ lintwarn(_("`nextfile' is a gawk extension"));
+ if (do_traditional) {
+ /*
+ * can't use yyerror, since may have overshot
+ * the source line
+ */
+ errcount++;
+ error(_("`nextfile' is a gawk extension"));
+ }
+ if (! io_allowed) {
+ /* same thing */
+ errcount++;
+ error(_("`nextfile' used in BEGIN or END action"));
+ }
+ $$ = node((NODE *) NULL, Node_K_nextfile, (NODE *) NULL);
+ }
+ | LEX_EXIT opt_exp statement_term
+ { $$ = node($2, Node_K_exit, (NODE *) NULL); }
+ | LEX_RETURN
+ {
+ if (! can_return)
+ yyerror(_("`return' used outside function context"));
+ }
+ opt_exp statement_term
+ { $$ = node($3, Node_K_return, (NODE *) NULL); }
+ | LEX_DELETE NAME '[' expression_list ']' statement_term
+ { $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, $4); }
+ | LEX_DELETE NAME statement_term
+ {
+ if (do_lint)
+ lintwarn(_("`delete array' is a gawk extension"));
+ if (do_traditional) {
+ /*
+ * can't use yyerror, since may have overshot
+ * the source line
+ */
+ errcount++;
+ error(_("`delete array' is a gawk extension"));
+ }
+ $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, (NODE *) NULL);
+ }
+ | exp statement_term
+ { $$ = $1; }
+ ;
+
+print
+ : LEX_PRINT
+ { $$ = $1; }
+ | LEX_PRINTF
+ { $$ = $1; }
+ ;
+
+if_statement
+ : LEX_IF '(' exp r_paren opt_nls statement
+ {
+ $$ = node($3, Node_K_if,
+ node($6, Node_if_branches, (NODE *) NULL));
+ }
+ | LEX_IF '(' exp r_paren opt_nls statement
+ LEX_ELSE opt_nls statement
+ { $$ = node($3, Node_K_if,
+ node($6, Node_if_branches, $9)); }
+ ;
+
+nls
+ : NEWLINE
+ { want_assign = FALSE; }
+ | nls NEWLINE
+ ;
+
+opt_nls
+ : /* empty */
+ | nls
+ ;
+
+input_redir
+ : /* empty */
+ { $$ = NULL; }
+ | '<' simp_exp
+ { $$ = node($2, Node_redirect_input, (NODE *) NULL); }
+ ;
+
+output_redir
+ : /* empty */
+ { $$ = NULL; }
+ | '>' exp
+ { $$ = node($2, Node_redirect_output, (NODE *) NULL); }
+ | APPEND_OP exp
+ { $$ = node($2, Node_redirect_append, (NODE *) NULL); }
+ | '|' exp
+ { $$ = node($2, Node_redirect_pipe, (NODE *) NULL); }
+ | TWOWAYIO exp
+ {
+ if ($2->type == Node_K_getline
+ && $2->rnode->type == Node_redirect_twoway)
+ yyerror(_("multistage two-way pipelines don't work"));
+ $$ = node($2, Node_redirect_twoway, (NODE *) NULL);
+ }
+ ;
+
+opt_param_list
+ : /* empty */
+ { $$ = NULL; }
+ | param_list
+ { $$ = $1; }
+ ;
+
+param_list
+ : NAME
+ { $$ = make_param($1); }
+ | param_list comma NAME
+ { $$ = append_right($1, make_param($3)); yyerrok; }
+ | error
+ { $$ = NULL; }
+ | param_list error
+ { $$ = NULL; }
+ | param_list comma error
+ { $$ = NULL; }
+ ;
+
+/* optional expression, as in for loop */
+opt_exp
+ : /* empty */
+ { $$ = NULL; }
+ | exp
+ { $$ = $1; }
+ ;
+
+opt_rexpression_list
+ : /* empty */
+ { $$ = NULL; }
+ | rexpression_list
+ { $$ = $1; }
+ ;
+
+rexpression_list
+ : rexp
+ { $$ = node($1, Node_expression_list, (NODE *) NULL); }
+ | rexpression_list comma rexp
+ {
+ $$ = append_right($1,
+ node($3, Node_expression_list, (NODE *) NULL));
+ yyerrok;
+ }
+ | error
+ { $$ = NULL; }
+ | rexpression_list error
+ { $$ = NULL; }
+ | rexpression_list error rexp
+ { $$ = NULL; }
+ | rexpression_list comma error
+ { $$ = NULL; }
+ ;
+
+opt_expression_list
+ : /* empty */
+ { $$ = NULL; }
+ | expression_list
+ { $$ = $1; }
+ ;
+
+expression_list
+ : exp
+ { $$ = node($1, Node_expression_list, (NODE *) NULL); }
+ | expression_list comma exp
+ {
+ $$ = append_right($1,
+ node($3, Node_expression_list, (NODE *) NULL));
+ yyerrok;
+ }
+ | error
+ { $$ = NULL; }
+ | expression_list error
+ { $$ = NULL; }
+ | expression_list error exp
+ { $$ = NULL; }
+ | expression_list comma error
+ { $$ = NULL; }
+ ;
+
+/* Expressions, not including the comma operator. */
+exp : variable ASSIGNOP
+ { want_assign = FALSE; }
+ exp
+ {
+ if (do_lint && $4->type == Node_regex)
+ lintwarn(_("regular expression on right of assignment"));
+ $$ = node($1, $2, $4);
+ }
+ | '(' expression_list r_paren LEX_IN NAME
+ { $$ = node(variable($5, CAN_FREE, Node_var_array), Node_in_array, $2); }
+ | exp '|' LEX_GETLINE opt_variable
+ {
+ $$ = node($4, Node_K_getline,
+ node($1, Node_redirect_pipein, (NODE *) NULL));
+ }
+ | exp TWOWAYIO LEX_GETLINE opt_variable
+ {
+ $$ = node($4, Node_K_getline,
+ node($1, Node_redirect_twoway, (NODE *) NULL));
+ }
+ | LEX_GETLINE opt_variable input_redir
+ {
+ if (do_lint && ! io_allowed && parsing_end_rule && $3 == NULL)
+ lintwarn(_("non-redirected `getline' undefined inside END action"));
+ $$ = node($2, Node_K_getline, $3);
+ }
+ | exp LEX_AND exp
+ { $$ = node($1, Node_and, $3); }
+ | exp LEX_OR exp
+ { $$ = node($1, Node_or, $3); }
+ | exp MATCHOP exp
+ {
+ if ($1->type == Node_regex)
+ warning(_("regular expression on left of `~' or `!~' operator"));
+ $$ = node($1, $2, mk_rexp($3));
+ }
+ | regexp
+ {
+ $$ = $1;
+ if (do_lint && tokstart[0] == '*') {
+ /* possible C comment */
+ int n = strlen(tokstart) - 1;
+ if (tokstart[n] == '*')
+ lintwarn(_("regexp constant `/%s/' looks like a C comment, but is not"), tokstart);
+ }
+ }
+ | '!' regexp %prec UNARY
+ {
+ $$ = node(node(make_number(0.0),
+ Node_field_spec,
+ (NODE *) NULL),
+ Node_nomatch,
+ $2);
+ }
+ | exp LEX_IN NAME
+ { $$ = node(variable($3, CAN_FREE, Node_var_array), Node_in_array, $1); }
+ | exp RELOP exp
+ {
+ if (do_lint && $3->type == Node_regex)
+ lintwarn(_("regular expression on right of comparison"));
+ $$ = node($1, $2, $3);
+ }
+ | exp '<' exp
+ { $$ = node($1, Node_less, $3); }
+ | exp '>' exp
+ { $$ = node($1, Node_greater, $3); }
+ | exp '?' exp ':' exp
+ { $$ = node($1, Node_cond_exp, node($3, Node_if_branches, $5));}
+ | simp_exp
+ { $$ = $1; }
+ | exp simp_exp %prec CONCAT_OP
+ { $$ = node($1, Node_concat, $2); }
+ ;
+
+rexp
+ : variable ASSIGNOP
+ { want_assign = FALSE; }
+ rexp
+ { $$ = node($1, $2, $4); }
+ | rexp LEX_AND rexp
+ { $$ = node($1, Node_and, $3); }
+ | rexp LEX_OR rexp
+ { $$ = node($1, Node_or, $3); }
+ | LEX_GETLINE opt_variable input_redir
+ {
+ if (do_lint && ! io_allowed && $3 == NULL)
+ lintwarn(_("non-redirected `getline' undefined inside BEGIN or END action"));
+ $$ = node($2, Node_K_getline, $3);
+ }
+ | regexp
+ { $$ = $1; }
+ | '!' regexp %prec UNARY
+ { $$ = node((NODE *) NULL, Node_nomatch, $2); }
+ | rexp MATCHOP rexp
+ { $$ = node($1, $2, mk_rexp($3)); }
+ | rexp LEX_IN NAME
+ { $$ = node(variable($3, CAN_FREE, Node_var_array), Node_in_array, $1); }
+ | rexp RELOP rexp
+ { $$ = node($1, $2, $3); }
+ | rexp '?' rexp ':' rexp
+ { $$ = node($1, Node_cond_exp, node($3, Node_if_branches, $5));}
+ | simp_exp
+ { $$ = $1; }
+ | rexp simp_exp %prec CONCAT_OP
+ { $$ = node($1, Node_concat, $2); }
+ ;
+
+simp_exp
+ : non_post_simp_exp
+ /* Binary operators in order of decreasing precedence. */
+ | simp_exp '^' simp_exp
+ { $$ = node($1, Node_exp, $3); }
+ | simp_exp '*' simp_exp
+ { $$ = node($1, Node_times, $3); }
+ | simp_exp '/' simp_exp
+ { $$ = node($1, Node_quotient, $3); }
+ | simp_exp '%' simp_exp
+ { $$ = node($1, Node_mod, $3); }
+ | simp_exp '+' simp_exp
+ { $$ = node($1, Node_plus, $3); }
+ | simp_exp '-' simp_exp
+ { $$ = node($1, Node_minus, $3); }
+ | variable INCREMENT
+ { $$ = node($1, Node_postincrement, (NODE *) NULL); }
+ | variable DECREMENT
+ { $$ = node($1, Node_postdecrement, (NODE *) NULL); }
+ ;
+
+non_post_simp_exp
+ : '!' simp_exp %prec UNARY
+ { $$ = node($2, Node_not, (NODE *) NULL); }
+ | '(' exp r_paren
+ { $$ = $2; }
+ | LEX_BUILTIN
+ '(' opt_expression_list r_paren
+ { $$ = snode($3, Node_builtin, (int) $1); }
+ | LEX_LENGTH '(' opt_expression_list r_paren
+ { $$ = snode($3, Node_builtin, (int) $1); }
+ | LEX_LENGTH
+ {
+ if (do_lint)
+ lintwarn(_("call of `length' without parentheses is not portable"));
+ $$ = snode((NODE *) NULL, Node_builtin, (int) $1);
+ if (do_posix)
+ warning(_("call of `length' without parentheses is deprecated by POSIX"));
+ }
+ | FUNC_CALL '(' opt_expression_list r_paren
+ {
+ $$ = node($3, Node_func_call, make_string($1, strlen($1)));
+ func_use($1, FUNC_USE);
+ param_sanity($3);
+ free($1);
+ }
+ | variable
+ | INCREMENT variable
+ { $$ = node($2, Node_preincrement, (NODE *) NULL); }
+ | DECREMENT variable
+ { $$ = node($2, Node_predecrement, (NODE *) NULL); }
+ | YNUMBER
+ { $$ = $1; }
+ | YSTRING
+ { $$ = $1; }
+
+ | '-' simp_exp %prec UNARY
+ {
+ if ($2->type == Node_val) {
+ $2->numbr = -(force_number($2));
+ $$ = $2;
+ } else
+ $$ = node($2, Node_unary_minus, (NODE *) NULL);
+ }
+ | '+' simp_exp %prec UNARY
+ {
+ /*
+ * was: $$ = $2
+ * POSIX semantics: force a conversion to numeric type
+ */
+ $$ = node (make_number(0.0), Node_plus, $2);
+ }
+ ;
+
+opt_variable
+ : /* empty */
+ { $$ = NULL; }
+ | variable
+ { $$ = $1; }
+ ;
+
+variable
+ : NAME
+ { $$ = variable($1, CAN_FREE, Node_var); }
+ | NAME '[' expression_list ']'
+ {
+ 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
+ $$ = node(variable($1, CAN_FREE, Node_var_array), Node_subscript, $3);
+ }
+ | '$' non_post_simp_exp
+ { $$ = node($2, Node_field_spec, (NODE *) NULL); }
+ ;
+
+l_brace
+ : '{' opt_nls
+ ;
+
+r_brace
+ : '}' opt_nls { yyerrok; }
+ ;
+
+r_paren
+ : ')' { yyerrok; }
+ ;
+
+opt_semi
+ : /* empty */
+ | semi
+ ;
+
+semi
+ : ';' { yyerrok; want_assign = FALSE; }
+ ;
+
+comma : ',' opt_nls { yyerrok; }
+ ;
+
+%%
+
+struct token {
+ const char *operator; /* text to match */
+ NODETYPE value; /* node type */
+ int class; /* lexical class */
+ unsigned flags; /* # of args. allowed and compatability */
+# define ARGS 0xFF /* 0, 1, 2, 3 args allowed (any combination */
+# define A(n) (1<<(n))
+# define VERSION_MASK 0xFF00 /* old awk is zero */
+# define NOT_OLD 0x0100 /* feature not in old awk */
+# define NOT_POSIX 0x0200 /* feature not in POSIX */
+# define GAWKX 0x0400 /* gawk extension */
+# define RESX 0x0800 /* Bell Labs Research extension */
+ NODE *(*ptr)(); /* function that implements this keyword */
+};
+
+/* Tokentab is sorted ascii ascending order, so it can be binary searched. */
+/* Function pointers come from declarations in awk.h. */
+
+static struct token tokentab[] = {
+{"BEGIN", Node_illegal, LEX_BEGIN, 0, 0},
+{"END", Node_illegal, LEX_END, 0, 0},
+#ifdef ARRAYDEBUG
+{"adump", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_adump},
+#endif
+{"and", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_and},
+{"asort", Node_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_asort},
+{"atan2", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2},
+{"bindtextdomain", Node_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_bindtextdomain},
+{"break", Node_K_break, LEX_BREAK, 0, 0},
+{"close", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1)|A(2), do_close},
+{"compl", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl},
+{"continue", Node_K_continue, LEX_CONTINUE, 0, 0},
+{"cos", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos},
+{"dcgettext", Node_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_dcgettext},
+{"delete", Node_K_delete, LEX_DELETE, NOT_OLD, 0},
+{"do", Node_K_do, LEX_DO, NOT_OLD, 0},
+{"else", Node_illegal, LEX_ELSE, 0, 0},
+{"exit", Node_K_exit, LEX_EXIT, 0, 0},
+{"exp", Node_builtin, LEX_BUILTIN, A(1), do_exp},
+{"extension", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
+{"fflush", Node_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush},
+{"for", Node_K_for, LEX_FOR, 0, 0},
+{"func", Node_K_function, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
+{"function", Node_K_function, LEX_FUNCTION, NOT_OLD, 0},
+{"gensub", Node_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), do_gensub},
+{"getline", Node_K_getline, LEX_GETLINE, NOT_OLD, 0},
+{"gsub", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_gsub},
+{"if", Node_K_if, LEX_IF, 0, 0},
+{"in", Node_illegal, LEX_IN, 0, 0},
+{"index", Node_builtin, LEX_BUILTIN, A(2), do_index},
+{"int", Node_builtin, LEX_BUILTIN, A(1), do_int},
+{"length", Node_builtin, LEX_LENGTH, A(0)|A(1), do_length},
+{"log", Node_builtin, LEX_BUILTIN, A(1), do_log},
+{"lshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift},
+{"match", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match},
+{"mktime", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_mktime},
+{"next", Node_K_next, LEX_NEXT, 0, 0},
+{"nextfile", Node_K_nextfile, LEX_NEXTFILE, GAWKX, 0},
+{"or", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_or},
+{"print", Node_K_print, LEX_PRINT, 0, 0},
+{"printf", Node_K_printf, LEX_PRINTF, 0, 0},
+{"rand", Node_builtin, LEX_BUILTIN, NOT_OLD|A(0), do_rand},
+{"return", Node_K_return, LEX_RETURN, NOT_OLD, 0},
+{"rshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift},
+{"sin", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_sin},
+{"split", Node_builtin, LEX_BUILTIN, A(2)|A(3), do_split},
+{"sprintf", Node_builtin, LEX_BUILTIN, 0, do_sprintf},
+{"sqrt", Node_builtin, LEX_BUILTIN, A(1), do_sqrt},
+{"srand", Node_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand},
+#if defined(GAWKDEBUG) || defined(ARRAYDEBUG) /* || ... */
+{"stopme", Node_builtin, LEX_BUILTIN, GAWKX|A(0), stopme},
+#endif
+{"strftime", Node_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2), do_strftime},
+{"strtonum", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum},
+{"sub", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_sub},
+{"substr", Node_builtin, LEX_BUILTIN, A(2)|A(3), do_substr},
+{"system", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system},
+{"systime", Node_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime},
+{"tolower", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower},
+{"toupper", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper},
+{"while", Node_K_while, LEX_WHILE, 0, 0},
+{"xor", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor},
+};
+
+/* getfname --- return name of a builtin function (for pretty printing) */
+
+const char *
+getfname(register NODE *(*fptr)())
+{
+ register int i, j;
+
+ j = sizeof(tokentab) / sizeof(tokentab[0]);
+ /* linear search, no other way to do it */
+ for (i = 0; i < j; i++)
+ if (tokentab[i].ptr == fptr)
+ return tokentab[i].operator;
+
+ fatal(_("fptr %x not in tokentab\n"), fptr);
+ return NULL; /* to stop warnings */
+}
+
+/* yyerror --- print a syntax error message, show where */
+
+/*
+ * Function identifier purposely indented to avoid mangling
+ * by ansi2knr. Sigh.
+ */
+
+static void
+#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
+ yyerror(const char *m, ...)
+#else
+/* VARARGS0 */
+ yyerror(va_alist)
+ va_dcl
+#endif
+{
+ va_list args;
+ const char *mesg = NULL;
+ register char *bp, *cp;
+ char *scan;
+ char buf[120];
+ static char end_of_file_line[] = "(END OF FILE)";
+
+ errcount++;
+ /* Find the current line in the input file */
+ if (lexptr && lexeme) {
+ if (thisline == NULL) {
+ cp = lexeme;
+ if (*cp == '\n') {
+ cp--;
+ mesg = _("unexpected newline");
+ }
+ for (; cp != lexptr_begin && *cp != '\n'; --cp)
+ continue;
+ if (*cp == '\n')
+ cp++;
+ thisline = cp;
+ }
+ /* NL isn't guaranteed */
+ bp = lexeme;
+ while (bp < lexend && *bp && *bp != '\n')
+ bp++;
+ } else {
+ thisline = end_of_file_line;
+ bp = thisline + strlen(thisline);
+ }
+ msg("%.*s", (int) (bp - thisline), thisline);
+ bp = buf;
+ cp = buf + sizeof(buf) - 24; /* 24 more than longest msg. input */
+ if (lexptr != NULL) {
+ scan = thisline;
+ while (bp < cp && scan < lexeme)
+ if (*scan++ == '\t')
+ *bp++ = '\t';
+ else
+ *bp++ = ' ';
+ *bp++ = '^';
+ *bp++ = ' ';
+ }
+#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
+ va_start(args, m);
+ if (mesg == NULL)
+ mesg = m;
+#else
+ va_start(args);
+ if (mesg == NULL)
+ mesg = va_arg(args, char *);
+#endif
+ strcpy(bp, mesg);
+ err("", buf, args);
+ va_end(args);
+}
+
+/* get_src_buf --- read the next buffer of source program */
+
+static char *
+get_src_buf()
+{
+ static int samefile = FALSE;
+ static int nextfile = 0;
+ static char *buf = NULL;
+ static int fd;
+ int n;
+ register char *scan;
+ static int len = 0;
+ static int did_newline = FALSE;
+ int newfile;
+ struct stat sbuf;
+
+# define SLOP 128 /* enough space to hold most source lines */
+
+again:
+ newfile = FALSE;
+ if (nextfile > numfiles)
+ return NULL;
+
+ if (srcfiles[nextfile].stype == CMDLINE) {
+ if (len == 0) {
+ len = strlen(srcfiles[nextfile].val);
+ if (len == 0) {
+ /*
+ * Yet Another Special case:
+ * gawk '' /path/name
+ * Sigh.
+ */
+ static int warned = FALSE;
+
+ if (do_lint && ! warned) {
+ warned = TRUE;
+ lintwarn(_("empty program text on command line"));
+ }
+ ++nextfile;
+ goto again;
+ }
+ sourceline = 1;
+ lexptr = lexptr_begin = srcfiles[nextfile].val;
+ lexend = lexptr + len;
+ } else if (! did_newline && *(lexptr-1) != '\n') {
+ /*
+ * The following goop is to ensure that the source
+ * ends with a newline and that the entire current
+ * line is available for error messages.
+ */
+ int offset;
+
+ did_newline = TRUE;
+ offset = lexptr - lexeme;
+ for (scan = lexeme; scan > lexptr_begin; scan--)
+ if (*scan == '\n') {
+ scan++;
+ break;
+ }
+ len = lexptr - scan;
+ emalloc(buf, char *, len+1, "get_src_buf");
+ memcpy(buf, scan, len);
+ thisline = buf;
+ lexptr = buf + len;
+ *lexptr = '\n';
+ lexeme = lexptr - offset;
+ lexptr_begin = buf;
+ lexend = lexptr + 1;
+ } else {
+ len = 0;
+ lexeme = lexptr = lexptr_begin = NULL;
+ }
+ if (lexptr == NULL && ++nextfile <= numfiles)
+ goto again;
+ return lexptr;
+ }
+ if (! samefile) {
+ source = srcfiles[nextfile].val;
+ if (source == NULL) {
+ if (buf != NULL) {
+ free(buf);
+ buf = NULL;
+ }
+ len = 0;
+ return lexeme = lexptr = lexptr_begin = NULL;
+ }
+ fd = pathopen(source);
+ if (fd <= INVALID_HANDLE) {
+ char *in;
+
+ /* suppress file name and line no. in error mesg */
+ in = source;
+ source = NULL;
+ fatal(_("can't open source file `%s' for reading (%s)"),
+ in, strerror(errno));
+ }
+ len = optimal_bufsize(fd, & sbuf);
+ newfile = TRUE;
+ if (buf != NULL)
+ free(buf);
+ emalloc(buf, char *, len + SLOP, "get_src_buf");
+ lexptr_begin = buf + SLOP;
+ samefile = TRUE;
+ sourceline = 1;
+ } else {
+ /*
+ * Here, we retain the current source line (up to length SLOP)
+ * in the beginning of the buffer that was overallocated above
+ */
+ int offset;
+ int linelen;
+
+ offset = lexptr - lexeme;
+ for (scan = lexeme; scan > lexptr_begin; scan--)
+ if (*scan == '\n') {
+ scan++;
+ break;
+ }
+ linelen = lexptr - scan;
+ if (linelen > SLOP)
+ linelen = SLOP;
+ thisline = buf + SLOP - linelen;
+ memcpy(thisline, scan, linelen);
+ lexeme = buf + SLOP - offset;
+ lexptr_begin = thisline;
+ }
+ n = read(fd, buf + SLOP, len);
+ if (n == -1)
+ fatal(_("can't read sourcefile `%s' (%s)"),
+ source, strerror(errno));
+ if (n == 0) {
+ if (newfile) {
+ static int warned = FALSE;
+
+ if (do_lint && ! warned) {
+ warned = TRUE;
+ lintwarn(_("source file `%s' is empty"), source);
+ }
+ }
+ if (fd != fileno(stdin)) /* safety */
+ close(fd);
+ samefile = FALSE;
+ nextfile++;
+ if (lexeme)
+ *lexeme = '\0';
+ len = 0;
+ goto again;
+ }
+ lexptr = buf + SLOP;
+ lexend = lexptr + n;
+ return buf;
+}
+
+/* tokadd --- add a character to the token buffer */
+
+#define tokadd(x) (*tok++ = (x), tok == tokend ? tokexpand() : tok)
+
+/* tokexpand --- grow the token buffer */
+
+char *
+tokexpand()
+{
+ static int toksize = 60;
+ int tokoffset;
+
+ tokoffset = tok - tokstart;
+ toksize *= 2;
+ if (tokstart != NULL)
+ erealloc(tokstart, char *, toksize, "tokexpand");
+ else
+ emalloc(tokstart, char *, toksize, "tokexpand");
+ tokend = tokstart + toksize;
+ tok = tokstart + tokoffset;
+ return tok;
+}
+
+/* nextc --- get the next input character */
+
+#if GAWKDEBUG
+int
+nextc()
+{
+ int c;
+
+ if (lexptr && lexptr < lexend)
+ c = (int) (unsigned char) *lexptr++;
+ else if (get_src_buf())
+ c = (int) (unsigned char) *lexptr++;
+ else
+ c = EOF;
+
+ return c;
+}
+#else
+#define nextc() ((lexptr && lexptr < lexend) ? \
+ ((int) (unsigned char) *lexptr++) : \
+ (get_src_buf() ? ((int) (unsigned char) *lexptr++) : EOF) \
+ )
+#endif
+
+/* pushback --- push a character back on the input */
+
+#define pushback() (lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr)
+
+/* allow_newline --- allow newline after &&, ||, ? and : */
+
+static void
+allow_newline()
+{
+ int c;
+
+ for (;;) {
+ c = nextc();
+ if (c == EOF)
+ break;
+ if (c == '#') {
+ while ((c = nextc()) != '\n' && c != EOF)
+ continue;
+ if (c == EOF)
+ break;
+ }
+ if (c == '\n')
+ sourceline++;
+ if (! ISSPACE(c)) {
+ pushback();
+ break;
+ }
+ }
+}
+
+/* yylex --- Read the input and turn it into tokens. */
+
+static int
+yylex()
+{
+ register int c;
+ int seen_e = FALSE; /* These are for numbers */
+ int seen_point = FALSE;
+ int esc_seen; /* for literal strings */
+ int low, mid, high;
+ static int did_newline = FALSE;
+ char *tokkey;
+ static int lasttok = 0, eof_warned = FALSE;
+ int inhex = FALSE;
+ int intlstr = FALSE;
+
+ if (nextc() == EOF) {
+ if (lasttok != NEWLINE) {
+ lasttok = NEWLINE;
+ if (do_lint && ! eof_warned) {
+ lintwarn(_("source file does not end in newline"));
+ eof_warned = TRUE;
+ }
+ return NEWLINE; /* fake it */
+ }
+ return 0;
+ }
+ pushback();
+#ifdef OS2
+ /*
+ * added for OS/2's extproc feature of cmd.exe
+ * (like #! in BSD sh)
+ */
+ if (strncasecmp(lexptr, "extproc ", 8) == 0) {
+ while (*lexptr && *lexptr != '\n')
+ lexptr++;
+ }
+#endif
+ lexeme = lexptr;
+ thisline = NULL;
+ if (want_regexp) {
+ int in_brack = 0; /* count brackets, [[:alnum:]] allowed */
+ /*
+ * Counting brackets is non-trivial. [[] is ok,
+ * and so is [\]], with a point being that /[/]/ as a regexp
+ * constant has to work.
+ *
+ * Do not count [ or ] if either one is preceded by a \.
+ * A `[' should be counted if
+ * a) it is the first one so far (in_brack == 0)
+ * b) it is the `[' in `[:'
+ * A ']' should be counted if not preceded by a \, since
+ * it is either closing `:]' or just a plain list.
+ * According to POSIX, []] is how you put a ] into a set.
+ * Try to handle that too.
+ *
+ * The code for \ handles \[ and \].
+ */
+
+ want_regexp = FALSE;
+ tok = tokstart;
+ for (;;) {
+ c = nextc();
+ switch (c) {
+ case '[':
+ /* one day check for `.' and `=' too */
+ if (nextc() == ':' || in_brack == 0)
+ in_brack++;
+ pushback();
+ break;
+ case ']':
+ if (tokstart[0] == '['
+ && (tok == tokstart + 1
+ || (tok == tokstart + 2
+ && tokstart[1] == '^')))
+ /* do nothing */;
+ else
+ in_brack--;
+ break;
+ case '\\':
+ if ((c = nextc()) == EOF) {
+ yyerror(_("unterminated regexp ends with `\\' at end of file"));
+ return lasttok = REGEXP; /* kludge */
+ } else if (c == '\n') {
+ sourceline++;
+ continue;
+ } else {
+ tokadd('\\');
+ tokadd(c);
+ continue;
+ }
+ break;
+ case '/': /* end of the regexp */
+ if (in_brack > 0)
+ break;
+
+ pushback();
+ tokadd('\0');
+ yylval.sval = tokstart;
+ return lasttok = REGEXP;
+ case '\n':
+ pushback();
+ yyerror(_("unterminated regexp"));
+ return lasttok = REGEXP; /* kludge */
+ case EOF:
+ yyerror(_("unterminated regexp at end of file"));
+ return lasttok = REGEXP; /* kludge */
+ }
+ tokadd(c);
+ }
+ }
+retry:
+ while ((c = nextc()) == ' ' || c == '\t')
+ continue;
+
+ lexeme = lexptr ? lexptr - 1 : lexptr;
+ thisline = NULL;
+ tok = tokstart;
+ yylval.nodetypeval = Node_illegal;
+
+ switch (c) {
+ case EOF:
+ if (lasttok != NEWLINE) {
+ lasttok = NEWLINE;
+ if (do_lint && ! eof_warned) {
+ lintwarn(_("source file does not end in newline"));
+ eof_warned = TRUE;
+ }
+ return NEWLINE; /* fake it */
+ }
+ return 0;
+
+ case '\n':
+ sourceline++;
+ return lasttok = NEWLINE;
+
+ case '#': /* it's a comment */
+ while ((c = nextc()) != '\n') {
+ if (c == EOF) {
+ if (lasttok != NEWLINE) {
+ lasttok = NEWLINE;
+ if (do_lint && ! eof_warned) {
+ lintwarn(
+ _("source file does not end in newline"));
+ eof_warned = TRUE;
+ }
+ return NEWLINE; /* fake it */
+ }
+ return 0;
+ }
+ }
+ sourceline++;
+ return lasttok = NEWLINE;
+
+ case '\\':
+#ifdef RELAXED_CONTINUATION
+ /*
+ * This code puports to allow comments and/or whitespace
+ * after the `\' at the end of a line used for continuation.
+ * Use it at your own risk. We think it's a bad idea, which
+ * is why it's not on by default.
+ */
+ if (! do_traditional) {
+ /* strip trailing white-space and/or comment */
+ while ((c = nextc()) == ' ' || c == '\t')
+ continue;
+ if (c == '#') {
+ if (do_lint)
+ lintwarn(
+ _("use of `\\ #...' line continuation is not portable"));
+ while ((c = nextc()) != '\n')
+ if (c == EOF)
+ break;
+ }
+ pushback();
+ }
+#endif /* RELAXED_CONTINUATION */
+ if (nextc() == '\n') {
+ sourceline++;
+ goto retry;
+ } else {
+ yyerror(_("backslash not last character on line"));
+ exit(1);
+ }
+ break;
+
+ case '$':
+ want_assign = TRUE;
+ return lasttok = '$';
+
+ case ':':
+ case '?':
+ if (! do_posix)
+ allow_newline();
+ return lasttok = c;
+
+ case ')':
+ case '(':
+ case ';':
+ case '{':
+ case ',':
+ want_assign = FALSE;
+ /* fall through */
+ case '[':
+ case ']':
+ return lasttok = c;
+
+ case '*':
+ if ((c = nextc()) == '=') {
+ yylval.nodetypeval = Node_assign_times;
+ return lasttok = ASSIGNOP;
+ } else if (do_posix) {
+ pushback();
+ return lasttok = '*';
+ } else if (c == '*') {
+ /* make ** and **= aliases for ^ and ^= */
+ static int did_warn_op = FALSE, did_warn_assgn = FALSE;
+
+ if (nextc() == '=') {
+ if (! did_warn_assgn) {
+ did_warn_assgn = TRUE;
+ if (do_lint)
+ lintwarn(_("POSIX does not allow operator `**='"));
+ if (do_lint_old)
+ warning(_("old awk does not support operator `**='"));
+ }
+ yylval.nodetypeval = Node_assign_exp;
+ return ASSIGNOP;
+ } else {
+ pushback();
+ if (! did_warn_op) {
+ did_warn_op = TRUE;
+ if (do_lint)
+ lintwarn(_("POSIX does not allow operator `**'"));
+ if (do_lint_old)
+ warning(_("old awk does not support operator `**'"));
+ }
+ return lasttok = '^';
+ }
+ }
+ pushback();
+ return lasttok = '*';
+
+ case '/':
+ if (want_assign) {
+ if (nextc() == '=') {
+ yylval.nodetypeval = Node_assign_quotient;
+ return lasttok = ASSIGNOP;
+ }
+ pushback();
+ }
+ return lasttok = '/';
+
+ case '%':
+ if (nextc() == '=') {
+ yylval.nodetypeval = Node_assign_mod;
+ return lasttok = ASSIGNOP;
+ }
+ pushback();
+ return lasttok = '%';
+
+ case '^':
+ {
+ static int did_warn_op = FALSE, did_warn_assgn = FALSE;
+
+ if (nextc() == '=') {
+ if (do_lint_old && ! did_warn_assgn) {
+ did_warn_assgn = TRUE;
+ warning(_("operator `^=' is not supported in old awk"));
+ }
+ yylval.nodetypeval = Node_assign_exp;
+ return lasttok = ASSIGNOP;
+ }
+ pushback();
+ if (do_lint_old && ! did_warn_op) {
+ did_warn_op = TRUE;
+ warning(_("operator `^' is not supported in old awk"));
+ }
+ return lasttok = '^';
+ }
+
+ case '+':
+ if ((c = nextc()) == '=') {
+ yylval.nodetypeval = Node_assign_plus;
+ return lasttok = ASSIGNOP;
+ }
+ if (c == '+')
+ return lasttok = INCREMENT;
+ pushback();
+ return lasttok = '+';
+
+ case '!':
+ if ((c = nextc()) == '=') {
+ yylval.nodetypeval = Node_notequal;
+ return lasttok = RELOP;
+ }
+ if (c == '~') {
+ yylval.nodetypeval = Node_nomatch;
+ want_assign = FALSE;
+ return lasttok = MATCHOP;
+ }
+ pushback();
+ return lasttok = '!';
+
+ case '<':
+ if (nextc() == '=') {
+ yylval.nodetypeval = Node_leq;
+ return lasttok = RELOP;
+ }
+ yylval.nodetypeval = Node_less;
+ pushback();
+ return lasttok = '<';
+
+ case '=':
+ if (nextc() == '=') {
+ yylval.nodetypeval = Node_equal;
+ return lasttok = RELOP;
+ }
+ yylval.nodetypeval = Node_assign;
+ pushback();
+ return lasttok = ASSIGNOP;
+
+ case '>':
+ if ((c = nextc()) == '=') {
+ yylval.nodetypeval = Node_geq;
+ return lasttok = RELOP;
+ } else if (c == '>') {
+ yylval.nodetypeval = Node_redirect_append;
+ return lasttok = APPEND_OP;
+ }
+ yylval.nodetypeval = Node_greater;
+ pushback();
+ return lasttok = '>';
+
+ case '~':
+ yylval.nodetypeval = Node_match;
+ want_assign = FALSE;
+ return lasttok = MATCHOP;
+
+ case '}':
+ /*
+ * Added did newline stuff. Easier than
+ * hacking the grammar.
+ */
+ if (did_newline) {
+ did_newline = FALSE;
+ return lasttok = c;
+ }
+ did_newline++;
+ --lexptr; /* pick up } next time */
+ return lasttok = NEWLINE;
+
+ case '"':
+ string:
+ esc_seen = FALSE;
+ while ((c = nextc()) != '"') {
+ if (c == '\n') {
+ pushback();
+ yyerror(_("unterminated string"));
+ exit(1);
+ }
+ if (c == '\\') {
+ c = nextc();
+ if (c == '\n') {
+ sourceline++;
+ continue;
+ }
+ esc_seen = TRUE;
+ tokadd('\\');
+ }
+ if (c == EOF) {
+ pushback();
+ yyerror(_("unterminated string"));
+ exit(1);
+ }
+ tokadd(c);
+ }
+ yylval.nodeval = make_str_node(tokstart,
+ tok - tokstart, esc_seen ? SCAN : 0);
+ yylval.nodeval->flags |= PERM;
+ if (intlstr) {
+ yylval.nodeval->flags |= INTLSTR;
+ intlstr = FALSE;
+ if (do_intl)
+ dumpintlstr(yylval.nodeval->stptr,
+ yylval.nodeval->stlen);
+ }
+ return lasttok = YSTRING;
+
+ case '-':
+ if ((c = nextc()) == '=') {
+ yylval.nodetypeval = Node_assign_minus;
+ return lasttok = ASSIGNOP;
+ }
+ if (c == '-')
+ return lasttok = DECREMENT;
+ pushback();
+ return lasttok = '-';
+
+ case '.':
+ c = nextc();
+ pushback();
+ if (! ISDIGIT(c))
+ return lasttok = '.';
+ else
+ c = '.';
+ /* FALL THROUGH */
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ /* It's a number */
+ for (;;) {
+ int gotnumber = FALSE;
+
+ tokadd(c);
+ switch (c) {
+ case 'x':
+ case 'X':
+ if (do_traditional)
+ goto done;
+ if (tok == tokstart + 2)
+ inhex = TRUE;
+ break;
+ case '.':
+ if (seen_point) {
+ gotnumber = TRUE;
+ break;
+ }
+ seen_point = TRUE;
+ break;
+ case 'e':
+ case 'E':
+ if (inhex)
+ break;
+ if (seen_e) {
+ gotnumber = TRUE;
+ break;
+ }
+ seen_e = TRUE;
+ if ((c = nextc()) == '-' || c == '+')
+ tokadd(c);
+ else
+ pushback();
+ break;
+ case 'a':
+ case 'A':
+ case 'b':
+ case 'B':
+ case 'c':
+ case 'C':
+ case 'D':
+ case 'd':
+ case 'f':
+ case 'F':
+ if (do_traditional || ! inhex)
+ goto done;
+ /* fall through */
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ break;
+ default:
+ done:
+ gotnumber = TRUE;
+ }
+ if (gotnumber)
+ break;
+ c = nextc();
+ }
+ if (c != EOF)
+ pushback();
+ else if (do_lint && ! eof_warned) {
+ lintwarn(_("source file does not end in newline"));
+ eof_warned = TRUE;
+ }
+ tokadd('\0');
+ if (! do_traditional && isnondecimal(tokstart))
+ yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart)));
+ else
+ yylval.nodeval = make_number(atof(tokstart));
+ yylval.nodeval->flags |= PERM;
+ return lasttok = YNUMBER;
+
+ case '&':
+ if ((c = nextc()) == '&') {
+ yylval.nodetypeval = Node_and;
+ allow_newline();
+ want_assign = FALSE;
+ return lasttok = LEX_AND;
+ }
+ pushback();
+ return lasttok = '&';
+
+ case '|':
+ if ((c = nextc()) == '|') {
+ yylval.nodetypeval = Node_or;
+ allow_newline();
+ want_assign = FALSE;
+ return lasttok = LEX_OR;
+ } else if (! do_traditional && c == '&') {
+ yylval.nodetypeval = Node_redirect_twoway;
+ want_assign = FALSE;
+ return lasttok = TWOWAYIO;
+ }
+ pushback();
+ return lasttok = '|';
+ }
+
+ if (c != '_' && ! ISALPHA(c)) {
+ yyerror(_("invalid char '%c' in expression"), c);
+ exit(1);
+ }
+
+ if (! do_traditional && c == '_') {
+ if ((c = nextc()) == '"') {
+ intlstr = TRUE;
+ goto string;
+ }
+ pushback();
+ c = '_';
+ }
+
+ /* it's some type of name-type-thing. Find its length. */
+ tok = tokstart;
+ while (is_identchar(c)) {
+ tokadd(c);
+ c = nextc();
+ }
+ tokadd('\0');
+ emalloc(tokkey, char *, tok - tokstart, "yylex");
+ memcpy(tokkey, tokstart, tok - tokstart);
+ if (c != EOF)
+ pushback();
+ else if (do_lint && ! eof_warned) {
+ lintwarn(_("source file does not end in newline"));
+ eof_warned = TRUE;
+ }
+
+ /* See if it is a special token. */
+ low = 0;
+ high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1;
+ while (low <= high) {
+ int i;
+
+ mid = (low + high) / 2;
+ c = *tokstart - tokentab[mid].operator[0];
+ i = c ? c : strcmp(tokstart, tokentab[mid].operator);
+
+ if (i < 0) /* token < mid */
+ high = mid - 1;
+ else if (i > 0) /* token > mid */
+ low = mid + 1;
+ else {
+ if (do_lint) {
+ if (tokentab[mid].flags & GAWKX)
+ lintwarn(_("`%s' is a gawk extension"),
+ tokentab[mid].operator);
+ if (tokentab[mid].flags & RESX)
+ lintwarn(_("`%s' is a Bell Labs extension"),
+ tokentab[mid].operator);
+ if (tokentab[mid].flags & NOT_POSIX)
+ lintwarn(_("POSIX does not allow `%s'"),
+ tokentab[mid].operator);
+ }
+ if (do_lint_old && (tokentab[mid].flags & NOT_OLD))
+ warning(_("`%s' is not supported in old awk"),
+ tokentab[mid].operator);
+ if ((do_traditional && (tokentab[mid].flags & GAWKX))
+ || (do_posix && (tokentab[mid].flags & NOT_POSIX)))
+ break;
+ if (tokentab[mid].class == LEX_BUILTIN
+ || tokentab[mid].class == LEX_LENGTH
+ )
+ yylval.lval = mid;
+ else
+ yylval.nodetypeval = tokentab[mid].value;
+
+ free(tokkey);
+ return lasttok = tokentab[mid].class;
+ }
+ }
+
+ yylval.sval = tokkey;
+ if (*lexptr == '(')
+ return lasttok = FUNC_CALL;
+ else {
+ static short goto_warned = FALSE;
+
+ want_assign = TRUE;
+#define SMART_ALECK 1
+ if (SMART_ALECK && do_lint
+ && ! goto_warned && strcasecmp(tokkey, "goto") == 0) {
+ goto_warned = TRUE;
+ lintwarn(_("`goto' considered harmful!\n"));
+ }
+ return lasttok = NAME;
+ }
+}
+
+/* node_common --- common code for allocating a new node */
+
+static NODE *
+node_common(NODETYPE op)
+{
+ register NODE *r;
+
+ getnode(r);
+ r->type = op;
+ r->flags = MALLOC;
+ if (r->type == Node_var)
+ r->flags |= UNINITIALIZED;
+ /* if lookahead is NL, lineno is 1 too high */
+ if (lexeme && *lexeme == '\n')
+ r->source_line = sourceline - 1;
+ else
+ r->source_line = sourceline;
+ r->source_file = source;
+ return r;
+}
+
+/* node --- allocates a node with defined lnode and rnode. */
+
+NODE *
+node(NODE *left, NODETYPE op, NODE *right)
+{
+ register NODE *r;
+
+ r = node_common(op);
+ r->lnode = left;
+ r->rnode = right;
+ return r;
+}
+
+/* snode --- allocate a node with defined subnode and proc for builtin
+ functions. Checks for arg. count and supplies defaults where
+ possible. */
+
+static NODE *
+snode(NODE *subn, NODETYPE op, int idx)
+{
+ register NODE *r;
+ register NODE *n;
+ int nexp = 0;
+ int args_allowed;
+
+ r = node_common(op);
+
+ /* traverse expression list to see how many args. given */
+ for (n = subn; n != NULL; n = n->rnode) {
+ nexp++;
+ if (nexp > 3)
+ break;
+ }
+
+ /* check against how many args. are allowed for this builtin */
+ args_allowed = tokentab[idx].flags & ARGS;
+ if (args_allowed && (args_allowed & A(nexp)) == 0)
+ fatal(_("%d is invalid as number of arguments for %s"),
+ nexp, tokentab[idx].operator);
+
+ r->proc = tokentab[idx].ptr;
+
+ /* special case processing for a few builtins */
+ if (nexp == 0 && r->proc == do_length) {
+ subn = node(node(make_number(0.0), Node_field_spec, (NODE *) NULL),
+ Node_expression_list,
+ (NODE *) NULL);
+ } else if (r->proc == do_match) {
+ static short warned = FALSE;
+
+ if (subn->rnode->lnode->type != Node_regex)
+ subn->rnode->lnode = mk_rexp(subn->rnode->lnode);
+
+ if (subn->rnode->rnode != NULL) { /* 3rd argument there */
+ if (do_lint && ! warned) {
+ warned = TRUE;
+ lintwarn(_("match: third argument is a gawk extension"));
+ }
+ if (do_traditional)
+ fatal(_("match: third argument is a gawk extension"));
+ }
+ } else if (r->proc == do_sub || r->proc == do_gsub) {
+ if (subn->lnode->type != Node_regex)
+ subn->lnode = mk_rexp(subn->lnode);
+ if (nexp == 2)
+ append_right(subn, node(node(make_number(0.0),
+ Node_field_spec,
+ (NODE *) NULL),
+ Node_expression_list,
+ (NODE *) NULL));
+ else if (subn->rnode->rnode->lnode->type == Node_val) {
+ if (do_lint) {
+ char *f;
+
+ f = (r->proc == do_sub) ? "sub" : "gsub";
+ lintwarn(_("%s: string literal as last arg of substitute has no effect"), f);
+ }
+ } else if (! isassignable(subn->rnode->rnode->lnode)) {
+ if (r->proc == do_sub)
+ yyerror(_("sub third parameter is not a changeable object"));
+ else
+ yyerror(_("gsub third parameter is not a changeable object"));
+ }
+ } else if (r->proc == do_gensub) {
+ if (subn->lnode->type != Node_regex)
+ subn->lnode = mk_rexp(subn->lnode);
+ if (nexp == 3)
+ append_right(subn, node(node(make_number(0.0),
+ Node_field_spec,
+ (NODE *) NULL),
+ Node_expression_list,
+ (NODE *) NULL));
+ } else if (r->proc == do_split) {
+ if (nexp == 2)
+ append_right(subn,
+ node(FS_node, Node_expression_list, (NODE *) NULL));
+ n = subn->rnode->rnode->lnode;
+ if (n->type != Node_regex)
+ subn->rnode->rnode->lnode = mk_rexp(n);
+ if (nexp == 2)
+ subn->rnode->rnode->lnode->re_flags |= FS_DFLT;
+ } else if (r->proc == do_close) {
+ static short warned = FALSE;
+
+ if ( nexp == 2) {
+ if (do_lint && nexp == 2 && ! warned) {
+ warned = TRUE;
+ lintwarn(_("close: second argument is a gawk extension"));
+ }
+ if (do_traditional)
+ fatal(_("close: second argument is a gawk extension"));
+ }
+ } else if (do_intl /* --gen-po */
+ && r->proc == do_dcgettext /* dcgettext(...) */
+ && subn->lnode->type == Node_val /* 1st arg is constant */
+ && (subn->lnode->flags & STR) != 0) { /* it's a string constant */
+ /* ala xgettext, dcgettext("some string" ...) dumps the string */
+ NODE *str = subn->lnode;
+
+ if ((str->flags & INTLSTR) != 0)
+ warning(_("use of dcgettext(_\"...\") is incorrect: remove leading underscore"));
+ /* don't dump it, the lexer already did */
+ else
+ dumpintlstr(str->stptr, str->stlen);
+ }
+
+
+ r->subnode = subn;
+ if (r->proc == do_sprintf) {
+ count_args(r);
+ r->lnode->printf_count = r->printf_count; /* hack */
+ }
+ return r;
+}
+
+/*
+ * mkrangenode:
+ * This allocates a Node_line_range node with defined condpair and
+ * zeroes the trigger word to avoid the temptation of assuming that calling
+ * 'node( foo, Node_line_range, 0)' will properly initialize 'triggered'.
+ * Otherwise like node().
+ */
+
+static NODE *
+mkrangenode(NODE *cpair)
+{
+ register NODE *r;
+
+ getnode(r);
+ r->type = Node_line_range;
+ r->condpair = cpair;
+ r->triggered = FALSE;
+ return r;
+}
+
+/* make_for_loop --- build a for loop */
+
+static NODE *
+make_for_loop(NODE *init, NODE *cond, NODE *incr)
+{
+ register FOR_LOOP_HEADER *r;
+ NODE *n;
+
+ emalloc(r, FOR_LOOP_HEADER *, sizeof(FOR_LOOP_HEADER), "make_for_loop");
+ getnode(n);
+ n->type = Node_illegal;
+ r->init = init;
+ r->cond = cond;
+ r->incr = incr;
+ n->sub.nodep.r.hd = r;
+ return n;
+}
+
+/* dup_parms --- return TRUE if there are duplicate parameters */
+
+static int
+dup_parms(NODE *func)
+{
+ register NODE *np;
+ char *fname, **names;
+ int count, i, j, dups;
+ NODE *params;
+
+ if (func == NULL) /* error earlier */
+ return TRUE;
+
+ fname = func->param;
+ count = func->param_cnt;
+ params = func->rnode;
+
+ if (count == 0) /* no args, no problem */
+ return FALSE;
+
+ if (params == NULL) /* error earlier */
+ return TRUE;
+
+ emalloc(names, char **, count * sizeof(char *), "dup_parms");
+
+ i = 0;
+ for (np = params; np != NULL; np = np->rnode) {
+ if (np->param == NULL) { /* error earlier, give up, go home */
+ free(names);
+ return TRUE;
+ }
+ names[i++] = np->param;
+ }
+
+ dups = 0;
+ for (i = 1; i < count; i++) {
+ for (j = 0; j < i; j++) {
+ if (strcmp(names[i], names[j]) == 0) {
+ dups++;
+ error(
+ _("function `%s': parameter #%d, `%s', duplicates parameter #%d"),
+ fname, i+1, names[j], j+1);
+ }
+ }
+ }
+
+ free(names);
+ return (dups > 0 ? TRUE : FALSE);
+}
+
+/* parms_shadow --- check if parameters shadow globals */
+
+static void
+parms_shadow(const char *fname, NODE *func)
+{
+ int count, i;
+
+ if (fname == NULL || func == NULL) /* error earlier */
+ return;
+
+ count = func->lnode->param_cnt;
+
+ if (count == 0) /* no args, no problem */
+ return;
+
+ /*
+ * Use warning() and not lintwarn() so that can warn
+ * about all shadowed parameters.
+ */
+ for (i = 0; i < count; i++) {
+ if (lookup(func->parmlist[i]) != NULL) {
+ warning(
+ _("function `%s': parameter `%s' shadows global variable"),
+ fname, func->parmlist[i]);
+ }
+ }
+}
+
+/*
+ * install:
+ * Install a name in the symbol table, even if it is already there.
+ * Caller must check against redefinition if that is desired.
+ */
+
+NODE *
+install(char *name, NODE *value)
+{
+ register NODE *hp;
+ register size_t len;
+ register int bucket;
+
+ var_count++;
+ len = strlen(name);
+ bucket = hash(name, len, (unsigned long) HASHSIZE);
+ getnode(hp);
+ hp->type = Node_hashnode;
+ hp->hnext = variables[bucket];
+ variables[bucket] = hp;
+ hp->hlength = len;
+ hp->hvalue = value;
+ hp->hname = name;
+ hp->hvalue->vname = name;
+ return hp->hvalue;
+}
+
+/* lookup --- find the most recent hash node for name installed by install */
+
+NODE *
+lookup(const char *name)
+{
+ register NODE *bucket;
+ register size_t len;
+
+ len = strlen(name);
+ for (bucket = variables[hash(name, len, (unsigned long) HASHSIZE)];
+ bucket != NULL; bucket = bucket->hnext)
+ if (bucket->hlength == len && STREQN(bucket->hname, name, len))
+ return bucket->hvalue;
+
+ return NULL;
+}
+
+/* var_comp --- compare two variable names */
+
+static int
+var_comp(const void *v1, const void *v2)
+{
+ NODE **npp1, **npp2;
+ NODE *n1, *n2;
+ int minlen;
+
+ npp1 = (NODE **) v1;
+ npp2 = (NODE **) v2;
+ n1 = *npp1;
+ n2 = *npp2;
+
+ if (n1->hlength > n2->hlength)
+ minlen = n1->hlength;
+ else
+ minlen = n2->hlength;
+
+ return strncmp(n1->hname, n2->hname, minlen);
+}
+
+/* valinfo --- dump var info */
+
+static void
+valinfo(NODE *n, FILE *fp)
+{
+ if (n->flags & STRING) {
+ fprintf(fp, "string (");
+ pp_string_fp(fp, n->stptr, n->stlen, '"', FALSE);
+ fprintf(fp, ")\n");
+ } else if (n->flags & NUMBER)
+ fprintf(fp, "number (%.17g)\n", n->numbr);
+ else if (n->flags & STR) {
+ fprintf(fp, "string value (");
+ pp_string_fp(fp, n->stptr, n->stlen, '"', FALSE);
+ fprintf(fp, ")\n");
+ } else if (n->flags & NUM)
+ fprintf(fp, "number value (%.17g)\n", n->numbr);
+ else
+ fprintf(fp, "?? flags %s\n", flags2str(n->flags));
+}
+
+
+/* dump_vars --- dump the symbol table */
+
+void
+dump_vars(const char *fname)
+{
+ int i, j;
+ NODE **table;
+ NODE *p;
+ FILE *fp;
+
+ emalloc(table, NODE **, var_count * sizeof(NODE *), "dump_vars");
+
+ if (fname == NULL)
+ fp = stderr;
+ else if ((fp = fopen(fname, "w")) == NULL) {
+ warning(_("could not open `%s' for writing (%s)"), fname, strerror(errno));
+ warning(_("sending profile to standard error"));
+ fp = stderr;
+ }
+
+ for (i = j = 0; i < HASHSIZE; i++)
+ for (p = variables[i]; p != NULL; p = p->hnext)
+ table[j++] = p;
+
+ assert(j == var_count);
+
+ /* Shazzam! */
+ qsort(table, j, sizeof(NODE *), var_comp);
+
+ for (i = 0; i < j; i++) {
+ p = table[i];
+ if (p->hvalue->type == Node_func)
+ continue;
+ fprintf(fp, "%.*s: ", (int) p->hlength, p->hname);
+ if (p->hvalue->type == Node_var_array)
+ fprintf(fp, "array, %ld elements\n", p->hvalue->table_size);
+ else if (p->hvalue->type == Node_var)
+ valinfo(p->hvalue->var_value, fp);
+ else {
+ NODE **lhs = get_lhs(p->hvalue, NULL, FALSE);
+
+ valinfo(*lhs, fp);
+ }
+ }
+
+ if (fp != stderr && fclose(fp) != 0)
+ warning(_("%s: close failed (%s)"), fname, strerror(errno));
+
+ free(table);
+}
+
+/* release_all_vars --- free all variable memory */
+
+void
+release_all_vars()
+{
+ int i;
+ NODE *p, *next;
+
+ for (i = 0; i < HASHSIZE; i++)
+ for (p = variables[i]; p != NULL; p = next) {
+ next = p->hnext;
+
+ if (p->hvalue->type == Node_func)
+ continue;
+ else if (p->hvalue->type == Node_var_array)
+ assoc_clear(p->hvalue);
+ else if (p->hvalue->type == Node_var)
+ unref(p->hvalue->var_value);
+ else {
+ NODE **lhs = get_lhs(p->hvalue, NULL, FALSE);
+
+ unref((*lhs)->var_value);
+ }
+ unref(p);
+ }
+}
+
+/* finfo --- for use in comparison and sorting of function names */
+
+struct finfo {
+ char *name;
+ size_t nlen;
+ NODE *func;
+};
+
+/* fcompare --- comparison function for qsort */
+
+static int
+fcompare(const void *p1, const void *p2)
+{
+ struct finfo *f1, *f2;
+ int minlen;
+
+ f1 = (struct finfo *) p1;
+ f2 = (struct finfo *) p2;
+
+ if (f1->nlen > f2->nlen)
+ minlen = f2->nlen;
+ else
+ minlen = f1->nlen;
+
+ return strncmp(f1->name, f2->name, minlen);
+}
+
+/* dump_funcs --- print all functions */
+
+void
+dump_funcs()
+{
+ int i, j;
+ NODE *p;
+ static struct finfo *tab = NULL;
+
+ if (func_count == 0)
+ return;
+
+ if (tab == NULL)
+ emalloc(tab, struct finfo *, func_count * sizeof(struct finfo), "dump_funcs");
+
+ for (i = j = 0; i < HASHSIZE; i++) {
+ for (p = variables[i]; p != NULL; p = p->hnext) {
+ if (p->hvalue->type == Node_func) {
+ tab[j].name = p->hname;
+ tab[j].nlen = p->hlength;
+ tab[j].func = p->hvalue;
+ j++;
+ }
+ }
+ }
+
+ assert(j == func_count);
+
+ /* Shazzam! */
+ qsort(tab, func_count, sizeof(struct finfo), fcompare);
+
+ for (i = 0; i < j; i++)
+ pp_func(tab[i].name, tab[i].nlen, tab[i].func);
+
+ free(tab);
+}
+
+/* shadow_funcs --- check all functions for parameters that shadow globals */
+
+void
+shadow_funcs()
+{
+ int i, j;
+ NODE *p;
+ struct finfo *tab;
+ static int calls = 0;
+
+ if (func_count == 0)
+ return;
+
+ if (calls++ != 0)
+ fatal(_("shadow_funcs() called twice!"));
+
+ emalloc(tab, struct finfo *, func_count * sizeof(struct finfo), "shadow_funcs");
+
+ for (i = j = 0; i < HASHSIZE; i++) {
+ for (p = variables[i]; p != NULL; p = p->hnext) {
+ if (p->hvalue->type == Node_func) {
+ tab[j].name = p->hname;
+ tab[j].nlen = p->hlength;
+ tab[j].func = p->hvalue;
+ j++;
+ }
+ }
+ }
+
+ assert(j == func_count);
+
+ /* Shazzam! */
+ qsort(tab, func_count, sizeof(struct finfo), fcompare);
+
+ for (i = 0; i < j; i++)
+ parms_shadow(tab[i].name, tab[i].func);
+
+ free(tab);
+}
+
+/*
+ * append_right:
+ * Add new to the rightmost branch of LIST. This uses n^2 time, so we make
+ * a simple attempt at optimizing it.
+ */
+
+static NODE *
+append_right(NODE *list, NODE *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;
+ return oldlist;
+ } else
+ savefront = oldlist;
+ while (list->rnode != NULL)
+ list = list->rnode;
+ savetail = list->rnode = new;
+ return oldlist;
+}
+
+/*
+ * func_install:
+ * check if name is already installed; if so, it had better have Null value,
+ * in which case def is added as the value. Otherwise, install name with def
+ * as value.
+ *
+ * Extra work, build up and save a list of the parameter names in a table
+ * and hang it off params->parmlist. This is used to set the `vname' field
+ * of each function parameter during a function call. See eval.c.
+ */
+
+static void
+func_install(NODE *params, NODE *def)
+{
+ NODE *r, *n, *thisfunc;
+ char **pnames, *names, *sp;
+ size_t pcount = 0, space = 0;
+ int i;
+
+ /* check for function foo(foo) { ... }. bleah. */
+ for (n = params->rnode; n != NULL; n = n->rnode) {
+ if (strcmp(n->param, params->param) == 0)
+ fatal(_("function `%s': can't use function name as parameter name"),
+ params->param);
+ }
+
+ thisfunc = NULL; /* turn off warnings */
+
+ /* symbol table managment */
+ pop_var(params, FALSE);
+ r = lookup(params->param);
+ if (r != NULL) {
+ fatal(_("function name `%s' previously defined"), params->param);
+ } else {
+ thisfunc = node(params, Node_func, def);
+ (void) install(params->param, thisfunc);
+ }
+
+ /* figure out amount of space to allocate */
+ for (n = params->rnode; n != NULL; n = n->rnode) {
+ pcount++;
+ space += strlen(n->param) + 1;
+ }
+
+ /* allocate it and fill it in */
+ if (pcount != 0) {
+ emalloc(names, char *, space, "func_install");
+ emalloc(pnames, char **, pcount * sizeof(char *), "func_install");
+ sp = names;
+ for (i = 0, n = params->rnode; i < pcount; i++, n = n->rnode) {
+ pnames[i] = sp;
+ strcpy(sp, n->param);
+ sp += strlen(n->param) + 1;
+ }
+ thisfunc->parmlist = pnames;
+ } else {
+ thisfunc->parmlist = NULL;
+ }
+
+ /* remove params from symbol table */
+ pop_params(params->rnode);
+
+ /* update lint table info */
+ func_use(params->param, FUNC_DEFINE);
+
+ func_count++; /* used by profiling / pretty printer */
+}
+
+/* pop_var --- remove a variable from the symbol table */
+
+static void
+pop_var(NODE *np, int freeit)
+{
+ register NODE *bucket, **save;
+ register size_t len;
+ char *name;
+
+ name = np->param;
+ len = strlen(name);
+ save = &(variables[hash(name, len, (unsigned long) HASHSIZE)]);
+ for (bucket = *save; bucket != NULL; bucket = bucket->hnext) {
+ if (len == bucket->hlength && STREQN(bucket->hname, name, len)) {
+ var_count--;
+ *save = bucket->hnext;
+ freenode(bucket);
+ if (freeit)
+ free(np->param);
+ return;
+ }
+ save = &(bucket->hnext);
+ }
+}
+
+/* pop_params --- remove list of function parameters from symbol table */
+
+/*
+ * pop parameters out of the symbol table. do this in reverse order to
+ * avoid reading freed memory if there were duplicated parameters.
+ */
+static void
+pop_params(NODE *params)
+{
+ if (params == NULL)
+ return;
+ pop_params(params->rnode);
+ pop_var(params, TRUE);
+}
+
+/* make_param --- make NAME into a function parameter */
+
+static NODE *
+make_param(char *name)
+{
+ NODE *r;
+
+ getnode(r);
+ r->type = Node_param_list;
+ r->rnode = NULL;
+ r->param = name;
+ r->param_cnt = param_counter++;
+ return (install(name, r));
+}
+
+static struct fdesc {
+ char *name;
+ short used;
+ short defined;
+ struct fdesc *next;
+} *ftable[HASHSIZE];
+
+/* func_use --- track uses and definitions of functions */
+
+static void
+func_use(char *name, enum defref how)
+{
+ struct fdesc *fp;
+ int len;
+ int ind;
+
+ len = strlen(name);
+ ind = hash(name, len, HASHSIZE);
+
+ for (fp = ftable[ind]; fp != NULL; fp = fp->next) {
+ if (strcmp(fp->name, name) == 0) {
+ if (how == FUNC_DEFINE)
+ fp->defined++;
+ else
+ fp->used++;
+ return;
+ }
+ }
+
+ /* not in the table, fall through to allocate a new one */
+
+ emalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use");
+ memset(fp, '\0', sizeof(struct fdesc));
+ emalloc(fp->name, char *, len + 1, "func_use");
+ strcpy(fp->name, name);
+ if (how == FUNC_DEFINE)
+ fp->defined++;
+ else
+ fp->used++;
+ fp->next = ftable[ind];
+ ftable[ind] = fp;
+}
+
+/* check_funcs --- verify functions that are called but not defined */
+
+static void
+check_funcs()
+{
+ struct fdesc *fp, *next;
+ int i;
+
+ for (i = 0; i < HASHSIZE; i++) {
+ for (fp = ftable[i]; fp != NULL; fp = fp->next) {
+#ifdef REALLYMEAN
+ /* making this the default breaks old code. sigh. */
+ if (fp->defined == 0) {
+ error(
+ _("function `%s' called but never defined"), fp->name);
+ errcount++;
+ }
+#else
+ if (do_lint && fp->defined == 0)
+ lintwarn(
+ _("function `%s' called but never defined"), fp->name);
+#endif
+ if (do_lint && fp->used == 0) {
+ lintwarn(_("function `%s' defined but never called"),
+ fp->name);
+ }
+ }
+ }
+
+ /* now let's free all the memory */
+ for (i = 0; i < HASHSIZE; i++) {
+ for (fp = ftable[i]; fp != NULL; fp = next) {
+ next = fp->next;
+ free(fp->name);
+ free(fp);
+ }
+ }
+}
+
+/* param_sanity --- look for parameters that are regexp constants */
+
+static void
+param_sanity(NODE *arglist)
+{
+ NODE *argp, *arg;
+ int i;
+
+ for (i = 1, argp = arglist; argp != NULL; argp = argp->rnode, i++) {
+ arg = argp->lnode;
+ if (arg->type == Node_regex)
+ warning(_("regexp constant for parameter #%d yields boolean value"), i);
+ }
+}
+
+/* variable --- make sure NAME is in the symbol table */
+
+NODE *
+variable(char *name, int can_free, NODETYPE type)
+{
+ register NODE *r;
+ static int env_loaded = FALSE;
+ static int procinfo_loaded = FALSE;
+
+ if (! env_loaded && STREQ(name, "ENVIRON")) {
+ load_environ();
+ env_loaded = TRUE;
+ }
+ if (! do_traditional && ! procinfo_loaded && STREQ(name, "PROCINFO")) {
+ load_procinfo();
+ procinfo_loaded = TRUE;
+ }
+ if ((r = lookup(name)) == NULL)
+ r = install(name, node(Nnull_string, type, (NODE *) NULL));
+ else if (can_free)
+ free(name);
+ return r;
+}
+
+/* mk_rexp --- make a regular expression constant */
+
+static NODE *
+mk_rexp(NODE *exp)
+{
+ NODE *n;
+
+ if (exp->type == Node_regex)
+ return exp;
+
+ getnode(n);
+ n->type = Node_regex;
+ n->re_exp = exp;
+ n->re_text = NULL;
+ n->re_reg = NULL;
+ n->re_flags = 0;
+ n->re_cnt = 1;
+ return n;
+}
+
+/* isnoeffect --- when used as a statement, has no side effects */
+
+/*
+ * To be completely general, we should recursively walk the parse
+ * tree, to make sure that all the subexpressions also have no effect.
+ * Instead, we just weaken the actual warning that's printed, up above
+ * in the grammar.
+ */
+
+static int
+isnoeffect(NODETYPE type)
+{
+ switch (type) {
+ case Node_times:
+ case Node_quotient:
+ case Node_mod:
+ case Node_plus:
+ case Node_minus:
+ case Node_subscript:
+ case Node_concat:
+ case Node_exp:
+ case Node_unary_minus:
+ case Node_field_spec:
+ case Node_and:
+ case Node_or:
+ case Node_equal:
+ case Node_notequal:
+ case Node_less:
+ case Node_greater:
+ case Node_leq:
+ case Node_geq:
+ case Node_match:
+ case Node_nomatch:
+ case Node_not:
+ case Node_val:
+ case Node_in_array:
+ case Node_NF:
+ case Node_NR:
+ case Node_FNR:
+ case Node_FS:
+ case Node_RS:
+ case Node_FIELDWIDTHS:
+ case Node_IGNORECASE:
+ case Node_OFS:
+ case Node_ORS:
+ case Node_OFMT:
+ case Node_CONVFMT:
+ case Node_BINMODE:
+ case Node_LINT:
+ return TRUE;
+ default:
+ break; /* keeps gcc -Wall happy */
+ }
+
+ return FALSE;
+}
+
+/* isassignable --- can this node be assigned to? */
+
+static int
+isassignable(register NODE *n)
+{
+ switch (n->type) {
+ case Node_var:
+ case Node_FIELDWIDTHS:
+ case Node_RS:
+ case Node_FS:
+ case Node_FNR:
+ case Node_NR:
+ case Node_NF:
+ case Node_IGNORECASE:
+ case Node_OFMT:
+ case Node_CONVFMT:
+ case Node_ORS:
+ case Node_OFS:
+ case Node_LINT:
+ case Node_BINMODE:
+ case Node_field_spec:
+ case Node_subscript:
+ return TRUE;
+ case Node_param_list:
+ return ((n->flags & FUNC) == 0); /* ok if not func name */
+ default:
+ break; /* keeps gcc -Wall happy */
+ }
+ return FALSE;
+}
+
+/* stopme --- for debugging */
+
+NODE *
+stopme(NODE *tree)
+{
+ return tmp_number((AWKNUM) 0.0);
+}
+
+/* dumpintlstr --- write out an initial .po file entry for the string */
+
+static void
+dumpintlstr(char *str, size_t len)
+{
+ char *cp;
+
+ /* See the GNU gettext distribution for details on the file format */
+
+ if (source != NULL) {
+ /* ala the gettext sources, remove leading `./'s */
+ for (cp = source; cp[0] == '.' && cp[1] == '/'; cp += 2)
+ continue;
+ printf("#: %s:%d\n", cp, sourceline);
+ }
+
+ printf("msgid ");
+ fflush(stdout);
+ pp_string_fp(stdout, str, len, '"', TRUE);
+ putchar('\n');
+ printf("msgstr \"\"\n\n");
+}
+
+/* count_args --- count the number of printf arguments */
+
+static void
+count_args(NODE *tree)
+{
+ size_t count = 0;
+ NODE *save_tree;
+
+ assert(tree->type == Node_K_printf
+ || (tree->type == Node_builtin && tree->proc == do_sprintf));
+ save_tree = tree;
+
+ tree = tree->lnode; /* printf format string */
+
+ for (count = 0; tree != NULL; tree = tree->rnode)
+ count++;
+
+ save_tree->printf_count = count;
+}
diff --git a/contrib/awk/awklib/ChangeLog b/contrib/awk/awklib/ChangeLog
index 1ec88a5fed42..531fdb98c86f 100644
--- a/contrib/awk/awklib/ChangeLog
+++ b/contrib/awk/awklib/ChangeLog
@@ -1,3 +1,27 @@
+Sun Jun 3 13:04:44 2001 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Release 3.1.0: Release tar file made. And there was
+ rejoicing.
+
+2001-02-26 Paul Eggert <eggert@twinsun.com>
+
+ * Makefile.am (stamp-eg): Use $(AWK), not awk, as the
+ native awk might not work.
+
+2001-02-26 Andreas Schwab <schwab@suse.de>
+
+ * Makefile.am: Install igawk as script.
+
+Mon Nov 6 15:29:08 2000 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am: Fixed to have all functionality from before
+ the switch to automake.
+ * extract.awk: Updated to match version in the doc.
+
+Sat Jul 26 23:08:29 1997 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.in (install-strip): new target.
+
Mon Aug 7 15:23:00 2000 Arnold D. Robbins <arnold@skeeve.com>
* Release 3.0.6: Release tar file made.
@@ -7,7 +31,7 @@ Sun Jun 25 15:08:19 2000 Arnold D. Robbins <arnold@skeeve.com>
* Release 3.0.5: Release tar file made.
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>
diff --git a/contrib/awk/awklib/Makefile.am b/contrib/awk/awklib/Makefile.am
new file mode 100644
index 000000000000..ecd23cfab537
--- /dev/null
+++ b/contrib/awk/awklib/Makefile.am
@@ -0,0 +1,75 @@
+#
+# awklib/Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 1995-2001 the Free Software Foundation, Inc.
+#
+# This file is part of GAWK, the GNU implementation of the
+# AWK Programming Language.
+#
+# GAWK 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.
+#
+# GAWK 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
+#
+
+## process this file with automake to produce Makefile.in
+
+EXTRA_DIST = ChangeLog extract.awk eg stamp-eg
+
+datadir = @datadir@/awk
+libexecdir = @libexecdir@/awk
+
+bin_SCRIPTS = igawk
+libexec_PROGRAMS = pwcat grcat
+AUXAWK = passwd.awk group.awk
+nodist_grcat_SOURCES = grcat.c
+nodist_pwcat_SOURCES = pwcat.c
+
+all: stamp-eg $(AUXPROGS) igawk $(AUXAWK)
+
+install-exec-hook: $(AUXAWK)
+ $(mkinstalldirs) $(DESTDIR)$(datadir)
+ for i in $(AUXAWK) $(srcdir)/eg/lib/*.awk ; do \
+ progname=`echo $$i | sed 's;.*/;;'` ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(datadir)/$$progname ; \
+ done
+
+# libexecdir and datadir are removed in the top level Makefile's uninstall
+uninstall-local:
+ rm -fr $(DESTDIR)$(libexecdir)/* $(DESTDIR)$(datadir)/*
+ rm -f $(DESTDIR)$(bindir)/igawk
+
+clean-local:
+ rm -f $(AUXAWK) igawk
+
+stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
+ rm -fr eg stamp-eg
+ $(AWK) -f $(srcdir)/extract.awk $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
+ @echo 'some makes are stupid and will not check a directory' > stamp-eg
+ @echo 'against a file, so this file is a place holder. gack.' >> stamp-eg
+
+pwcat: $(srcdir)/eg/lib/pwcat.c
+ $(CC) $(CFLAGS) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@
+
+grcat: $(srcdir)/eg/lib/grcat.c
+ $(CC) $(CFLAGS) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@
+
+igawk: $(srcdir)/eg/prog/igawk.sh
+ cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@
+
+passwd.awk: $(srcdir)/eg/lib/passwdawk.in
+ (cd $(srcdir)/eg/lib ; \
+ sed 's;/usr/local/libexec/awk;$(libexecdir);' < passwdawk.in) > passwd.awk
+
+group.awk: $(srcdir)/eg/lib/groupawk.in
+ (cd $(srcdir)/eg/lib ; \
+ sed 's;/usr/local/libexec/awk;$(libexecdir);' < groupawk.in) > group.awk
diff --git a/contrib/awk/awklib/Makefile.in b/contrib/awk/awklib/Makefile.in
index 67f0e50063b2..686b65adad99 100644
--- a/contrib/awk/awklib/Makefile.in
+++ b/contrib/awk/awklib/Makefile.in
@@ -1,57 +1,411 @@
-# Makefile for GNU Awk support library.
+# Makefile.in generated automatically by automake 1.4a from Makefile.am
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_FLAG =
+transform = @program_transform_name@
+
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+
+@SET_MAKE@
+AMDEP = @AMDEP@
+AMTAR = @AMTAR@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+DATADIRNAME = @DATADIRNAME@
+DEPDIR = @DEPDIR@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+LN_S = @LN_S@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+SOCKET_LIBS = @SOCKET_LIBS@
+U = @U@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+YACC = @YACC@
+install_sh = @install_sh@
+l = @l@
+
+#
+# awklib/Makefile.am --- automake input file for gawk
+#
+# Copyright (C) 1995-2001 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.
-#
+#
# GAWK 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.
-#
+#
# GAWK 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
+#
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-CC = @CC@
-CFLAGS = @CFLAGS@
+EXTRA_DIST = ChangeLog extract.awk eg stamp-eg
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-binprefix =
-manprefix =
-
-bindir = @bindir@
-libdir = @libdir@
-mandir = @mandir@/man1
-manext = .1
-infodir = @infodir@
datadir = @datadir@/awk
libexecdir = @libexecdir@/awk
-AUXPROGS = pwcat grcat
+bin_SCRIPTS = igawk
+libexec_PROGRAMS = pwcat grcat
AUXAWK = passwd.awk group.awk
+nodist_grcat_SOURCES = grcat.c
+nodist_pwcat_SOURCES = pwcat.c
+subdir = awklib
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+PROGRAMS = $(libexec_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+nodist_grcat_OBJECTS = grcat.o
+grcat_OBJECTS = $(nodist_grcat_OBJECTS)
+grcat_LDADD = $(LDADD)
+grcat_DEPENDENCIES =
+grcat_LDFLAGS =
+nodist_pwcat_OBJECTS = pwcat.o
+pwcat_OBJECTS = $(nodist_pwcat_OBJECTS)
+pwcat_LDADD = $(LDADD)
+pwcat_DEPENDENCIES =
+pwcat_LDFLAGS =
+SCRIPTS = $(bin_SCRIPTS)
+
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES =
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+DEP_FILES = @AMDEP@ $(DEPDIR)/grcat.Po $(DEPDIR)/pwcat.Po
+DIST_COMMON = ChangeLog Makefile.am Makefile.in
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+GZIP_ENV = --best
+SOURCES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES)
+OBJECTS = $(nodist_grcat_OBJECTS) $(nodist_pwcat_OBJECTS)
+
+all: all-redirect
+.SUFFIXES:
+.SUFFIXES: .c .o
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --gnu awklib/Makefile
+
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
+
+
+mostlyclean-libexecPROGRAMS:
+
+clean-libexecPROGRAMS:
+ -test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS)
+
+distclean-libexecPROGRAMS:
+
+maintainer-clean-libexecPROGRAMS:
+
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libexecdir)
+ @list='$(libexec_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libexecdir)/$$f"; \
+ $(INSTALL_PROGRAM) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libexecdir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-libexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libexec_PROGRAMS)'; for p in $$list; do \
+ f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 's/$$/$(EXEEXT)/'`"; \
+ echo " rm -f $(DESTDIR)$(libexecdir)/$$f"; \
+ rm -f $(DESTDIR)$(libexecdir)/$$f; \
+ done
+
+mostlyclean-compile:
+ -rm -f *.o core *.core
+
+clean-compile:
+
+distclean-compile:
+ -rm -f *.tab.c
+
+maintainer-clean-compile:
+
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ f="`echo $$p|sed '$(transform)'`"; \
+ if test -f $$p; then \
+ echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f; \
+ elif test -f $(srcdir)/$$p; then \
+ echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f"; \
+ $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; for p in $$list; do \
+ f="`echo $$p|sed '$(transform)'`"; \
+ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+ rm -f $(DESTDIR)$(bindir)/$$f; \
+ done
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique $(LISP)
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || etags $(ETAGS_ARGS) $$tags $$unique $(LISP)
+
+mostlyclean-tags:
+
+clean-tags:
+
+distclean-tags:
+ -rm -f TAGS ID
+
+maintainer-clean-tags:
+
+@AMDEP@include $(DEPDIR)/grcat.Po
+@AMDEP@include $(DEPDIR)/pwcat.Po
+
+mostlyclean-depend:
+
+clean-depend:
+
+distclean-depend:
+ -rm -rf $(DEPDIR)
+
+maintainer-clean-depend:
+
+@AMDEP@CCDEPMODE = @CCDEPMODE@
+
+.c.o:
+@AMDEP@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
+
+
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
+
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ d=$(srcdir); \
+ if test -d $$d/$$file; then \
+ cp -pR $$d/$$file $(distdir) \
+ || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+info-am:
+info: info-am
+dvi-am:
+dvi: dvi-am
+check-am: all-am
+check: check-am
+installcheck-am:
+installcheck: installcheck-am
+install-exec-am: install-libexecPROGRAMS install-binSCRIPTS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-exec: install-exec-am
+
+install-data-am:
+install-data: install-data-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+install: install-am
+uninstall-am: uninstall-libexecPROGRAMS uninstall-binSCRIPTS \
+ uninstall-local
+uninstall: uninstall-am
+all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+all-redirect: all-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir)
+
+
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_FILES)
+ -rm -f config.cache config.log stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+ -rm -f Makefile.in
+mostlyclean-am: mostlyclean-libexecPROGRAMS mostlyclean-compile \
+ mostlyclean-tags mostlyclean-depend mostlyclean-generic
+
+mostlyclean: mostlyclean-am
+
+clean-am: clean-libexecPROGRAMS clean-compile clean-tags clean-depend \
+ clean-generic mostlyclean-am clean-local
+
+clean: clean-am
+
+distclean-am: distclean-libexecPROGRAMS distclean-compile \
+ distclean-tags distclean-depend distclean-generic \
+ clean-am
+
+distclean: distclean-am
+
+maintainer-clean-am: maintainer-clean-libexecPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-depend maintainer-clean-generic \
+ distclean-am
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+maintainer-clean: maintainer-clean-am
+
+.PHONY: mostlyclean-libexecPROGRAMS distclean-libexecPROGRAMS \
+clean-libexecPROGRAMS maintainer-clean-libexecPROGRAMS \
+uninstall-libexecPROGRAMS install-libexecPROGRAMS mostlyclean-compile \
+distclean-compile clean-compile maintainer-clean-compile \
+uninstall-binSCRIPTS install-binSCRIPTS tags mostlyclean-tags \
+distclean-tags clean-tags maintainer-clean-tags mostlyclean-depend \
+distclean-depend clean-depend maintainer-clean-depend distdir info-am \
+info dvi-am dvi check check-am installcheck-am installcheck \
+install-exec-am install-exec install-data-am install-data install-am \
+install uninstall-local uninstall-am uninstall all-redirect all-am all \
+install-strip installdirs mostlyclean-generic distclean-generic \
+clean-generic maintainer-clean-generic clean mostlyclean distclean \
+maintainer-clean
+
all: stamp-eg $(AUXPROGS) igawk $(AUXAWK)
-stamp-eg: $(srcdir)/../doc/gawk.texi
+install-exec-hook: $(AUXAWK)
+ $(mkinstalldirs) $(DESTDIR)$(datadir)
+ for i in $(AUXAWK) $(srcdir)/eg/lib/*.awk ; do \
+ progname=`echo $$i | sed 's;.*/;;'` ; \
+ $(INSTALL_DATA) $$i $(DESTDIR)$(datadir)/$$progname ; \
+ done
+
+# libexecdir and datadir are removed in the top level Makefile's uninstall
+uninstall-local:
+ rm -fr $(DESTDIR)$(libexecdir)/* $(DESTDIR)$(datadir)/*
+ rm -f $(DESTDIR)$(bindir)/igawk
+
+clean-local:
+ rm -f $(AUXAWK) igawk
+
+stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
rm -fr eg stamp-eg
- ../gawk -f $(srcdir)/extract.awk $(srcdir)/../doc/gawk.texi
+ $(AWK) -f $(srcdir)/extract.awk $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
@echo 'some makes are stupid and will not check a directory' > stamp-eg
@echo 'against a file, so this file is a place holder. gack.' >> stamp-eg
@@ -72,28 +426,6 @@ group.awk: $(srcdir)/eg/lib/groupawk.in
(cd $(srcdir)/eg/lib ; \
sed 's;/usr/local/libexec/awk;$(libexecdir);' < groupawk.in) > group.awk
-install: igawk $(AUXPROGS) $(AUXAWK)
- $(INSTALL_PROGRAM) igawk $(bindir)/igawk
- for i in $(AUXPROGS) ; do \
- $(INSTALL_PROGRAM) $$i $(libexecdir)/$$i ; \
- done
- for i in $(AUXAWK) $(srcdir)/eg/lib/*.awk ; do \
- progname=`echo $$i | sed 's;.*/;;'` ; \
- $(INSTALL_DATA) $$i $(datadir)/$$progname ; \
- done
-
-# libexecdir and datadir are removed in the top level Makefile's uninstall
-uninstall:
- rm -fr $(libexecdir)/* $(datadir)/*
- rm -f $(bindir)/igawk
-
-clean:
- rm -f $(AUXPROGS) $(AUXAWK) igawk *~
-
-distclean: clean
- rm -f Makefile
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use; it"
- @echo "deletes files that may require special tools to rebuild."
- rm -fr eg stamp-eg
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/contrib/awk/awklib/eg/lib/assert.awk b/contrib/awk/awklib/eg/lib/assert.awk
index 50f42e7dd383..bbfc0669bb79 100644
--- a/contrib/awk/awklib/eg/lib/assert.awk
+++ b/contrib/awk/awklib/eg/lib/assert.awk
@@ -1,4 +1,6 @@
# assert --- assert that a condition is true. Otherwise exit.
+
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
diff --git a/contrib/awk/awklib/eg/lib/bits2str.awk b/contrib/awk/awklib/eg/lib/bits2str.awk
new file mode 100644
index 000000000000..9725ee8fa7d0
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/bits2str.awk
@@ -0,0 +1,16 @@
+# bits2str --- turn a byte into readable 1's and 0's
+
+function bits2str(bits, data, mask)
+{
+ if (bits == 0)
+ return "0"
+
+ mask = 1
+ for (; bits != 0; bits = rshift(bits, 1))
+ data = (and(bits, mask) ? "1" : "0") data
+
+ while ((length(data) % 8) != 0)
+ data = "0" data
+
+ return data
+}
diff --git a/contrib/awk/awklib/eg/lib/cliff_rand.awk b/contrib/awk/awklib/eg/lib/cliff_rand.awk
new file mode 100644
index 000000000000..345447ec82a9
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/cliff_rand.awk
@@ -0,0 +1,14 @@
+# cliff_rand.awk --- generate Cliff random numbers
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# December 2000
+
+BEGIN { _cliff_seed = 0.1 }
+
+function cliff_rand()
+{
+ _cliff_seed = (100 * log(_cliff_seed)) % 1
+ if (_cliff_seed < 0)
+ _cliff_seed = - _cliff_seed
+ return _cliff_seed
+}
diff --git a/contrib/awk/awklib/eg/lib/ftrans.awk b/contrib/awk/awklib/eg/lib/ftrans.awk
index cec615be7db1..b0743e2889bf 100644
--- a/contrib/awk/awklib/eg/lib/ftrans.awk
+++ b/contrib/awk/awklib/eg/lib/ftrans.awk
@@ -2,8 +2,8 @@
#
# user supplies beginfile() and endfile() functions
#
-# Arnold Robbins, arnold@gnu.org, November 1992
-# Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# November 1992
FNR == 1 {
if (_filename_ != "")
diff --git a/contrib/awk/awklib/eg/lib/getopt.awk b/contrib/awk/awklib/eg/lib/getopt.awk
index dae20e5f087b..93753052eef1 100644
--- a/contrib/awk/awklib/eg/lib/getopt.awk
+++ b/contrib/awk/awklib/eg/lib/getopt.awk
@@ -1,28 +1,26 @@
-# getopt --- do C library getopt(3) function in awk
+# getopt.awk --- do C library getopt(3) function in awk
#
-# arnold@gnu.org
-# Public domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
#
# Initial version: March, 1991
# Revised: May, 1993
# External variables:
-# Optind -- index of ARGV for first non-option argument
+# Optind -- index in ARGV of first non-option argument
# Optarg -- string value of argument to current option
-# Opterr -- if non-zero, print our own diagnostic
+# Opterr -- if nonzero, print our own diagnostic
# Optopt -- current option letter
-# Returns
+# Returns:
# -1 at end of options
# ? for unrecognized option
# <c> a character representing the current option
-# Private Data
-# _opti index in multi-flag option, e.g., -abc
-function getopt(argc, argv, options, optl, thisopt, i)
+# Private Data:
+# _opti -- index in multi-flag option, e.g., -abc
+function getopt(argc, argv, options, thisopt, i)
{
- optl = length(options)
- if (optl == 0) # no options given
+ if (length(options) == 0) # no options given
return -1
if (argv[Optind] == "--") { # all done
diff --git a/contrib/awk/awklib/eg/lib/gettime.awk b/contrib/awk/awklib/eg/lib/gettime.awk
index 82f09d726e33..c425123c6268 100644
--- a/contrib/awk/awklib/eg/lib/gettime.awk
+++ b/contrib/awk/awklib/eg/lib/gettime.awk
@@ -1,6 +1,8 @@
-# gettimeofday --- get the time of day in a usable format
+# gettimeofday.awk --- get the time of day in a usable format
+#
# 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:
# time["second"] -- seconds (0 - 59)
@@ -11,17 +13,17 @@
# time["month"] -- month of year (1 - 12)
# time["monthname"] -- name of the month
# time["shortmonth"] -- short name of the month
-# time["year"] -- year within century (0 - 99)
-# time["fullyear"] -- year with century (19xx or 20xx)
+# time["year"] -- year modulo 100 (0 - 99)
+# time["fullyear"] -- full year
# time["weekday"] -- day of week (Sunday = 0)
# time["altweekday"] -- day of week (Monday = 0)
-# time["weeknum"] -- week number, Sunday first day
-# time["altweeknum"] -- week number, Monday first day
# time["dayname"] -- name of weekday
# time["shortdayname"] -- short name of weekday
# time["yearday"] -- day of year (0 - 365)
# time["timezone"] -- abbreviation of timezone name
# time["ampm"] -- AM or PM designation
+# time["weeknum"] -- week number, Sunday first day
+# time["altweeknum"] -- week number, Monday first day
function gettimeofday(time, ret, now, i)
{
@@ -32,8 +34,7 @@ function gettimeofday(time, ret, now, i)
ret = strftime("%a %b %d %H:%M:%S %Z %Y", now)
# clear out target array
- for (i in time)
- delete time[i]
+ delete time
# fill in values, force numeric values to be
# numeric by adding 0
diff --git a/contrib/awk/awklib/eg/lib/grcat.c b/contrib/awk/awklib/eg/lib/grcat.c
index 570b32304272..d34ddd560b65 100644
--- a/contrib/awk/awklib/eg/lib/grcat.c
+++ b/contrib/awk/awklib/eg/lib/grcat.c
@@ -2,9 +2,9 @@
* grcat.c
*
* Generate a printable version of the group database
- *
- * Arnold Robbins, arnold@gnu.org
- * May 1993
+ */
+/*
+ * Arnold Robbins, arnold@gnu.org, May 1993
* Public Domain
*/
diff --git a/contrib/awk/awklib/eg/lib/groupawk.in b/contrib/awk/awklib/eg/lib/groupawk.in
index 11a72a5a4a40..9d8b402197e2 100644
--- a/contrib/awk/awklib/eg/lib/groupawk.in
+++ b/contrib/awk/awklib/eg/lib/groupawk.in
@@ -1,13 +1,17 @@
# group.awk --- functions for dealing with the group file
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
+# Revised October 2000
BEGIN \
{
# Change to suit your system
_gr_awklib = "/usr/local/libexec/awk/"
}
-function _gr_init( oldfs, oldrs, olddol0, grcat, n, a, i)
+
+function _gr_init( oldfs, oldrs, olddol0, grcat,
+ using_fw, n, a, i)
{
if (_gr_inited)
return
@@ -15,6 +19,7 @@ function _gr_init( oldfs, oldrs, olddol0, grcat, n, a, i)
oldfs = FS
oldrs = RS
olddol0 = $0
+ using_fw = (PROCINFO["FS"] == "FIELDWIDTHS")
FS = ":"
RS = "\n"
@@ -43,6 +48,8 @@ function _gr_init( oldfs, oldrs, olddol0, grcat, n, a, i)
_gr_count = 0
_gr_inited++
FS = oldfs
+ if (using_fw)
+ FIELDWIDTHS = FIELDWIDTHS
RS = oldrs
$0 = olddol0
}
diff --git a/contrib/awk/awklib/eg/lib/join.awk b/contrib/awk/awklib/eg/lib/join.awk
index f52f5e626569..e17b4270ca38 100644
--- a/contrib/awk/awklib/eg/lib/join.awk
+++ b/contrib/awk/awklib/eg/lib/join.awk
@@ -1,4 +1,5 @@
# join.awk --- join an array into a string
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
diff --git a/contrib/awk/awklib/eg/lib/libintl.awk b/contrib/awk/awklib/eg/lib/libintl.awk
new file mode 100644
index 000000000000..a9402c2af9fa
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/libintl.awk
@@ -0,0 +1,9 @@
+function bindtextdomain(dir, domain)
+{
+ return dir
+}
+
+function dcgettext(string, domain, category)
+{
+ return string
+}
diff --git a/contrib/awk/awklib/eg/lib/nextfile.awk b/contrib/awk/awklib/eg/lib/nextfile.awk
index 4bb07bc34252..caedf0e478e3 100644
--- a/contrib/awk/awklib/eg/lib/nextfile.awk
+++ b/contrib/awk/awklib/eg/lib/nextfile.awk
@@ -1,5 +1,6 @@
# nextfile --- skip remaining records in current file
# correctly handle successive occurrences of the same file
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May, 1993
diff --git a/contrib/awk/awklib/eg/lib/noassign.awk b/contrib/awk/awklib/eg/lib/noassign.awk
new file mode 100644
index 000000000000..d6d176e40e9d
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/noassign.awk
@@ -0,0 +1,17 @@
+# noassign.awk --- library file to avoid the need for a
+# special option that disables command-line assignments
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# October 1999
+
+function disable_assigns(argc, argv, i)
+{
+ for (i = 1; i < argc; i++)
+ if (argv[i] ~ /^[A-Za-z_][A-Za-z_0-9]*=.*/)
+ argv[i] = ("./" argv[i])
+}
+
+BEGIN {
+ if (No_command_assign)
+ disable_assigns(ARGC, ARGV)
+}
diff --git a/contrib/awk/awklib/eg/lib/ord.awk b/contrib/awk/awklib/eg/lib/ord.awk
index b19149eb5f52..3eacbcc576dc 100644
--- a/contrib/awk/awklib/eg/lib/ord.awk
+++ b/contrib/awk/awklib/eg/lib/ord.awk
@@ -1,16 +1,15 @@
# ord.awk --- do ord and chr
-#
+
# Global identifiers:
# _ord_: numerical values indexed by characters
# _ord_init: function to initialize _ord_
#
-# Arnold Robbins
-# arnold@gnu.org
-# Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
# 16 January, 1992
# 20 July, 1992, revised
BEGIN { _ord_init() }
+
function _ord_init( low, high, i, t)
{
low = sprintf("%c", 7) # BEL is ascii 7
@@ -37,18 +36,9 @@ function ord(str, c)
c = substr(str, 1, 1)
return _ord_[c]
}
+
function chr(c)
{
# force c to be numeric by adding 0
return sprintf("%c", c + 0)
}
-#### test code ####
-# BEGIN \
-# {
-# for (;;) {
-# printf("enter a character: ")
-# if (getline var <= 0)
-# break
-# printf("ord(%s) = %d\n", var, ord(var))
-# }
-# }
diff --git a/contrib/awk/awklib/eg/lib/passwdawk.in b/contrib/awk/awklib/eg/lib/passwdawk.in
index dd6ee7f58c65..5f6f9e2657fb 100644
--- a/contrib/awk/awklib/eg/lib/passwdawk.in
+++ b/contrib/awk/awklib/eg/lib/passwdawk.in
@@ -1,21 +1,26 @@
# passwd.awk --- access password file information
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
+# Revised October 2000
BEGIN {
# tailor this to suit your system
_pw_awklib = "/usr/local/libexec/awk/"
}
-function _pw_init( oldfs, oldrs, olddol0, pwcat)
+function _pw_init( oldfs, oldrs, olddol0, pwcat, using_fw)
{
if (_pw_inited)
return
+
oldfs = FS
oldrs = RS
olddol0 = $0
+ using_fw = (PROCINFO["FS"] == "FIELDWIDTHS")
FS = ":"
RS = "\n"
+
pwcat = _pw_awklib "pwcat"
while ((pwcat | getline) > 0) {
_pw_byname[$1] = $0
@@ -26,6 +31,8 @@ function _pw_init( oldfs, oldrs, olddol0, pwcat)
_pw_count = 0
_pw_inited = 1
FS = oldfs
+ if (using_fw)
+ FIELDWIDTHS = FIELDWIDTHS
RS = oldrs
$0 = olddol0
}
diff --git a/contrib/awk/awklib/eg/lib/pwcat.c b/contrib/awk/awklib/eg/lib/pwcat.c
index 591b8523ee30..b9a71340a43e 100644
--- a/contrib/awk/awklib/eg/lib/pwcat.c
+++ b/contrib/awk/awklib/eg/lib/pwcat.c
@@ -2,10 +2,9 @@
* pwcat.c
*
* Generate a printable version of the password database
- *
- * Arnold Robbins
- * arnold@gnu.org
- * May 1993
+ */
+/*
+ * Arnold Robbins, arnold@gnu.org, May 1993
* Public Domain
*/
diff --git a/contrib/awk/awklib/eg/lib/readable.awk b/contrib/awk/awklib/eg/lib/readable.awk
new file mode 100644
index 000000000000..51705aea0a56
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/readable.awk
@@ -0,0 +1,16 @@
+# readable.awk --- library file to skip over unreadable files
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# October 2000
+
+BEGIN {
+ for (i = 1; i < ARGC; i++) {
+ if (ARGV[i] ~ /^[A-Za-z_][A-Za-z0-9_]*=.*/ \
+ || ARGV[i] == "-")
+ continue # assignment or standard input
+ else if ((getline junk < ARGV[i]) < 0) # unreadable
+ delete ARGV[i]
+ else
+ close(ARGV[i])
+ }
+}
diff --git a/contrib/awk/awklib/eg/lib/rewind.awk b/contrib/awk/awklib/eg/lib/rewind.awk
new file mode 100644
index 000000000000..33286611341c
--- /dev/null
+++ b/contrib/awk/awklib/eg/lib/rewind.awk
@@ -0,0 +1,20 @@
+# rewind.awk --- rewind the current file and start over
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# September 2000
+
+function rewind( i)
+{
+ # shift remaining arguments up
+ for (i = ARGC; i > ARGIND; i--)
+ ARGV[i] = ARGV[i-1]
+
+ # make sure gawk knows to keep going
+ ARGC++
+
+ # make current file next to get done
+ ARGV[ARGIND+1] = FILENAME
+
+ # do it
+ nextfile
+}
diff --git a/contrib/awk/awklib/eg/lib/round.awk b/contrib/awk/awklib/eg/lib/round.awk
index 67ce6469819c..bf16c2b64902 100644
--- a/contrib/awk/awklib/eg/lib/round.awk
+++ b/contrib/awk/awklib/eg/lib/round.awk
@@ -1,7 +1,7 @@
# round --- do normal rounding
#
-# Arnold Robbins, arnold@gnu.org, August, 1996
-# Public Domain
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# August, 1996
function round(x, ival, aval, fraction)
{
diff --git a/contrib/awk/awklib/eg/misc/findpat.awk b/contrib/awk/awklib/eg/misc/findpat.awk
new file mode 100644
index 000000000000..e9bef9eaf5d1
--- /dev/null
+++ b/contrib/awk/awklib/eg/misc/findpat.awk
@@ -0,0 +1,10 @@
+{
+ if ($1 == "FIND")
+ regex = $2
+ else {
+ where = match($0, regex)
+ if (where != 0)
+ print "Match of", regex, "found at",
+ where, "in", $0
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/PostAgent.sh b/contrib/awk/awklib/eg/network/PostAgent.sh
new file mode 100644
index 000000000000..ccf9a6874b4a
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/PostAgent.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+MobAg=/tmp/MobileAgent.$$
+# direct script to mobile agent file
+cat > $MobAg
+# execute agent concurrently
+gawk -f $MobAg $MobAg > /dev/null &
+# HTTP header, terminator and body
+gawk 'BEGIN { print "\r\nAgent started" }'
+rm $MobAg # delete script file of agent
diff --git a/contrib/awk/awklib/eg/network/coreserv.awk b/contrib/awk/awklib/eg/network/coreserv.awk
new file mode 100644
index 000000000000..e9e617109a25
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/coreserv.awk
@@ -0,0 +1,113 @@
+# CGI Library and core of a web server
+#
+# Juergen Kahrs, Juergen.Kahrs@vr-web.de
+# with Arnold Robbins, arnold@gnu.org
+# September 2000
+
+# Global arrays
+# GETARG --- arguments to CGI GET command
+# MENU --- menu items (path names)
+# PARAM --- parameters of form x=y
+
+# Optional variable MyHost contains host address
+# Optional variable MyPort contains port number
+# Needs TopHeader, TopDoc, TopFooter
+# Sets MyPrefix, HttpService, Status, Reason
+
+BEGIN {
+ if (MyHost == "") {
+ "uname -n" | getline MyHost
+ close("uname -n")
+ }
+ if (MyPort == 0) MyPort = 8080
+ HttpService = "/inet/tcp/" MyPort "/0/0"
+ MyPrefix = "http://" MyHost ":" MyPort
+ SetUpServer()
+ while ("awk" != "complex") {
+ # header lines are terminated this way
+ RS = ORS = "\r\n"
+ Status = 200 # this means OK
+ Reason = "OK"
+ Header = TopHeader
+ Document = TopDoc
+ Footer = TopFooter
+ if (GETARG["Method"] == "GET") {
+ HandleGET()
+ } else if (GETARG["Method"] == "HEAD") {
+ # not yet implemented
+ } else if (GETARG["Method"] != "") {
+ print "bad method", GETARG["Method"]
+ }
+ Prompt = Header Document Footer
+ print "HTTP/1.0", Status, Reason |& HttpService
+ print "Connection: Close" |& HttpService
+ print "Pragma: no-cache" |& HttpService
+ len = length(Prompt) + length(ORS)
+ print "Content-length:", len |& HttpService
+ print ORS Prompt |& HttpService
+ # ignore all the header lines
+ while ((HttpService |& getline) > 0)
+ continue
+ # stop talking to this client
+ close(HttpService)
+ # wait for new client request
+ HttpService |& getline
+ # do some logging
+ print systime(), strftime(), $0
+ CGI_setup($1, $2, $3)
+ }
+}
+
+function CGI_setup( method, uri, version, i)
+{
+ delete GETARG
+ delete MENU
+ delete PARAM
+ GETARG["Method"] = method
+ GETARG["URI"] = uri
+ GETARG["Version"] = version
+
+ i = index(uri, "?")
+ if (i > 0) { # is there a "?" indicating a CGI request?
+ split(substr(uri, 1, i-1), MENU, "[/:]")
+ split(substr(uri, i+1), PARAM, "&")
+ for (i in PARAM) {
+ PARAM[i] = _CGI_decode(PARAM[i])
+ j = index(PARAM[i], "=")
+ GETARG[substr(PARAM[i], 1, j-1)] = \
+ substr(PARAM[i], j+1)
+ }
+ } else { # there is no "?", no need for splitting PARAMs
+ split(uri, MENU, "[/:]")
+ }
+ for (i in MENU) # decode characters in path
+ if (i > 4) # but not those in host name
+ MENU[i] = _CGI_decode(MENU[i])
+}
+function _CGI_decode(str, hexdigs, i, pre, code1, code2,
+ val, result)
+{
+ hexdigs = "123456789abcdef"
+
+ i = index(str, "%")
+ if (i == 0) # no work to do
+ return str
+
+ do {
+ pre = substr(str, 1, i-1) # part before %xx
+ code1 = substr(str, i+1, 1) # first hex digit
+ code2 = substr(str, i+2, 1) # second hex digit
+ str = substr(str, i+3) # rest of string
+
+ code1 = tolower(code1)
+ code2 = tolower(code2)
+ val = index(hexdigs, code1) * 16 \
+ + index(hexdigs, code2)
+
+ result = result pre sprintf("%c", val)
+ i = index(str, "%")
+ } while (i != 0)
+ if (length(str) > 0)
+ result = result str
+ return result
+}
diff --git a/contrib/awk/awklib/eg/network/eliza.awk b/contrib/awk/awklib/eg/network/eliza.awk
new file mode 100644
index 000000000000..2e022b41a919
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/eliza.awk
@@ -0,0 +1,270 @@
+function SetUpServer() {
+ SetUpEliza()
+ TopHeader = \
+ "<HTML><title>An HTTP-based System with GAWK</title>\
+ <HEAD><META HTTP-EQUIV=\"Content-Type\"\
+ CONTENT=\"text/html; charset=iso-8859-1\"></HEAD>\
+ <BODY BGCOLOR=\"#ffffff\" TEXT=\"#000000\"\
+ LINK=\"#0000ff\" VLINK=\"#0000ff\"\
+ ALINK=\"#0000ff\"> <A NAME=\"top\">"
+ TopDoc = "\
+ <h2>Please choose one of the following actions:</h2>\
+ <UL>\
+ <LI>\
+ <A HREF=" MyPrefix "/AboutServer>About this server</A>\
+ </LI><LI>\
+ <A HREF=" MyPrefix "/AboutELIZA>About Eliza</A></LI>\
+ <LI>\
+ <A HREF=" MyPrefix \
+ "/StartELIZA>Start talking to Eliza</A></LI></UL>"
+ TopFooter = "</BODY></HTML>"
+}
+function HandleGET() {
+ # A real HTTP server would treat some parts of the URI as a file name.
+ # We take parts of the URI as menu choices and go on accordingly.
+ if(MENU[2] == "AboutServer") {
+ Document = "This is not a CGI script.\
+ This is an httpd, an HTML file, and a CGI script all \
+ in one GAWK script. It needs no separate www-server, \
+ no installation, and no root privileges.\
+ <p>To run it, do this:</p><ul>\
+ <li> start this script with \"gawk -f httpserver.awk\",</li>\
+ <li> and on the same host let your www browser open location\
+ \"http://localhost:8080\"</li>\
+ </ul>\<p>\ Details of HTTP come from:</p><ul>\
+ <li>Hethmon: Illustrated Guide to HTTP</p>\
+ <li>RFC 2068</li></ul><p>JK 14.9.1997</p>"
+ } else if (MENU[2] == "AboutELIZA") {
+ Document = "This is an implementation of the famous ELIZA\
+ program by Joseph Weizenbaum. It is written in GAWK and\
+/bin/sh: expad: command not found
+ } else if (MENU[2] == "StartELIZA") {
+ gsub(/\+/, " ", GETARG["YouSay"])
+ # Here we also have to substitute coded special characters
+ Document = "<form method=GET>" \
+ "<h3>" ElizaSays(GETARG["YouSay"]) "</h3>\
+ <p><input type=text name=YouSay value=\"\" size=60>\
+ <br><input type=submit value=\"Tell her about it\"></p></form>"
+ }
+}
+function ElizaSays(YouSay) {
+ if (YouSay == "") {
+ cost = 0
+ answer = "HI, IM ELIZA, TELL ME YOUR PROBLEM"
+ } else {
+ q = toupper(YouSay)
+ gsub("'", "", q)
+ if(q == qold) {
+ answer = "PLEASE DONT REPEAT YOURSELF !"
+ } else {
+ if (index(q, "SHUT UP") > 0) {
+ answer = "WELL, PLEASE PAY YOUR BILL. ITS EXACTLY ... $"\
+ int(100*rand()+30+cost/100)
+ } else {
+ qold = q
+ w = "-" # no keyword recognized yet
+ for (i in k) { # search for keywords
+ if (index(q, i) > 0) {
+ w = i
+ break
+ }
+ }
+ if (w == "-") { # no keyword, take old subject
+ w = wold
+ subj = subjold
+ } else { # find subject
+ subj = substr(q, index(q, w) + length(w)+1)
+ wold = w
+ subjold = subj # remember keyword and subject
+ }
+ for (i in conj)
+ gsub(i, conj[i], q) # conjugation
+ # from all answers to this keyword, select one randomly
+ answer = r[indices[int(split(k[w], indices) * rand()) + 1]]
+ # insert subject into answer
+ gsub("_", subj, answer)
+ }
+ }
+ }
+ cost += length(answer) # for later payment : 1 cent per character
+ return answer
+}
+function SetUpEliza() {
+ srand()
+ wold = "-"
+ subjold = " "
+
+ # table for conjugation
+ conj[" ARE " ] = " AM "
+ conj["WERE " ] = "WAS "
+ conj[" YOU " ] = " I "
+ conj["YOUR " ] = "MY "
+ conj[" IVE " ] =\
+ conj[" I HAVE " ] = " YOU HAVE "
+ conj[" YOUVE " ] =\
+ conj[" YOU HAVE "] = " I HAVE "
+ conj[" IM " ] =\
+ conj[" I AM " ] = " YOU ARE "
+ conj[" YOURE " ] =\
+ conj[" YOU ARE " ] = " I AM "
+
+ # table of all answers
+ r[1] = "DONT YOU BELIEVE THAT I CAN _"
+ r[2] = "PERHAPS YOU WOULD LIKE TO BE ABLE TO _ ?"
+ r[3] = "YOU WANT ME TO BE ABLE TO _ ?"
+ r[4] = "PERHAPS YOU DONT WANT TO _ "
+ r[5] = "DO YOU WANT TO BE ABLE TO _ ?"
+ r[6] = "WHAT MAKES YOU THINK I AM _ ?"
+ r[7] = "DOES IT PLEASE YOU TO BELIEVE I AM _ ?"
+ r[8] = "PERHAPS YOU WOULD LIKE TO BE _ ?"
+ r[9] = "DO YOU SOMETIMES WISH YOU WERE _ ?"
+ r[10] = "DONT YOU REALLY _ ?"
+ r[11] = "WHY DONT YOU _ ?"
+ r[12] = "DO YOU WISH TO BE ABLE TO _ ?"
+ r[13] = "DOES THAT TROUBLE YOU ?"
+ r[14] = "TELL ME MORE ABOUT SUCH FEELINGS"
+ r[15] = "DO YOU OFTEN FEEL _ ?"
+ r[16] = "DO YOU ENJOY FEELING _ ?"
+ r[17] = "DO YOU REALLY BELIEVE I DONT _ ?"
+ r[18] = "PERHAPS IN GOOD TIME I WILL _ "
+ r[19] = "DO YOU WANT ME TO _ ?"
+ r[20] = "DO YOU THINK YOU SHOULD BE ABLE TO _ ?"
+ r[21] = "WHY CANT YOU _ ?"
+ r[22] = "WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM _ ?"
+ r[23] = "WOULD YOU PREFER IF I WERE NOT _ ?"
+ r[24] = "PERHAPS IN YOUR FANTASIES I AM _ "
+ r[25] = "HOW DO YOU KNOW YOU CANT _ ?"
+ r[26] = "HAVE YOU TRIED ?"
+ r[27] = "PERHAPS YOU CAN NOW _ "
+ r[28] = "DID YOU COME TO ME BECAUSE YOU ARE _ ?"
+ r[29] = "HOW LONG HAVE YOU BEEN _ ?"
+ r[30] = "DO YOU BELIEVE ITS NORMAL TO BE _ ?"
+ r[31] = "DO YOU ENJOY BEING _ ?"
+ r[32] = "WE WERE DISCUSSING YOU -- NOT ME"
+ r[33] = "Oh, I _"
+ r[34] = "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU ?"
+ r[35] = "WHAT WOULD IT MEAN TO YOU, IF YOU GOT _ ?"
+ r[36] = "WHY DO YOU WANT _ ?"
+ r[37] = "SUPPOSE YOU SOON GOT _"
+ r[38] = "WHAT IF YOU NEVER GOT _ ?"
+ r[39] = "I SOMETIMES ALSO WANT _"
+ r[40] = "WHY DO YOU ASK ?"
+ r[41] = "DOES THAT QUESTION INTEREST YOU ?"
+ r[42] = "WHAT ANSWER WOULD PLEASE YOU THE MOST ?"
+ r[43] = "WHAT DO YOU THINK ?"
+ r[44] = "ARE SUCH QUESTIONS IN YOUR MIND OFTEN ?"
+ r[45] = "WHAT IS IT THAT YOU REALLY WANT TO KNOW ?"
+ r[46] = "HAVE YOU ASKED ANYONE ELSE ?"
+ r[47] = "HAVE YOU ASKED SUCH QUESTIONS BEFORE ?"
+ r[48] = "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT ?"
+ r[49] = "NAMES DON'T INTEREST ME"
+ r[50] = "I DONT CARE ABOUT NAMES -- PLEASE GO ON"
+ r[51] = "IS THAT THE REAL REASON ?"
+ r[52] = "DONT ANY OTHER REASONS COME TO MIND ?"
+ r[53] = "DOES THAT REASON EXPLAIN ANYTHING ELSE ?"
+ r[54] = "WHAT OTHER REASONS MIGHT THERE BE ?"
+ r[55] = "PLEASE DON'T APOLOGIZE !"
+ r[56] = "APOLOGIES ARE NOT NECESSARY"
+ r[57] = "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE ?"
+ r[58] = "DON'T BE SO DEFENSIVE"
+ r[59] = "WHAT DOES THAT DREAM SUGGEST TO YOU ?"
+ r[60] = "DO YOU DREAM OFTEN ?"
+ r[61] = "WHAT PERSONS APPEAR IN YOUR DREAMS ?"
+ r[62] = "ARE YOU DISTURBED BY YOUR DREAMS ?"
+ r[63] = "HOW DO YOU DO ... PLEASE STATE YOUR PROBLEM"
+ r[64] = "YOU DON'T SEEM QUITE CERTAIN"
+ r[65] = "WHY THE UNCERTAIN TONE ?"
+ r[66] = "CAN'T YOU BE MORE POSITIVE ?"
+ r[67] = "YOU AREN'T SURE ?"
+ r[68] = "DON'T YOU KNOW ?"
+ r[69] = "WHY NO _ ?"
+ r[70] = "DON'T SAY NO, IT'S ALWAYS SO NEGATIVE"
+ r[71] = "WHY NOT ?"
+ r[72] = "ARE YOU SURE ?"
+ r[73] = "WHY NO ?"
+ r[74] = "WHY ARE YOU CONCERNED ABOUT MY _ ?"
+ r[75] = "WHAT ABOUT YOUR OWN _ ?"
+ r[76] = "CAN'T YOU THINK ABOUT A SPECIFIC EXAMPLE ?"
+ r[77] = "WHEN ?"
+ r[78] = "WHAT ARE YOU THINKING OF ?"
+ r[79] = "REALLY, ALWAYS ?"
+ r[80] = "DO YOU REALLY THINK SO ?"
+ r[81] = "BUT YOU ARE NOT SURE YOU _ "
+ r[82] = "DO YOU DOUBT YOU _ ?"
+ r[83] = "IN WHAT WAY ?"
+ r[84] = "WHAT RESEMBLANCE DO YOU SEE ?"
+ r[85] = "WHAT DOES THE SIMILARITY SUGGEST TO YOU ?"
+ r[86] = "WHAT OTHER CONNECTION DO YOU SEE ?"
+ r[87] = "COULD THERE REALLY BE SOME CONNECTIONS ?"
+ r[88] = "HOW ?"
+ r[89] = "YOU SEEM QUITE POSITIVE"
+ r[90] = "ARE YOU SURE ?"
+ r[91] = "I SEE"
+ r[92] = "I UNDERSTAND"
+ r[93] = "WHY DO YOU BRING UP THE TOPIC OF FRIENDS ?"
+ r[94] = "DO YOUR FRIENDS WORRY YOU ?"
+ r[95] = "DO YOUR FRIENDS PICK ON YOU ?"
+ r[96] = "ARE YOU SURE YOU HAVE ANY FRIENDS ?"
+ r[97] = "DO YOU IMPOSE ON YOUR FRIENDS ?"
+ r[98] = "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU"
+ r[99] = "DO COMPUTERS WORRY YOU ?"
+ r[100] = "ARE YOU TALKING ABOUT ME IN PARTICULAR ?"
+ r[101] = "ARE YOU FRIGHTENED BY MACHINES ?"
+ r[102] = "WHY DO YOU MENTION COMPUTERS ?"
+ r[103] = "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEMS ?"
+ r[104] = "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE ?"
+ r[105] = "WHAT IS IT ABOUT MACHINES THAT WORRIES YOU ?"
+ r[106] = "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS ?"
+ r[107] = "WHAT DOES THAT SUGGEST TO YOU ?"
+ r[108] = "I SEE"
+ r[109] = "IM NOT SURE I UNDERSTAND YOU FULLY"
+ r[110] = "COME COME ELUCIDATE YOUR THOUGHTS"
+ r[111] = "CAN YOU ELABORATE ON THAT ?"
+ r[112] = "THAT IS QUITE INTERESTING"
+ r[113] = "WHY DO YOU HAVE PROBLEMS WITH MONEY ?"
+ r[114] = "DO YOU THINK MONEY IS EVERYTHING ?"
+ r[115] = "ARE YOU SURE THAT MONEY IS THE PROBLEM ?"
+ r[116] = "I THINK WE WANT TO TALK ABOUT YOU, NOT ABOUT ME"
+ r[117] = "WHAT'S ABOUT ME ?"
+ r[118] = "WHY DO YOU ALWAYS BRING UP MY NAME ?"
+ # table for looking up answers that
+ # fit to a certain keyword
+ k["CAN YOU"] = "1 2 3"
+ k["CAN I"] = "4 5"
+ k["YOU ARE"] =\
+ k["YOURE"] = "6 7 8 9"
+ k["I DONT"] = "10 11 12 13"
+ k["I FEEL"] = "14 15 16"
+ k["WHY DONT YOU"] = "17 18 19"
+ k["WHY CANT I"] = "20 21"
+ k["ARE YOU"] = "22 23 24"
+ k["I CANT"] = "25 26 27"
+ k["I AM"] =\
+ k["IM "] = "28 29 30 31"
+ k["YOU "] = "32 33 34"
+ k["I WANT"] = "35 36 37 38 39"
+ k["WHAT"] =\
+ k["HOW"] =\
+ k["WHO"] =\
+ k["WHERE"] =\
+ k["WHEN"] =\
+ k["WHY"] = "40 41 42 43 44 45 46 47 48"
+ k["NAME"] = "49 50"
+ k["CAUSE"] = "51 52 53 54"
+ k["SORRY"] = "55 56 57 58"
+ k["DREAM"] = "59 60 61 62"
+ k["HELLO"] =\
+ k["HI "] = "63"
+ k["MAYBE"] = "64 65 66 67 68"
+ k[" NO "] = "69 70 71 72 73"
+ k["YOUR"] = "74 75"
+ k["ALWAYS"] = "76 77 78 79"
+ k["THINK"] = "80 81 82"
+ k["LIKE"] = "83 84 85 86 87 88 89"
+ k["YES"] = "90 91 92"
+ k["FRIEND"] = "93 94 95 96 97 98"
+ k["COMPUTER"] = "99 100 101 102 103 104 105"
+ k["-"] = "106 107 108 109 110 111 112"
+ k["MONEY"] = "113 114 115"
+ k["ELIZA"] = "116 117 118"
+}
diff --git a/contrib/awk/awklib/eg/network/fingerclient.awk b/contrib/awk/awklib/eg/network/fingerclient.awk
new file mode 100644
index 000000000000..bcc2c94cfa55
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/fingerclient.awk
@@ -0,0 +1,7 @@
+BEGIN {
+ NetService = "/inet/tcp/0/localhost/finger"
+ print "var{name}" |& NetService
+ while ((NetService |& getline) > 0)
+ print $0
+ close(NetService)
+}
diff --git a/contrib/awk/awklib/eg/network/geturl.awk b/contrib/awk/awklib/eg/network/geturl.awk
new file mode 100644
index 000000000000..53853e50283b
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/geturl.awk
@@ -0,0 +1,24 @@
+BEGIN {
+ if (ARGC != 2) {
+ print "GETURL - retrieve Web page via HTTP 1.0"
+ print "IN:\n the URL as a command-line parameter"
+ print "PARAM(S):\n -v Proxy=MyProxy"
+ print "OUT:\n the page content on stdout"
+ print " the page header on stderr"
+ print "JK 16.05.1997"
+ print "ADR 13.08.2000"
+ exit
+ }
+ URL = ARGV[1]; ARGV[1] = ""
+ if (Proxy == "") Proxy = "127.0.0.1"
+ if (ProxyPort == 0) ProxyPort = 80
+ if (Method == "") Method = "GET"
+ HttpService = "/inet/tcp/0/" Proxy "/" ProxyPort
+ ORS = RS = "\r\n\r\n"
+ print Method " " URL " HTTP/1.0" |& HttpService
+ HttpService |& getline Header
+ print Header > "/dev/stderr"
+ while ((HttpService |& getline) > 0)
+ printf "%s", $0
+ close(HttpService)
+}
diff --git a/contrib/awk/awklib/eg/network/hello-serv.awk b/contrib/awk/awklib/eg/network/hello-serv.awk
new file mode 100644
index 000000000000..003ee088ac44
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/hello-serv.awk
@@ -0,0 +1,14 @@
+BEGIN {
+ RS = ORS = "\r\n"
+ HttpService = "/inet/tcp/8080/0/0"
+ Hello = "<HTML><HEAD>" \
+ "<TITLE>A Famous Greeting</TITLE></HEAD>" \
+ "<BODY><H1>Hello, world</H1></BODY></HTML>"
+ Len = length(Hello) + length(ORS)
+ print "HTTP/1.0 200 OK" |& HttpService
+ print "Content-Length: " Len ORS |& HttpService
+ print Hello |& HttpService
+ while ((HttpService |& getline) > 0)
+ continue;
+ close(HttpService)
+}
diff --git a/contrib/awk/awklib/eg/network/maze.awk b/contrib/awk/awklib/eg/network/maze.awk
new file mode 100644
index 000000000000..94888f8c61fe
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/maze.awk
@@ -0,0 +1,73 @@
+function SetUpServer() {
+ TopHeader = "<HTML><title>Walk through a maze</title>"
+ TopDoc = "\
+ <h2>Please choose one of the following actions:</h2>\
+ <UL>\
+ <LI><A HREF=" MyPrefix "/AboutServer>About this server</A>\
+ <LI><A HREF=" MyPrefix "/VRMLtest>Watch a simple VRML scene</A>\
+ </UL>"
+ TopFooter = "</HTML>"
+ srand()
+}
+function HandleGET() {
+ if (MENU[2] == "AboutServer") {
+ Document = "If your browser has a VRML 2 plugin,\
+ this server shows you a simple VRML scene."
+ } else if (MENU[2] == "VRMLtest") {
+ XSIZE = YSIZE = 11 # initially, everything is wall
+ for (y = 0; y < YSIZE; y++)
+ for (x = 0; x < XSIZE; x++)
+ Maze[x, y] = "#"
+ delete Maze[0, 1] # entry is not wall
+ delete Maze[XSIZE-1, YSIZE-2] # exit is not wall
+ MakeMaze(1, 1)
+ Document = "\
+#VRML V2.0 utf8\n\
+Group {\n\
+ children [\n\
+ PointLight {\n\
+ ambientIntensity 0.2\n\
+ color 0.7 0.7 0.7\n\
+ location 0.0 8.0 10.0\n\
+ }\n\
+ DEF B1 Background {\n\
+ skyColor [0 0 0, 1.0 1.0 1.0 ]\n\
+ skyAngle 1.6\n\
+ groundColor [1 1 1, 0.8 0.8 0.8, 0.2 0.2 0.2 ]\n\
+ groundAngle [ 1.2 1.57 ]\n\
+ }\n\
+ DEF Wall Shape {\n\
+ geometry Box {size 1 1 1}\n\
+ appearance Appearance { material Material { diffuseColor 0 0 1 } }\n\
+ }\n\
+ DEF Entry Viewpoint {\n\
+ position 0.5 1.0 5.0\n\
+ orientation 0.0 0.0 -1.0 0.52\n\
+ }\n"
+ for (i in Maze) {
+ split(i, t, SUBSEP)
+ Document = Document " Transform { translation "
+ Document = Document t[1] " 0 -" t[2] " children USE Wall }\n"
+ }
+ Document = Document " ] # end of group for world\n}"
+ Reason = "OK" ORS "Content-type: model/vrml"
+ Header = Footer = ""
+ }
+}
+function MakeMaze(x, y) {
+ delete Maze[x, y] # here we are, we have no wall here
+ p = 0 # count unvisited fields in all directions
+ if (x-2 SUBSEP y in Maze) d[p++] = "-x"
+ if (x SUBSEP y-2 in Maze) d[p++] = "-y"
+ if (x+2 SUBSEP y in Maze) d[p++] = "+x"
+ if (x SUBSEP y+2 in Maze) d[p++] = "+y"
+ if (p>0) { # if there are univisited fields, go there
+ p = int(p*rand()) # choose one unvisited field at random
+ if (d[p] == "-x") { delete Maze[x - 1, y]; MakeMaze(x - 2, y)
+ } else if (d[p] == "-y") { delete Maze[x, y - 1]; MakeMaze(x, y - 2)
+ } else if (d[p] == "+x") { delete Maze[x + 1, y]; MakeMaze(x + 2, y)
+ } else if (d[p] == "+y") { delete Maze[x, y + 1]; MakeMaze(x, y + 2)
+ } # we are back from recursion
+ MakeMaze(x, y); # try again while there are unvisited fields
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/mobag.awk b/contrib/awk/awklib/eg/network/mobag.awk
new file mode 100644
index 000000000000..a8c55008b78d
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/mobag.awk
@@ -0,0 +1,72 @@
+BEGIN {
+ if (ARGC != 2) {
+ print "MOBAG - a simple mobile agent"
+ print "CALL:\n gawk -f mobag.awk mobag.awk"
+ print "IN:\n the name of this script as a command-line parameter"
+ print "PARAM:\n -v MyOrigin=myhost.com"
+ print "OUT:\n the result on stdout"
+ print "JK 29.03.1998 01.04.1998"
+ exit
+ }
+ if (MyOrigin == "") {
+ "uname -n" | getline MyOrigin
+ close("uname -n")
+ }
+}
+#ReadMySelf
+/^function / { FUNC = $2 }
+/^END/ || /^#ReadMySelf/ { FUNC = $1 }
+FUNC != "" { MOBFUN[FUNC] = MOBFUN[FUNC] RS $0 }
+(FUNC != "") && (/^}/ || /^#EndOfMySelf/) \
+ { FUNC = "" }
+#EndOfMySelf
+function migrate(Destination, MobCode, Label) {
+ MOBVAR["Label"] = Label
+ MOBVAR["Destination"] = Destination
+ RS = ORS = "\r\n"
+ HttpService = "/inet/tcp/0/" Destination
+ for (i in MOBFUN)
+ MobCode = (MobCode "\n" MOBFUN[i])
+ MobCode = MobCode "\n\nBEGIN {"
+ for (i in MOBVAR)
+ MobCode = (MobCode "\n MOBVAR[\"" i "\"] = \"" MOBVAR[i] "\"")
+ MobCode = MobCode "\n}\n"
+ print "POST /cgi-bin/PostAgent.sh HTTP/1.0" |& HttpService
+ print "Content-length:", length(MobCode) ORS |& HttpService
+ printf "%s", MobCode |& HttpService
+ while ((HttpService |& getline) > 0)
+ print $0
+ close(HttpService)
+}
+END {
+ if (ARGC != 2) exit # stop when called with wrong parameters
+ if (MyOrigin != "") # is this the originating host?
+ MyInit() # if so, initialize the application
+ else # we are on a host with migrated data
+ MyJob() # so we do our job
+}
+function MyInit() {
+ MOBVAR["MyOrigin"] = MyOrigin
+ MOBVAR["Machines"] = "localhost/80 max/80 moritz/80 castor/80"
+ split(MOBVAR["Machines"], Machines) # which host is the first?
+ migrate(Machines[1], "", "") # go to the first host
+ while (("/inet/tcp/8080/0/0" |& getline) > 0) # wait for result
+ print $0 # print result
+ close("/inet/tcp/8080/0/0")
+}
+function MyJob() {
+ # forget this host
+ sub(MOBVAR["Destination"], "", MOBVAR["Machines"])
+ MOBVAR["Result"]=MOBVAR["Result"] SUBSEP SUBSEP MOBVAR["Destination"] ":"
+ while (("who" | getline) > 0) # who is logged in?
+ MOBVAR["Result"] = MOBVAR["Result"] SUBSEP $0
+ close("who")
+ if (index(MOBVAR["Machines"], "/") > 0) { # any more machines to visit?
+ split(MOBVAR["Machines"], Machines) # which host is next?
+ migrate(Machines[1], "", "") # go there
+ } else { # no more machines
+ gsub(SUBSEP, "\n", MOBVAR["Result"]) # send result to origin
+ print MOBVAR["Result"] |& "/inet/tcp/0/" MOBVAR["MyOrigin"] "/8080"
+ close("/inet/tcp/0/" MOBVAR["MyOrigin"] "/8080")
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/panic.awk b/contrib/awk/awklib/eg/network/panic.awk
new file mode 100644
index 000000000000..6db8c46d4b04
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/panic.awk
@@ -0,0 +1,18 @@
+BEGIN {
+ RS = ORS = "\r\n"
+ if (MyPort == 0) MyPort = 8080
+ HttpService = "/inet/tcp/" MyPort "/0/0"
+ Hello = "<HTML><HEAD><TITLE>Out Of Service</TITLE>" \
+ "</HEAD><BODY><H1>" \
+ "This site is temporarily out of service." \
+ "</H1></BODY></HTML>"
+ Len = length(Hello) + length(ORS)
+ while ("awk" != "complex") {
+ print "HTTP/1.0 200 OK" |& HttpService
+ print "Content-Length: " Len ORS |& HttpService
+ print Hello |& HttpService
+ while ((HttpService |& getline) > 0)
+ continue;
+ close(HttpService)
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/protbase.awk b/contrib/awk/awklib/eg/network/protbase.awk
new file mode 100644
index 000000000000..16199e45121e
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/protbase.awk
@@ -0,0 +1,11 @@
+{ request = request "\n" $0 }
+
+END {
+ BLASTService = "/inet/tcp/0/www.ncbi.nlm.nih.gov/80"
+ printf "POST /cgi-bin/BLAST/nph-blast_report HTTP/1.0\n" |& BLASTService
+ printf "Content-Length: " length(request) "\n\n" |& BLASTService
+ printf request |& BLASTService
+ while ((BLASTService |& getline) > 0)
+ print $0
+ close(BLASTService)
+}
diff --git a/contrib/awk/awklib/eg/network/protbase.request b/contrib/awk/awklib/eg/network/protbase.request
new file mode 100644
index 000000000000..4c5c3d2c1d2f
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/protbase.request
@@ -0,0 +1,7 @@
+PROGRAM blastn
+DATALIB month
+EXPECT 0.75
+BEGIN
+>GAWK310 the gawking gene GNU AWK
+tgcttggctgaggagccataggacgagagcttcctggtgaagtgtgtttcttgaaatcat
+caccaccatggacagcaaa
diff --git a/contrib/awk/awklib/eg/network/protbase.result b/contrib/awk/awklib/eg/network/protbase.result
new file mode 100644
index 000000000000..a087af43fefa
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/protbase.result
@@ -0,0 +1,9 @@
+Sequences producing significant alignments: (bits) Value
+
+gb|AC021182.14|AC021182 Homo sapiens chromosome 7 clone RP11-733... 38 0.20
+gb|AC021056.12|AC021056 Homo sapiens chromosome 3 clone RP11-115... 38 0.20
+emb|AL160278.10|AL160278 Homo sapiens chromosome 9 clone RP11-57... 38 0.20
+emb|AL391139.11|AL391139 Homo sapiens chromosome X clone RP11-35... 38 0.20
+emb|AL365192.6|AL365192 Homo sapiens chromosome 6 clone RP3-421H... 38 0.20
+emb|AL138812.9|AL138812 Homo sapiens chromosome 11 clone RP1-276... 38 0.20
+gb|AC073881.3|AC073881 Homo sapiens chromosome 15 clone CTD-2169... 38 0.20
diff --git a/contrib/awk/awklib/eg/network/remconf.awk b/contrib/awk/awklib/eg/network/remconf.awk
new file mode 100644
index 000000000000..f4f21e1a9af3
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/remconf.awk
@@ -0,0 +1,54 @@
+function SetUpServer() {
+ TopHeader = "<HTML><title>Remote Configuration</title>"
+ TopDoc = "<BODY>\
+ <h2>Please choose one of the following actions:</h2>\
+ <UL>\
+ <LI><A HREF=" MyPrefix "/AboutServer>About this server</A></LI>\
+ <LI><A HREF=" MyPrefix "/ReadConfig>Read Configuration</A></LI>\
+ <LI><A HREF=" MyPrefix "/CheckConfig>Check Configuration</A></LI>\
+ <LI><A HREF=" MyPrefix "/ChangeConfig>Change Configuration</A></LI>\
+ <LI><A HREF=" MyPrefix "/SaveConfig>Save Configuration</A></LI>\
+ </UL>"
+ TopFooter = "</BODY></HTML>"
+ if (ConfigFile == "") ConfigFile = "config.asc"
+}
+function HandleGET() {
+ if(MENU[2] == "AboutServer") {
+ Document = "This is a GUI for remote configuration of an\
+ embedded system. It is is implemented as one GAWK script."
+ } else if (MENU[2] == "ReadConfig") {
+ RS = "\n"
+ while ((getline < ConfigFile) > 0)
+ config[$1] = $2;
+ close(ConfigFile)
+ RS = "\r\n"
+ Document = "Configuration has been read."
+ } else if (MENU[2] == "CheckConfig") {
+ Document = "<TABLE BORDER=1 CELLPADDING=5>"
+ for (i in config)
+ Document = Document "<TR><TD>" i "</TD>" \
+ "<TD>" config[i] "</TD></TR>"
+ Document = Document "</TABLE>"
+ } else if (MENU[2] == "ChangeConfig") {
+ if ("Param" in GETARG) { # any parameter to set?
+ if (GETARG["Param"] in config) { # is parameter valid?
+ config[GETARG["Param"]] = GETARG["Value"]
+ Document = (GETARG["Param"] " = " GETARG["Value"] ".")
+ } else {
+ Document = "Parameter <b>" GETARG["Param"] "</b> is invalid."
+ }
+ } else {
+ Document = "<FORM method=GET><h4>Change one parameter</h4>\
+ <TABLE BORDER CELLPADDING=5>\
+ <TR><TD>Parameter</TD><TD>Value</TD></TR>\
+ <TR><TD><input type=text name=Param value=\"\" size=20></TD>\
+ <TD><input type=text name=Value value=\"\" size=40></TD>\
+ </TR></TABLE><input type=submit value=\"Set\"></FORM>"
+ }
+ } else if (MENU[2] == "SaveConfig") {
+ for (i in config)
+ printf("%s %s\n", i, config[i]) > ConfigFile
+ close(ConfigFile)
+ Document = "Configuration has been saved."
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/statist.awk b/contrib/awk/awklib/eg/network/statist.awk
new file mode 100644
index 000000000000..8a583940ef74
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/statist.awk
@@ -0,0 +1,85 @@
+function SetUpServer() {
+ TopHeader = "<HTML><title>Statistics with GAWK</title>"
+ TopDoc = "<BODY>\
+ <h2>Please choose one of the following actions:</h2>\
+ <UL>\
+ <LI><A HREF=" MyPrefix "/AboutServer>About this server</A></LI>\
+ <LI><A HREF=" MyPrefix "/EnterParameters>Enter Parameters</A></LI>\
+ </UL>"
+ TopFooter = "</BODY></HTML>"
+ GnuPlot = "gnuplot 2>&1"
+ m1=m2=0; v1=v2=1; n1=n2=10
+}
+function HandleGET() {
+ if(MENU[2] == "AboutServer") {
+ Document = "This is a GUI for a statistical computation.\
+ It compares means and variances of two distributions.\
+ It is implemented as one GAWK script and uses GNUPLOT."
+ } else if (MENU[2] == "EnterParameters") {
+ Document = ""
+ if ("m1" in GETARG) { # are there parameters to compare?
+ Document = Document "<SCRIPT LANGUAGE=\"JavaScript\">\
+ setTimeout(\"window.open(\\\"" MyPrefix "/Image" systime()\
+ "\\\",\\\"dist\\\", \\\"status=no\\\");\", 1000); </SCRIPT>"
+ m1 = GETARG["m1"]; v1 = GETARG["v1"]; n1 = GETARG["n1"]
+ m2 = GETARG["m2"]; v2 = GETARG["v2"]; n2 = GETARG["n2"]
+ t = (m1-m2)/sqrt(v1/n1+v2/n2)
+ df = (v1/n1+v2/n2)*(v1/n1+v2/n2)/((v1/n1)*(v1/n1)/(n1-1) \
+ + (v2/n2)*(v2/n2) /(n2-1))
+ if (v1>v2) {
+ f = v1/v2
+ df1 = n1 - 1
+ df2 = n2 - 1
+ } else {
+ f = v2/v1
+ df1 = n2 - 1
+ df2 = n1 - 1
+ }
+ print "pt=ibeta(" df/2 ",0.5," df/(df+t*t) ")" |& GnuPlot
+ print "pF=2.0*ibeta(" df2/2 "," df1/2 "," \
+ df2/(df2+df1*f) ")" |& GnuPlot
+ print "print pt, pF" |& GnuPlot
+ RS="\n"; GnuPlot |& getline; RS="\r\n" # $1 is pt, $2 is pF
+ print "invsqrt2pi=1.0/sqrt(2.0*pi)" |& GnuPlot
+ print "nd(x)=invsqrt2pi/sd*exp(-0.5*((x-mu)/sd)**2)" |& GnuPlot
+ print "set term png small color" |& GnuPlot
+ #print "set term postscript color" |& GnuPlot
+ #print "set term gif medium size 320,240" |& GnuPlot
+ print "set yrange[-0.3:]" |& GnuPlot
+ print "set label 'p(m1=m2) =" $1 "' at 0,-0.1 left" |& GnuPlot
+ print "set label 'p(v1=v2) =" $2 "' at 0,-0.2 left" |& GnuPlot
+ print "plot mu=" m1 ",sd=" sqrt(v1) ", nd(x) title 'sample 1',\
+ mu=" m2 ",sd=" sqrt(v2) ", nd(x) title 'sample 2'" |& GnuPlot
+ print "quit" |& GnuPlot
+ GnuPlot |& getline Image
+ while ((GnuPlot |& getline) > 0)
+ Image = Image RS $0
+ close(GnuPlot)
+ }
+ Document = Document "\
+ <h3>Do these samples have the same Gaussian distribution?</h3>\
+ <FORM METHOD=GET> <TABLE BORDER CELLPADDING=5>\
+ <TR>\
+ <TD>1. Mean </TD>
+ <TD><input type=text name=m1 value=" m1 " size=8></TD>\
+ <TD>1. Variance</TD>
+ <TD><input type=text name=v1 value=" v1 " size=8></TD>\
+ <TD>1. Count </TD>
+ <TD><input type=text name=n1 value=" n1 " size=8></TD>\
+ </TR><TR>\
+ <TD>2. Mean </TD>
+ <TD><input type=text name=m2 value=" m2 " size=8></TD>\
+ <TD>2. Variance</TD>
+ <TD><input type=text name=v2 value=" v2 " size=8></TD>\
+ <TD>2. Count </TD>
+ <TD><input type=text name=n2 value=" n2 " size=8></TD>\
+ </TR> <input type=submit value=\"Compute\">\
+ </TABLE></FORM><BR>"
+ } else if (MENU[2] ~ "Image") {
+ Reason = "OK" ORS "Content-type: image/png"
+ #Reason = "OK" ORS "Content-type: application/x-postscript"
+ #Reason = "OK" ORS "Content-type: image/gif"
+ Header = Footer = ""
+ Document = Image
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/stoxdata.txt b/contrib/awk/awklib/eg/network/stoxdata.txt
new file mode 100644
index 000000000000..1b6d015eef16
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/stoxdata.txt
@@ -0,0 +1,4 @@
+Date,Open,High,Low,Close,Volume
+9-Oct-00,22.75,22.75,21.375,22.375,7888500
+6-Oct-00,23.8125,24.9375,21.5625,22,10701100
+5-Oct-00,24.4375,24.625,23.125,23.50,5810300
diff --git a/contrib/awk/awklib/eg/network/stoxpred.awk b/contrib/awk/awklib/eg/network/stoxpred.awk
new file mode 100644
index 000000000000..5cdc2a8d65a2
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/stoxpred.awk
@@ -0,0 +1,116 @@
+function ReadQuotes() {
+ # Retrieve historical data for each ticker symbol
+ FS = ","
+ for (stock = 1; stock <= StockCount; stock++) {
+ URL = "http://chart.yahoo.com/table.csv?s=" name[stock] \
+ "&a=" month "&b=" day "&c=" year-1 \
+ "&d=" month "&e=" day "&f=" year \
+ "g=d&q=q&y=0&z=" name[stock] "&x=.csv"
+ printf("GET " URL " HTTP/1.0\r\n\r\n") |& YahooData
+ while ((YahooData |& getline) > 0) {
+ if (NF == 6 && $1 ~ /Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec/) {
+ if (stock == 1)
+ days[++daycount] = $1;
+ quote[$1, stock] = $5
+ }
+ }
+ close(YahooData)
+ }
+ FS = " "
+}
+function CleanUp() {
+ # clean up time series; eliminate incomplete data sets
+ for (d = 1; d <= daycount; d++) {
+ for (stock = 1; stock <= StockCount; stock++)
+ if (! ((days[d], stock) in quote))
+ stock = StockCount + 10
+ if (stock > StockCount + 1)
+ continue
+ datacount++
+ for (stock = 1; stock <= StockCount; stock++)
+ data[datacount, stock] = int(0.5 + quote[days[d], stock])
+ }
+ delete quote
+ delete days
+}
+function Prediction() {
+ # Predict each ticker symbol by prolonging yesterday's trend
+ for (stock = 1; stock <= StockCount; stock++) {
+ if (data[1, stock] > data[2, stock]) {
+ predict[stock] = "up"
+ } else if (data[1, stock] < data[2, stock]) {
+ predict[stock] = "down"
+ } else {
+ predict[stock] = "neutral"
+ }
+ if ((data[1, stock] > data[2, stock]) && (data[2, stock] > data[3, stock]))
+ hot[stock] = 1
+ if ((data[1, stock] < data[2, stock]) && (data[2, stock] < data[3, stock]))
+ avoid[stock] = 1
+ }
+ # Do a plausibility check: how many predictions proved correct?
+ for (s = 1; s <= StockCount; s++) {
+ for (d = 1; d <= datacount-2; d++) {
+ if (data[d+1, s] > data[d+2, s]) {
+ UpCount++
+ } else if (data[d+1, s] < data[d+2, s]) {
+ DownCount++
+ } else {
+ NeutralCount++
+ }
+ if (((data[d, s] > data[d+1, s]) && (data[d+1, s] > data[d+2, s])) ||
+ ((data[d, s] < data[d+1, s]) && (data[d+1, s] < data[d+2, s])) ||
+ ((data[d, s] == data[d+1, s]) && (data[d+1, s] == data[d+2, s])))
+ CorrectCount++
+ }
+ }
+}
+function Report() {
+ # Generate report
+ report = "\nThis is your daily "
+ report = report "stock market report for "strftime("%A, %B %d, %Y")".\n"
+ report = report "Here are the predictions for today:\n\n"
+ for (stock = 1; stock <= StockCount; stock++)
+ report = report "\t" name[stock] "\t" predict[stock] "\n"
+ for (stock in hot) {
+ if (HotCount++ == 0)
+ report = report "\nThe most promising shares for today are these:\n\n"
+ report = report "\t" name[stock] "\t\thttp://biz.yahoo.com/n/" \
+ tolower(substr(name[stock], 1, 1)) "/" tolower(name[stock]) ".html\n"
+ }
+ for (stock in avoid) {
+ if (AvoidCount++ == 0)
+ report = report "\nThe stock shares to avoid today are these:\n\n"
+ report = report "\t" name[stock] "\t\thttp://biz.yahoo.com/n/" \
+ tolower(substr(name[stock], 1, 1)) "/" tolower(name[stock]) ".html\n"
+ }
+ report = report "\nThis sums up to " HotCount+0 " winners and " AvoidCount+0
+ report = report " losers. When using this kind\nof prediction scheme for"
+ report = report " the 12 months which lie behind us,\nwe get " UpCount
+ report = report " 'ups' and " DownCount " 'downs' and " NeutralCount
+ report = report " 'neutrals'. Of all\nthese " UpCount+DownCount+NeutralCount
+ report = report " predictions " CorrectCount " proved correct next day.\n"
+ report = report "A success rate of "\
+ int(100*CorrectCount/(UpCount+DownCount+NeutralCount)) "%.\n"
+ report = report "Random choice would have produced a 33% success rate.\n"
+ report = report "Disclaimer: Like every other prediction of the stock\n"
+ report = report "market, this report is, of course, complete nonsense.\n"
+ report = report "If you are stupid enough to believe these predictions\n"
+ report = report "you should visit a doctor who can treat your ailment."
+}
+function SendMail() {
+ # send report to customers
+ customer["uncle.scrooge@ducktown.gov"] = "Uncle Scrooge"
+ customer["more@utopia.org" ] = "Sir Thomas More"
+ customer["spinoza@denhaag.nl" ] = "Baruch de Spinoza"
+ customer["marx@highgate.uk" ] = "Karl Marx"
+ customer["keynes@the.long.run" ] = "John Maynard Keynes"
+ customer["bierce@devil.hell.org" ] = "Ambrose Bierce"
+ customer["laplace@paris.fr" ] = "Pierre Simon de Laplace"
+ for (c in customer) {
+ MailPipe = "mail -s 'Daily Stock Prediction Newsletter'" c
+ print "Good morning " customer[c] "," | MailPipe
+ print report "\n.\n" | MailPipe
+ close(MailPipe)
+ }
+}
diff --git a/contrib/awk/awklib/eg/network/testserv.awk b/contrib/awk/awklib/eg/network/testserv.awk
new file mode 100644
index 000000000000..812bfe6a617a
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/testserv.awk
@@ -0,0 +1,12 @@
+BEGIN {
+ CGI_setup("GET",
+ "http://www.gnu.org/cgi-bin/foo?p1=stuff&p2=stuff%26junk" \
+ "&percent=a %25 sign",
+ "1.0")
+ for (i in MENU)
+ printf "MENU[\"%s\"] = %s\n", i, MENU[i]
+ for (i in PARAM)
+ printf "PARAM[\"%s\"] = %s\n", i, PARAM[i]
+ for (i in GETARG)
+ printf "GETARG[\"%s\"] = %s\n", i, GETARG[i]
+}
diff --git a/contrib/awk/awklib/eg/network/urlchk.awk b/contrib/awk/awklib/eg/network/urlchk.awk
new file mode 100644
index 000000000000..6ddedfa854df
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/urlchk.awk
@@ -0,0 +1,28 @@
+BEGIN {
+ if (ARGC != 2) {
+ print "URLCHK - check if URLs have changed"
+ print "IN:\n the file with URLs as a command-line parameter"
+ print " file contains URL, old length, new length"
+ print "PARAMS:\n -v Proxy=MyProxy -v ProxyPort=8080"
+ print "OUT:\n same as file with URLs"
+ print "JK 02.03.1998"
+ exit
+ }
+ URLfile = ARGV[1]; ARGV[1] = ""
+ if (Proxy != "") Proxy = " -v Proxy=" Proxy
+ if (ProxyPort != "") ProxyPort = " -v ProxyPort=" ProxyPort
+ while ((getline < URLfile) > 0)
+ Length[$1] = $3 + 0
+ close(URLfile) # now, URLfile is read in and can be updated
+ GetHeader = "gawk " Proxy ProxyPort " -v Method=\"HEAD\" -f geturl.awk "
+ for (i in Length) {
+ GetThisHeader = GetHeader i " 2>&1"
+ while ((GetThisHeader | getline) > 0)
+ if (toupper($0) ~ /CONTENT-LENGTH/) NewLength = $2 + 0
+ close(GetThisHeader)
+ print i, Length[i], NewLength > URLfile
+ if (Length[i] != NewLength) # report only changed URLs
+ print i, Length[i], NewLength
+ }
+ close(URLfile)
+}
diff --git a/contrib/awk/awklib/eg/network/webgrab.awk b/contrib/awk/awklib/eg/network/webgrab.awk
new file mode 100644
index 000000000000..41738805afb2
--- /dev/null
+++ b/contrib/awk/awklib/eg/network/webgrab.awk
@@ -0,0 +1,6 @@
+BEGIN { RS = "http://[#%&\\+\\-\\./0-9\\:;\\?A-Z_a-z\\~]*" }
+RT != "" {
+ command = ("gawk -v Proxy=MyProxy -f geturl.awk " RT \
+ " > doc" NR ".html")
+ print command
+}
diff --git a/contrib/awk/awklib/eg/prog/alarm.awk b/contrib/awk/awklib/eg/prog/alarm.awk
index e158e451f6ea..26252fa1a820 100644
--- a/contrib/awk/awklib/eg/prog/alarm.awk
+++ b/contrib/awk/awklib/eg/prog/alarm.awk
@@ -1,4 +1,7 @@
-# alarm --- set an alarm
+# alarm.awk --- set an alarm
+#
+# Requires gettimeofday library function
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
@@ -11,7 +14,8 @@ BEGIN \
usage2 = sprintf("\t(%s) time ::= hh:mm", ARGV[1])
if (ARGC < 2) {
- print usage > "/dev/stderr"
+ print usage1 > "/dev/stderr"
+ print usage2 > "/dev/stderr"
exit 1
} else if (ARGC == 5) {
delay = ARGV[4] + 0
@@ -37,7 +41,7 @@ BEGIN \
message = sprintf("\aIt is now %s!\a", ARGV[1])
else if (index(message, "\a") == 0)
message = "\a" message "\a"
- # split up dest time
+ # split up alarm time
split(ARGV[1], atime, ":")
hour = atime[1] + 0 # force numeric
minute = atime[2] + 0 # force numeric
diff --git a/contrib/awk/awklib/eg/prog/awksed.awk b/contrib/awk/awklib/eg/prog/awksed.awk
index 1795b24b3e4e..4b188c64d0a9 100644
--- a/contrib/awk/awklib/eg/prog/awksed.awk
+++ b/contrib/awk/awklib/eg/prog/awksed.awk
@@ -1,6 +1,6 @@
# awksed.awk --- do s/foo/bar/g using just print
# Thanks to Michael Brennan for the idea
-
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# August 1995
diff --git a/contrib/awk/awklib/eg/prog/cut.awk b/contrib/awk/awklib/eg/prog/cut.awk
index 6e2dd064e310..d9c6c9b945f0 100644
--- a/contrib/awk/awklib/eg/prog/cut.awk
+++ b/contrib/awk/awklib/eg/prog/cut.awk
@@ -1,13 +1,16 @@
# cut.awk --- implement cut in awk
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Options:
-# -f list Cut fields
-# -d c Field delimiter character
-# -c list Cut characters
+# -f list Cut fields
+# -d c Field delimiter character
+# -c list Cut characters
+#
+# -s Suppress lines without the delimiter
#
-# -s Suppress lines without the delimiter character
+# Requires getopt and join library functions
function usage( e1, e2)
{
@@ -122,7 +125,7 @@ function set_charlist( field, i, j, f, g, t,
nfields = j - 1
}
{
- if (by_fields && suppress && $0 !~ FS)
+ if (by_fields && suppress && index($0, FS) != 0)
next
for (i = 1; i <= nfields; i++) {
diff --git a/contrib/awk/awklib/eg/prog/dupword.awk b/contrib/awk/awklib/eg/prog/dupword.awk
index 9a518a164983..a2cc7d2b2b12 100644
--- a/contrib/awk/awklib/eg/prog/dupword.awk
+++ b/contrib/awk/awklib/eg/prog/dupword.awk
@@ -1,10 +1,15 @@
-# dupword --- find duplicate words in text
+# dupword.awk --- find duplicate words in text
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# December 1991
+# Revised October 2000
{
$0 = tolower($0)
- gsub(/[^A-Za-z0-9 \t]/, "");
+ gsub(/[^[:alnum:][:blank:]]/, " ");
+ $0 = $0 # re-split
+ if (NF == 0)
+ next
if ($1 == prev)
printf("%s:%d: duplicate %s\n",
FILENAME, FNR, $1)
diff --git a/contrib/awk/awklib/eg/prog/egrep.awk b/contrib/awk/awklib/eg/prog/egrep.awk
index 06762a1f7a87..73f175ca6ce5 100644
--- a/contrib/awk/awklib/eg/prog/egrep.awk
+++ b/contrib/awk/awklib/eg/prog/egrep.awk
@@ -1,4 +1,5 @@
# egrep.awk --- simulate egrep in awk
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
@@ -9,6 +10,8 @@
# -i ignore case
# -l print filenames only
# -e argument is pattern
+#
+# Requires getopt and file transition library functions
BEGIN {
while ((c = getopt(ARGC, ARGV, "ce:svil")) != -1) {
@@ -69,18 +72,20 @@ function endfile(file)
if (! matches)
next
- if (no_print && ! count_only)
- nextfile
+ if (! count_only) {
+ if (no_print)
+ nextfile
- if (filenames_only && ! count_only) {
- print FILENAME
- nextfile
- }
+ if (filenames_only) {
+ print FILENAME
+ nextfile
+ }
- if (do_filenames && ! count_only)
- print FILENAME ":" $0
- else if (! count_only)
- print
+ if (do_filenames)
+ print FILENAME ":" $0
+ else
+ print
+ }
}
END \
{
@@ -91,6 +96,7 @@ END \
function usage( e)
{
e = "Usage: egrep [-csvil] [-e pat] [files ...]"
+ e = e "\n\tegrep [-csvil] pat [files ...]"
print e > "/dev/stderr"
exit 1
}
diff --git a/contrib/awk/awklib/eg/prog/extract.awk b/contrib/awk/awklib/eg/prog/extract.awk
index 65f3f2d29265..5cb191ae1cd9 100644
--- a/contrib/awk/awklib/eg/prog/extract.awk
+++ b/contrib/awk/awklib/eg/prog/extract.awk
@@ -1,6 +1,9 @@
# extract.awk --- extract files and run programs
# from texinfo files
-# Arnold Robbins, arnold@gnu.org, Public Domain, May 1993
+#
+# Arnold Robbins, arnold@gnu.org, Public Domain
+# May 1993
+# Revised September 2000
BEGIN { IGNORECASE = 1 }
@@ -41,6 +44,8 @@ BEGIN { IGNORECASE = 1 }
break
else if (line ~ /^@(end[ \t]+)?group/)
continue
+ else if (line ~ /^@c(omment+)?[ \t]+/)
+ continue
if (index(line, "@") == 0) {
print line > curfile
continue
@@ -58,9 +63,8 @@ BEGIN { IGNORECASE = 1 }
print join(a, 1, n, SUBSEP) > curfile
}
}
-function unexpected_eof()
-{
- printf("%s:%d: unexpected EOF or error\n", \
+function unexpected_eof() {
+ printf("%s:%d: unexpected EOF or error\n",
FILENAME, FNR) > "/dev/stderr"
exit 1
}
diff --git a/contrib/awk/awklib/eg/prog/guide.awk b/contrib/awk/awklib/eg/prog/guide.awk
new file mode 100644
index 000000000000..a2dea1b7f64a
--- /dev/null
+++ b/contrib/awk/awklib/eg/prog/guide.awk
@@ -0,0 +1,7 @@
+BEGIN {
+ TEXTDOMAIN = "guide"
+ bindtextdomain(".") # for testing
+ print _"Don't Panic"
+ print _"The Answer Is", 42
+ print "Pardon me, Zaphod who?"
+}
diff --git a/contrib/awk/awklib/eg/prog/histsort.awk b/contrib/awk/awklib/eg/prog/histsort.awk
index 48186d0b6f5e..c0a9165a12e3 100644
--- a/contrib/awk/awklib/eg/prog/histsort.awk
+++ b/contrib/awk/awklib/eg/prog/histsort.awk
@@ -1,8 +1,9 @@
# histsort.awk --- compact a shell history file
+# Thanks to Byron Rakitzis for the general idea
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
-# Thanks to Byron Rakitzis for the general idea
{
if (data[$0]++ == 0)
lines[++count] = $0
diff --git a/contrib/awk/awklib/eg/prog/id.awk b/contrib/awk/awklib/eg/prog/id.awk
index a983c572bd2b..af78f7600a96 100644
--- a/contrib/awk/awklib/eg/prog/id.awk
+++ b/contrib/awk/awklib/eg/prog/id.awk
@@ -1,6 +1,10 @@
# id.awk --- implement id in awk
+#
+# Requires user and group library functions
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
+# Revised February 1996
# output is:
# uid=12(foo) euid=34(bar) gid=3(baz) \
@@ -8,17 +12,10 @@
BEGIN \
{
- if ((getline < "/dev/user") < 0) {
- err = "id: no /dev/user support - cannot run"
- print err > "/dev/stderr"
- exit 1
- }
- close("/dev/user")
-
- uid = $1
- euid = $2
- gid = $3
- egid = $4
+ uid = PROCINFO["uid"]
+ euid = PROCINFO["euid"]
+ gid = PROCINFO["gid"]
+ egid = PROCINFO["egid"]
printf("uid=%d", uid)
pw = getpwuid(uid)
@@ -52,18 +49,19 @@ BEGIN \
}
}
- if (NF > 4) {
- printf(" groups=");
- for (i = 5; i <= NF; i++) {
- printf("%d", $i)
- pw = getgrgid($i)
- if (pw != "") {
- split(pw, a, ":")
- printf("(%s)", a[1])
- }
- if (i < NF)
- printf(",")
+ for (i = 1; ("group" i) in PROCINFO; i++) {
+ if (i == 1)
+ printf(" groups=")
+ group = PROCINFO["group" i]
+ printf("%d", group)
+ pw = getgrgid(group)
+ if (pw != "") {
+ split(pw, a, ":")
+ printf("(%s)", a[1])
}
+ if (("group" (i+1)) in PROCINFO)
+ printf(",")
}
+
print ""
}
diff --git a/contrib/awk/awklib/eg/prog/igawk.sh b/contrib/awk/awklib/eg/prog/igawk.sh
index 6fb70c381881..7144ce50464f 100644
--- a/contrib/awk/awklib/eg/prog/igawk.sh
+++ b/contrib/awk/awklib/eg/prog/igawk.sh
@@ -1,6 +1,6 @@
#! /bin/sh
-
# igawk --- like gawk but do @include processing
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# July 1993
@@ -37,15 +37,15 @@ do
f=`echo "$1" | sed 's/-.file=//'`
echo @include "$f" >> /tmp/ig.s.$$ ;;
- -?file) # get arg, $2
+ -?file) # get arg, $2
echo @include "$2" >> /tmp/ig.s.$$
shift;;
- -?source=*) # -Wsource or --source
+ -?source=*) # -Wsource or --source
t=`echo "$1" | sed 's/-.source=//'`
echo "$t" >> /tmp/ig.s.$$ ;;
- -?source) # get arg, $2
+ -?source) # get arg, $2
echo "$2" >> /tmp/ig.s.$$
shift;;
@@ -54,7 +54,7 @@ do
gawk --version
exit 0 ;;
- -[W-]*) opts="$opts '$1'" ;;
+ -[W-]*) opts="$opts '$1'" ;;
*) break;;
esac
@@ -76,6 +76,7 @@ fi
# at this point, /tmp/ig.s.$$ has the program
gawk -- '
# process @include directives
+
function pathto(file, i, t, junk)
{
if (index(file, "/") != 0)
@@ -109,16 +110,16 @@ BEGIN {
}
fpath = pathto($2)
if (fpath == "") {
- printf("igawk:%s:%d: cannot find %s\n", \
+ printf("igawk:%s:%d: cannot find %s\n",
input[stackptr], FNR, $2) > "/dev/stderr"
continue
}
if (! (fpath in processed)) {
processed[fpath] = input[stackptr]
- input[++stackptr] = fpath
+ input[++stackptr] = fpath # push onto stack
} else
- print $2, "included in", input[stackptr], \
- "already included in", \
+ print $2, "included in", input[stackptr],
+ "already included in",
processed[fpath] > "/dev/stderr"
}
close(input[stackptr])
diff --git a/contrib/awk/awklib/eg/prog/labels.awk b/contrib/awk/awklib/eg/prog/labels.awk
index 3c69751ad6c5..fa9c4dab5388 100644
--- a/contrib/awk/awklib/eg/prog/labels.awk
+++ b/contrib/awk/awklib/eg/prog/labels.awk
@@ -1,10 +1,11 @@
-# labels.awk
+# labels.awk --- print mailing labels
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# June 1992
-# Program to print labels. Each label is 5 lines of data
-# that may have blank lines. The label sheets have 2
-# blank lines at the top and 2 at the bottom.
+# Each label is 5 lines of data that may have blank lines.
+# The label sheets have 2 blank lines at the top and 2 at
+# the bottom.
BEGIN { RS = "" ; MAXLINES = 100 }
diff --git a/contrib/awk/awklib/eg/prog/split.awk b/contrib/awk/awklib/eg/prog/split.awk
index 863ba4e41821..2906a8531512 100644
--- a/contrib/awk/awklib/eg/prog/split.awk
+++ b/contrib/awk/awklib/eg/prog/split.awk
@@ -1,4 +1,7 @@
# split.awk --- do split in awk
+#
+# Requires ord and chr library functions
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
@@ -32,13 +35,14 @@ BEGIN {
close(out)
if (s2 == "z") {
if (s1 == "z") {
- printf("split: %s is too large to split\n", \
+ printf("split: %s is too large to split\n",
FILENAME) > "/dev/stderr"
exit 1
}
s1 = chr(ord(s1) + 1)
s2 = "a"
- } else
+ }
+ else
s2 = chr(ord(s2) + 1)
out = (outfile s1 s2)
tcount = 1
diff --git a/contrib/awk/awklib/eg/prog/tee.awk b/contrib/awk/awklib/eg/prog/tee.awk
index 4c12c56d3ccf..eafc4b9ae7b7 100644
--- a/contrib/awk/awklib/eg/prog/tee.awk
+++ b/contrib/awk/awklib/eg/prog/tee.awk
@@ -1,4 +1,5 @@
# tee.awk --- tee in awk
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
# Revised December 1995
diff --git a/contrib/awk/awklib/eg/prog/testbits.awk b/contrib/awk/awklib/eg/prog/testbits.awk
new file mode 100644
index 000000000000..143cd9167c74
--- /dev/null
+++ b/contrib/awk/awklib/eg/prog/testbits.awk
@@ -0,0 +1,27 @@
+# bits2str --- turn a byte into readable 1's and 0's
+
+function bits2str(bits, data, mask)
+{
+ if (bits == 0)
+ return "0"
+
+ mask = 1
+ for (; bits != 0; bits = rshift(bits, 1))
+ data = (and(bits, mask) ? "1" : "0") data
+
+ while ((length(data) % 8) != 0)
+ data = "0" data
+
+ return data
+}
+BEGIN {
+ printf "123 = %s\n", bits2str(123)
+ printf "0123 = %s\n", bits2str(0123)
+ printf "0x99 = %s\n", bits2str(0x99)
+ comp = compl(0x99)
+ printf "compl(0x99) = %#x = %s\n", comp, bits2str(comp)
+ shift = lshift(0x99, 2)
+ printf "lshift(0x99, 2) = %#x = %s\n", shift, bits2str(shift)
+ shift = rshift(0x99, 2)
+ printf "rshift(0x99, 2) = %#x = %s\n", shift, bits2str(shift)
+}
diff --git a/contrib/awk/awklib/eg/prog/translate.awk b/contrib/awk/awklib/eg/prog/translate.awk
index 97c4ada6e8b0..803700c44d4d 100644
--- a/contrib/awk/awklib/eg/prog/translate.awk
+++ b/contrib/awk/awklib/eg/prog/translate.awk
@@ -1,8 +1,9 @@
-# translate --- do tr like stuff
+# translate.awk --- do tr-like stuff
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# August 1989
-# bugs: does not handle things like: tr A-Z a-z, it has
+# Bugs: does not handle things like: tr A-Z a-z, it has
# to be spelled out. However, if `to' is shorter than `from',
# the last character in `to' is used for the rest of `from'.
diff --git a/contrib/awk/awklib/eg/prog/uniq.awk b/contrib/awk/awklib/eg/prog/uniq.awk
index d97eecca4f20..cfb50c79789b 100644
--- a/contrib/awk/awklib/eg/prog/uniq.awk
+++ b/contrib/awk/awklib/eg/prog/uniq.awk
@@ -1,4 +1,7 @@
# uniq.awk --- do uniq in awk
+#
+# Requires getopt and join library functions
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
@@ -81,7 +84,7 @@ NR == 1 {
last = $0
next
}
-
+
{
equal = are_equal()
diff --git a/contrib/awk/awklib/eg/prog/wc.awk b/contrib/awk/awklib/eg/prog/wc.awk
index 56aab429d949..f46616b906a0 100644
--- a/contrib/awk/awklib/eg/prog/wc.awk
+++ b/contrib/awk/awklib/eg/prog/wc.awk
@@ -1,4 +1,5 @@
# wc.awk --- count lines, words, characters
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
@@ -8,6 +9,8 @@
# -c only count characters
#
# Default is to count lines, words, characters
+#
+# Requires getopt and file transition library functions
BEGIN {
# let getopt print a message about
@@ -29,11 +32,11 @@ BEGIN {
print_total = (ARGC - i > 2)
}
-function beginfile(file) {
+function beginfile(file)
+{
chars = lines = words = 0
fname = FILENAME
}
-
function endfile(file)
{
tchars += chars
@@ -53,7 +56,6 @@ function endfile(file)
lines++
words += NF
}
-
END {
if (print_total) {
if (do_lines)
diff --git a/contrib/awk/awklib/eg/prog/wordfreq.awk b/contrib/awk/awklib/eg/prog/wordfreq.awk
index b67fed472fb3..62db5cfa1c00 100644
--- a/contrib/awk/awklib/eg/prog/wordfreq.awk
+++ b/contrib/awk/awklib/eg/prog/wordfreq.awk
@@ -1,10 +1,17 @@
-# Print list of word frequencies
+# wordfreq.awk --- print list of word frequencies
+
{
$0 = tolower($0) # remove case distinctions
- gsub(/[^a-z0-9_ \t]/, "", $0) # remove punctuation
+ # remove punctuation
+ gsub(/[^[:alnum:]_[:blank:]]/, "", $0)
for (i = 1; i <= NF; i++)
freq[$i]++
}
+
+END {
+ for (word in freq)
+ printf "%s\t%d\n", word, freq[word]
+}
END {
sort = "sort +1 -nr"
for (word in freq)
diff --git a/contrib/awk/awklib/extract.awk b/contrib/awk/awklib/extract.awk
index e18a1ad90997..1b052e738b69 100644
--- a/contrib/awk/awklib/extract.awk
+++ b/contrib/awk/awklib/extract.awk
@@ -1,7 +1,9 @@
# extract.awk --- extract files and run programs
# from texinfo files
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
+# Revised September 2000
BEGIN { IGNORECASE = 1 }
@@ -42,6 +44,8 @@ BEGIN { IGNORECASE = 1 }
break
else if (line ~ /^@(end[ \t]+)?group/)
continue
+ else if (line ~ /^@c(omment+)?[ \t]+/)
+ continue
if (index(line, "@") == 0) {
print line > curfile
continue
@@ -61,7 +65,7 @@ BEGIN { IGNORECASE = 1 }
}
function unexpected_eof()
{
- printf("%s:%d: unexpected EOF or error\n", \
+ printf("%s:%d: unexpected EOF or error\n",
FILENAME, FNR) > "/dev/stderr"
exit 1
}
@@ -71,6 +75,7 @@ END {
close(curfile)
}
# join.awk --- join an array into a string
+#
# Arnold Robbins, arnold@gnu.org, Public Domain
# May 1993
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index 499e05504474..10f8b49fbd56 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -25,6 +25,9 @@
#include "awk.h"
+#if defined(HAVE_FCNTL_H)
+#include <fcntl.h>
+#endif
#undef HUGE
#undef CHARBITS
#undef INTBITS
@@ -32,16 +35,15 @@
#include "random.h"
/* can declare these, since we always use the random shipped with gawk */
-extern char *initstate P((unsigned seed, char *state, int n));
+extern char *initstate P((unsigned long seed, char *state, long n));
extern char *setstate P((char *state));
extern long random P((void));
-extern void srandom P((unsigned int seed));
+extern void srandom P((unsigned long seed));
extern NODE **fields_arr;
extern int output_is_tty;
static NODE *sub_common P((NODE *tree, int how_many, int backdigs));
-NODE *format_tree P((const char *, int, NODE *));
#ifdef _CRAY
/* Work around a problem in conversion of doubles to exact integers. */
@@ -81,20 +83,20 @@ static void efwrite P((const void *ptr, size_t size, size_t count, FILE *fp,
/* efwrite --- like fwrite, but with error checking */
static void
-efwrite(ptr, size, count, fp, from, rp, flush)
-const void *ptr;
-size_t size, count;
-FILE *fp;
-const char *from;
-struct redirect *rp;
-int flush;
+efwrite(const void *ptr,
+ size_t size,
+ size_t count,
+ FILE *fp,
+ const char *from,
+ struct redirect *rp,
+ int flush)
{
errno = 0;
if (fwrite(ptr, size, count, fp) != count)
goto wrerror;
if (flush
&& ((fp == stdout && output_is_tty)
- || (rp && (rp->flag & RED_NOBUF)))) {
+ || (rp != NULL && (rp->flag & RED_NOBUF)))) {
fflush(fp);
if (ferror(fp))
goto wrerror;
@@ -102,27 +104,28 @@ int flush;
return;
wrerror:
- fatal("%s to \"%s\" failed (%s)", from,
- rp ? rp->value : "standard output",
- errno ? strerror(errno) : "reason unknown");
+ fatal(_("%s to \"%s\" failed (%s)"), from,
+ rp ? rp->value : _("standard output"),
+ errno ? strerror(errno) : _("reason unknown"));
}
/* do_exp --- exponential function */
NODE *
-do_exp(tree)
-NODE *tree;
+do_exp(NODE *tree)
{
NODE *tmp;
double d, res;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("exp: received non-numeric argument"));
d = force_number(tmp);
free_temp(tmp);
errno = 0;
res = exp(d);
if (errno == ERANGE)
- warning("exp argument %g is out of range", d);
+ warning(_("exp: argument %g is out of range"), d);
return tmp_number((AWKNUM) res);
}
@@ -135,9 +138,7 @@ NODE *tree;
*/
static FILE *
-stdfile(name, len)
-char *name;
-size_t len;
+stdfile(char *name, size_t len)
{
if (len == 11) {
if (STREQN(name, "/dev/stderr", 11))
@@ -152,8 +153,7 @@ size_t len;
/* do_fflush --- flush output, either named file or pipe or everything */
NODE *
-do_fflush(tree)
-NODE *tree;
+do_fflush(NODE *tree)
{
struct redirect *rp;
NODE *tmp;
@@ -179,14 +179,15 @@ NODE *tree;
}
rp = getredirect(tmp->stptr, tmp->stlen);
- status = 1;
+ status = -1;
if (rp != NULL) {
if ((rp->flag & (RED_WRITE|RED_APPEND)) == 0) {
- /* if (do_lint) */
- warning(
- "fflush: cannot flush: %s `%s' opened for reading, not writing",
- (rp->flag & RED_PIPE) ? "pipe" : "file",
- file);
+ if (rp->flag & RED_PIPE)
+ warning(_("fflush: cannot flush: pipe `%s' opened for reading, not writing"),
+ file);
+ else
+ warning(_("fflush: cannot flush: file `%s' opened for reading, not writing"),
+ file);
free_temp(tmp);
return tmp_number((AWKNUM) status);
}
@@ -195,8 +196,10 @@ NODE *tree;
status = fflush(fp);
} else if ((fp = stdfile(tmp->stptr, tmp->stlen)) != NULL) {
status = fflush(fp);
- } else
- warning("fflush: `%s' is not an open file or pipe", file);
+ } else {
+ status = -1;
+ warning(_("fflush: `%s' is not an open file, pipe or co-process"), file);
+ }
free_temp(tmp);
return tmp_number((AWKNUM) status);
}
@@ -204,8 +207,7 @@ NODE *tree;
/* do_index --- find index of a string */
NODE *
-do_index(tree)
-NODE *tree;
+do_index(NODE *tree)
{
NODE *s1, *s2;
register char *p1, *p2;
@@ -215,6 +217,12 @@ NODE *tree;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
+ if (do_lint) {
+ if ((s1->flags & (STRING|STR)) == 0)
+ lintwarn(_("index: received non-string first argument"));
+ if ((s2->flags & (STRING|STR)) == 0)
+ lintwarn(_("index: received non-string second argument"));
+ }
force_string(s1);
force_string(s2);
p1 = s1->stptr;
@@ -228,7 +236,7 @@ NODE *tree;
while (l1 > 0) {
if (l2 > l1)
break;
- if (casetable[(int)*p1] == casetable[(int)*p2]
+ if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2]
&& (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) {
ret = 1 + s1->stlen - l1;
break;
@@ -257,8 +265,7 @@ NODE *tree;
/* double_to_int --- convert double to int, used several places */
double
-double_to_int(d)
-double d;
+double_to_int(double d)
{
if (d >= 0)
d = Floor(d);
@@ -270,13 +277,14 @@ double d;
/* do_int --- convert double to int for awk */
NODE *
-do_int(tree)
-NODE *tree;
+do_int(NODE *tree)
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("int: received non-numeric argument"));
d = force_number(tmp);
d = double_to_int(d);
free_temp(tmp);
@@ -286,13 +294,14 @@ NODE *tree;
/* do_length --- length of a string or $0 */
NODE *
-do_length(tree)
-NODE *tree;
+do_length(NODE *tree)
{
NODE *tmp;
size_t len;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (STRING|STR)) == 0)
+ lintwarn(_("length: received non-string argument"));
len = force_string(tmp)->stlen;
free_temp(tmp);
return tmp_number((AWKNUM) len);
@@ -301,16 +310,17 @@ NODE *tree;
/* do_log --- the log function */
NODE *
-do_log(tree)
-NODE *tree;
+do_log(NODE *tree)
{
NODE *tmp;
double d, arg;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("log: received non-numeric argument"));
arg = (double) force_number(tmp);
if (arg < 0.0)
- warning("log called with negative argument %g", arg);
+ warning(_("log: received negative argument %g"), arg);
d = log(arg);
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -327,10 +337,11 @@ NODE *tree;
*/
NODE *
-format_tree(fmt_string, n0, carg)
-const char *fmt_string;
-int n0;
-register NODE *carg;
+format_tree(
+ const char *fmt_string,
+ int n0,
+ register NODE *carg,
+ int num_args)
{
/* copy 'l' bytes from 's' to 'obufout' checking for space in the process */
/* difference of pointers should be of ptrdiff_t type, but let us be kind */
@@ -369,21 +380,16 @@ register NODE *carg;
osiz *= 2; \
}
-/*
- * Get the next arg to be formatted. If we've run out of args,
- * return "" (Null string)
- */
-#define parse_next_arg() { \
- if (carg == NULL) { \
- toofew = TRUE; \
- break; \
- } else { \
- arg = tree_eval(carg->lnode); \
- carg = carg->rnode; \
- } \
-}
+ static NODE **the_args = 0;
+ static size_t args_size = 0;
+ size_t cur_arg = 0;
+
+ auto NODE **save_args = 0;
+ auto size_t save_args_size = 0;
+ static int call_level = 0;
NODE *r;
+ int i;
int toofew = FALSE;
char *obuf, *obufout;
size_t osiz, ofre;
@@ -391,7 +397,8 @@ register NODE *carg;
const char *s0, *s1;
int cs1;
NODE *arg;
- long fw, prec;
+ long fw, prec, argnum;
+ int used_dollar;
int lj, alt, big, bigbig, small, have_prec, need_format;
long *cur = NULL;
#ifdef sun386 /* Can't cast unsigned (int/long) from ptr->value */
@@ -419,7 +426,79 @@ register NODE *carg;
osiz = INITIAL_OUT_SIZE;
ofre = osiz - 1;
+ /*
+ * Icky problem. If the args make a nested call to printf/sprintf,
+ * we end up clobbering the static variable `the_args'. Not good.
+ * We don't just malloc and free the_args each time, since most of the
+ * time there aren't nested calls. But if this is a nested call,
+ * save the memory pointed to by the_args and allocate a fresh
+ * array. Then free it on end.
+ */
+ if (++call_level > 1) { /* nested */
+ save_args = the_args;
+ save_args_size = args_size;
+
+ args_size = 0; /* force fresh allocation */
+ }
+
+ if (args_size == 0) {
+ /* allocate array */
+ emalloc(the_args, NODE **, (num_args+1) * sizeof(NODE *), "format_tree");
+ args_size = num_args + 1;
+ } else if (num_args + 1 > args_size) {
+ /* grow it */
+ erealloc(the_args, NODE **, (num_args+1) * sizeof(NODE *), "format_tree");
+ args_size = num_args + 1;
+ }
+
+
+ /* fill it in */
+ /*
+ * We ignore the_args[0] since format strings use
+ * 1-based numbers to indicate the arguments. It's
+ * easiest to just convert to int and index, without
+ * having to remember to subtract 1.
+ */
+ memset(the_args, '\0', num_args * sizeof(NODE *));
+ for (i = 1; carg != NULL; i++, carg = carg->rnode) {
+ NODE *tmp;
+
+ /* Here lies the wumpus's other brother. R.I.P. */
+ tmp = tree_eval(carg->lnode);
+ the_args[i] = dupnode(tmp);
+ free_temp(tmp);
+ }
+ assert(i == num_args);
+ cur_arg = 1;
+
+ /*
+ * Check first for use of `count$'.
+ * If plain argument retrieval was used earlier, choke.
+ * Otherwise, return the requested argument.
+ * If not `count$' now, but it was used earlier, choke.
+ * If this format is more than total number of args, choke.
+ * Otherwise, return the current argument.
+ */
+#define parse_next_arg() { \
+ if (argnum > 0) { \
+ if (cur_arg > 1) \
+ fatal(_("must use `count$' on all formats or none")); \
+ arg = the_args[argnum]; \
+ } else if (used_dollar) { \
+ fatal(_("must use `count$' on all formats or none")); \
+ arg = 0; /* shutup the compiler */ \
+ } else if (cur_arg >= num_args) { \
+ arg = 0; /* shutup the compiler */ \
+ toofew = TRUE; \
+ break; \
+ } else { \
+ arg = the_args[cur_arg]; \
+ cur_arg++; \
+ } \
+}
+
need_format = FALSE;
+ used_dollar = FALSE;
s0 = s1 = fmt_string;
while (n0-- > 0) {
@@ -433,6 +512,7 @@ register NODE *carg;
cur = &fw;
fw = 0;
prec = 0;
+ argnum = 0;
have_prec = FALSE;
signchar = FALSE;
zero_flag = FALSE;
@@ -498,12 +578,42 @@ check_pos:
if (n0 == 0) /* badly formatted control string */
continue;
goto retry;
+ case '$':
+ if (do_traditional)
+ fatal(_("`$' is not permitted in awk formats"));
+ if (cur == &fw) {
+ argnum = fw;
+ fw = 0;
+ used_dollar = TRUE;
+ if (argnum <= 0)
+ fatal(_("arg count with `$' must be > 0"));
+ if (argnum >= num_args)
+ fatal(_("arg count %d greater than total number of supplied arguments"), argnum);
+ } else
+ fatal(_("`$' not permitted after period in format"));
+ goto retry;
case '*':
if (cur == NULL)
break;
- parse_next_arg();
+ if (! do_traditional && ISDIGIT(*s1)) {
+ int val = 0;
+
+ for (; n0 > 0 && *s1 && ISDIGIT(*s1); s1++, n0--) {
+ val *= 10;
+ val += *s1 - '0';
+ }
+ if (*s1 != '$') {
+ fatal(_("no `$' supplied for positional field width or precision"));
+ } else {
+ s1++;
+ n0--;
+ }
+
+ arg = the_args[val];
+ } else {
+ parse_next_arg();
+ }
*cur = force_number(arg);
- free_temp(arg);
if (*cur < 0 && cur == &fw) {
*cur = -*cur;
lj++;
@@ -551,11 +661,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- warning("`l' is meaningless in awk formats; ignored");
+ lintwarn(_("`l' is meaningless in awk formats; ignored"));
warned = TRUE;
}
if (do_posix)
- fatal("'l' is not permitted in POSIX awk formats");
+ fatal(_("`l' is not permitted in POSIX awk formats"));
}
big = TRUE;
goto retry;
@@ -566,11 +676,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- warning("`L' is meaningless in awk formats; ignored");
+ lintwarn(_("`L' is meaningless in awk formats; ignored"));
warned = TRUE;
}
if (do_posix)
- fatal("'L' is not permitted in POSIX awk formats");
+ fatal(_("`L' is not permitted in POSIX awk formats"));
}
bigbig = TRUE;
goto retry;
@@ -581,11 +691,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- warning("`h' is meaningless in awk formats; ignored");
+ lintwarn(_("`h' is meaningless in awk formats; ignored"));
warned = TRUE;
}
if (do_posix)
- fatal("'h' is not permitted in POSIX awk formats");
+ fatal(_("`h' is not permitted in POSIX awk formats"));
}
small = TRUE;
goto retry;
@@ -779,7 +889,6 @@ check_pos:
fw--;
}
s0 = s1;
- free_temp(arg);
break;
out_of_range:
@@ -796,7 +905,6 @@ check_pos:
parse_next_arg();
tmpval = force_number(arg);
format_float:
- free_temp(arg);
if (! have_prec)
prec = DEFAULT_G_PRECISION;
chksize(fw + prec + 9); /* 9 == slop */
@@ -836,35 +944,44 @@ check_pos:
}
if (toofew)
fatal("%s\n\t`%s'\n\t%*s%s",
- "not enough arguments to satisfy format string",
- fmt_string, s1 - fmt_string - 2, "",
- "^ ran out for this one"
- );
+ _("not enough arguments to satisfy format string"),
+ fmt_string, s1 - fmt_string - 2, "",
+ _("^ ran out for this one"));
}
if (do_lint) {
if (need_format)
- warning(
- "printf format specifier does not have control letter");
+ lintwarn(
+ _("[s]printf: format specifier does not have control letter"));
if (carg != NULL)
- warning(
- "too many arguments supplied for format string");
+ lintwarn(
+ _("too many arguments supplied for format string"));
}
bchunk(s0, s1 - s0);
r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED);
r->flags |= TEMP;
+
+ for (i = 1; i < num_args; i++) {
+ unref(the_args[i]);
+ }
+
+ if (call_level-- > 1) {
+ free(the_args);
+ the_args = save_args;
+ args_size = save_args_size;
+ }
+
return r;
}
/* do_sprintf --- perform sprintf */
NODE *
-do_sprintf(tree)
-NODE *tree;
+do_sprintf(NODE *tree)
{
NODE *r;
NODE *sfmt = force_string(tree_eval(tree->lnode));
- r = format_tree(sfmt->stptr, sfmt->stlen, tree->rnode);
+ r = format_tree(sfmt->stptr, sfmt->stlen, tree->rnode, tree->printf_count);
free_temp(sfmt);
return r;
}
@@ -872,8 +989,7 @@ NODE *tree;
/* do_printf --- perform printf, including redirection */
void
-do_printf(tree)
-register NODE *tree;
+do_printf(NODE *tree)
{
struct redirect *rp = NULL;
register FILE *fp;
@@ -881,10 +997,10 @@ register NODE *tree;
if (tree->lnode == NULL) {
if (do_traditional) {
if (do_lint)
- warning("printf: no arguments");
+ lintwarn(_("printf: no arguments"));
return; /* bwk accepts it silently */
}
- fatal("printf: no arguments");
+ fatal(_("printf: no arguments"));
}
if (tree->rnode != NULL) {
@@ -899,33 +1015,36 @@ register NODE *tree;
return;
} else
fp = stdout;
+ tree->lnode->printf_count = tree->printf_count;
tree = do_sprintf(tree->lnode);
efwrite(tree->stptr, sizeof(char), tree->stlen, fp, "printf", rp, TRUE);
+ if (rp != NULL && (rp->flag & RED_TWOWAY) != 0)
+ fflush(rp->fp);
free_temp(tree);
}
/* do_sqrt --- do the sqrt function */
NODE *
-do_sqrt(tree)
-NODE *tree;
+do_sqrt(NODE *tree)
{
NODE *tmp;
double arg;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("sqrt: received non-numeric argument"));
arg = (double) force_number(tmp);
free_temp(tmp);
if (arg < 0.0)
- warning("sqrt called with negative argument %g", arg);
+ warning(_("sqrt: called with negative argument %g"), arg);
return tmp_number((AWKNUM) sqrt(arg));
}
/* do_substr --- do the substr function */
NODE *
-do_substr(tree)
-NODE *tree;
+do_substr(NODE *tree)
{
NODE *t1, *t2, *t3;
NODE *r;
@@ -940,13 +1059,13 @@ NODE *tree;
if (d_index < 1.0) {
if (do_lint)
- warning("substr: start index %g invalid, using 1",
- d_index);
+ lintwarn(_("substr: start index %g is invalid, using 1"),
+ d_index);
d_index = 1;
}
if (do_lint && double_to_int(d_index) != d_index)
- warning("substr: non-integer start index %g will be truncated",
- d_index);
+ lintwarn(_("substr: non-integer start index %g will be truncated"),
+ d_index);
indx = d_index - 1; /* awk indices are from 1, C's are from 0 */
@@ -959,33 +1078,33 @@ NODE *tree;
free_temp(t3);
if (d_length <= 0.0) {
if (do_lint)
- warning("substr: length %g is <= 0", d_length);
+ lintwarn(_("substr: length %g is <= 0"), d_length);
free_temp(t1);
return Nnull_string;
}
if (do_lint && double_to_int(d_length) != d_length)
- warning(
- "substr: non-integer length %g will be truncated",
+ lintwarn(
+ _("substr: non-integer length %g will be truncated"),
d_length);
length = d_length;
}
if (t1->stlen == 0) {
if (do_lint)
- warning("substr: source string is zero length");
+ lintwarn(_("substr: source string is zero length"));
free_temp(t1);
return Nnull_string;
}
if ((indx + length) > t1->stlen) {
if (do_lint)
- warning(
- "substr: length %d at position %d exceeds length of first argument (%d)",
+ lintwarn(
+ _("substr: length %d at start index %d exceeds length of first argument (%d)"),
length, indx+1, t1->stlen);
length = t1->stlen - indx;
}
if (indx >= t1->stlen) {
if (do_lint)
- warning("substr: start index %d is past end of string",
+ lintwarn(_("substr: start index %d is past end of string"),
indx+1);
free_temp(t1);
return Nnull_string;
@@ -998,8 +1117,7 @@ NODE *tree;
/* do_strftime --- format a time stamp */
NODE *
-do_strftime(tree)
-NODE *tree;
+do_strftime(NODE *tree)
{
NODE *t1, *t2, *ret;
struct tm *tm;
@@ -1007,6 +1125,7 @@ NODE *tree;
char *bufp;
size_t buflen, bufsize;
char buf[BUFSIZ];
+ /* FIXME: One day make %d be %e, after C 99 is common. */
static char def_format[] = "%a %b %d %H:%M:%S %Z %Y";
char *format;
int formatlen;
@@ -1019,12 +1138,15 @@ NODE *tree;
t1 = t2 = NULL;
if (tree != NULL) { /* have args */
if (tree->lnode != NULL) {
- t1 = force_string(tree_eval(tree->lnode));
+ NODE *tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (STRING|STR)) == 0)
+ lintwarn(_("strftime: recieved non-string first argument"));
+ t1 = force_string(tmp);
format = t1->stptr;
formatlen = t1->stlen;
if (formatlen == 0) {
if (do_lint)
- warning("strftime called with empty format string");
+ lintwarn(_("strftime: received empty format string"));
free_temp(t1);
return tmp_string("", 0);
}
@@ -1032,6 +1154,8 @@ NODE *tree;
if (tree->rnode != NULL) {
t2 = tree_eval(tree->rnode->lnode);
+ if (do_lint && (t2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("strftime: recieved non-numeric second argument"));
fclock = (time_t) force_number(t2);
free_temp(t2);
}
@@ -1071,8 +1195,7 @@ NODE *tree;
/* do_systime --- get the time of day */
NODE *
-do_systime(tree)
-NODE *tree;
+do_systime(NODE *tree)
{
time_t lclock;
@@ -1080,13 +1203,57 @@ NODE *tree;
return tmp_number((AWKNUM) lclock);
}
+/* do_mktime --- turn a time string into a timestamp */
+
+NODE *
+do_mktime(NODE *tree)
+{
+ NODE *t1;
+ struct tm then;
+ long year;
+ int month, day, hour, minute, second, count;
+ int dst = -1; /* default is unknown */
+ time_t then_stamp;
+ char save;
+
+ t1 = tree_eval(tree->lnode);
+ if (do_lint && (t1->flags & (STRING|STR)) == 0)
+ lintwarn(_("mktime: received non-string argument"));
+ t1 = force_string(t1);
+
+ save = t1->stptr[t1->stlen];
+ t1->stptr[t1->stlen] = '\0';
+
+ count = sscanf(t1->stptr, "%ld %d %d %d %d %d %d",
+ & year, & month, & day,
+ & hour, & minute, & second,
+ & dst);
+ t1->stptr[t1->stlen] = save;
+ free_temp(t1);
+
+ if (count < 6
+ || month < month - 1
+ || year < year - 1900 || year - 1900 != (int) (year - 1900))
+ return tmp_number((AWKNUM) -1);
+
+ memset(& then, '\0', sizeof(then));
+ then.tm_sec = second;
+ then.tm_min = minute;
+ then.tm_hour = hour;
+ then.tm_mday = day;
+ then.tm_mon = month - 1;
+ then.tm_year = year - 1900;
+ then.tm_isdst = dst;
+
+ then_stamp = mktime(& then);
+ return tmp_number((AWKNUM) then_stamp);
+}
/* do_system --- run an external command */
NODE *
-do_system(tree)
-NODE *tree;
+do_system(NODE *tree)
{
NODE *tmp;
int ret = 0;
@@ -1095,6 +1262,8 @@ NODE *tree;
(void) flush_io(); /* so output is synchronous with gawk's */
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (STRING|STR)) == 0)
+ lintwarn(_("system: recieved non-string argument"));
cmd = force_string(tmp)->stptr;
if (cmd && *cmd) {
@@ -1117,8 +1286,11 @@ NODE *tree;
save = cmd[tmp->stlen];
cmd[tmp->stlen] = '\0';
+ os_restore_mode(fileno(stdin));
ret = system(cmd);
ret = (ret >> 8) & 0xff;
+ if ((BINMODE & 1) != 0)
+ os_setbinmode(fileno(stdin), O_BINARY);
cmd[tmp->stlen] = save;
}
@@ -1131,8 +1303,7 @@ extern NODE **fmt_list; /* declared in eval.c */
/* do_print --- print items, separated by OFS, terminated with ORS */
void
-do_print(tree)
-register NODE *tree;
+do_print(register NODE *tree)
{
register NODE **t;
struct redirect *rp = NULL;
@@ -1196,25 +1367,29 @@ register NODE *tree;
if (ORSlen > 0)
efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, TRUE);
+ if (rp != NULL && (rp->flag & RED_TWOWAY) != 0)
+ fflush(rp->fp);
+
free(t);
}
/* do_tolower --- lower case a string */
NODE *
-do_tolower(tree)
-NODE *tree;
+do_tolower(NODE *tree)
{
NODE *t1, *t2;
register unsigned char *cp, *cp2;
t1 = tree_eval(tree->lnode);
+ if (do_lint && (t1->flags & (STRING|STR)) == 0)
+ lintwarn(_("tolower: recieved non-string argument"));
t1 = force_string(t1);
t2 = tmp_string(t1->stptr, t1->stlen);
for (cp = (unsigned char *)t2->stptr,
cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
if (ISUPPER(*cp))
- *cp = tolower(*cp);
+ *cp = TOLOWER(*cp);
free_temp(t1);
return t2;
}
@@ -1222,19 +1397,20 @@ NODE *tree;
/* do_toupper --- upper case a string */
NODE *
-do_toupper(tree)
-NODE *tree;
+do_toupper(NODE *tree)
{
NODE *t1, *t2;
register unsigned char *cp, *cp2;
t1 = tree_eval(tree->lnode);
+ if (do_lint && (t1->flags & (STRING|STR)) == 0)
+ lintwarn(_("toupper: recieved non-string argument"));
t1 = force_string(t1);
t2 = tmp_string(t1->stptr, t1->stlen);
for (cp = (unsigned char *)t2->stptr,
cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
if (ISLOWER(*cp))
- *cp = toupper(*cp);
+ *cp = TOUPPER(*cp);
free_temp(t1);
return t2;
}
@@ -1242,14 +1418,19 @@ NODE *tree;
/* do_atan2 --- do the atan2 function */
NODE *
-do_atan2(tree)
-NODE *tree;
+do_atan2(NODE *tree)
{
NODE *t1, *t2;
double d1, d2;
t1 = tree_eval(tree->lnode);
t2 = tree_eval(tree->rnode->lnode);
+ if (do_lint) {
+ if ((t1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("atan2: received non-numeric first argument"));
+ if ((t2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("atan2: received non-numeric second argument"));
+ }
d1 = force_number(t1);
d2 = force_number(t2);
free_temp(t1);
@@ -1260,13 +1441,14 @@ NODE *tree;
/* do_sin --- do the sin function */
NODE *
-do_sin(tree)
-NODE *tree;
+do_sin(NODE *tree)
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("sin: received non-numeric argument"));
d = sin((double) force_number(tmp));
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -1275,13 +1457,14 @@ NODE *tree;
/* do_cos --- do the cos function */
NODE *
-do_cos(tree)
-NODE *tree;
+do_cos(NODE *tree)
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("cos: received non-numeric argument"));
d = cos((double) force_number(tmp));
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -1294,8 +1477,7 @@ static char state[512];
/* ARGSUSED */
NODE *
-do_rand(tree)
-NODE *tree;
+do_rand(NODE *tree)
{
if (firstrand) {
(void) initstate((unsigned) 1, state, sizeof state);
@@ -1308,8 +1490,7 @@ NODE *tree;
/* do_srand --- seed the random number generator */
NODE *
-do_srand(tree)
-NODE *tree;
+do_srand(NODE *tree)
{
NODE *tmp;
static long save_seed = 1;
@@ -1326,30 +1507,62 @@ NODE *tree;
srandom((unsigned int) (save_seed = (long) time((time_t *) 0)));
else {
tmp = tree_eval(tree->lnode);
+ if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("srand: received non-numeric argument"));
srandom((unsigned int) (save_seed = (long) force_number(tmp)));
free_temp(tmp);
}
return tmp_number((AWKNUM) ret);
}
-/* do_match --- match a regexp, set RSTART and RLENGTH */
+/* do_match --- match a regexp, set RSTART and RLENGTH,
+ * optional third arg is array filled with text of
+ * subpatterns enclosed in parens.
+ */
NODE *
-do_match(tree)
-NODE *tree;
+do_match(NODE *tree)
{
- NODE *t1;
- int rstart;
+ NODE *t1, *dest, *it;
+ int rstart, len, ii;
AWKNUM rlength;
Regexp *rp;
+ regoff_t s;
+ char *start;
t1 = force_string(tree_eval(tree->lnode));
- tree = tree->rnode->lnode;
- rp = re_update(tree);
+ tree = tree->rnode;
+ rp = re_update(tree->lnode);
+
+ dest = NULL;
+ if (tree->rnode != NULL) { /* 3rd optional arg for the subpatterns */
+ dest = tree->rnode->lnode;
+ if (dest->type == Node_param_list)
+ dest = stack_ptr[dest->param_cnt];
+ if (dest->type == Node_array_ref)
+ dest = dest->orig_array;
+ if (dest->type != Node_var && dest->type != Node_var_array)
+ fatal(_("match: third argument is not an array"));
+ dest->type = Node_var_array;
+ assoc_clear(dest);
+ }
+
rstart = research(rp, t1->stptr, 0, t1->stlen, TRUE);
if (rstart >= 0) { /* match succeded */
rstart++; /* 1-based indexing */
rlength = REEND(rp, t1->stptr) - RESTART(rp, t1->stptr);
+
+ /* Build the array only if the caller wants the optional subpatterns */
+ if (dest != NULL) {
+ for (ii = 0; (s = SUBPATSTART(rp, t1->stptr, ii)) != -1; ii++) {
+ start = t1->stptr + s;
+ len = SUBPATEND(rp, t1->stptr, ii) - s;
+
+ it = make_string(start, len);
+ it->flags |= MAYBE_NUM;
+ *assoc_lookup(dest, tmp_number((AWKNUM) (ii)), FALSE) = it;
+ }
+ }
} else { /* match failed */
rstart = 0;
rlength = -1.0;
@@ -1424,13 +1637,11 @@ NODE *tree;
*/
/*
- * NB: `howmany' conflicts with a SunOS macro in <sys/param.h>.
+ * NB: `howmany' conflicts with a SunOS 4.x macro in <sys/param.h>.
*/
static NODE *
-sub_common(tree, how_many, backdigs)
-NODE *tree;
-int how_many, backdigs;
+sub_common(NODE *tree, int how_many, int backdigs)
{
register char *scan;
register char *bp, *cp;
@@ -1479,18 +1690,13 @@ int how_many, backdigs;
if (tmp->type == Node_val)
lhs = NULL;
else
- lhs = get_lhs(tmp, &after_assign);
+ lhs = get_lhs(tmp, &after_assign, FALSE);
t->flags |= STRING;
/*
* create a private copy of the string
*/
if (t->stref > 1 || (t->flags & (PERM|FIELD)) != 0) {
- unsigned int saveflags;
-
- saveflags = t->flags;
- t->flags &= ~MALLOC;
- tmp = dupnode(t);
- t->flags = saveflags;
+ tmp = copynode(t);
t = tmp;
priv = TRUE;
}
@@ -1672,8 +1878,7 @@ int how_many, backdigs;
/* do_gsub --- global substitution */
NODE *
-do_gsub(tree)
-NODE *tree;
+do_gsub(NODE *tree)
{
return sub_common(tree, -1, FALSE);
}
@@ -1681,8 +1886,7 @@ NODE *tree;
/* do_sub --- single substitution */
NODE *
-do_sub(tree)
-NODE *tree;
+do_sub(NODE *tree)
{
return sub_common(tree, 1, FALSE);
}
@@ -1690,8 +1894,7 @@ NODE *tree;
/* do_gensub --- fix up the tree for sub_common for the gensub function */
NODE *
-do_gensub(tree)
-NODE *tree;
+do_gensub(NODE *tree)
{
NODE n1, n2, n3, *t, *tmp, *target, *ret;
long how_many = 1; /* default is one substitution */
@@ -1735,6 +1938,8 @@ NODE *tree;
how_many = d;
else
how_many = 1;
+ if (d == 0)
+ warning(_("gensub: 3rd argument of 0 treated as 1"));
}
free_temp(t);
@@ -1758,13 +1963,12 @@ NODE *tree;
* 'format' string HAS to be of "<flags>*.*g" kind, or we bomb!
*/
static void
-sgfmt(buf, format, alt, fwidth, prec, g)
-char *buf; /* return buffer; assumed big enough to hold result */
-const char *format;
-int alt; /* use alternate form flag */
-int fwidth; /* field width in a format */
-int prec; /* indicates desired significant digits, not decimal places */
-double g; /* value to format */
+sgfmt(char *buf, /* return buffer; assumed big enough to hold result */
+ const char *format,
+ int alt, /* use alternate form flag */
+ int fwidth, /* field width in a format */
+ int prec, /* indicates desired significant digits, not decimal places */
+ double g) /* value to format */
{
char dform[40];
register char *gpos;
@@ -1828,173 +2032,191 @@ double g; /* value to format */
}
#endif /* GFMT_WORKAROUND */
-#ifdef BITOPS
#define BITS_PER_BYTE 8 /* if not true, you lose. too bad. */
/* do_lshift --- perform a << operation */
NODE *
-do_lshift(tree)
-NODE *tree;
+do_lshift(NODE *tree)
{
NODE *s1, *s2;
- unsigned long uval, ushift, result;
+ unsigned long uval, ushift, res;
AWKNUM val, shift;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
val = force_number(s1);
shift = force_number(s2);
- free_temp(s1);
- free_temp(s2);
if (do_lint) {
+ if ((s1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("lshift: received non-numeric first argument"));
+ if ((s2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("lshift: received non-numeric first argument"));
if (val < 0 || shift < 0)
- warning("lshift(%lf, %lf): negative values will give strange results", val, shift);
+ lintwarn(_("lshift(%lf, %lf): negative values will give strange results"), val, shift);
if (double_to_int(val) != val || double_to_int(shift) != shift)
- warning("lshift(%lf, %lf): fractional values will be truncated", val, shift);
+ lintwarn(_("lshift(%lf, %lf): fractional values will be truncated"), val, shift);
if (shift > (sizeof(unsigned long) * BITS_PER_BYTE))
- warning("lshift(%lf, %lf): too large shift value will give strange results", val, shift);
+ lintwarn(_("lshift(%lf, %lf): too large shift value will give strange results"), val, shift);
}
+ free_temp(s1);
+ free_temp(s2);
+
uval = (unsigned long) val;
ushift = (unsigned long) shift;
- result = uval << ushift;
- return tmp_number((AWKNUM) result);
+ res = uval << ushift;
+ return tmp_number((AWKNUM) res);
}
/* do_rshift --- perform a >> operation */
NODE *
-do_rshift(tree)
-NODE *tree;
+do_rshift(NODE *tree)
{
NODE *s1, *s2;
- unsigned long uval, ushift, result;
+ unsigned long uval, ushift, res;
AWKNUM val, shift;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
val = force_number(s1);
shift = force_number(s2);
- free_temp(s1);
- free_temp(s2);
if (do_lint) {
+ if ((s1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("rshift: received non-numeric first argument"));
+ if ((s2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("rshift: received non-numeric first argument"));
if (val < 0 || shift < 0)
- warning("rshift(%lf, %lf): negative values will give strange results", val, shift);
+ lintwarn(_("rshift(%lf, %lf): negative values will give strange results"), val, shift);
if (double_to_int(val) != val || double_to_int(shift) != shift)
- warning("rshift(%lf, %lf): fractional values will be truncated", val, shift);
+ lintwarn(_("rshift(%lf, %lf): fractional values will be truncated"), val, shift);
if (shift > (sizeof(unsigned long) * BITS_PER_BYTE))
- warning("rshift(%lf, %lf): too large shift value will give strange results", val, shift);
+ lintwarn(_("rshift(%lf, %lf): too large shift value will give strange results"), val, shift);
}
+ free_temp(s1);
+ free_temp(s2);
+
uval = (unsigned long) val;
ushift = (unsigned long) shift;
- result = uval >> ushift;
- return tmp_number((AWKNUM) result);
+ res = uval >> ushift;
+ return tmp_number((AWKNUM) res);
}
/* do_and --- perform an & operation */
NODE *
-do_and(tree)
-NODE *tree;
+do_and(NODE *tree)
{
NODE *s1, *s2;
- unsigned long uleft, uright, result;
+ unsigned long uleft, uright, res;
AWKNUM left, right;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
left = force_number(s1);
right = force_number(s2);
- free_temp(s1);
- free_temp(s2);
if (do_lint) {
+ if ((s1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("and: received non-numeric first argument"));
+ if ((s2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("and: received non-numeric first argument"));
if (left < 0 || right < 0)
- warning("and(%lf, %lf): negative values will give strange results", left, right);
+ lintwarn(_("and(%lf, %lf): negative values will give strange results"), left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- warning("and(%lf, %lf): fractional values will be truncated", left, right);
+ lintwarn(_("and(%lf, %lf): fractional values will be truncated"), left, right);
}
+ free_temp(s1);
+ free_temp(s2);
+
uleft = (unsigned long) left;
uright = (unsigned long) right;
- result = uleft & uright;
- return tmp_number((AWKNUM) result);
+ res = uleft & uright;
+ return tmp_number((AWKNUM) res);
}
/* do_or --- perform an | operation */
NODE *
-do_or(tree)
-NODE *tree;
+do_or(NODE *tree)
{
NODE *s1, *s2;
- unsigned long uleft, uright, result;
+ unsigned long uleft, uright, res;
AWKNUM left, right;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
left = force_number(s1);
right = force_number(s2);
- free_temp(s1);
- free_temp(s2);
if (do_lint) {
+ if ((s1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("or: received non-numeric first argument"));
+ if ((s2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("or: received non-numeric first argument"));
if (left < 0 || right < 0)
- warning("or(%lf, %lf): negative values will give strange results", left, right);
+ lintwarn(_("or(%lf, %lf): negative values will give strange results"), left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- warning("or(%lf, %lf): fractional values will be truncated", left, right);
+ lintwarn(_("or(%lf, %lf): fractional values will be truncated"), left, right);
}
+ free_temp(s1);
+ free_temp(s2);
+
uleft = (unsigned long) left;
uright = (unsigned long) right;
- result = uleft | uright;
- return tmp_number((AWKNUM) result);
+ res = uleft | uright;
+ return tmp_number((AWKNUM) res);
}
/* do_xor --- perform an ^ operation */
NODE *
-do_xor(tree)
-NODE *tree;
+do_xor(NODE *tree)
{
NODE *s1, *s2;
- unsigned long uleft, uright, result;
+ unsigned long uleft, uright, res;
AWKNUM left, right;
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
left = force_number(s1);
right = force_number(s2);
- free_temp(s1);
- free_temp(s2);
if (do_lint) {
+ if ((s1->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("xor: received non-numeric first argument"));
+ if ((s2->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("xor: received non-numeric first argument"));
if (left < 0 || right < 0)
- warning("xor(%lf, %lf): negative values will give strange results", left, right);
+ lintwarn(_("xor(%lf, %lf): negative values will give strange results"), left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- warning("xor(%lf, %lf): fractional values will be truncated", left, right);
+ lintwarn(_("xor(%lf, %lf): fractional values will be truncated"), left, right);
}
+ free_temp(s1);
+ free_temp(s2);
+
uleft = (unsigned long) left;
uright = (unsigned long) right;
- result = uleft ^ uright;
- return tmp_number((AWKNUM) result);
+ res = uleft ^ uright;
+ return tmp_number((AWKNUM) res);
}
/* do_compl --- perform a ~ operation */
NODE *
-do_compl(tree)
-NODE *tree;
+do_compl(NODE *tree)
{
NODE *tmp;
double d;
@@ -2005,10 +2227,12 @@ NODE *tree;
free_temp(tmp);
if (do_lint) {
+ if ((tmp->flags & (NUM|NUMBER)) == 0)
+ lintwarn(_("compl: received non-numeric argument"));
if (d < 0)
- warning("compl(%lf): negative value will give strange results", d);
+ lintwarn(_("compl(%lf): negative value will give strange results"), d);
if (double_to_int(d) != d)
- warning("compl(%lf): fractional value will be truncated", d);
+ lintwarn(_("compl(%lf): fractional value will be truncated"), d);
}
uval = (unsigned long) d;
@@ -2019,11 +2243,10 @@ NODE *tree;
/* do_strtonum --- the strtonum function */
NODE *
-do_strtonum(tree)
-NODE *tree;
+do_strtonum(NODE *tree)
{
NODE *tmp;
- double d, arg;
+ double d;
tmp = tree_eval(tree->lnode);
@@ -2037,9 +2260,7 @@ NODE *tree;
free_temp(tmp);
return tmp_number((AWKNUM) d);
}
-#endif /* BITOPS */
-#if defined(BITOPS) || defined(NONDECDATA)
/* nondec2awknum --- convert octal or hex value to double */
/*
@@ -2049,13 +2270,12 @@ NODE *tree;
*/
AWKNUM
-nondec2awknum(str, len)
-char *str;
-size_t len;
+nondec2awknum(char *str, size_t len)
{
AWKNUM retval = 0.0;
char save;
short val;
+ char *start = str;
if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) {
assert(len > 2);
@@ -2097,18 +2317,172 @@ size_t len;
}
} else if (*str == '0') {
for (; len > 0; len--) {
- if (! isdigit(*str) || *str == '8' || *str == '9')
+ if (! ISDIGIT(*str))
+ goto done;
+ else if (*str == '8' || *str == '9') {
+ str = start;
goto decimal;
+ }
retval = (retval * 8) + (*str - '0');
str++;
}
} else {
decimal:
save = str[len];
- retval = atof(str);
+ retval = strtod(str, NULL);
str[len] = save;
}
done:
return retval;
}
-#endif /* defined(BITOPS) || defined(NONDECDATA) */
+
+/* do_dcgettext --- handle i18n translations */
+
+/*
+ * awk usage is
+ *
+ * str = dcgettext(string [, domain [, category]])
+ *
+ * Default domain is TEXTDOMAIN, default category is LC_MESSAGES.
+ */
+
+NODE *
+do_dcgettext(NODE *tree)
+{
+ NODE *tmp, *t1, *t2;
+ char *string;
+ char *the_result;
+#if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT
+ int lc_cat = -1;
+ char *category, *domain;
+ static struct category_table {
+ int val;
+ char *name;
+ } cat_tab[] = {
+#ifdef LC_ALL
+ { LC_ALL, "LC_ALL" },
+#endif /* LC_ALL */
+#ifdef LC_COLLATE
+ { LC_COLLATE, "LC_COLLATE" },
+#endif /* LC_COLLATE */
+#ifdef LC_CTYPE
+ { LC_CTYPE, "LC_CTYPE" },
+#endif /* LC_CTYPE */
+#ifdef LC_MESSAGES
+ { LC_MESSAGES, "LC_MESSAGES" },
+#endif /* LC_MESSAGES */
+#ifdef LC_MONETARY
+ { LC_MONETARY, "LC_MONETARY" },
+#endif /* LC_MONETARY */
+#ifdef LC_NUMERIC
+ { LC_NUMERIC, "LC_NUMERIC" },
+#endif /* LC_NUMERIC */
+#ifdef LC_RESPONSE
+ { LC_RESPONSE, "LC_RESPONSE" },
+#endif /* LC_RESPONSE */
+#ifdef LC_TIME
+ { LC_TIME, "LC_TIME" },
+#endif /* LC_TIME */
+ };
+#endif /* ENABLE_NLS */
+
+ tmp = tree->lnode; /* first argument */
+ t1 = force_string(tree_eval(tmp));
+ string = t1->stptr;
+
+ t2 = NULL;
+#if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT
+ tree = tree->rnode; /* second argument */
+ if (tree != NULL) {
+ tmp = tree->lnode;
+ t2 = force_string(tree_eval(tmp));
+ domain = t2->stptr;
+ } else
+ domain = TEXTDOMAIN;
+
+ if (tree != NULL && tree->rnode != NULL) { /* third argument */
+ int low, high, i, mid;
+ NODE *t;
+
+ tree = tree->rnode;
+ tmp = tree->lnode;
+ t = force_string(tree_eval(tmp));
+ category = t->stptr;
+
+ /* binary search the table */
+ low = 0;
+ high = (sizeof(cat_tab) / sizeof(cat_tab[0])) - 1;
+ while (low <= high) {
+ mid = (low + high) / 2;
+ i = strcmp(category, cat_tab[mid].name);
+
+ if (i < 0) /* category < mid */
+ high = mid - 1;
+ else if (i > 0) /* category > mid */
+ low = mid + 1;
+ else {
+ lc_cat = cat_tab[mid].val;
+ break;
+ }
+ }
+ if (lc_cat == -1) /* not there */
+ fatal(_("dcgettext: `%s' is not a valid locale category"), category);
+
+ free_temp(t);
+ } else
+ lc_cat = LC_MESSAGES;
+
+ the_result = dcgettext(domain, string, lc_cat);
+#else
+ the_result = string;
+#endif
+ free_temp(t1);
+ if (t2 != NULL)
+ free_temp(t2);
+
+ return tmp_string(the_result, strlen(the_result));
+}
+
+/* do_bindtextdomain --- set the directory for a text domain */
+
+/*
+ * awk usage is
+ *
+ * binding = bindtextdomain(dir [, domain])
+ *
+ * If dir is "", pass NULL to C version.
+ * Default domain is TEXTDOMAIN.
+ */
+
+NODE *
+do_bindtextdomain(NODE *tree)
+{
+ NODE *tmp, *t1, *t2;
+ char *directory, *domain;
+ char *the_result;
+
+ t1 = t2 = NULL;
+ /* set defaults */
+ directory = NULL;
+ domain = TEXTDOMAIN;
+
+ tmp = tree->lnode; /* first argument */
+ t1 = force_string(tree_eval(tmp));
+ if (t1->stlen > 0)
+ directory = t1->stptr;
+
+ tree = tree->rnode; /* second argument */
+ if (tree != NULL) {
+ tmp = tree->lnode;
+ t2 = force_string(tree_eval(tmp));
+ domain = t2->stptr;
+ }
+
+ the_result = bindtextdomain(domain, directory);
+
+ free_temp(t1);
+ if (t2 != NULL)
+ free_temp(t1);
+
+ return tmp_string(the_result, strlen(the_result));
+}
diff --git a/contrib/awk/configh.in b/contrib/awk/configh.in
index f423d4aac894..8c8a517c6c47 100644
--- a/contrib/awk/configh.in
+++ b/contrib/awk/configh.in
@@ -3,22 +3,22 @@
* acconfig.h -- configuration definitions for gawk.
*/
-/*
- * Copyright (C) 1995-2000 the Free Software Foundation, Inc.
- *
+/*
+ * Copyright (C) 1995-2001 the Free Software Foundation, Inc.
+ *
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
- *
+ *
* GAWK 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.
- *
+ *
* GAWK 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
@@ -88,9 +88,15 @@
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
/* Define if on MINIX. */
#undef _MINIX
+/* Define to `long' if <sys/types.h> doesn't define. */
+#undef off_t
+
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
@@ -128,24 +134,39 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
-#undef HAVE_STRINGIZE /* can use ANSI # operator in cpp */
#undef REGEX_MALLOC /* use malloc instead of alloca in regex.c */
#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 */
+#undef HAVE_MKTIME /* we have the mktime function */
+#undef HAVE_SOCKETS /* we have sockets on this system */
+#undef HAVE_PORTALS /* we have portals on /p on this system */
+#undef DYNAMIC /* allow dynamic addition of builtins */
+#undef STRTOD_NOT_C89 /* strtod doesn't have C89 semantics */
+#undef ssize_t /* signed version of size_t */
+
+/* Define if you have the __argz_count function. */
+#undef HAVE___ARGZ_COUNT
+
+/* Define if you have the __argz_next function. */
+#undef HAVE___ARGZ_NEXT
+
+/* Define if you have the __argz_stringify function. */
+#undef HAVE___ARGZ_STRINGIFY
+
+/* Define if you have the alarm function. */
+#undef HAVE_ALARM
+
+/* Define if you have the dcgettext function. */
+#undef HAVE_DCGETTEXT
/* Define if you have the fmod function. */
#undef HAVE_FMOD
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
-/* Define if you have the madvise function. */
-#undef HAVE_MADVISE
-
/* Define if you have the memcmp function. */
#undef HAVE_MEMCMP
@@ -155,12 +176,30 @@
/* Define if you have the memset function. */
#undef HAVE_MEMSET
+/* Define if you have the munmap function. */
+#undef HAVE_MUNMAP
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
+/* Define if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
@@ -179,21 +218,48 @@
/* Define if you have the tzset function. */
#undef HAVE_TZSET
+/* Define if you have the <argz.h> header file. */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <libintl.h> header file. */
+#undef HAVE_LIBINTL_H
+
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
+/* Define if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <mcheck.h> header file. */
+#undef HAVE_MCHECK_H
+
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define if you have the <nl_types.h> header file. */
+#undef HAVE_NL_TYPES_H
+
/* Define if you have the <signum.h> header file. */
#undef HAVE_SIGNUM_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
@@ -203,23 +269,53 @@
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
+/* Define if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if you have the i library (-li). */
+#undef HAVE_LIBI
+
+/* Define if you have the intl library (-lintl). */
+#undef HAVE_LIBINTL
+
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
+/* Name of package */
+#undef PACKAGE
+
+/* Version number of package */
+#undef VERSION
+
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
-/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
-#undef _LARGEFILE_SOURCE
-
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
-/* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */
-#undef _XOPEN_SOURCE
+/* Define if compiler has function prototypes */
+#undef PROTOTYPES
+
+/* Define to 1 if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define to 1 if NLS is requested. */
+#undef ENABLE_NLS
+
+/* Define to 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext. */
+#undef HAVE_CATGETS
#include <custom.h> /* overrides for stuff autoconf can't deal with */
diff --git a/contrib/awk/configure b/contrib/awk/configure
index b4ba9dc3dd80..e4ef6d7c3f2c 100755
--- a/contrib/awk/configure
+++ b/contrib/awk/configure
@@ -12,11 +12,18 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-bitops Enable Octal and Hex constants and bit functions"
+ --disable-dependency-tracking Speeds up one-time builds
+ --enable-dependency-tracking Do not reject slow dependency extractors"
ac_help="$ac_help
- --enable-non-decimal-data Enable Octal and Hex constants as valid input data"
+ --enable-portals Enable /p as path prefix for portals"
ac_help="$ac_help
--disable-largefile omit support for large files"
+ac_help="$ac_help
+ --disable-nls do not use Native Language Support"
+ac_help="$ac_help
+ --with-included-gettext use the GNU gettext library included here"
+ac_help="$ac_help
+ --with-catgets use catgets functions if available"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -528,22 +535,318 @@ 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.
+# 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:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# 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:570: 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
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
-# Check whether --enable-bitops or --disable-bitops was given.
-if test "${enable_bitops+set}" = set; then
- enableval="$enable_bitops"
- cat >> confdefs.h <<\EOF
-#define BITOPS 1
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
+echo "configure:623: checking whether build environment is sane" >&5
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftestfile`
+ fi
+ if test "$*" != "X $srcdir/configure conftestfile" \
+ && test "$*" != "X conftestfile $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" 1>&2; exit 1; }
+ fi
+
+ test "$2" = conftestfile
+ )
+then
+ # Ok.
+ :
+else
+ { echo "configure: error: newly created file is older than distributed files!
+Check your system clock" 1>&2; exit 1; }
+fi
+rm -f conftest*
+echo "$ac_t""yes" 1>&6
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+
+test x"${MISSING+set}" = xset || \
+ MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run :"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ am_backtick='`'
+ echo "configure: warning: ${am_backtick}missing' script is too old or missing" 1>&2
+fi
+
+for ac_prog in gawk mawk nawk awk
+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:696: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AWK="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+AWK="$ac_cv_prog_AWK"
+if test -n "$AWK"; then
+ echo "$ac_t""$AWK" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$AWK" && break
+done
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:726: 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
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval="$enable_dependency_tracking"
+ :
fi
-# Check whether --enable-non-decimal-data or --disable-non-decimal-data was given.
-if test "${enable_non_decimal_data+set}" = set; then
- enableval="$enable_non_decimal_data"
+if test "x$enable_dependency_tracking" = xno; then
+ AMDEP="#"
+else
+ am_depcomp="$ac_aux_dir/depcomp"
+ if test ! -f "$am_depcomp"; then
+ AMDEP="#"
+ else
+ AMDEP=
+ fi
+fi
+
+if test -z "$AMDEP"; then
+ AMDEPBACKSLASH='\'
+else
+ AMDEPBACKSLASH=
+fi
+
+
+
+
+
+if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
+ DEPDIR=.deps
+else
+ DEPDIR=_deps
+fi
+
+
+# test to see if srcdir already configured
+if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
+fi
+
+# Define the identity of the package.
+PACKAGE=gawk
+VERSION=3.1.0
+cat >> confdefs.h <<EOF
+#define PACKAGE "$PACKAGE"
+EOF
+
+cat >> confdefs.h <<EOF
+#define VERSION "$VERSION"
+EOF
+
+
+# Some tools Automake needs.
+
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
+
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake"}
+
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+
+
+if test -z "$install_sh"; then
+ install_sh="$ac_aux_dir/install-sh"
+ test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
+ test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
+ install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
+fi
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+
+
+
+
+
+# Check whether --enable-portals or --disable-portals was given.
+if test "${enable_portals+set}" = set; then
+ enableval="$enable_portals"
cat >> confdefs.h <<\EOF
-#define NONDECDATA 1
+#define HAVE_PORTALS 1
EOF
fi
@@ -554,7 +857,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:558: checking for $ac_word" >&5
+echo "configure:861: 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
@@ -585,7 +888,7 @@ done
test -n "$YACC" || YACC="yacc"
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:589: checking whether ln -s works" >&5
+echo "configure:892: 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
@@ -608,7 +911,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:612: checking for $ac_word" >&5
+echo "configure:915: 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
@@ -638,7 +941,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:642: checking for $ac_word" >&5
+echo "configure:945: 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
@@ -689,7 +992,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:693: checking for $ac_word" >&5
+echo "configure:996: 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
@@ -721,7 +1024,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:725: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1028: 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.
@@ -732,12 +1035,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 736 "configure"
+#line 1039 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
@@ -763,12 +1066,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:767: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1070: 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:772: checking whether we are using GNU C" >&5
+echo "configure:1075: 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
@@ -777,7 +1080,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:781: \"$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:1084: \"$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
@@ -796,7 +1099,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:800: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1103: 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
@@ -827,8 +1130,145 @@ else
fi
fi
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1136: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1151 "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:1157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1168 "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:1174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1185 "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:1191: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+
+
+
+
+
+
+depcc="$CC"
+depcpp="$CPP"
+echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
+echo "configure:1224: checking dependency style of $depcc" >&5
+if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+if test -z "$AMDEP"; then
+ echo '#include "conftest.h"' > conftest.c
+ echo 'int i;' > conftest.h
+
+ am_cv_CC_dependencies_compiler_type=none
+ for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
+ case "$depmode" in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode="$depmode" \
+ source=conftest.c object=conftest.o \
+ depfile=conftest.Po tmpdepfile=conftest.TPo \
+ $SHELL $am_depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+ grep conftest.h conftest.Po > /dev/null 2>&1; then
+ am_cv_CC_dependencies_compiler_type="$depmode"
+ break
+ fi
+ done
+
+ rm -f conftest.*
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+
+echo "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6
+CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type"
+
+
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:832: checking how to run the C preprocessor" >&5
+echo "configure:1272: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -843,13 +1283,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 847 "configure"
+#line 1287 "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:853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -860,13 +1300,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 864 "configure"
+#line 1304 "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:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -877,13 +1317,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 881 "configure"
+#line 1321 "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:887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1327: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -907,28 +1347,46 @@ else
fi
echo "$ac_t""$CPP" 1>&6
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1354: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
# 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; }
+#
+# If the user supplies $INSTALL, figure they know what they're doing.
+if test "x$INSTALL" = "x"
+then
+ INSTALL="$srcdir/install-sh -c"
+ export INSTALL
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
@@ -942,7 +1400,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:946: checking for a BSD compatible install" >&5
+echo "configure:1404: 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
@@ -996,7 +1454,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:1000: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1458: 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
@@ -1023,37 +1481,30 @@ else
fi
-if test "$CFLAGS" = ""
-then
- if test "$GCC" = yes
- then
- CFLAGS="-g -O"
- else
- CFLAGS="-O"
- fi
-fi
-
# This is mainly for my use during testing and development.
# Yes, it's a bit of a hack.
+echo $ac_n "checking for special development options""... $ac_c" 1>&6
+echo "configure:1488: checking for special development options" >&5
if test -f $srcdir/.developing
then
- cat >> confdefs.h <<\EOF
-#define BITOPS 1
-EOF
-
- cat >> confdefs.h <<\EOF
-#define NONDECDATA 1
-EOF
-
+ # add other debug flags as appropriate, save GAWKDEBUG for emergencies
CFLAGS="$CFLAGS -DARRAYDEBUG"
+ # turn on compiler warnings if we're doing development
+ if test "$GCC" = yes
+ then
+ CFLAGS="$CFLAGS -Wall"
+ fi
+ echo "$ac_t""yes" 1>&6
+else
+ echo "$ac_t""no" 1>&6
fi
echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1055: checking for AIX" >&5
+echo "configure:1506: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
-#line 1057 "configure"
+#line 1508 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
@@ -1075,7 +1526,7 @@ rm -f conftest*
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1079: checking for POSIXized ISC" >&5
+echo "configure:1530: 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
@@ -1097,17 +1548,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:1101: checking for minix/config.h" >&5
+echo "configure:1552: 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 1106 "configure"
+#line 1557 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1562: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1144,7 +1595,8 @@ EOF
fi
-# Check whether --enable-largefile or --disable-largefile was given.
+
+ # Check whether --enable-largefile or --disable-largefile was given.
if test "${enable_largefile+set}" = set; then
enableval="$enable_largefile"
:
@@ -1153,25 +1605,32 @@ fi
if test "$enable_largefile" != no; then
echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6
-echo "configure:1157: checking for special C compiler options needed for large files" >&5
-if eval "test \"`echo '$''{'gawk_cv_sys_largefile_CC'+set}'`\" = set"; then
+echo "configure:1609: checking for special C compiler options needed for large files" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- gawk_cv_sys_largefile_CC=no
+ ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
cat > conftest.$ac_ext <<EOF
-#line 1166 "configure"
+#line 1618 "configure"
#include "confdefs.h"
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
int main() {
; return 0; }
EOF
-if { (eval echo configure:1175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1634: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
:
else
echo "configure: failed program was:" >&5
@@ -1180,18 +1639,25 @@ else
ac_save_CC="$CC"
CC="$CC -n32"
cat > conftest.$ac_ext <<EOF
-#line 1184 "configure"
+#line 1643 "configure"
#include "confdefs.h"
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
int main() {
; return 0; }
EOF
-if { (eval echo configure:1193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1659: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- gawk_cv_sys_largefile_CC=' -n32'
+ ac_cv_sys_largefile_CC=' -n32'
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -1203,51 +1669,62 @@ rm -f conftest*
fi
fi
-echo "$ac_t""$gawk_cv_sys_largefile_CC" 1>&6
- if test "$gawk_cv_sys_largefile_CC" != no; then
- CC="$CC$gawk_cv_sys_largefile_CC"
+echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC="$CC$ac_cv_sys_largefile_CC"
fi
echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6
-echo "configure:1213: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-if eval "test \"`echo '$''{'gawk_cv_sys_file_offset_bits'+set}'`\" = set"; then
+echo "configure:1679: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- gawk_cv_sys_file_offset_bits=no
+ ac_cv_sys_file_offset_bits=no
cat > conftest.$ac_ext <<EOF
-#line 1219 "configure"
+#line 1685 "configure"
#include "confdefs.h"
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
-
-
int main() {
; return 0; }
EOF
-if { (eval echo configure:1230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1701: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 1237 "configure"
+#line 1708 "configure"
#include "confdefs.h"
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
-
int main() {
; return 0; }
EOF
-if { (eval echo configure:1249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- gawk_cv_sys_file_offset_bits=64
+ ac_cv_sys_file_offset_bits=64
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -1257,53 +1734,64 @@ fi
rm -f conftest*
fi
-echo "$ac_t""$gawk_cv_sys_file_offset_bits" 1>&6
- if test "$gawk_cv_sys_file_offset_bits" != no; then
+echo "$ac_t""$ac_cv_sys_file_offset_bits" 1>&6
+ if test "$ac_cv_sys_file_offset_bits" != no; then
cat >> confdefs.h <<EOF
-#define _FILE_OFFSET_BITS $gawk_cv_sys_file_offset_bits
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
EOF
fi
- echo $ac_n "checking for _LARGEFILE_SOURCE value needed for large files""... $ac_c" 1>&6
-echo "configure:1269: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-if eval "test \"`echo '$''{'gawk_cv_sys_largefile_source'+set}'`\" = set"; then
+ echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6
+echo "configure:1746: checking for _LARGE_FILES value needed for large files" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- gawk_cv_sys_largefile_source=no
+ ac_cv_sys_large_files=no
cat > conftest.$ac_ext <<EOF
-#line 1275 "configure"
+#line 1752 "configure"
#include "confdefs.h"
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
-#include <stdio.h>
-
int main() {
-return !ftello;
+
; return 0; }
EOF
-if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
cat > conftest.$ac_ext <<EOF
-#line 1293 "configure"
+#line 1775 "configure"
#include "confdefs.h"
-#define _LARGEFILE_SOURCE 1
+#define _LARGE_FILES 1
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply "#define LARGE_OFF_T 9223372036854775807",
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
-#include <stdio.h>
int main() {
-return !ftello;
+
; return 0; }
EOF
-if { (eval echo configure:1305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- gawk_cv_sys_largefile_source=1
+ ac_cv_sys_large_files=1
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
@@ -1313,158 +1801,2117 @@ fi
rm -f conftest*
fi
-echo "$ac_t""$gawk_cv_sys_largefile_source" 1>&6
- if test "$gawk_cv_sys_largefile_source" != no; then
+echo "$ac_t""$ac_cv_sys_large_files" 1>&6
+ if test "$ac_cv_sys_large_files" != no; then
cat >> confdefs.h <<EOF
-#define _LARGEFILE_SOURCE $gawk_cv_sys_largefile_source
+#define _LARGE_FILES $ac_cv_sys_large_files
EOF
fi
- echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6
-echo "configure:1325: checking for _LARGE_FILES value needed for large files" >&5
-if eval "test \"`echo '$''{'gawk_cv_sys_large_files'+set}'`\" = set"; then
+ fi
+
+
+echo $ac_n "checking for AIX compilation hacks""... $ac_c" 1>&6
+echo "configure:1816: 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
- gawk_cv_sys_large_files=no
- cat > conftest.$ac_ext <<EOF
-#line 1331 "configure"
+
+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
+
+
+echo $ac_n "checking for Linux/Alpha compilation hacks""... $ac_c" 1>&6
+echo "configure:1834: checking for Linux/Alpha compilation hacks" >&5
+if eval "test \"`echo '$''{'gawk_cv_linux_alpha_hack'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+if test "Linux" = "`uname`" && test "alpha" = "`uname -m`"
+then
+ # this isn't necessarily always true,
+ # the vendor's compiler is also often found
+ if test "$GCC" = yes
+ then
+ CFLAGS="$CFLAGS -mieee"
+ gawk_cv_linux_alpha_hack=yes
+ else
+ gawk_cv_linux_alpha_hack=no
+ fi
+else
+ gawk_cv_linux_alpha_hack=no
+fi
+
+fi
+echo "$ac_t""${gawk_cv_linux_alpha_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 ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
+echo "configure:1867: checking for ${CC-cc} option to accept ANSI C" >&5
+if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ am_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ cat > conftest.$ac_ext <<EOF
+#line 1884 "configure"
#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
-
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
-
int main() {
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+
; return 0; }
EOF
-if { (eval echo configure:1342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1921: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ am_cv_prog_cc_stdc="$ac_arg"; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+CC="$ac_save_CC"
+
+fi
+
+if test -z "$am_cv_prog_cc_stdc"; then
+ echo "$ac_t""none needed" 1>&6
+else
+ echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6
+fi
+case "x$am_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $am_cv_prog_cc_stdc" ;;
+esac
+
+
+
+echo $ac_n "checking for function prototypes""... $ac_c" 1>&6
+echo "configure:1947: checking for function prototypes" >&5
+if test "$am_cv_prog_cc_stdc" != no; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define PROTOTYPES 1
+EOF
+
+ U= ANSI2KNR=
+else
+ echo "$ac_t""no" 1>&6
+ U=_ ANSI2KNR=./ansi2knr
+ # Ensure some checks needed by ansi2knr itself.
+ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1960: 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 1965 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1973: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+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 1990 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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 2008 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2029 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
:
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ for ac_hdr in string.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2067: 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 2072 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+fi
+
+
+ALL_LINGUAS="he"
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:2108: 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 1349 "configure"
+#line 2113 "configure"
#include "confdefs.h"
-#define _LARGE_FILES 1
-#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
-
-
int main() {
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
; return 0; }
EOF
-if { (eval echo configure:1361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- gawk_cv_sys_large_files=1
+ ac_cv_c_const=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
fi
rm -f conftest*
fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:2183: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 2190 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:2197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
rm -f conftest*
+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
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
EOF
+ ;;
+esac
- fi
- echo $ac_n "checking for _XOPEN_SOURCE value needed for large files""... $ac_c" 1>&6
-echo "configure:1381: checking for _XOPEN_SOURCE value needed for large files" >&5
-if eval "test \"`echo '$''{'gawk_cv_sys_xopen_source'+set}'`\" = set"; then
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:2223: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- gawk_cv_sys_xopen_source=no
- cat > conftest.$ac_ext <<EOF
-#line 1387 "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 2228 "configure"
#include "confdefs.h"
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
-
-#include <stdio.h>
-
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_off_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+ cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2256: 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 2261 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+# 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:2291: 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 2296 "configure"
+#include "confdefs.h"
+#include <alloca.h>
int main() {
-return !ftello;
+char *p = alloca(2 * sizeof(int));
; return 0; }
EOF
-if { (eval echo configure:1398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- :
+if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_header_alloca_h=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
+ ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:2324: 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 1405 "configure"
+#line 2329 "configure"
#include "confdefs.h"
-#define _XOPEN_SOURCE 500
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:2357: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_func_alloca_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.${ac_objext}
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:2389: 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 2394 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+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:2419: 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 2424 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:2474: 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
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2482 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:2501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_stack_direction=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+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:2526: 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 2531 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2565: 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 2570 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:2618: 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
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2626 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
#include <sys/types.h>
- int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
-
-#include <stdio.h>
-
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
+}
+
+EOF
+if { (eval echo configure:2766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+
+ for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2794: 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 2799 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+strdup __argz_count __argz_stringify __argz_next
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2834: 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 2839 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
int main() {
-return !ftello;
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
; return 0; }
EOF
-if { (eval echo configure:1417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- gawk_cv_sys_xopen_source=500
+ eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ for ac_func in stpcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2891: 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 2896 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
rm -f conftest*
fi
-echo "$ac_t""$gawk_cv_sys_xopen_source" 1>&6
- if test "$gawk_cv_sys_xopen_source" != no; then
- cat >> confdefs.h <<EOF
-#define _XOPEN_SOURCE $gawk_cv_sys_xopen_source
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STPCPY 1
+EOF
+
fi
-
-echo $ac_n "checking for AIX compilation hacks""... $ac_c" 1>&6
-echo "configure:1440: checking for AIX compilation hacks" >&5
-if eval "test \"`echo '$''{'gawk_cv_aix_hack'+set}'`\" = set"; then
+ if test $ac_cv_header_locale_h = yes; then
+ echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:2953: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+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
+ cat > conftest.$ac_ext <<EOF
+#line 2958 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:2965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=yes
else
- gawk_cv_aix_hack=no
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=no
fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+ fi
+ fi
+ echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+echo "configure:2986: checking whether NLS is requested" >&5
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
+else
+ USE_NLS=yes
fi
-echo "$ac_t""${gawk_cv_aix_hack}" 1>&6
+ echo "$ac_t""$USE_NLS" 1>&6
+
-if test "$ISC" = 1 # will be set by test for ISC
-then
- CFLAGS="$CFLAGS -D_SYSV3"
+ USE_INCLUDED_LIBINTL=no
+
+ if test "$USE_NLS" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define ENABLE_NLS 1
+EOF
+
+ echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+echo "configure:3006: checking whether included gettext is requested" >&5
+ # Check whether --with-included-gettext or --without-included-gettext was given.
+if test "${with_included_gettext+set}" = set; then
+ withval="$with_included_gettext"
+ nls_cv_force_use_gnu_gettext=$withval
+else
+ nls_cv_force_use_gnu_gettext=no
fi
+ echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+echo "configure:3025: checking for libintl.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 3030 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:3052: checking for gettext in libc" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3057 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:3080: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3088 "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
+ builtin and then its argument prototype would still apply. */
+char bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:3099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
+echo "configure:3115: checking for gettext in -lintl" >&5
+ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3123 "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
+ builtin and then its argument prototype would still apply. */
+char gettext();
+
+int main() {
+gettext()
+; return 0; }
+EOF
+if { (eval echo configure:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo intl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lintl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$ac_cv_lib_intl_gettext" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GETTEXT 1
+EOF
+
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3176: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$MSGFMT" != "no"; then
+ for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3210: 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 3215 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3265: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3301: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat > conftest.$ac_ext <<EOF
+#line 3333 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+fi
+rm -f conftest*
+ INSTOBJEXT=.mo
+ fi
+ fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ if test "$CATOBJEXT" = "NONE"; then
+ echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6
+echo "configure:3364: checking whether catgets can be used" >&5
+ # Check whether --with-catgets or --without-catgets was given.
+if test "${with_catgets+set}" = set; then
+ withval="$with_catgets"
+ nls_cv_use_catgets=$withval
+else
+ nls_cv_use_catgets=no
+fi
+
+ echo "$ac_t""$nls_cv_use_catgets" 1>&6
+
+ if test "$nls_cv_use_catgets" = "yes"; then
+ echo $ac_n "checking for main in -li""... $ac_c" 1>&6
+echo "configure:3377: checking for main in -li" >&5
+ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-li $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3385 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:3392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-li $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ echo $ac_n "checking for catgets""... $ac_c" 1>&6
+echo "configure:3420: checking for catgets" >&5
+if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3425 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char catgets(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char catgets();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_catgets) || defined (__stub___catgets)
+choke me
+#else
+catgets();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_catgets=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_CATGETS 1
+EOF
+
+ INTLOBJS="\$(CATOBJS)"
+ # Extract the first word of "gencat", so it can be a program name with args.
+set dummy gencat; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3470: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GENCAT" in
+ /*)
+ ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GENCAT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no"
+ ;;
+esac
+fi
+GENCAT="$ac_cv_path_GENCAT"
+if test -n "$GENCAT"; then
+ echo "$ac_t""$GENCAT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$GENCAT" != "no"; then
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3506: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test "$GMSGFMT" = "no"; then
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3543: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3578: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.cat
+ INSTOBJEXT=.cat
+ DATADIRNAME=lib
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+ fi
+
+ if (test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes") \
+ && test "$ac_cv_func_dcgettext" = no; then
+ nls_cv_use_gnu_gettext=yes
+ elif test "$CATOBJEXT" = "NONE"; then
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ INTLOBJS="\$(GETTOBJS)"
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3640: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3674: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:3710: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ 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
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=intl/libintl.h
+ nls_cv_header_libgt=intl/libgettext.h
+ fi
+ if test -z "$nls_cv_header_intl"; then
+ # Clean out junk possibly left behind by a previous configuration.
+ rm -f intl/libintl.h
+ fi
+
+
+
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+echo "configure:3807: checking for catalogs to be installed" >&5
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ echo "$ac_t""$LINGUAS" 1>&6
+ fi
+
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+
+
+ test -d intl || mkdir intl
+ if test "$CATOBJEXT" = ".cat"; then
+ ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+echo "configure:3835: checking for linux/version.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 3840 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3845: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ msgformat=linux
+else
+ echo "$ac_t""no" 1>&6
+msgformat=xopen
+fi
+
+
+ sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
+ fi
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
+
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+
+
+
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+
+
+ l=
+
+
+ test -d po || mkdir po
+ case "$srcdir" in
+ .)
+ posrcprefix="../" ;;
+ /* | [A-Za-z]:*)
+ posrcprefix="$srcdir/" ;;
+ *)
+ posrcprefix="../$srcdir/" ;;
+ esac
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+
+
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1463: checking for ANSI C header files" >&5
+echo "configure:3910: 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 1468 "configure"
+#line 3915 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1472,7 +3919,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1489,7 +3936,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 1493 "configure"
+#line 3940 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1507,7 +3954,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 1511 "configure"
+#line 3958 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1528,7 +3975,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1532 "configure"
+#line 3979 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1539,7 +3986,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1563,12 +4010,12 @@ EOF
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1567: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:4014: 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 1572 "configure"
+#line 4019 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -1584,7 +4031,7 @@ wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:1588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
@@ -1604,21 +4051,23 @@ EOF
fi
-for ac_hdr in limits.h locale.h stdarg.h unistd.h signum.h sys/param.h string.h
+for ac_hdr in fcntl.h limits.h locale.h libintl.h mcheck.h \
+ netdb.h netinet/in.h signum.h stdarg.h string.h \
+ sys/param.h sys/socket.h unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1612: checking for $ac_hdr" >&5
+echo "configure:4061: 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 1617 "configure"
+#line 4066 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4071: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1644,23 +4093,24 @@ else
fi
done
+
if test "$ac_cv_header_string_h" = yes
then
for ac_hdr in memory.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1654: checking for $ac_hdr" >&5
+echo "configure:4104: 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 1659 "configure"
+#line 4109 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1691,17 +4141,17 @@ else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1695: checking for $ac_hdr" >&5
+echo "configure:4145: 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 1700 "configure"
+#line 4150 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1730,12 +4180,12 @@ done
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1734: checking for pid_t" >&5
+echo "configure:4184: 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 1739 "configure"
+#line 4189 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1763,12 +4213,12 @@ EOF
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1767: checking return type of signal handlers" >&5
+echo "configure:4217: 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 1772 "configure"
+#line 4222 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1785,7 +4235,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1804,12 +4254,12 @@ EOF
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1808: checking for size_t" >&5
+echo "configure:4258: 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 1813 "configure"
+#line 4263 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1837,12 +4287,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:1841: checking for uid_t in sys/types.h" >&5
+echo "configure:4291: 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 1846 "configure"
+#line 4296 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@@ -1871,7 +4321,7 @@ EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:1875: checking type of array argument to getgroups" >&5
+echo "configure:4325: 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
@@ -1879,7 +4329,7 @@ else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 1883 "configure"
+#line 4333 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
@@ -1904,7 +4354,7 @@ main()
}
EOF
-if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_type_getgroups=gid_t
else
@@ -1918,7 +4368,7 @@ fi
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 1922 "configure"
+#line 4372 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@@ -1941,8 +4391,84 @@ cat >> confdefs.h <<EOF
EOF
+
+ 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:4400: 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 4405 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
+echo "configure:4437: checking for ssize_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4442 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_ssize_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_ssize_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_ssize_t" 1>&6
+if test $ac_cv_type_ssize_t = no; then
+ cat >> confdefs.h <<\EOF
+#define ssize_t int
+EOF
+
+fi
+
+
+
cat > conftest.$ac_ext <<EOF
-#line 1946 "configure"
+#line 4472 "configure"
#include "confdefs.h"
#include <stdio.h>
EOF
@@ -1963,146 +4489,165 @@ fi
rm -f conftest*
-if test "$YACC" = "bison -y" ||
- { test -f $srcdir/awktab.c && grep 'alloca *(' $srcdir/awktab.c > /dev/null; }
-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:1973: checking for working alloca.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+cat >> confdefs.h <<\EOF
+#define REGEX_MALLOC 1
+EOF
+
+echo $ac_n "checking for vprintf""... $ac_c" 1>&6
+echo "configure:4498: 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 1978 "configure"
+#line 4503 "configure"
#include "confdefs.h"
-#include <alloca.h>
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vprintf(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char vprintf();
+
int main() {
-char *p = alloca(2 * sizeof(int));
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_vprintf) || defined (__stub___vprintf)
+choke me
+#else
+vprintf();
+#endif
+
; return 0; }
EOF
-if { (eval echo configure:1985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- ac_cv_header_alloca_h=yes
+ eval "ac_cv_func_vprintf=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_header_alloca_h=no
+ eval "ac_cv_func_vprintf=no"
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
-if test $ac_cv_header_alloca_h = yes; then
+if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA_H 1
+#define HAVE_VPRINTF 1
EOF
+else
+ echo "$ac_t""no" 1>&6
fi
-echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:2006: checking for alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+if test "$ac_cv_func_vprintf" != yes; then
+echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
+echo "configure:4550: 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 2011 "configure"
+#line 4555 "configure"
#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt();
-#ifdef __GNUC__
-# define alloca __builtin_alloca
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
#else
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-# endif
-# endif
-# endif
-# endif
+_doprnt();
#endif
-int main() {
-char *p = (char *) alloca(1);
; return 0; }
EOF
-if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- ac_cv_func_alloca_works=yes
+ eval "ac_cv_func__doprnt=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_func_alloca_works=no
+ eval "ac_cv_func__doprnt=no"
fi
rm -f conftest*
fi
-echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
-if test $ac_cv_func_alloca_works = yes; then
+if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
-#define HAVE_ALLOCA 1
+#define HAVE_DOPRNT 1
EOF
+else
+ echo "$ac_t""no" 1>&6
fi
-if test $ac_cv_func_alloca_works = no; then
- # The SVR3 libPW and SVR4 libucb both contain incompatible functions
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
- ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
-#define C_ALLOCA 1
-EOF
+fi
-echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:2071: checking whether alloca needs Cray hooks" >&5
-if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+for ac_hdr in stdlib.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:4607: 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 2076 "configure"
+#line 4612 "configure"
#include "confdefs.h"
-#if defined(CRAY) && ! defined(CRAY2)
-webecray
-#else
-wenotbecray
-#endif
-
+#include <$ac_hdr>
EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "webecray" >/dev/null 2>&1; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4617: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
rm -rf conftest*
- ac_cv_os_cray=yes
+ eval "ac_cv_header_$ac_safe=yes"
else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
rm -rf conftest*
- ac_cv_os_cray=no
+ eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
-
fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
-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:2101: checking for $ac_func" >&5
+for ac_func in strtod
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4646: 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 2106 "configure"
+#line 4651 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2125,7 +4670,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2139,180 +4684,389 @@ fi
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
cat >> confdefs.h <<EOF
-#define CRAY_STACKSEG_END $ac_func
+#define $ac_tr_func 1
EOF
-
- break
+
else
echo "$ac_t""no" 1>&6
fi
-
done
-fi
-echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:2156: checking stack direction for C alloca" >&5
-if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+echo $ac_n "checking for strtod with C89 semantics""... $ac_c" 1>&6
+echo "configure:4699: checking for strtod with C89 semantics" >&5
+if eval "test \"`echo '$''{'gawk_ac_cv_func_strtod_c89'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
- ac_cv_c_stack_direction=0
+ gawk_ac_cv_func_strtod_c89=no
else
cat > conftest.$ac_ext <<EOF
-#line 2164 "configure"
+#line 4707 "configure"
#include "confdefs.h"
-find_stack_direction ()
-{
- static char *addr = 0;
- auto char dummy;
- if (addr == 0)
- {
- addr = &dummy;
- return find_stack_direction ();
- }
- else
- return (&dummy > addr) ? 1 : -1;
-}
+/* Test program from Arnold Robbins (arnold@skeeve.com) */
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern double strtod();
+#endif
+
+int
main ()
{
- exit (find_stack_direction() < 0);
+#if ! HAVE_STRTOD
+ exit(1);
+#else
+ double d;
+ char *str = "0x345a";
+
+ d = strtod(str, 0);
+ if (d == 0)
+ exit (0);
+ else
+ exit (1);
}
EOF
-if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
- ac_cv_c_stack_direction=1
+ gawk_ac_cv_func_strtod_c89=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
- ac_cv_c_stack_direction=-1
+ gawk_ac_cv_func_strtod_c89=no
fi
rm -fr conftest*
fi
fi
-echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
-cat >> confdefs.h <<EOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
+echo "$ac_t""$gawk_ac_cv_func_strtod_c89" 1>&6
+if test $gawk_ac_cv_func_strtod_c89 = no; then
+ cat >> confdefs.h <<\EOF
+#define STRTOD_NOT_C89 1
EOF
fi
-fi
-cat >> confdefs.h <<\EOF
-#define REGEX_MALLOC 1
-EOF
-
-echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2210: checking for vprintf" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:4755: 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 2215 "configure"
+#line 4760 "configure"
#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char vprintf(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char vprintf();
-
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_vprintf) || defined (__stub___vprintf)
-choke me
-#else
-vprintf();
-#endif
-
+struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:2238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4769: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- eval "ac_cv_func_vprintf=yes"
+ ac_cv_header_time=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func_vprintf=no"
+ ac_cv_header_time=no
fi
rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
- echo "$ac_t""yes" 1>&6
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
cat >> confdefs.h <<\EOF
-#define HAVE_VPRINTF 1
+#define TIME_WITH_SYS_TIME 1
EOF
+fi
+
+for ac_hdr in sys/time.h unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:4793: 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 4798 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:4803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
else
echo "$ac_t""no" 1>&6
fi
+done
-if test "$ac_cv_func_vprintf" != yes; then
-echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2262: checking for _doprnt" >&5
-if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
+for ac_func in alarm
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4832: 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 2267 "configure"
+#line 4837 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char _doprnt(); below. */
+ which can conflict with char $ac_func(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char _doprnt();
+char $ac_func();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub__doprnt) || defined (__stub____doprnt)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-_doprnt();
+$ac_func();
#endif
; return 0; }
EOF
-if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_func__doprnt=yes"
+ eval "ac_cv_func_$ac_func=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func__doprnt=no"
+ eval "ac_cv_func_$ac_func=no"
fi
rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_DOPRNT 1
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
EOF
-
+
else
echo "$ac_t""no" 1>&6
fi
+done
+
+echo $ac_n "checking for working mktime""... $ac_c" 1>&6
+echo "configure:4885: checking for working mktime" >&5
+if eval "test \"`echo '$''{'ac_cv_func_working_mktime'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_working_mktime=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4893 "configure"
+#include "confdefs.h"
+/* Test program from Paul Eggert (eggert@twinsun.com)
+ and Tony Leneis (tony@plaza.ds.adp.com). */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#if !HAVE_ALARM
+# define alarm(X) /* empty */
+#endif
+
+/* Work around redefinition to rpl_putenv by other config tests. */
+#undef putenv
+
+static time_t time_t_max;
+
+/* Values we'll use to set the TZ environment variable. */
+static const char *const tz_strings[] = {
+ (const char *) 0, "TZ=GMT0", "TZ=JST-9",
+ "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
+};
+#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
+
+/* Fail if mktime fails to convert a date in the spring-forward gap.
+ Based on a problem report from Andreas Jaeger. */
+static void
+spring_forward_gap ()
+{
+ /* glibc (up to about 1998-10-07) failed this test) */
+ struct tm tm;
+
+ /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
+ instead of "TZ=America/Vancouver" in order to detect the bug even
+ on systems that don't support the Olson extension, or don't have the
+ full zoneinfo tables installed. */
+ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
+
+ tm.tm_year = 98;
+ tm.tm_mon = 3;
+ tm.tm_mday = 5;
+ tm.tm_hour = 2;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = -1;
+ if (mktime (&tm) == (time_t)-1)
+ exit (1);
+}
+
+static void
+mktime_test (now)
+ time_t now;
+{
+ struct tm *lt;
+ if ((lt = localtime (&now)) && mktime (lt) != now)
+ exit (1);
+ now = time_t_max - now;
+ if ((lt = localtime (&now)) && mktime (lt) != now)
+ exit (1);
+}
+
+static void
+irix_6_4_bug ()
+{
+ /* Based on code from Ariel Faigon. */
+ struct tm tm;
+ tm.tm_year = 96;
+ tm.tm_mon = 3;
+ tm.tm_mday = 0;
+ tm.tm_hour = 0;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ tm.tm_isdst = -1;
+ mktime (&tm);
+ if (tm.tm_mon != 2 || tm.tm_mday != 31)
+ exit (1);
+}
+
+static void
+bigtime_test (j)
+ int j;
+{
+ struct tm tm;
+ time_t now;
+ tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
+ now = mktime (&tm);
+ if (now != (time_t) -1)
+ {
+ struct tm *lt = localtime (&now);
+ if (! (lt
+ && lt->tm_year == tm.tm_year
+ && lt->tm_mon == tm.tm_mon
+ && lt->tm_mday == tm.tm_mday
+ && lt->tm_hour == tm.tm_hour
+ && lt->tm_min == tm.tm_min
+ && lt->tm_sec == tm.tm_sec
+ && lt->tm_yday == tm.tm_yday
+ && lt->tm_wday == tm.tm_wday
+ && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
+ == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
+ exit (1);
+ }
+}
+
+int
+main ()
+{
+ time_t t, delta;
+ int i, j;
+
+ /* This test makes some buggy mktime implementations loop.
+ Give up after 60 seconds; a mktime slower than that
+ isn't worth using anyway. */
+ alarm (60);
+
+ for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2)
+ continue;
+ time_t_max--;
+ delta = time_t_max / 997; /* a suitable prime number */
+ for (i = 0; i < N_STRINGS; i++)
+ {
+ if (tz_strings[i])
+ putenv (tz_strings[i]);
+
+ for (t = 0; t <= time_t_max - delta; t += delta)
+ mktime_test (t);
+ mktime_test ((time_t) 60 * 60);
+ mktime_test ((time_t) 60 * 60 * 24);
+
+ for (j = 1; 0 < j; j *= 2)
+ bigtime_test (j);
+ bigtime_test (j - 1);
+ }
+ irix_6_4_bug ();
+ spring_forward_gap ();
+ exit (0);
+}
+EOF
+if { (eval echo configure:5042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_working_mktime=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_working_mktime=no
+fi
+rm -fr conftest*
+fi
fi
+echo "$ac_t""$ac_cv_func_working_mktime" 1>&6
+if test $ac_cv_func_working_mktime = no; then
+ LIBOBJS="$LIBOBJS mktime.${ac_objext}"
+fi
+
+case "$ac_cv_func_working_mktime" in
+yes) cat >> confdefs.h <<\EOF
+#define HAVE_MKTIME 1
+EOF
+
+ ;;
+esac
echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6
-echo "configure:2316: checking for fmod in -lm" >&5
+echo "configure:5070: 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
@@ -2320,7 +5074,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2324 "configure"
+#line 5078 "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
@@ -2331,7 +5085,7 @@ int main() {
fmod()
; return 0; }
EOF
-if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2358,16 +5112,16 @@ else
echo "$ac_t""no" 1>&6
fi
-for ac_func in madvise memset memcpy memcmp fmod setlocale strchr strerror \
- strftime strncasecmp strtod system tzset
+for ac_func in 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:2366: checking for $ac_func" >&5
+echo "configure:5120: 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 2371 "configure"
+#line 5125 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2390,7 +5144,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2415,21 +5169,19 @@ fi
done
-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:2423: checking for $ac_hdr" >&5
+ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
+echo "configure:5175: checking for dlfcn.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 2428 "configure"
+#line 5180 "configure"
#include "confdefs.h"
-#include <$ac_hdr>
+#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2445,268 +5197,74 @@ rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2462: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5202: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- cat > conftest.$ac_ext <<EOF
-#line 2467 "configure"
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5210 "configure"
#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char $ac_func();
+char dlopen();
int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+dlopen()
; return 0; }
EOF
-if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+ eval "ac_cv_lib_$ac_lib_var=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
-fi
+LIBS="$ac_save_LIBS"
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+ cat >> confdefs.h <<\EOF
+#define DYNAMIC 1
EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:2515: 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
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 2523 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
+ LIBS="$LIBS -ldl"
+ if test "$GCC" = yes
+ then
+ # Add others here as appropriate,
+ # one day use GNU libtool.
+ if uname | egrep -i linux > /dev/null
+ then
+ LDFLAGS="$LDFLAGS -rdynamic"
+ fi
+ fi
-EOF
-if { (eval echo configure:2663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_mmap_fixed_mapped=yes
else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
+ echo "$ac_t""no" 1>&6
fi
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
+else
+ echo "$ac_t""no" 1>&6
fi
-if (uname) > /dev/null 2>&1
-then
- case `uname` in
- *VMS*|*BeOS*)
- cat >> confdefs.h <<\EOF
+case `(uname) 2> /dev/null` in
+*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:2710: checking whether getpgrp takes no argument" >&5
+ ;;
+*) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
+echo "configure:5268: 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
@@ -2714,7 +5272,7 @@ else
{ echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2718 "configure"
+#line 5276 "configure"
#include "confdefs.h"
/*
@@ -2769,7 +5327,7 @@ main()
}
EOF
-if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_getpgrp_void=yes
else
@@ -2792,193 +5350,251 @@ EOF
fi
- ;;
- *) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:2798: 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
+ ;;
+esac
+
+
+gawk_have_sockets=no
+# Check for system-dependent location of socket libraries
+
+SOCKET_LIBS=
+if test "$ISC" = yes; then
+ SOCKET_LIBS="-lnsl_s -linet"
else
- if test "$cross_compiling" = yes; then
- { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; }
+ # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
+ # libraries were built with DECnet support. And karl@cs.umb.edu says
+ # the Alpha needs dnet_stub (dnet does not exist).
+ #
+ # ADR: Is this needed just for sockets???
+# AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"])
+# if test $ac_cv_lib_dnet_ntoa = no; then
+# AC_CHECK_LIB(dnet_stub, dnet_ntoa,
+# [SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"])
+# fi
+
+ # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
+ # to get the SysV transport functions.
+ # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
+ # needs -lnsl.
+ # The nsl library prevents programs from opening the X display
+ # on Irix 5.2, according to dickey@clark.net.
+ echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
+echo "configure:5383: checking for gethostbyname" >&5
+if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2806 "configure"
+#line 5388 "configure"
#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char gethostbyname(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
-/*
- * 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);
+int main() {
- 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);
- }
-}
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+choke me
+#else
+gethostbyname();
+#endif
+; return 0; }
EOF
-if { (eval echo configure:2861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_getpgrp_void=yes
+if { (eval echo configure:5411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_getpgrp_void=no
+ rm -rf conftest*
+ eval "ac_cv_func_gethostbyname=no"
fi
-rm -fr conftest*
+rm -f conftest*
fi
-
+if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
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
+ if test $ac_cv_func_gethostbyname = no; then
+ echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:5432: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5440 "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
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:5451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
- ;;
- esac
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SOCKET_LIBS="$SOCKET_LIBS -lnsl"
else
- echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:2888: checking whether getpgrp takes no argument" >&5
-if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ # lieder@skyler.mavd.honeywell.com says without -lsocket,
+ # socket/setsockopt and other routines are undefined under SCO ODT
+ # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
+ # on later versions), says simon@lia.di.epfl.ch: it contains
+ # gethostby* variants that don't use the nameserver (or something).
+ # -lsocket must be given before -lnsl if both are needed.
+ # We assume that if connect needs -lnsl, so does gethostbyname.
+ echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:5481: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+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 2896 "configure"
+#line 5486 "configure"
#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
-/*
- * 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 main() {
-int pid;
-int pg1, pg2, pg3, pg4;
-int ng, np, s, child;
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
-main()
-{
- pid = getpid();
- pg1 = getpgrp(0);
- pg2 = getpgrp();
- pg3 = getpgrp(pid);
- pg4 = getpgrp(1);
+; return 0; }
+EOF
+if { (eval echo configure:5509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_connect=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
- /*
- * 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);
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+fi
- 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);
- }
-}
+ if test $ac_cv_func_connect = no; then
+ echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:5530: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $SOCKET_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5538 "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
+ builtin and then its argument prototype would still apply. */
+char connect();
+int main() {
+connect()
+; return 0; }
EOF
-if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_getpgrp_void=yes
+if { (eval echo configure:5549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=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*
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SOCKET_LIBS="-lsocket $SOCKET_LIBS"
+ gawk_have_sockets=yes
+else
+ echo "$ac_t""no" 1>&6
+fi
+ else
+ gawk_have_sockets=yes
+ 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
+if test "${gawk_have_sockets}" = "yes"
+then
+ echo $ac_n "checking where to find the socket library calls""... $ac_c" 1>&6
+echo "configure:5578: checking where to find the socket library calls" >&5
+ case "${SOCKET_LIBS}" in
+ ?*) gawk_lib_loc="${SOCKET_LIBS}" ;;
+ *) gawk_lib_loc="the standard library" ;;
+ esac
+ echo "$ac_t""${gawk_lib_loc}" 1>&6
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_SOCKETS 1
EOF
fi
-fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:2977: checking for st_blksize in struct stat" >&5
+echo "configure:5593: 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 2982 "configure"
+#line 5598 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -2986,7 +5602,7 @@ int main() {
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:2990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
@@ -3007,12 +5623,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3011: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:5627: 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 3016 "configure"
+#line 5632 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -3021,7 +5637,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:3025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -3042,12 +5658,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3046: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:5662: 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 3051 "configure"
+#line 5667 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -3055,7 +5671,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:3059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -3076,12 +5692,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3080: checking for tm_zone in struct tm" >&5
+echo "configure:5696: 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 3085 "configure"
+#line 5701 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@@ -3089,7 +5705,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
-if { (eval echo configure:3093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5709: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@@ -3109,12 +5725,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3113: checking for tzname" >&5
+echo "configure:5729: 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 3118 "configure"
+#line 5734 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@@ -3124,7 +5740,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
-if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@@ -3147,14 +5763,14 @@ fi
echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3151: checking whether char is unsigned" >&5
+echo "configure:5767: 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 3158 "configure"
+#line 5774 "configure"
#include "confdefs.h"
#ifdef __CHAR_UNSIGNED__
yes
@@ -3176,7 +5792,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 3180 "configure"
+#line 5796 "configure"
#include "confdefs.h"
/* volatile prevents gcc2 from optimizing the test away on sparcs. */
#if !defined(__STDC__) || __STDC__ != 1
@@ -3186,7 +5802,7 @@ main() {
volatile char c = 255; exit(c < 0);
}
EOF
-if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_char_unsigned=yes
else
@@ -3210,12 +5826,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3214: checking for working const" >&5
+echo "configure:5830: 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 3219 "configure"
+#line 5835 "configure"
#include "confdefs.h"
int main() {
@@ -3264,7 +5880,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:3268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -3284,15 +5900,55 @@ EOF
fi
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:5905: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 5912 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:5919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
-echo $ac_n "checking for ANSI stringizing capability""... $ac_c" 1>&6
-echo "configure:3291: checking for ANSI stringizing capability" >&5
-if eval "test \"`echo '$''{'gawk_cv_c_stringize'+set}'`\" = set"; then
+echo $ac_n "checking for preprocessor stringizing operator""... $ac_c" 1>&6
+echo "configure:5947: checking for preprocessor stringizing operator" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stringize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3296 "configure"
+#line 5952 "configure"
#include "confdefs.h"
#define x(y) #y
@@ -3303,23 +5959,23 @@ EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "#teststring" >/dev/null 2>&1; then
rm -rf conftest*
- gawk_cv_c_stringize=no
+ ac_cv_c_stringize=no
else
rm -rf conftest*
- gawk_cv_c_stringize=yes
+ ac_cv_c_stringize=yes
fi
rm -f conftest*
fi
-if test "${gawk_cv_c_stringize}" = yes
+if test "${ac_cv_c_stringize}" = yes
then
- cat >> confdefs.h <<\EOF
+ cat >> confdefs.h <<\EOF
#define HAVE_STRINGIZE 1
EOF
fi
-echo "$ac_t""${gawk_cv_c_stringize}" 1>&6
+echo "$ac_t""${ac_cv_c_stringize}" 1>&6
trap '' 1 2 15
@@ -3423,7 +6079,12 @@ done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
-trap 'rm -fr `echo "Makefile doc/Makefile test/Makefile awklib/Makefile config.h:configh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "Makefile \
+ awklib/Makefile \
+ doc/Makefile \
+ intl/Makefile \
+ po/Makefile.in \
+ test/Makefile config.h:configh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -3455,15 +6116,54 @@ s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
-s%@YACC@%$YACC%g
-s%@LN_S@%$LN_S%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@PACKAGE@%$PACKAGE%g
+s%@VERSION@%$VERSION%g
+s%@ACLOCAL@%$ACLOCAL%g
+s%@AUTOCONF@%$AUTOCONF%g
+s%@AUTOMAKE@%$AUTOMAKE%g
+s%@AUTOHEADER@%$AUTOHEADER%g
+s%@MAKEINFO@%$MAKEINFO%g
+s%@AMTAR@%$AMTAR%g
+s%@install_sh@%$install_sh%g
+s%@AWK@%$AWK%g
s%@SET_MAKE@%$SET_MAKE%g
+s%@AMDEP@%$AMDEP%g
+s%@AMDEPBACKSLASH@%$AMDEPBACKSLASH%g
+s%@DEPDIR@%$DEPDIR%g
+s%@YACC@%$YACC%g
+s%@LN_S@%$LN_S%g
+s%@CC@%$CC%g
+s%@CPP@%$CPP%g
+s%@CCDEPMODE@%$CCDEPMODE%g
+s%@RANLIB@%$RANLIB%g
+s%@U@%$U%g
+s%@ANSI2KNR@%$ANSI2KNR%g
s%@ALLOCA@%$ALLOCA%g
+s%@USE_NLS@%$USE_NLS%g
+s%@MSGFMT@%$MSGFMT%g