#! /bin/sh # This is patch #3 to gawk 3.0. cd to gawk-3.0.2 and sh this file. # Them remove all the .orig files and rename the directory gawk-3.0.3. # first, apply patches patch -p1 << \EOF diff -crN gawk-3.0.2/COPYING gawk-3.0.3/COPYING *** gawk-3.0.2/COPYING Tue Nov 21 06:42:34 1995 --- gawk-3.0.3/COPYING Thu May 1 21:36:06 1997 *************** *** 2,8 **** Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. ! 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. --- 2,8 ---- Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. ! 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. *************** *** 279,285 **** END OF TERMS AND CONDITIONS ! Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it --- 279,285 ---- END OF TERMS AND CONDITIONS ! How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it *************** *** 305,311 **** 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 Also add information on how to contact you by electronic and paper mail. --- 305,312 ---- 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 ! Also add information on how to contact you by electronic and paper mail. diff -crN gawk-3.0.2/ChangeLog gawk-3.0.3/ChangeLog *** gawk-3.0.2/ChangeLog Wed Dec 25 11:25:32 1996 --- gawk-3.0.3/ChangeLog Thu May 15 12:49:48 1997 *************** *** 1,3 **** --- 1,283 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Wed May 14 08:06:08 1997 Arnold D. Robbins + + * io.c (do_close): add lint warning if closing something that + isn't open. + + Tue May 13 12:14:12 1997 Arnold D. Robbins + + * random.c, builtin.c: remove __GLIBC__ tests, since it breaks + `make test'. I prefer consistency across platforms. + * Makefile.in (gawk): undid April 25 changes and added comment. + Putting COMPLAGS in breaks with -g on VMS POSIX. + + Sun May 11 14:48:04 1997 Darrell Hankerson + + * io.c [MSC_VER]: add cases for WIN32. + * regex.c [MSC_VER]: add cases for WIN32. + + Sun May 11 07:04:01 1997 Arnold D. Robbins + + * builtin.c (do_print): in the loop that evaluates each expression + to be printed, do a dupnode to avoid bizarre output. Thanks to + Michal for finding this problem. + * awk.y (yylex): fix scanning of hexadecimal constants. + + Wed May 7 15:09:25 1997 Arnold D. Robbins + + * io.c (get_a_record): fix casetable indexing with cast to int. + Keeps Michal happy. + + Tue May 6 16:40:19 1997 Arnold D. Robbins + + * eval.c (func_call): removed unneeded variables. + + Mon May 5 21:17:37 1997 Pat Rankin + + * missing/strftime.c [case 'v', VMS_EXT]: for VMS date format, two + digit day of month should not be zero padded on the 1st through + the 9th. + + Mon May 5 06:33:47 1997 Arnold D. Robbins + + * regex.h, regex.c: merge with current GLIBC version. + + Mon May 5 06:33:47 1997 Pat Rankin + + * io.c (nextfile): move the check for null return from iop_open + in the normal case and add one for the "no args" case. + + Fri Apr 25 16:52:33 1997 Arnold D. Robbins + + * array.c (grow_table): add a bunch more large primes so arrays + can get really big. Thanks to christos@deshaw.com. + * all files: remove ifdef'ed out code and update copyrights. + * Makefile.in (gawk): add $(COMPFLAGS) to command line. + * eval.c (flags2str): added case for FIELD. + + Thu Apr 24 22:39:23 1997 Arnold D. Robbins + + * COPYING: changed to current official version from FSF. + * regex.c: merge with GLIBC version. + * awk.h [_GNU_SOURCE]: bracket definition inside ifdef. + (NODE.source_line): move name member out of `x' union and + into `nodep'; avoids problems doing diagnostics. + (nondec2num): put decl into #if BITOPS || NONDECDATA + * posix/gawkmisc.c, missing/system.c, missing/strtod.c, + missing/strerror.c: move to generic GPL statement at top. + * builtin.c (nondec2num): put into #if BITOPS || NONDECDATA + + Wed Apr 23 22:14:14 1997 Arnold D. Robbins + + * dfa.c: misc changes for really pedantic SGI compilers. + * builtin.c: bracket defs of random() etc for GLIBC. + * random.c: bracket whole file for GLIBC. + * configure.in: extra goop for GETPGRP test for VMS POSIX. + * custom.h [VMS]: remove hard definition of GETPGRP_VOID. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Tue Apr 15 21:35:45 1997 Arnold D. Robbins + + NEW UNDOCUMENTED FEATURE. USE THE SOURCE LUKE! + * acconfig.h [NONDECDATA]: new macro. + * awk.h: add decl of do_strtonum. + * awk.y (tokentab): add entry for strtonum function. + * builtin.c (do_strtonum): new function. + * configure.in (non-decimal-data): new --enable-* option. + * node.c (r_force_number): change to allow non-decimal data inside + ifdef NONDECDATA. + + Tue Apr 15 06:32:50 1997 Pat Rankin + + * missing/strftime.c (malloc, realloc, getenv, strchr): only + declare these when STDC_HEADERS is not defined. + : include these when STDC_HEADERS is defined. + * awk.h (freenode, tree_eval, m_tree_eval): reorganize definitions. + * alloca.c (malloc): if malloc is already defined as a macro, + presumeably by config.h, don't define or declare it. + + Wed Apr 9 22:45:27 1997 Arnold D. Robbins + + * Makefile.in [COMPFLAGS]: per suggestion from Karl Berry, put + $(CFLAGS) last. + + Tue Apr 8 23:54:46 1997 Arnold D. Robbins + + * eval.c (interpret): For Node_K_break and Node_K_continue, if + treating them like `next', also check the function call stack + and pop it if necessary. + + Mon Apr 7 18:22:37 1997 Arnold D. Robbins + + * awk.h: Add decls of new routines do_compl() and set_loc(). + * awk.y (tokentab): add entry for "compl" function. + * builtin.c (do_compl): new functionto do ones complement. + (do_substr): rationalized yet again, now notices negative start + and length parameters. + * eval.c (push_args): fix if call_list gets realloc'ed in the + middle of things. Avoids crash for deeply nested function calls. + * main.c (catch_sig): add call to set_loc(). + * msg.c (set_loc, srcfile, srcline): new function and private + variables to help out in tracing down source of error messages. + + Fri Mar 28 08:42:27 1997 Arnold D. Robbins + + * io.c (iop_alloc, iop_close): Undo changes of Feb 11, apparently + other cleanups in io.c made mmap stuff start working again. + BAH! It's a mess, the test suite still fails. I'm leaving the + mmap stuff undefined for now. It'll probably get ripped out in 3.1. + + Thu Mar 27 08:48:57 1997 Arnold D. Robbins + + * custom.h [_SEQUENT_]: undef HAVE_MMAP. + + Wed Mar 26 09:08:16 1997 Arnold D. Robbins + + * io.c (iop_alloc): fix definition to make it static. + + Mon Mar 24 23:09:07 1997 Arnold D. Robbins + + * field.c (init_fields, etc..): more clean up use of Null_field + and the various flags. + * node.c (unref): if a field, free the node itself. Fixes + memory leak problems. + + Sun Mar 23 22:51:09 1997 Arnold D. Robbins + + * awk.h [FIELD]: new flag for node->flags field. + * builtin.c (sub_common): if FIELD is set, dup the string. + * field.c (init_fields): set up a new Null_field global var. + (init_fields, set_field, set_record) use the FIELD flag. + (getfield): use Null_field instead of private variable. + * io.c (wait_any): comment out calls to pclose and iop_close, + caused weird race conditions. See test/pipeio1.awk. Thanks + to Darrell Hankerson for tracing this one down. + + Tue Mar 18 20:57:18 1997 Arnold D. Robbins + + * dfa.c (inboth): free templist; plugs memory leak. + * field.c (init_fields, grow_fields_arr, set_field, rebuild_record, + set_record): remove PERM flag from entries in fields_arr[]. Fixes + nasty memory leak. + + Tue Mar 18 06:33:00 1997 Arnold D. Robbins + + * awk.y (dup_parms): robustified against parameter errors. + + Sun Mar 16 21:31:40 1997 Arnold D. Robbins + + NEW UNDOCUMENTED FEATURE. USE THE SOURCE LUKE! + * acconfig.h [BITOPS]: new macro. If set, do octal & hex and bit ops. + * awk.h [isnondecimal]: new macro, and decl of new functions. + * awk.y (yylex): add recognition of octal and hex constants. + * builtin.c (do_and, do_or, do_xor, do_lshift, do_rshift): new + functions that do bit operations. + (nondec2awknum): new function to convert octal or hex to double. + * configure.in: Add AC_ARG_ENABLE for bit operations. + * node.c (r_force_number): add octal and hex conversion. + + Sun Mar 16 21:28:56 1997 Arnold D. Robbins + + * awk.h [IOP_NOFREE_OBJ]: new macro. + * io.c (iop_open, iop_alloc): add new third parameter, which is + either NULL, meaning allocate a new IOP, or the address of one + already allocated. Have a static one in the `nextfile' + routine, and use the IOP_NOFREE_OBJ flag for it. All of this + keeps us from reading freed memory. The `swaplns' test fails + otherwise. + (iop_close): if IOP_NOFREE_OBJ is set, don't free the IOBUF. + + Wed Feb 26 06:21:02 1997 Arnold D. Robbins + + * eval.c (in_function, pop_fcall_stack, pop_fcall, push_args): + new functions. These manage "frames" of awk function call arguments. + The problem is that a `next' or a `nextfile' from a function + leaks memory. These changes allow us to free up that memory. + (interpret): for Node_K_next and Node_K_nextfile, check if in + a function call and free all function call frames. + + Fri Feb 21 06:23:19 1997 Arnold D. Robbins + + * Misc changes from Katsuyuki Okabe : + * 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 + + * main.c (main): add do_intervals to condition that causes + resetup() to be called again. Makes the --re-interval option + actually work. What a concept. + + Fri Feb 14 09:47:31 1997 Arnold D. Robbins + + * io.c [#include "awk.h"]: undef HAVE_MMAP to just use thoe old code. + Something is causing a file descriptor leak, and this is getting to + be just too much hair. I reserve the right to rip out the mmap + code entirely at a future date. + + Tue Feb 11 06:28:29 1997 Arnold D. Robbins + + * io.c (iop_alloc): for an mmap'ed file, close the file descriptor, + and then touch each page to get a private copy. Fixes nasty case + of truncating our input file. + (iop_close): don't call close on mmap'ed file. + + Wed Feb 5 17:59:04 1997 Arnold D. Robbins + + * eval.c (interpret): For Node_K_delete, just call do_delete; let + it handle the case of `delete array'. + * array.c (do_delete): Changed to handle case of `delete array', + and made smarter if the array is actually an uninitialized + parameter. + + Sun Jan 26 22:58:29 1997 Arnold D. Robbins + + * getopt.h, getopt.c, getopt1.c: replaced with new versions from + GLIBC 2. + + Sun Jan 19 23:37:03 1997 Arnold D. Robbins + + * eval.c (nodetype2str): not static, for debugging. + (flags2str) new function: for debugging. + * field.c (get_field): add new var that is like Nnull_string but + does not have numeric attributes, so that new fields are strings. + (set_record): turn off PERM flag before unrefing fields and field 0. + * array.c (in_array): always evaluate subscript, could have + side effects. + * builtin.c (do_strftime): way increase size of buffer to make sure + we don't have overflow problem. Keeps Paul Eggert happy. + * custom.h [__amigaos__]: define fork to vfork. From Fred Fish. + * dfa.c: move include of config.h to top, for RSXNT. From Kai + Uwe Rommel. + (ISALPHA, etc): change from Jacob Engelbrecht (jaen@novo.dk) + to better handle non-ascii environments. + * gawkmisc.c: remove amigados case, posix should now work fine. + * amiga/*: nuked per previous entry. + * Makefile.in: removed all references to amiga + * io.c [HAVE_SYS_PARAM_H]: Add #undef RE_DUP_MAX to avoid + spurious conflict with regex.h. + (flush_io): remove amiga ifdefs, not needed anymore. + (spec_setup): set getrec field for special files. Fix from + Mark Gray (markgray@pdt.net). + * node.c (more_nodes): fix to get the last entry in the array. + + Wed Jan 8 17:42:37 1997 Andreas Schwab + + * io.c (mmap_get_record): Fix return value if file ends without + record separator. + + Fri Jan 3 19:57:16 1997 Pat Rankin + + * awk.y (get_src_buf): Test for an empty source file by detecting + an initial read of 0 bytes rather than by relying on info from + stat(). + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/Makefile.in gawk-3.0.3/Makefile.in *** gawk-3.0.2/Makefile.in Wed Dec 25 11:17:05 1996 --- gawk-3.0.3/Makefile.in Tue May 13 12:37:41 1997 *************** *** 1,6 **** # Makefile for GNU Awk. # ! # Copyright (C) 1986, 1988-1996 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,6 ---- # Makefile for GNU Awk. # ! # Copyright (C) 1986, 1988-1997 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 58,64 **** SHELL = /bin/sh CFLAGS = @CFLAGS@ ! COMPFLAGS = $(CFLAGS) -DGAWK -I. -I$(srcdir) @DEFS@ # object files AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \ --- 58,64 ---- SHELL = /bin/sh CFLAGS = @CFLAGS@ ! COMPFLAGS = -DGAWK -I. -I$(srcdir) @DEFS@ $(CFLAGS) # object files AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \ *************** *** 97,103 **** ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \ stamp-h.in ! OTHERS= amiga doc pc atari vms README_d posix awklib ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info* --- 97,103 ---- ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \ stamp-h.in ! OTHERS= doc pc atari vms README_d posix awklib ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info* *************** *** 136,141 **** --- 136,143 ---- config.status: configure $(SHELL) ./config.status --recheck + # Note: if you need something at both compile time and link time, like -pg, + # you will have to edit the Makefile manually to set LDFLAGS. gawk: $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(CC) -o gawk $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS) *************** *** 145,151 **** # SunOS make's (at least) VPATH doesn't do subdirectories... # Solaris make doesn't allow $< in the actual rule ! gawkmisc.o: $(srcdir)/amiga/gawkmisc.ami $(srcdir)/atari/gawkmisc.atr \ $(srcdir)/pc/gawkmisc.pc $(srcdir)/posix/gawkmisc.c \ $(srcdir)/vms/gawkmisc.vms $(CC) -c $(COMPFLAGS) -DDEFPATH='$(DEFPATH)' $(srcdir)/gawkmisc.c --- 147,153 ---- # 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 diff -crN gawk-3.0.2/NEWS gawk-3.0.3/NEWS *** gawk-3.0.2/NEWS Sun Dec 22 10:04:09 1996 --- gawk-3.0.3/NEWS Sun May 11 15:42:55 1997 *************** *** 1,3 **** --- 1,44 ---- + Changes from 3.0.2 to 3.0.3 + --------------------------- + + The horrendous per-record memory leak introduced in 3.0.1 is gone, finally. + + The `amiga' directory is now gone; Amiga support is now entirely handled + by the POSIX support. + + Win32 support has been added in the `pc' directory. See `README_d/README.pc' + for more info. + + The mmap changes are disabled in io.c, and will be removed entirely + in the next big release. They were an interesting experiment that just + really didn't work in practice. + + A minor memory leak that occurred when using `next' from within a + function has also been fixed. + + Problems with I/O from sub-processes via a pipe are now gone. + + Using "/dev/pid" and the other special /dev files no longer causes a core dump. + + The files regex.h, regex.c, getopt.h, getopt.c, and getopt1.c have been + merged with the versions in GNU libc. Thanks to Ulrich Drepper for his help. + + Some new undocumented features have been added. Use the source, Luke! + It is not clear yet whether these will ever be fully supported. + + Array performance should be much better for very very large arrays. "Virtual + memory required, real memory helpful." + + builtin.c:do_substr rationalized, again. + + The --re-interval option now works as advertised. + + The license text on some of the missing/* files is now generic. + + Lots more new test cases. + + Lots of other small bugs fixed, see the ChangeLog files for details. + Changes from 3.0.1 to 3.0.2 --------------------------- *************** *** 1550,1556 **** Sun Dec 24 16:16:05 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu) ! * * Makefile: Add (commented out) default defines for Sony News. * awk.h: Move declaration of vprintf so it will compile when -DVPRINTF_MISSING is defined. --- 1591,1597 ---- Sun Dec 24 16:16:05 1989 David J. MacKenzie (djm at hobbes.ai.mit.edu) ! * Makefile: Add (commented out) default defines for Sony News. * awk.h: Move declaration of vprintf so it will compile when -DVPRINTF_MISSING is defined. diff -crN gawk-3.0.2/PORTS gawk-3.0.3/PORTS *** gawk-3.0.2/PORTS Tue Dec 10 21:36:58 1996 --- gawk-3.0.3/PORTS Wed May 14 14:10:57 1997 *************** *** 5,31 **** Dec Alpha OSF 4.0 HP9000/755 HP-UX 9.01 IBM PowerPC AIX 4.1.4.0 SGI IRIX 4.0.5 SGI IRIX 5.3 SunOS 4.1.3 SunOS 5.5 Other systems: - DEC Alpha OSF/1 3.2 DEC Alpha Linux/AXP DECstation 5000 ULTRIX 4.3 HP 9000/735 HP-UX 10.01 IBM RS/6000 AIX 3.2 IBM SP2 AIX 4.1 NeXT Turbostation Mach 3.3 SGI Indigo/2 IRIX 5.3 SGI PowerChallenge IRIX 6.1 Sun SPARC Solaris 2.5 Sun SPARC Solaris 2.5.1 Sun SPARC SunOS 4.1.3 - Sun SPARC Linux 2.0.22 - Intel x86 Linux 2.1.10 - Intel x86 DOS (compiler: djgpp v2, emx+gcc, - and MSC 6.00A, 7, and 8) - Intel x86 OS+2 (compiler: emx+gcc) - --- 5,36 ---- Dec Alpha OSF 4.0 HP9000/755 HP-UX 9.01 IBM PowerPC AIX 4.1.4.0 + SCO Unix (OpenServer 5) SGI IRIX 4.0.5 SGI IRIX 5.3 + SGI IRIX 6.1 + SGI IRIX 6.2 SunOS 4.1.3 SunOS 5.5 + IBM SP2 AIX 4.1 Other systems: DEC Alpha Linux/AXP + DEC Alpha OSF/1 3.2 DECstation 5000 ULTRIX 4.3 HP 9000/735 HP-UX 10.01 IBM RS/6000 AIX 3.2 IBM SP2 AIX 4.1 + Intel x86 DOS (compiler: djgpp v2, emx+gcc, + and MSC 6.00A, 7, and 8) + Intel x86 Linux 2.0.27 + Intel x86 Linux 2.1.36 + Intel x86 OS+2 (compiler: emx+gcc) NeXT Turbostation Mach 3.3 SGI Indigo/2 IRIX 5.3 + SGI O2 IRIX 6.2 SGI PowerChallenge IRIX 6.1 + Sun SPARC Linux 2.0.22 Sun SPARC Solaris 2.5 Sun SPARC Solaris 2.5.1 Sun SPARC SunOS 4.1.3 diff -crN gawk-3.0.2/README gawk-3.0.3/README *** gawk-3.0.2/README Fri Dec 20 09:02:52 1996 --- gawk-3.0.3/README Thu May 1 21:36:10 1997 *************** *** 1,10 **** README: ! This is GNU Awk 3.0.2. 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. ! Patches 1 and 2 just fix bugs -- see NEWS and ChangeLog for details. See the file INSTALL for installation instructions. --- 1,10 ---- README: ! This is GNU Awk 3.0.3. It should be upwardly compatible with the Bell Labs research version of awk. It is almost completely compliant with ! the 1993 POSIX 1003.2 standard for awk. (See the note below about POSIX.) ! Patches 1 through 3 just fix bugs -- see NEWS and ChangeLog for details. See the file INSTALL for installation instructions. diff -crN gawk-3.0.2/README_d/README.linux gawk-3.0.3/README_d/README.linux *** gawk-3.0.2/README_d/README.linux Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/README_d/README.linux Thu Apr 17 14:46:16 1997 *************** *** 0 **** --- 1,13 ---- + Thu Apr 17 14:41:17 EDT 1997 + + Some Linux systems, notably RedHat systems through RedHat 4.1, have the + symbolic links for /dev/stdin and /dev/stdout messed up. Specifically, + /dev/stdin is linked to ../proc/self/fd/1 and /dev/stdout to + ../proc/self/fd/0. This is backwards. This causes strange behavior + when using those files from within gawk. + + Removing and redoing the symlinks fixes the problem. It is fixed in + post-4.1 RedHat Linux. + + Arnold Robbins + arnold@gnu.ai.mit.edu diff -crN gawk-3.0.2/README_d/README.pc gawk-3.0.3/README_d/README.pc *** gawk-3.0.2/README_d/README.pc Sat Dec 7 11:32:54 1996 --- gawk-3.0.3/README_d/README.pc Sun May 11 14:51:36 1997 *************** *** 1,8 **** This is the README for GNU awk 3.0 under OS/2 and DOS. ! Gawk has been compiled and tested under OS/2 and DOS using the GNU ! development tools from DJ Delorie (DJGPP, DOS-only) and Eberhard Mattes ! (EMX, DOS and OS/2). Microsoft C can be used to build 16-bit versions for DOS and OS/2. --- 1,10 ---- This is the README for GNU awk 3.0 under OS/2 and DOS. ! Gawk has been compiled and tested under OS/2, DOS, and Win32 using ! the GNU development tools from DJ Delorie (DJGPP; DOS with special support ! for long filenames under Win95) and Eberhard Mattes (EMX; OS/2, DOS, and ! Win32 with rsxnt). Microsoft Visual C/C++ can be used to build a Win32 ! version for Windows 95/NT, and MSC can be used to build 16-bit versions for DOS and OS/2. *************** *** 74,80 **** http://www.leo.org/archiv/os2 or ftp://ftp.leo.org ! It contains emx-compiled (32bit) versions of gawk for OS/2 and DOS, along with many OS/2 utilities. The djgpp collection at --- 76,82 ---- http://www.leo.org/archiv/os2 or ftp://ftp.leo.org ! It contains emx-compiled (32bit) versions of gawk for OS/2, DOS, and Win32, along with many OS/2 utilities. The djgpp collection at *************** *** 86,98 **** djgpp-compiled utilities. ! 2. An sh-like shell may be useful for awk programming (and is essential for running "make test"). Stewartson's sh (OS/2 and DOS) is a good choice, and may be found in GNUish. Stewartson's shell uses a configuration file (see "Command Line Building" in the sh manual page), and it may be necessary to edit the entry for ! gawk. The following entries are suggested: -- $(EXTENDED_LINE) -- -- Comment only, not part of file -- gawk = unix ignoretype # emxbnd --- 88,160 ---- djgpp-compiled utilities. ! 2. The following table illustrates some of the differences among the various ! compiled versions of gawk. For example, the djgpp version runs on all the ! systems, but with differing capabilities: it supports long filenames under ! Win-95 but not under NT, and it runs as a DPMI application under OS/2 (which ! translates into "works in the DOS-box under OS/2, but not as a true OS/2 ! application"). ! ! DOS Win/WfW Win95 NT OS/2 ! ------------------------------------------------------- ! djgpp | DPMI DPMI DPMI DPMI,NoLFN DPMI ! emx(1) | N N N N OS2 ! emxbnd(2) | VCPI,DPMI DPMI DPMI,NoLFN DPMI,NoLFN DPMI,OS2 ! emxnt(3) | N N Win32 Win32 N ! msc | 16 16 16,NoLFN 16,NoLFN 16,DOS ! msc6bnd | 16 16 16,NoLFN 16,NoLFN 16,DOS,OS2 ! msc6os2 | N N N N 16,OS2 ! vcWin32 | N N Win32 Win32 N ! ! (1) Requires emxrt. ! ! (2) May run as a DPMI app in plain DOS and in a DOS-shell under OS/2 ! or Windows, and as a true OS/2 application under OS/2. DPMI ! requires rsxnt, and VCPI or use as an OS/2 app requires emxrt. ! ! (3) Requires rsxnt. ! ! 16 16bit; limited capacity, especially under DOS. ! ! DOS Runs as a DOS application. ! ! DPMI Dos Protected Mode Interface; program runs as a DOS application. ! Under plain DOS, a DPMI server (such as csdpmi from the djgpp ! archives) is required. See also VCPI. ! ! emxrt The emx runtime, available from LEO. ! ! N Not supported. ! ! NoLFN No long filename support. ! ! OS2 Runs as an OS/2 application. ! ! rsxnt Runtimes for use with DPMI or Win32. ! ! VCPI Virtual Control Program Interface; program runs as a DOS app. ! Memory managers (such as emm386) may need adjustment. VCPI cannot ! be used under OS/2, Win/WfW, Win-95, or NT. See also DPMI. ! ! Win32 Uses/supports Win32 features (such as long filenames). ! ! Reportedly, NTEmacs (another Win32 program) can run programs such as ! Win32-gawk asynchronously. Currently, NTEmacs supports async subprocesses ! only if the child is a Win32 app. Similarly, like native OS/2 versions are ! a plus under OS/2 even for command-line programs, native Win32 versions are ! nice to have under NT and Win95. ! ! Users interested in Win32 applications may also wish to examine the Cygnus ! GNU-Win32 Project at http://www.cygnus.com. ! ! ! 3. An sh-like shell may be useful for awk programming (and is essential for running "make test"). Stewartson's sh (OS/2 and DOS) is a good choice, and may be found in GNUish. Stewartson's shell uses a configuration file (see "Command Line Building" in the sh manual page), and it may be necessary to edit the entry for ! gawk. The following entries are suggested: -- $(EXTENDED_LINE) -- -- Comment only, not part of file -- gawk = unix ignoretype # emxbnd *************** *** 106,115 **** for other other utilities (such as sed and wc) may need to be edited in order to match your specific collection of programs. ! As of Fall 1996, Daisuke Aoyama has a test version ! of bash (compiled with djgpp). This version worked flawlessly in ! tests with djgpp gawk and make. It was added to the djgpp collection ! in Nov-96, and may also be obtained via http://www.st.rim.or.jp/~jack/alpha/ http://www.neongenesis.com/~jack/djgpp-work/alpha/ --- 168,176 ---- for other other utilities (such as sed and wc) may need to be edited in order to match your specific collection of programs. ! Daisuke Aoyama has ported Bash 1.14.7 to djgpp. ! This version worked flawlessly in tests with djgpp gawk and make. It ! is now part of the djgpp collection and also from http://www.st.rim.or.jp/~jack/alpha/ http://www.neongenesis.com/~jack/djgpp-work/alpha/ *************** *** 132,138 **** emx on DOS). GNU make is recommended if using djgpp-bash. ! 3. GNU make is available at LEO for OS/2 and in the djgpp collection for DOS. dmake is by Dennis Vadura (dvadura@watdragon.uwaterloo.ca), CS --- 193,199 ---- emx on DOS). GNU make is recommended if using djgpp-bash. ! 4. GNU make is available at LEO for OS/2 and in the djgpp collection for DOS. dmake is by Dennis Vadura (dvadura@watdragon.uwaterloo.ca), CS *************** *** 147,153 **** ftp://ftp.simtel.net/simtelnet/msdos/c/ndmake45.zip ! 4. Stewartson's shell contains sources for a setargv-replacement for MSC, which can add enhanced command-line processing capabilities to gawk. See the makefile. Note that there is a fatal bug in stdargv.c, triggered in the case of no closing quote. The following --- 208,214 ---- ftp://ftp.simtel.net/simtelnet/msdos/c/ndmake45.zip ! 5. Stewartson's shell contains sources for a setargv-replacement for MSC, which can add enhanced command-line processing capabilities to gawk. See the makefile. Note that there is a fatal bug in stdargv.c, triggered in the case of no closing quote. The following *************** *** 168,184 **** Known bugs ---------- ! 1. DJGPP version 1 does not properly support signals. At the time of ! this writing, Version 2 of djgpp was in beta, and promises better ! signal support. However, as of 2.00.beta2, known bugs remain. ! ! 2. DJGPP version 1 fails the fsbs test due to its broken handling of ! the line in test/Makefile. Fixed in the version 2 betas. ! ! 3. DJGPP 2.00.beta2 popen() fails on commands with pipes; edit the ! makefile and use the popen in the pc directory. Fixed in beta3. ! 4. emx does not support DST. On 2-Jan-96, Mattes writes: Quotation from ISO 9899-1990: --- 229,242 ---- Known bugs ---------- ! 1. DJGPP version 1 has known problems with signals, and in the way it ! handles command-lines. Older versions of this file contain notes on ! other bugs, and on a few bugs uncovered in the v2 betas. Testing of ! gawk with DJGPP v1 ended with gawk-3.0. djgpp-2.01 and djgpp ports of ! GNU make 3.75 or later are strongly preferred, in part due to enhanced ! support for sh-like shells. ! 2. emx does not support DST. On 2-Jan-96, Mattes writes: Quotation from ISO 9899-1990: *************** *** 205,235 **** found in /usr/share/zoneinfo/*. The setting of the TZ environment variable (eg. TZ=US/Pacific) is then used to lookup the specifics for that locale. ! 5. The 16-bit DOS version can exhaust memory on scripts such as Henry ! Spencer's "awf". Use GNU C versions if possible. ! 6. builtin.c of gawk-3.0.1 triggers a bug in MSC 6.00A. The makefile works around the bug by compiling builtin.c without optimizations (-Od). In limited testing, it appears that inserting some dummy code in builtin.c can provide a better solution than disabling optimizations. ! 7. The support in djgpp for sh-like shells (as is needed in ! test/getlnhd.awk) was in development as of Oct-96. Pre-release ! versions of the library worked in our tests. Similarly, the makefiles ! depend on features of djgpp-make which were available only in ! pre-release versions. The DOS maintainers wish to express their thanks to Eli Zaretskii for his work and for the many conversations ! concerning gawk-3.0.1, make, and djgpp. ! 8. There are problems with system() when using the rsx package with emx ! programs (rsx is used in DPMI environments such as MS-Win). The djgpp ! versions are preferred in this case. ---- - If you have any problems with the DOS or OS/2 versions of Gawk, please send bug reports (along with the version and compiler used) to --- 263,304 ---- found in /usr/share/zoneinfo/*. The setting of the TZ environment variable (eg. TZ=US/Pacific) is then used to lookup the specifics for that locale. ! 3. The 16-bit DOS version can exhaust memory on scripts such as Henry ! Spencer's "awf". Use GNU C versions if possible. ! 4. builtin.c of gawk-3.0.[1-3] triggers a bug in MSC 6.00A. The makefile works around the bug by compiling builtin.c without optimizations (-Od). In limited testing, it appears that inserting some dummy code in builtin.c can provide a better solution than disabling optimizations. ! 5. There are problems with system() when using the rsx package with emx ! programs (rsx is used in DPMI environments such as MS-Win). The djgpp ! versions are preferred in this case. ! ! 6. In contrast to getpid() on UNIX, the getpid() in Microsoft C/C++ 1.52 ! (AKA 8.0) sometimes returns negative numbers. The DOS Gawk developers felt ! that it was best to use Microsoft's built-in function; but at the same time, ! we are placing this warning here, because this behavior will undoubtably be ! surprising to many. ! ! 7. MSC 6 fails the strftlng test. The funstack test exhausts memory ! on the 16bit DOS versions. ! ! ! Gawk-3.0.3 thanks ! ----------------- The DOS maintainers wish to express their thanks to Eli Zaretskii for his work and for the many conversations ! concerning gawk-3.0, make, and djgpp. His FAQ for djgpp is essential ! reading, and he was always willing to answer our questions (even when ! we didn't read the relevant portions of the FAQ :). ! We are indebted to Juan Grigera for the ! Visual C++ target, and for additional help on changes for Win32. ---- If you have any problems with the DOS or OS/2 versions of Gawk, please send bug reports (along with the version and compiler used) to *************** *** 237,239 **** --- 306,316 ---- or Kai Uwe Rommel, rommel@ars.de (OS/2 or bound versions) Darrel Hankerson, hankedr@mail.auburn.edu + + Support for Win32 started in gawk-3.0.3. Reports concerning the emx + version using rsxnt (emxnt) should go to Kai Uwe Rommel. Reports on + the Visual C++ version (vcWin32) may be sent to + + Juan Grigera, j-grigera@usa.net (Visual C++ version) + + with a copy to Scott Deifik. diff -crN gawk-3.0.2/README_d/README.sgi gawk-3.0.3/README_d/README.sgi *** gawk-3.0.2/README_d/README.sgi Tue Sep 10 08:54:43 1996 --- gawk-3.0.3/README_d/README.sgi Sun Jan 19 16:58:24 1997 *************** *** 1,18 **** ! Tue Sep 10 08:53:46 EDT 1996 ! Gawk 3.0.x is known to be broken on 64-bit SGI machines running IRIX 6.2. - 1) It needs to be compiled with the native cc, not gcc. - - 2) Even if compiled with the native cc, the -32 option must be used. - If not, the gensub and gnu regex tests fail. - - I don't have access to an IRIX 6.x machine, so I am not able to track - down the problem. If any kind soul is able to run gawk from a debugger - and figure out what the problem(s) are, and would let me know (and supply - patches!), I'd greatly appreciate it. - - Thanks! - - Arnold Robbins - arnold@gnu.ai.mit.edu --- 1,20 ---- ! From emory!hawkwind.utcs.toronto.edu!cks Mon Dec 30 20:12:35 1996 ! Return-Path: ! To: arnold@skeeve.atl.ga.us (Arnold D. Robbins) ! Subject: Re: gawk regex bug ! In-Reply-To: Your message of Tue, 30 Jul 1996 21:45:00 -0400. ! ! Date: Mon, 30 Dec 1996 19:37:30 -0500 ! From: Chris Siebenmann ! Message-Id: <96Dec30.193738est.24603@hawkwind.utcs.utoronto.ca> ! Status: OR ! Content-Length: 196 ! X-Lines: 5 ! X-Display-Position: 2 ! ! The latest in my 'gawk on SGIs' stuff: with the newest SGI compilers ! (MIPSPro 7.1, just released) gawk 3.0 compiles and passes the selftests ! even at the highest (-O3) optimization level. ! - cks diff -crN gawk-3.0.2/README_d/README.solaris gawk-3.0.3/README_d/README.solaris *** gawk-3.0.2/README_d/README.solaris Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/README_d/README.solaris Fri Feb 7 06:34:17 1997 *************** *** 0 **** --- 1,37 ---- + From dragon!lehman.com!carson Fri Feb 7 01:12:09 1997 + Return-Path: + From: carson@lehman.com + Date: Fri, 7 Feb 1997 01:05:58 -0500 + Message-ID: <199702070605.BAA09185@dragon.lehman.com> + To: arnold@gnu.ai.mit.edu + Subject: Solaris 2.5.1 x86 bug in gawk-3.0.2 + Reply-To: carson@lehman.com + Status: R + Content-Length: 630 + X-Lines: 23 + X-Display-Position: 0 + + + awktab.c has the following bogus logic: + + #ifndef alloca + #ifdef __GNUC__ + #define alloca __builtin_alloca + #else /* not GNU C. */ + #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) + #include + #else /* not sparc */ + + Solaris x86 obviously dosn't define sparc or __sparc. + + What you _meant_ to say was: + + if (defined(__sun) && defined(__SVR4)) + + (which identifies Solaris 2.x under both Sun's cc and gcc) + + -- + Carson Gaspar -- carson@cs.columbia.edu carson@lehman.com + http://www.cs.columbia.edu/~carson/home.html + + diff -crN gawk-3.0.2/README_d/README.sony gawk-3.0.3/README_d/README.sony *** gawk-3.0.2/README_d/README.sony Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/README_d/README.sony Sun Jan 19 23:15:05 1997 *************** *** 0 **** --- 1,11 ---- + Sun Jan 19 23:13:50 EST 1997 + + > Machine: SONY NWS-5000 (MIPS r4000) + > OS : NEWS-OS 4.2.1 (4.3BSD compatible) + > This OS doesn't have `uname' + > Tools : gcc-2.7.2.1, bison-1.25, cmp-2.7, bash-2.0 + + This system has the same problem with the test/tweakfld case that Ultrix MIPS + has. See the README.ultrix file for details. + + Arnold Robbins diff -crN gawk-3.0.2/acconfig.h gawk-3.0.3/acconfig.h *** gawk-3.0.2/acconfig.h Sun Oct 20 17:26:44 1996 --- gawk-3.0.3/acconfig.h Thu May 1 21:36:11 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1995, 96 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1995-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 28,33 **** --- 28,35 ---- #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) */ @BOTTOM@ diff -crN gawk-3.0.2/alloca.c gawk-3.0.3/alloca.c *** gawk-3.0.2/alloca.c Sun Sep 29 23:02:36 1996 --- gawk-3.0.3/alloca.c Tue Apr 15 06:29:41 1997 *************** *** 70,75 **** --- 70,76 ---- #define NULL 0 #endif + #ifndef malloc /* Different portions of Emacs need to call different versions of malloc. The Emacs executable needs alloca to call xmalloc, because ordinary malloc isn't protected from input signals. On the other *************** *** 84,89 **** --- 85,91 ---- #define malloc xmalloc #endif extern pointer malloc (); + #endif /* malloc */ /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically diff -crN gawk-3.0.2/array.c gawk-3.0.3/array.c *** gawk-3.0.2/array.c Sun Oct 20 17:27:14 1996 --- gawk-3.0.3/array.c Thu May 1 21:36:11 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991 - 96 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991 - 97 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 236,244 **** symbol = stack_ptr[symbol->param_cnt]; if ((symbol->flags & SCALAR) != 0) fatal("attempt to use scalar as array"); ! if (symbol->var_array == NULL) ! return 0; subs = concat_exp(subs); /* concat_exp returns a string node */ hash1 = hash(subs->stptr, subs->stlen, (unsigned long) symbol->array_size); ret = (assoc_find(symbol, subs, hash1) != NULL); free_temp(subs); --- 236,249 ---- symbol = stack_ptr[symbol->param_cnt]; if ((symbol->flags & SCALAR) != 0) fatal("attempt to use scalar as array"); ! /* ! * evaluate subscript first, it could have side effects ! */ subs = concat_exp(subs); /* concat_exp returns a string node */ + if (symbol->var_array == NULL) { + free_temp(subs); + return 0; + } hash1 = hash(subs->stptr, subs->stlen, (unsigned long) symbol->array_size); ret = (assoc_find(symbol, subs, hash1) != NULL); free_temp(subs); *************** *** 330,343 **** register NODE *bucket, *last; NODE *subs; ! if (symbol->type == Node_param_list) symbol = stack_ptr[symbol->param_cnt]; if (symbol->type == Node_var_array) { if (symbol->var_array == NULL) return; } else fatal("delete: illegal use of variable `%s' as array", symbol->vname); subs = concat_exp(tree); /* concat_exp returns string node */ hash1 = hash(subs->stptr, subs->stlen, (unsigned long) symbol->array_size); --- 335,357 ---- register NODE *bucket, *last; NODE *subs; ! if (symbol->type == Node_param_list) { symbol = stack_ptr[symbol->param_cnt]; + if (symbol->type == Node_var) + return; + } if (symbol->type == Node_var_array) { if (symbol->var_array == NULL) return; } else fatal("delete: illegal use of variable `%s' as array", symbol->vname); + + if (tree == NULL) { /* delete array */ + assoc_clear(symbol); + return; + } + subs = concat_exp(tree); /* concat_exp returns string node */ hash1 = hash(subs->stptr, subs->stlen, (unsigned long) symbol->array_size); *************** *** 450,456 **** * very large (> 8K), we just double more or less, instead of * just jumping from 8K to 64K. */ ! static long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497 }; /* find next biggest hash size */ newsize = oldsize = symbol->array_size; --- 464,477 ---- * very large (> 8K), we just double more or less, instead of * just jumping from 8K to 64K. */ ! static long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, ! #if ! defined(MSDOS) && ! defined(OS2) && ! defined(atarist) ! 131101, 262147, 524309, 1048583, 2097169, ! 4194319, 8388617, 16777259, 33554467, ! 67108879, 134217757, 268435459, 536870923, ! 1073741827 ! #endif ! }; /* find next biggest hash size */ newsize = oldsize = symbol->array_size; diff -crN gawk-3.0.2/atari/ChangeLog gawk-3.0.3/atari/ChangeLog *** gawk-3.0.2/atari/ChangeLog Wed Dec 25 11:25:49 1996 --- gawk-3.0.3/atari/ChangeLog Thu May 15 12:50:07 1997 *************** *** 1,3 **** --- 1,11 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/awk.h gawk-3.0.3/awk.h *** gawk-3.0.2/awk.h Sun Oct 20 17:28:29 1996 --- gawk-3.0.3/awk.h Thu May 1 21:36:12 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 29,35 **** --- 29,37 ---- #include #endif + #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 /* enable GNU extensions */ + #endif /* _GNU_SOURCE */ #include #ifdef HAVE_LIMITS_H *************** *** 356,365 **** int r_ent; /* range entered */ } r; union { - char *name; struct exp_node *extra; long xl; } x; short number; unsigned char reflags; # define CASE 1 --- 358,367 ---- int r_ent; /* range entered */ } r; union { struct exp_node *extra; long xl; } x; + char *name; short number; unsigned char reflags; # define CASE 1 *************** *** 409,414 **** --- 411,417 ---- # define SCALAR 512 /* used as scalar, can't be array */ # 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 */ } NODE; *************** *** 416,422 **** #define lnode sub.nodep.l.lptr #define nextp sub.nodep.l.lptr #define rnode sub.nodep.r.rptr ! #define source_file sub.nodep.x.name #define source_line sub.nodep.number #define param_cnt sub.nodep.number #define param sub.nodep.l.param_name --- 419,425 ---- #define lnode sub.nodep.l.lptr #define nextp sub.nodep.l.lptr #define rnode sub.nodep.r.rptr ! #define source_file sub.nodep.name #define source_line sub.nodep.number #define param_cnt sub.nodep.number #define param sub.nodep.l.param_name *************** *** 478,483 **** --- 481,487 ---- # define IOP_IS_INTERNAL 2 # define IOP_NO_FREE 4 # define IOP_MMAPPED 8 + # define IOP_NOFREE_OBJ 16 int (*getrec)(); } IOBUF; *************** *** 579,608 **** /* ------------------------- Pseudo-functions ------------------------- */ ! #define is_identchar(c) (isalnum(c) || (c) == '_') #ifdef MPROF #define getnode(n) emalloc(n, NODE *, sizeof(NODE), "getnode") - #ifndef DEBUG #define freenode(n) free(n) - #endif #else /* not MPROF */ #define getnode(n) if (nextfree) n = nextfree, nextfree = nextfree->nextp;\ else n = more_nodes() - #ifndef DEBUG #define freenode(n) ((n)->flags &= ~SCALAR, (n)->nextp = nextfree, nextfree = (n)) - #endif #endif /* not MPROF */ #ifdef DEBUG - #define tree_eval(t) r_tree_eval(t, FALSE) - #define m_tree_eval(t, iscond) r_tree_eval(t, iscond) - #define get_lhs(p, a) r_get_lhs((p), (a)) #undef freenode #else #define get_lhs(p, a) ((p)->type == Node_var ? (&(p)->var_value) : \ r_get_lhs((p), (a))) - #define tree_eval(t) m_tree_eval(t, FALSE) #if __GNUC__ >= 2 #define m_tree_eval(t, iscond) \ ({NODE * _t = (t); \ --- 583,607 ---- /* ------------------------- Pseudo-functions ------------------------- */ ! #define is_identchar(c) (isalnum(c) || (c) == '_') ! #define isnondecimal(str) (((str)[0]) == '0') #ifdef MPROF #define getnode(n) emalloc(n, NODE *, sizeof(NODE), "getnode") #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)) #endif /* not MPROF */ #ifdef DEBUG #undef freenode + #define get_lhs(p, a) r_get_lhs((p), (a)) + #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))) #if __GNUC__ >= 2 #define m_tree_eval(t, iscond) \ ({NODE * _t = (t); \ *************** *** 630,635 **** --- 629,635 ---- r_tree_eval(_t, iscond))))) #endif /* __GNUC__ */ #endif /* not DEBUG */ + #define tree_eval(t) m_tree_eval(t, FALSE) #define make_number(x) mk_number((x), (unsigned int)(MALLOC|NUM|NUMBER)) #define tmp_number(x) mk_number((x), (unsigned int)(MALLOC|TEMP|NUM|NUMBER)) *************** *** 639,645 **** #define SCAN 1 #define ALREADY_MALLOCED 2 ! #define cant_happen() fatal("internal error line %d, file: %s", \ __LINE__, __FILE__); #ifdef HAVE_STRINGIZE --- 639,645 ---- #define SCAN 1 #define ALREADY_MALLOCED 2 ! #define cant_happen() r_fatal("internal error line %d, file: %s", \ __LINE__, __FILE__); #ifdef HAVE_STRINGIZE *************** *** 694,699 **** --- 694,701 ---- #define STREQN(a,b,n) ((n) && *(a)== *(b) && \ strncmp((a), (b), (size_t) (n)) == 0) + #define fatal set_loc(__FILE__, __LINE__), r_fatal + /* ------------- Function prototypes or defs (as appropriate) ------------- */ /* array.c */ *************** *** 741,746 **** --- 743,760 ---- 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 *do_lshift P((NODE *tree)); + extern NODE *do_rshift P((NODE *tree)); + extern NODE *do_and P((NODE *tree)); + 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) */ /* eval.c */ extern int interpret P((NODE *volatile tree)); extern NODE *r_tree_eval P((NODE *tree, int iscond)); *************** *** 782,788 **** extern int pathopen P((const char *file)); extern NODE *do_getline P((NODE *tree)); extern void do_nextfile P((void)); - extern IOBUF *iop_alloc P((int fd, const char *name)); extern struct redirect *getredirect P((char *str, int len)); /* main.c */ extern int main P((int argc, char **argv)); --- 796,801 ---- *************** *** 795,812 **** extern void msg P((va_list va_alist, ...)); extern void error P((va_list va_alist, ...)); extern void warning P((va_list va_alist, ...)); ! extern void fatal P((va_list va_alist, ...)); #else #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ extern void msg (char *mesg, ...); extern void error (char *mesg, ...); extern void warning (char *mesg, ...); ! extern void fatal (char *mesg, ...); #else extern void msg (); extern void error (); extern void warning (); ! extern void fatal (); #endif #endif /* node.c */ --- 808,828 ---- extern void msg P((va_list va_alist, ...)); 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, ...)); #else #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ extern void msg (char *mesg, ...); extern void error (char *mesg, ...); extern void warning (char *mesg, ...); ! extern void set_loc (char *file, int line); ! extern void r_fatal (char *mesg, ...); #else extern void msg (); extern void error (); extern void warning (); ! extern void set_loc (); ! extern void r_fatal (); #endif #endif /* node.c */ diff -crN gawk-3.0.2/awk.y gawk-3.0.3/awk.y *** gawk-3.0.2/awk.y Thu Dec 19 22:52:12 1996 --- gawk-3.0.3/awk.y Sun May 11 07:10:13 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 895,903 **** --- 895,909 ---- static struct token tokentab[] = { {"BEGIN", Node_illegal, LEX_BEGIN, 0, 0}, {"END", Node_illegal, LEX_END, 0, 0}, + #ifdef BITOPS + {"and", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_and}, + #endif /* BITOPS */ {"atan2", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2}, {"break", Node_K_break, LEX_BREAK, 0, 0}, {"close", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_close}, + #ifdef BITOPS + {"compl", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl}, + #endif /* BITOPS */ {"continue", Node_K_continue, LEX_CONTINUE, 0, 0}, {"cos", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos}, {"delete", Node_K_delete, LEX_DELETE, NOT_OLD, 0}, *************** *** 918,936 **** --- 924,954 ---- {"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}, + #ifdef BITOPS + {"lshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift}, + #endif /* BITOPS */ {"match", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_match}, {"next", Node_K_next, LEX_NEXT, 0, 0}, {"nextfile", Node_K_nextfile, LEX_NEXTFILE, GAWKX, 0}, + #ifdef BITOPS + {"or", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_or}, + #endif /* BITOPS */ {"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}, + #ifdef BITOPS + {"rshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift}, + #endif /* BITOPS */ {"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}, {"strftime", Node_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2), do_strftime}, + #ifdef BITOPS + {"strtonum", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum}, + #endif /* BITOPS */ {"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}, *************** *** 938,943 **** --- 956,964 ---- {"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}, + #ifdef BITOPS + {"xor", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor}, + #endif /* BITOPS */ }; /* yyerror --- print a syntax error message, show where */ *************** *** 1022,1032 **** --- 1043,1055 ---- 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; *************** *** 1104,1120 **** in, strerror(errno)); } len = optimal_bufsize(fd, & sbuf); ! if (sbuf.st_size == 0) { ! static int warned = FALSE; ! ! if (do_lint && ! warned) { ! warned = TRUE; ! warning("source file `%s' is empty", source); ! } ! close(fd); ! ++nextfile; ! goto again; ! } if (buf != NULL) free(buf); emalloc(buf, char *, len + SLOP, "get_src_buf"); --- 1127,1133 ---- in, strerror(errno)); } len = optimal_bufsize(fd, & sbuf); ! newfile = TRUE; if (buf != NULL) free(buf); emalloc(buf, char *, len + SLOP, "get_src_buf"); *************** *** 1148,1153 **** --- 1161,1174 ---- 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; + warning("source file `%s' is empty", source); + } + } close(fd); samefile = FALSE; nextfile++; *************** *** 1251,1256 **** --- 1272,1278 ---- static int did_newline = FALSE; char *tokkey; static int lasttok = 0, eof_warned = FALSE; + int inhex = FALSE; if (nextc() == EOF) { if (lasttok != NEWLINE) { *************** *** 1643,1648 **** --- 1665,1679 ---- tokadd(c); switch (c) { + #ifdef BITOPS + case 'x': + case 'X': + if (do_traditional) + goto done; + if (tok == tokstart + 2) + inhex = TRUE; + break; + #endif /* BITOTS */ case '.': if (seen_point) { gotnumber = TRUE; *************** *** 1652,1657 **** --- 1683,1690 ---- break; case 'e': case 'E': + if (inhex) + break; if (seen_e) { gotnumber = TRUE; break; *************** *** 1662,1667 **** --- 1695,1715 ---- else pushback(); break; + #ifdef BITOPS + 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 */ + #endif case '0': case '1': case '2': *************** *** 1674,1679 **** --- 1722,1728 ---- case '9': break; default: + done: gotnumber = TRUE; } if (gotnumber) *************** *** 1687,1692 **** --- 1736,1746 ---- eof_warned = TRUE; } tokadd('\0'); + #ifdef BITOPS + if (! do_traditional && isnondecimal(tokstart)) + yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart))); + else + #endif /* BITOPS */ yylval.nodeval = make_number(atof(tokstart)); yylval.nodeval->flags |= PERM; return lasttok = YNUMBER; *************** *** 1956,1961 **** --- 2010,2018 ---- int count, i, j, dups; NODE *params; + if (func == NULL) /* error earlier */ + return TRUE; + fname = func->param; count = func->param_cnt; params = func->rnode; *************** *** 1963,1973 **** if (count == 0) /* no args, no problem */ return FALSE; emalloc(names, char **, count * sizeof(char *), "dup_parms"); i = 0; ! for (np = params; np != NULL; np = np->rnode) names[i++] = np->param; dups = 0; for (i = 1; i < count; i++) { --- 2020,2038 ---- 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++) { diff -crN gawk-3.0.2/awktab.c gawk-3.0.3/awktab.c *** gawk-3.0.2/awktab.c Thu Dec 19 23:03:38 1996 --- gawk-3.0.3/awktab.c Sun May 11 14:57:51 1997 *************** *** 2395,2403 **** --- 2395,2409 ---- static struct token tokentab[] = { {"BEGIN", Node_illegal, LEX_BEGIN, 0, 0}, {"END", Node_illegal, LEX_END, 0, 0}, + #ifdef BITOPS + {"and", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_and}, + #endif /* BITOPS */ {"atan2", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2}, {"break", Node_K_break, LEX_BREAK, 0, 0}, {"close", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_close}, + #ifdef BITOPS + {"compl", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl}, + #endif /* BITOPS */ {"continue", Node_K_continue, LEX_CONTINUE, 0, 0}, {"cos", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos}, {"delete", Node_K_delete, LEX_DELETE, NOT_OLD, 0}, *************** *** 2418,2436 **** --- 2424,2454 ---- {"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}, + #ifdef BITOPS + {"lshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift}, + #endif /* BITOPS */ {"match", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_match}, {"next", Node_K_next, LEX_NEXT, 0, 0}, {"nextfile", Node_K_nextfile, LEX_NEXTFILE, GAWKX, 0}, + #ifdef BITOPS + {"or", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_or}, + #endif /* BITOPS */ {"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}, + #ifdef BITOPS + {"rshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift}, + #endif /* BITOPS */ {"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}, {"strftime", Node_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2), do_strftime}, + #ifdef BITOPS + {"strtonum", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum}, + #endif /* BITOPS */ {"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}, *************** *** 2438,2443 **** --- 2456,2464 ---- {"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}, + #ifdef BITOPS + {"xor", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor}, + #endif /* BITOPS */ }; /* yyerror --- print a syntax error message, show where */ *************** *** 2522,2532 **** --- 2543,2555 ---- 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; *************** *** 2604,2620 **** in, strerror(errno)); } len = optimal_bufsize(fd, & sbuf); ! if (sbuf.st_size == 0) { ! static int warned = FALSE; ! ! if (do_lint && ! warned) { ! warned = TRUE; ! warning("source file `%s' is empty", source); ! } ! close(fd); ! ++nextfile; ! goto again; ! } if (buf != NULL) free(buf); emalloc(buf, char *, len + SLOP, "get_src_buf"); --- 2627,2633 ---- in, strerror(errno)); } len = optimal_bufsize(fd, & sbuf); ! newfile = TRUE; if (buf != NULL) free(buf); emalloc(buf, char *, len + SLOP, "get_src_buf"); *************** *** 2648,2653 **** --- 2661,2674 ---- 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; + warning("source file `%s' is empty", source); + } + } close(fd); samefile = FALSE; nextfile++; *************** *** 2751,2756 **** --- 2772,2778 ---- static int did_newline = FALSE; char *tokkey; static int lasttok = 0, eof_warned = FALSE; + int inhex = FALSE; if (nextc() == EOF) { if (lasttok != NEWLINE) { *************** *** 3143,3148 **** --- 3165,3179 ---- tokadd(c); switch (c) { + #ifdef BITOPS + case 'x': + case 'X': + if (do_traditional) + goto done; + if (tok == tokstart + 2) + inhex = TRUE; + break; + #endif /* BITOTS */ case '.': if (seen_point) { gotnumber = TRUE; *************** *** 3152,3157 **** --- 3183,3190 ---- break; case 'e': case 'E': + if (inhex) + break; if (seen_e) { gotnumber = TRUE; break; *************** *** 3162,3167 **** --- 3195,3215 ---- else pushback(); break; + #ifdef BITOPS + 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 */ + #endif case '0': case '1': case '2': *************** *** 3174,3179 **** --- 3222,3228 ---- case '9': break; default: + done: gotnumber = TRUE; } if (gotnumber) *************** *** 3187,3192 **** --- 3236,3246 ---- eof_warned = TRUE; } tokadd('\0'); + #ifdef BITOPS + if (! do_traditional && isnondecimal(tokstart)) + yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart))); + else + #endif /* BITOPS */ yylval.nodeval = make_number(atof(tokstart)); yylval.nodeval->flags |= PERM; return lasttok = YNUMBER; *************** *** 3456,3461 **** --- 3510,3518 ---- int count, i, j, dups; NODE *params; + if (func == NULL) /* error earlier */ + return TRUE; + fname = func->param; count = func->param_cnt; params = func->rnode; *************** *** 3463,3473 **** if (count == 0) /* no args, no problem */ return FALSE; emalloc(names, char **, count * sizeof(char *), "dup_parms"); i = 0; ! for (np = params; np != NULL; np = np->rnode) names[i++] = np->param; dups = 0; for (i = 1; i < count; i++) { --- 3520,3538 ---- 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++) { diff -crN gawk-3.0.2/awklib/ChangeLog gawk-3.0.3/awklib/ChangeLog *** gawk-3.0.2/awklib/ChangeLog Wed Dec 25 11:25:57 1996 --- gawk-3.0.3/awklib/ChangeLog Thu May 15 12:50:16 1997 *************** *** 1,3 **** --- 1,15 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Sun Apr 13 15:40:55 1997 Arnold D. Robbins + + * Makefile.in (install): fix second for loop to use $$i. Sigh. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/awklib/Makefile.in gawk-3.0.3/awklib/Makefile.in *** gawk-3.0.2/awklib/Makefile.in Wed Dec 25 11:18:51 1996 --- gawk-3.0.3/awklib/Makefile.in Thu May 1 21:36:13 1997 *************** *** 1,6 **** # Makefile for GNU Awk support library. # ! # Copyright (C) 1995-1996 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,6 ---- # Makefile for GNU Awk support library. # ! # Copyright (C) 1995-1997 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 78,84 **** $(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 --- 78,84 ---- $(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 diff -crN gawk-3.0.2/builtin.c gawk-3.0.3/builtin.c *** gawk-3.0.2/builtin.c Tue Dec 17 22:22:32 1996 --- gawk-3.0.3/builtin.c Tue May 13 12:13:50 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 25,30 **** --- 25,31 ---- #include "awk.h" + #include #undef HUGE #undef CHARBITS #undef INTBITS *************** *** 871,895 **** { NODE *t1, *t2, *t3; NODE *r; ! register int indx; size_t length; t1 = force_string(tree_eval(tree->lnode)); t2 = tree_eval(tree->rnode->lnode); ! indx = (int) force_number(t2) - 1; free_temp(t2); ! if (indx < 0) { if (do_lint) ! warning("substr: start index %d invalid, using 1", ! indx+1); ! indx = 0; /* awk indices start at 1, C at 0 */ ! } if (tree->rnode->rnode == NULL) { /* third arg. missing */ ! length = t1->stlen - indx; /* use remainder of string */ } else { t3 = tree_eval(tree->rnode->rnode->lnode); ! length = (size_t) force_number(t3); free_temp(t3); } if ((indx + length) > t1->stlen) { if (do_lint) --- 872,923 ---- { NODE *t1, *t2, *t3; NODE *r; ! register size_t indx; size_t length; + double d_index, d_length; t1 = force_string(tree_eval(tree->lnode)); t2 = tree_eval(tree->rnode->lnode); ! d_index = force_number(t2); free_temp(t2); ! ! if (d_index < 1.0) { if (do_lint) ! warning("substr: start index %g 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); ! ! indx = d_index - 1; /* awk indices are from 1, C's are from 0 */ ! if (tree->rnode->rnode == NULL) { /* third arg. missing */ ! /* use remainder of string */ ! length = t1->stlen - indx; } else { t3 = tree_eval(tree->rnode->rnode->lnode); ! d_length = force_number(t3); free_temp(t3); + if (d_length <= 0.0) { + if (do_lint) + warning("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", + d_length); + length = d_length; + } + + if (t1->stlen == 0) { + if (do_lint) + warning("substr: source string is zero length"); + free_temp(t1); + return Nnull_string; } if ((indx + length) > t1->stlen) { if (do_lint) *************** *** 898,909 **** length, indx+1, t1->stlen); length = t1->stlen - indx; } ! if (indx >= t1->stlen || (long) length <= 0) { ! if (do_lint && indx >= t1->stlen) ! warning("substr: position %d is past end of string", indx+1); - if (do_lint && (long) length <= 0) - warning("substr: length %d is <= 0", (long) length); free_temp(t1); return Nnull_string; } --- 926,935 ---- 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", indx+1); free_temp(t1); return Nnull_string; } *************** *** 959,974 **** bufp = buf; bufsize = sizeof(buf); for (;;) { buflen = strftime(bufp, bufsize, format, tm); /* * buflen can be zero EITHER because there's not enough * room in the string, or because the control command * goes to the empty string. Make a reasonable guess that ! * if the buffer is 4 times bigger than the length of the * format string, it's not failing for lack of room. * Thanks to Paul Eggert for pointing out this issue. */ ! if (buflen > 0 || bufsize >= 4 * formatlen) break; bufsize *= 2; if (bufp == buf) --- 985,1001 ---- bufp = buf; bufsize = sizeof(buf); for (;;) { + *bufp = '\0'; buflen = strftime(bufp, bufsize, format, tm); /* * buflen can be zero EITHER because there's not enough * room in the string, or because the control command * goes to the empty string. Make a reasonable guess that ! * if the buffer is 1024 times bigger than the length of the * format string, it's not failing for lack of room. * Thanks to Paul Eggert for pointing out this issue. */ ! if (buflen > 0 || bufsize >= 1024 * formatlen) break; bufsize *= 2; if (bufp == buf) *************** *** 1081,1087 **** tree = save; for (i = 0; tree != NULL; i++, tree = tree->rnode) { ! t[i] = tree_eval(tree->lnode); if (t[i]->flags & NUMBER) { if (OFMTidx == CONVFMTidx) (void) force_string(t[i]); --- 1108,1120 ---- tree = save; for (i = 0; tree != NULL; i++, tree = tree->rnode) { ! NODE *n; ! ! /* Here lies the wumpus. R.I.P. */ ! n = tree_eval(tree->lnode); ! t[i] = dupnode(n); ! free_temp(n); ! if (t[i]->flags & NUMBER) { if (OFMTidx == CONVFMTidx) (void) force_string(t[i]); *************** *** 1092,1098 **** for (i = 0; i < numnodes; i++) { efwrite(t[i]->stptr, sizeof(char), t[i]->stlen, fp, "print", rp, FALSE); ! free_temp(t[i]); if (i != numnodes - 1) { if (OFSlen > 0) efwrite(OFS, sizeof(char), (size_t) OFSlen, --- 1125,1131 ---- for (i = 0; i < numnodes; i++) { efwrite(t[i]->stptr, sizeof(char), t[i]->stlen, fp, "print", rp, FALSE); ! unref(t[i]); if (i != numnodes - 1) { if (OFSlen > 0) efwrite(OFS, sizeof(char), (size_t) OFSlen, *************** *** 1389,1395 **** /* * create a private copy of the string */ ! if (t->stref > 1 || (t->flags & PERM)) { unsigned int saveflags; saveflags = t->flags; --- 1422,1428 ---- /* * create a private copy of the string */ ! if (t->stref > 1 || (t->flags & (PERM|FIELD)) != 0) { unsigned int saveflags; saveflags = t->flags; *************** *** 1731,1733 **** --- 1764,2048 ---- } } #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; + { + NODE *s1, *s2; + unsigned long uval, ushift, result; + 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 (val < 0 || shift < 0) + warning("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); + if (shift > (sizeof(unsigned long) * BITS_PER_BYTE)) + warning("lshift(%lf, %lf): too large shift value will give strange results", val, shift); + } + + uval = (unsigned long) val; + ushift = (unsigned long) shift; + + result = uval << ushift; + return tmp_number((AWKNUM) result); + } + + /* do_rshift --- perform a >> operation */ + + NODE * + do_rshift(tree) + NODE *tree; + { + NODE *s1, *s2; + unsigned long uval, ushift, result; + 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 (val < 0 || shift < 0) + warning("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); + if (shift > (sizeof(unsigned long) * BITS_PER_BYTE)) + warning("rshift(%lf, %lf): too large shift value will give strange results", val, shift); + } + + uval = (unsigned long) val; + ushift = (unsigned long) shift; + + result = uval >> ushift; + return tmp_number((AWKNUM) result); + } + + /* do_and --- perform an & operation */ + + NODE * + do_and(tree) + NODE *tree; + { + NODE *s1, *s2; + unsigned long uleft, uright, result; + 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 (left < 0 || right < 0) + warning("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); + } + + uleft = (unsigned long) left; + uright = (unsigned long) right; + + result = uleft & uright; + return tmp_number((AWKNUM) result); + } + + /* do_or --- perform an | operation */ + + NODE * + do_or(tree) + NODE *tree; + { + NODE *s1, *s2; + unsigned long uleft, uright, result; + 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 (left < 0 || right < 0) + warning("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); + } + + uleft = (unsigned long) left; + uright = (unsigned long) right; + + result = uleft | uright; + return tmp_number((AWKNUM) result); + } + + /* do_xor --- perform an ^ operation */ + + NODE * + do_xor(tree) + NODE *tree; + { + NODE *s1, *s2; + unsigned long uleft, uright, result; + 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 (left < 0 || right < 0) + warning("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); + } + + uleft = (unsigned long) left; + uright = (unsigned long) right; + + result = uleft ^ uright; + return tmp_number((AWKNUM) result); + } + + /* do_compl --- perform a ~ operation */ + + NODE * + do_compl(tree) + NODE *tree; + { + NODE *tmp; + double d; + unsigned long uval; + + tmp = tree_eval(tree->lnode); + d = force_number(tmp); + free_temp(tmp); + + if (do_lint) { + if (uval < 0) + warning("compl(%lf): negative value will give strange results", d); + if (double_to_int(d) != d) + warning("compl(%lf): fractional value will be truncated", d); + } + + uval = (unsigned long) d; + uval = ~ uval; + return tmp_number((AWKNUM) uval); + } + + /* do_strtonum --- the strtonum function */ + + NODE * + do_strtonum(tree) + NODE *tree; + { + NODE *tmp; + double d, arg; + + tmp = tree_eval(tree->lnode); + + if ((tmp->flags & (NUM|NUMBER)) != 0) + d = (double) force_number(tmp); + else if (isnondecimal(tmp->stptr)) + d = nondec2awknum(tmp->stptr, tmp->stlen); + else + d = (double) force_number(tmp); + + free_temp(tmp); + return tmp_number((AWKNUM) d); + } + #endif /* BITOPS */ + + #if defined(BITOPS) || defined(NONDECDATA) + /* nondec2awknum --- convert octal or hex value to double */ + + /* + * Because of awk's concatenation rules and the way awk.y:yylex() + * collects a number, this routine has to be willing to stop on the + * first invalid character. + */ + + AWKNUM + nondec2awknum(str, len) + char *str; + size_t len; + { + AWKNUM retval = 0.0; + char save; + short val; + + if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) { + assert(len > 2); + + for (str += 2, len -= 2; len > 0; len--, str++) { + switch (*str) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + val = *str - '0'; + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + val = *str - 'a' + 10; + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + val = *str - 'A' + 10; + break; + default: + goto done; + } + retval = (retval * 16) + val; + } + } else if (*str == '0') { + for (; len > 0; len--) { + if (! isdigit(*str) || *str == '8' || *str == '9') + goto done; + retval = (retval * 8) + (*str - '0'); + str++; + } + } else { + save = str[len]; + retval = atof(str); + str[len] = save; + } + done: + return retval; + } + #endif /* defined(BITOPS) || defined(NONDECDATA) */ diff -crN gawk-3.0.2/configh.in gawk-3.0.3/configh.in *** gawk-3.0.2/configh.in Wed Dec 18 10:12:58 1996 --- gawk-3.0.3/configh.in Thu May 1 21:36:15 1997 *************** *** 4,10 **** */ /* ! * Copyright (C) 1995, 96 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 4,10 ---- */ /* ! * Copyright (C) 1995-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 128,133 **** --- 128,135 ---- #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) */ /* Define if you have the fmod function. */ #undef HAVE_FMOD diff -crN gawk-3.0.2/configure gawk-3.0.3/configure *** gawk-3.0.2/configure Wed Dec 18 10:27:38 1996 --- gawk-3.0.3/configure Tue May 13 20:59:00 1997 *************** *** 11,16 **** --- 11,20 ---- 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" + ac_help="$ac_help + --enable-non-decimal-data Enable Octal and Hex constants as valid input data" # Initialize some variables set by options. # The variables have the same names as the options, with *************** *** 521,532 **** for ac_prog in 'bison -y' byacc 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:530: 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 --- 525,555 ---- + # 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 + EOF + + 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" + cat >> confdefs.h <<\EOF + #define NONDECDATA 1 + EOF + + fi + + for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:553: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 556,562 **** test -n "$YACC" || YACC="yacc" echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 ! echo "configure:560: 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 --- 579,585 ---- test -n "$YACC" || YACC="yacc" echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 ! echo "configure:583: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 579,585 **** # 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:583: 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 --- 602,608 ---- # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:606: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 608,614 **** # 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:612: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else --- 631,637 ---- # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 ! echo "configure:635: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 656,662 **** fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 ! echo "configure:660: 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. --- 679,685 ---- fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 ! echo "configure:683: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. *************** *** 666,676 **** cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then --- 689,699 ---- cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then *************** *** 690,701 **** { 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:694: 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:699: 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 --- 713,724 ---- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 ! echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 ! echo "configure:722: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 704,710 **** yes; #endif EOF ! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:708: \"$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 --- 727,733 ---- yes; #endif EOF ! if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no *************** *** 719,725 **** ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! echo "configure:723: 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 --- 742,748 ---- ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 ! echo "configure:746: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 747,753 **** fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 ! echo "configure:751: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= --- 770,776 ---- fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 ! echo "configure:774: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= *************** *** 762,774 **** # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : --- 785,797 ---- # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : *************** *** 779,791 **** rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:789: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : --- 802,814 ---- rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : *************** *** 841,847 **** # 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:845: 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 --- 864,870 ---- # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 ! echo "configure:868: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 *************** *** 892,898 **** echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 ! echo "configure:896: 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 --- 915,921 ---- echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 ! echo "configure:919: 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 *************** *** 931,939 **** echo $ac_n "checking for AIX""... $ac_c" 1>&6 ! echo "configure:935: checking for AIX" >&5 cat > conftest.$ac_ext <&6 ! echo "configure:958: checking for AIX" >&5 cat > conftest.$ac_ext <&6 ! echo "configure:959: 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 --- 978,984 ---- echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 ! echo "configure:982: 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 *************** *** 977,993 **** ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 ! echo "configure:981: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 1000,1016 ---- ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 ! echo "configure:1004: checking for minix/config.h" >&5 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 1026,1037 **** echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 ! echo "configure:1030: 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 < #include --- 1049,1060 ---- echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 ! echo "configure:1053: 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 < #include *************** *** 1039,1045 **** #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 1062,1068 ---- #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 1056,1062 **** 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 --- 1079,1085 ---- 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 *************** *** 1074,1080 **** 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 --- 1097,1103 ---- 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 *************** *** 1095,1101 **** : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') --- 1118,1124 ---- : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') *************** *** 1106,1112 **** exit (0); } EOF ! if { (eval echo configure:1110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else --- 1129,1135 ---- exit (0); } EOF ! if { (eval echo configure:1133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else *************** *** 1130,1141 **** fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 ! echo "configure:1134: 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 < #include --- 1153,1164 ---- fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 ! echo "configure:1157: checking for sys/wait.h that is POSIX.1 compatible" >&5 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 < #include *************** *** 1151,1157 **** s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF ! if { (eval echo configure:1155: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else --- 1174,1180 ---- s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF ! if { (eval echo configure:1178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else *************** *** 1175,1191 **** do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1179: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 1198,1214 ---- do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1202: checking for $ac_hdr" >&5 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1212: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 1217,1233 **** do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1221: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 1240,1256 ---- do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1244: checking for $ac_hdr" >&5 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 1258,1274 **** do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1262: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1272: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 1281,1297 ---- do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1285: checking for $ac_hdr" >&5 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 1297,1308 **** fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 ! echo "configure:1301: 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 < #if STDC_HEADERS --- 1320,1331 ---- fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 ! echo "configure:1324: 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 < #if STDC_HEADERS *************** *** 1330,1341 **** fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 ! echo "configure:1334: 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 < #include --- 1353,1364 ---- fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 ! echo "configure:1357: 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 < #include *************** *** 1352,1358 **** int i; ; return 0; } EOF ! if { (eval echo configure:1356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else --- 1375,1381 ---- int i; ; return 0; } EOF ! if { (eval echo configure:1379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else *************** *** 1371,1382 **** echo $ac_n "checking for size_t""... $ac_c" 1>&6 ! echo "configure:1375: 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 < #if STDC_HEADERS --- 1394,1405 ---- echo $ac_n "checking for size_t""... $ac_c" 1>&6 ! echo "configure:1398: 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 < #if STDC_HEADERS *************** *** 1404,1415 **** fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 ! echo "configure:1408: 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 --- 1427,1438 ---- fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 ! echo "configure:1431: checking for uid_t in sys/types.h" >&5 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 *************** *** 1438,1444 **** fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 ! echo "configure:1442: 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 --- 1461,1467 ---- fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 ! echo "configure:1465: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else *************** *** 1446,1452 **** ac_cv_type_getgroups=cross else cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else --- 1494,1500 ---- } EOF ! if { (eval echo configure:1498: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else *************** *** 1485,1491 **** if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF --- 1508,1514 ---- if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF *************** *** 1509,1515 **** cat > conftest.$ac_ext < EOF --- 1532,1538 ---- cat > conftest.$ac_ext < EOF *************** *** 1536,1554 **** # 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:1540: 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF ! if { (eval echo configure:1552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else --- 1559,1577 ---- # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 ! echo "configure:1563: checking for working alloca.h" >&5 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 < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF ! if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else *************** *** 1569,1580 **** fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 ! echo "configure:1573: 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 <&6 ! echo "configure:1596: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else --- 1620,1626 ---- char *p = (char *) alloca(1); ; return 0; } EOF ! if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else *************** *** 1629,1640 **** echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 ! echo "configure:1633: 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 <&6 ! echo "configure:1656: 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 <&6 ! echo "configure:1663: 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 <&6 ! echo "configure:1686: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else --- 1710,1716 ---- ; return 0; } EOF ! if { (eval echo configure:1714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else *************** *** 1714,1720 **** fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 ! echo "configure:1718: 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 --- 1737,1743 ---- fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 ! echo "configure:1741: 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 *************** *** 1722,1728 **** ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else --- 1764,1770 ---- exit (find_stack_direction() < 0); } EOF ! if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else *************** *** 1768,1779 **** EOF echo $ac_n "checking for vprintf""... $ac_c" 1>&6 ! echo "configure:1772: 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 <&6 ! echo "configure:1795: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else --- 1819,1825 ---- ; return 0; } EOF ! if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else *************** *** 1820,1831 **** if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 ! echo "configure:1824: 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 <&6 ! echo "configure:1847: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else --- 1871,1877 ---- ; return 0; } EOF ! if { (eval echo configure:1875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else *************** *** 1874,1880 **** echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6 ! echo "configure:1878: 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 --- 1897,1903 ---- echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6 ! echo "configure:1901: 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 *************** *** 1882,1888 **** ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else --- 1916,1922 ---- fmod() ; return 0; } EOF ! if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else *************** *** 1924,1935 **** strftime strncasecmp strtod system tzset do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:1928: 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 <&6 ! echo "configure:1951: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else --- 1975,1981 ---- ; return 0; } EOF ! if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else *************** *** 1981,1997 **** do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:1985: 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:1995: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* --- 2004,2020 ---- do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 ! echo "configure:2008: checking for $ac_hdr" >&5 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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" ! { (eval echo configure:2018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* *************** *** 2020,2031 **** for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 ! echo "configure:2024: 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 <&6 ! echo "configure:2047: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else --- 2071,2077 ---- ; return 0; } EOF ! if { (eval echo configure:2075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else *************** *** 2073,2079 **** done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 ! echo "configure:2077: 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 --- 2096,2102 ---- done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 ! echo "configure:2100: 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 *************** *** 2081,2087 **** ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext < conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else --- 2244,2250 ---- } EOF ! if { (eval echo configure:2248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else *************** *** 2244,2251 **** fi ! echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 ! echo "configure:2249: 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 --- 2267,2281 ---- fi ! if (uname) > /dev/null 2>&1 ! then ! case `uname` in ! *VMS*) cat >> confdefs.h <<\EOF ! #define GETPGRP_VOID 1 ! EOF ! ;; ! *) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 ! echo "configure:2279: 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 *************** *** 2253,2259 **** { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_getpgrp_void=yes else --- 2338,2344 ---- } EOF ! if { (eval echo configure:2342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_getpgrp_void=yes else *************** *** 2331,2344 **** fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 ! echo "configure:2337: 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 < #include --- 2361,2465 ---- fi + ;; + esac + else + echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 + echo "configure:2369: checking whether getpgrp takes no argument" >&5 + if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } + else + cat > conftest.$ac_ext < + #include + + int pid; + int pg1, pg2, pg3, pg4; + int ng, np, s, child; + + main() + { + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } + } + + EOF + if { (eval echo configure:2432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null + then + ac_cv_func_getpgrp_void=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_getpgrp_void=no + fi + rm -fr conftest* + fi + + + fi + + echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6 + if test $ac_cv_func_getpgrp_void = yes; then + cat >> confdefs.h <<\EOF + #define GETPGRP_VOID 1 + EOF + + fi + + fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 ! echo "configure:2458: checking for st_blksize in struct stat" >&5 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 < #include *************** *** 2346,2352 **** struct stat s; s.st_blksize; ; return 0; } EOF ! if { (eval echo configure:2350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else --- 2467,2473 ---- struct stat s; s.st_blksize; ; return 0; } EOF ! if { (eval echo configure:2471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else *************** *** 2367,2378 **** fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 ! echo "configure:2371: 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 < #include --- 2488,2499 ---- fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 ! echo "configure:2492: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include *************** *** 2381,2387 **** struct tm *tp; ; return 0; } EOF ! if { (eval echo configure:2385: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else --- 2502,2508 ---- struct tm *tp; ; return 0; } EOF ! if { (eval echo configure:2506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else *************** *** 2402,2413 **** fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 ! echo "configure:2406: 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 < #include --- 2523,2534 ---- fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 ! echo "configure:2527: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include *************** *** 2415,2421 **** struct tm *tp; tp->tm_sec; ; return 0; } EOF ! if { (eval echo configure:2419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else --- 2536,2542 ---- struct tm *tp; tp->tm_sec; ; return 0; } EOF ! if { (eval echo configure:2540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else *************** *** 2436,2447 **** fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 ! echo "configure:2440: 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 < #include <$ac_cv_struct_tm> --- 2557,2568 ---- fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 ! echo "configure:2561: checking for tm_zone in struct tm" >&5 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 < #include <$ac_cv_struct_tm> *************** *** 2449,2455 **** struct tm tm; tm.tm_zone; ; return 0; } EOF ! if { (eval echo configure:2453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else --- 2570,2576 ---- struct tm tm; tm.tm_zone; ; return 0; } EOF ! if { (eval echo configure:2574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else *************** *** 2469,2480 **** else echo $ac_n "checking for tzname""... $ac_c" 1>&6 ! echo "configure:2473: 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 < #ifndef tzname /* For SGI. */ --- 2590,2601 ---- else echo $ac_n "checking for tzname""... $ac_c" 1>&6 ! echo "configure:2594: 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 < #ifndef tzname /* For SGI. */ *************** *** 2484,2490 **** atoi(*tzname); ; return 0; } EOF ! if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else --- 2605,2611 ---- atoi(*tzname); ; return 0; } EOF ! if { (eval echo configure:2609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else *************** *** 2507,2520 **** echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 ! echo "configure:2511: 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 <&6 ! echo "configure:2632: 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 <&2; exit 1; } else cat > conftest.$ac_ext <&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else --- 2667,2673 ---- volatile char c = 255; exit(c < 0); } EOF ! if { (eval echo configure:2671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else *************** *** 2570,2581 **** fi echo $ac_n "checking for working const""... $ac_c" 1>&6 ! echo "configure:2574: 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 <&6 ! echo "configure:2695: 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 <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else --- 2745,2751 ---- ; return 0; } EOF ! if { (eval echo configure:2749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else *************** *** 2647,2658 **** echo $ac_n "checking for ANSI stringizing capability""... $ac_c" 1>&6 ! echo "configure:2651: checking for ANSI stringizing capability" >&5 if eval "test \"`echo '$''{'gawk_cv_c_stringize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 ! echo "configure:2772: checking for ANSI stringizing capability" >&5 if eval "test \"`echo '$''{'gawk_cv_c_stringize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /dev/null 2>&1 ! then ! case `uname` in ! *VMS*) AC_DEFINE(GETPGRP_VOID) ;; ! *) AC_FUNC_GETPGRP ! ;; ! esac ! else ! AC_FUNC_GETPGRP ! fi dnl checks for structure members AC_STRUCT_ST_BLKSIZE diff -crN gawk-3.0.2/custom.h gawk-3.0.3/custom.h *** gawk-3.0.2/custom.h Tue Dec 24 10:28:11 1996 --- gawk-3.0.3/custom.h Thu May 1 21:36:17 1997 *************** *** 11,17 **** */ /* ! * Copyright (C) 1995, 96 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 11,17 ---- */ /* ! * Copyright (C) 1995-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 40,51 **** /* for VMS POSIX, from Pat Rankin, rankin@eql.caltech.edu */ #ifdef VMS_POSIX #undef VMS - #define GETPGRP_VOID /* autoconf's test for this tries to use - `setpgrp()', which doesn't exist. */ #include "vms/redirect.h" #endif /* For QNX, based on submission from Michael Hunter, mphunter@qnx.com */ #ifdef __QNX__ #define GETPGRP_VOID 1 #endif --- 40,59 ---- /* for VMS POSIX, from Pat Rankin, rankin@eql.caltech.edu */ #ifdef VMS_POSIX #undef VMS #include "vms/redirect.h" #endif /* For QNX, based on submission from Michael Hunter, mphunter@qnx.com */ #ifdef __QNX__ #define GETPGRP_VOID 1 + #endif + + /* For Amigas, from Fred Fish, fnf@ninemoons.com */ + #ifdef __amigaos__ + #define fork vfork + #endif + + /* For sequent, based on email with Aron Griffis */ + #ifdef _SEQUENT_ + #undef HAVE_MMAP #endif diff -crN gawk-3.0.2/dfa.c gawk-3.0.3/dfa.c *** gawk-3.0.2/dfa.c Sun Oct 20 12:17:54 1996 --- gawk-3.0.3/dfa.c Thu May 1 21:36:18 1997 *************** *** 18,31 **** /* Written June, 1988 by Mike Haertel Modified July, 1988 by Arthur David Olson to assist BMG speedups */ - #include - #include - #include - #ifdef HAVE_CONFIG_H #include #endif #ifdef STDC_HEADERS #include #else --- 18,31 ---- /* Written June, 1988 by Mike Haertel Modified July, 1988 by Arthur David Olson to assist BMG speedups */ #ifdef HAVE_CONFIG_H #include #endif + #include + #include + #include + #ifdef STDC_HEADERS #include #else *************** *** 51,69 **** #define isgraph(C) (isprint(C) && !isspace(C)) #endif ! #ifdef isascii ! #define ISALPHA(C) (isascii(C) && isalpha(C)) ! #define ISUPPER(C) (isascii(C) && isupper(C)) ! #define ISLOWER(C) (isascii(C) && islower(C)) ! #define ISDIGIT(C) (isascii(C) && isdigit(C)) ! #define ISXDIGIT(C) (isascii(C) && isxdigit(C)) ! #define ISSPACE(C) (isascii(C) && isspace(C)) ! #define ISPUNCT(C) (isascii(C) && ispunct(C)) ! #define ISALNUM(C) (isascii(C) && isalnum(C)) ! #define ISPRINT(C) (isascii(C) && isprint(C)) ! #define ISGRAPH(C) (isascii(C) && isgraph(C)) ! #define ISCNTRL(C) (isascii(C) && iscntrl(C)) ! #else #define ISALPHA(C) isalpha(C) #define ISUPPER(C) isupper(C) #define ISLOWER(C) islower(C) --- 51,57 ---- #define isgraph(C) (isprint(C) && !isspace(C)) #endif ! #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) #define ISALPHA(C) isalpha(C) #define ISUPPER(C) isupper(C) #define ISLOWER(C) islower(C) *************** *** 75,80 **** --- 63,80 ---- #define ISPRINT(C) isprint(C) #define ISGRAPH(C) isgraph(C) #define ISCNTRL(C) iscntrl(C) + #else + #define ISALPHA(C) (isascii(C) && isalpha(C)) + #define ISUPPER(C) (isascii(C) && isupper(C)) + #define ISLOWER(C) (isascii(C) && islower(C)) + #define ISDIGIT(C) (isascii(C) && isdigit(C)) + #define ISXDIGIT(C) (isascii(C) && isxdigit(C)) + #define ISSPACE(C) (isascii(C) && isspace(C)) + #define ISPUNCT(C) (isascii(C) && ispunct(C)) + #define ISALNUM(C) (isascii(C) && isalnum(C)) + #define ISPRINT(C) (isascii(C) && isprint(C)) + #define ISGRAPH(C) (isascii(C) && isgraph(C)) + #define ISCNTRL(C) (isascii(C) && iscntrl(C)) #endif #include "regex.h" *************** *** 334,340 **** static char *lexstart; /* Pointer to beginning of input string. */ static char *lexptr; /* Pointer to next input character. */ ! static lexleft; /* Number of characters remaining. */ static token lasttok; /* Previous token returned; initially END. */ static int laststart; /* True if we're separated from beginning or (, | only by zero-width characters. */ --- 334,340 ---- static char *lexstart; /* Pointer to beginning of input string. */ static char *lexptr; /* Pointer to next input character. */ ! static int lexleft; /* Number of characters remaining. */ static token lasttok; /* Previous token returned; initially END. */ static int laststart; /* True if we're separated from beginning or (, | only by zero-width characters. */ *************** *** 743,754 **** /* The above loop should consume at most a backslash and some other character. */ abort(); } /* Recursive descent parser for regular expressions. */ static token tok; /* Lookahead token. */ ! static depth; /* Current depth of a hypothetical stack holding deferred productions. This is used to determine the depth that will be required of the real stack later on in --- 743,755 ---- /* The above loop should consume at most a backslash and some other character. */ abort(); + return END; /* keeps pedantic compilers happy. */ } /* Recursive descent parser for regular expressions. */ static token tok; /* Lookahead token. */ ! static int depth; /* Current depth of a hypothetical stack holding deferred productions. This is used to determine the depth that will be required of the real stack later on in *************** *** 1536,1542 **** int state_newline; /* New state on a newline transition. */ int wants_letter; /* New state wants to know letter context. */ int state_letter; /* New state on a letter transition. */ ! static initialized; /* Flag for static initialization. */ int i, j, k; /* Initialize the set of letters, if necessary. */ --- 1537,1543 ---- int state_newline; /* New state on a newline transition. */ int wants_letter; /* New state wants to know letter context. */ int state_letter; /* New state on a letter transition. */ ! static int initialized; /* Flag for static initialization. */ int i, j, k; /* Initialize the set of letters, if necessary. */ *************** *** 1874,1885 **** int *count; int *backref; { ! register s, s1, tmp; /* Current state. */ register unsigned char *p; /* Current input character. */ ! register **trans, *t; /* Copy of d->trans so it can be optimized into a register. */ ! static sbit[NOTCHAR]; /* Table for anding with d->success. */ ! static sbit_init; if (! sbit_init) { --- 1875,1886 ---- int *count; int *backref; { ! register int s, s1, tmp; /* Current state. */ register unsigned char *p; /* Current input character. */ ! register int **trans, *t; /* Copy of d->trans so it can be optimized into a register. */ ! static int sbit[NOTCHAR]; /* Table for anding with d->success. */ ! static int sbit_init; if (! sbit_init) { *************** *** 2338,2343 **** --- 2339,2345 ---- } both = addlists(both, temp); freelist(temp); + free(temp); if (both == NULL) return NULL; } diff -crN gawk-3.0.2/doc/ChangeLog gawk-3.0.3/doc/ChangeLog *** gawk-3.0.2/doc/ChangeLog Wed Dec 25 11:26:04 1996 --- gawk-3.0.3/doc/ChangeLog Thu May 15 12:50:34 1997 *************** *** 1,3 **** --- 1,26 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Sun Apr 13 15:39:20 1997 Arnold D. Robbins + + * Makefile.in ($(infodir)/gawk.info): exit 0 in case install-info + fails. + + Thu Jan 2 23:17:53 1997 Fred Fish + + * Makefile.in (awkcard.tr): Use ':' chars to separate parts of + sed command, since $(srcdir) may expand to something with '/' + characters in it, which confuses sed terribly. + * gawk.texi (Amiga Installation): Note change of configuration + from "m68k-cbm-amigados" to "m68k-amigaos". Point ftp users + towards current ADE distribution and not obsolete Aminet + "gcc" distribution. Change "FreshFish" to "Geek Gadgets". + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/doc/Makefile.in gawk-3.0.3/doc/Makefile.in *** gawk-3.0.2/doc/Makefile.in Wed Dec 25 11:20:37 1996 --- gawk-3.0.3/doc/Makefile.in Wed May 14 21:36:15 1997 *************** *** 1,6 **** # Makefile for GNU Awk documentation. # ! # Copyright (C) 1993-1996 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,6 ---- # Makefile for GNU Awk documentation. # ! # Copyright (C) 1993-1997 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 79,85 **** done; \ if $(SHELL) -c 'install-info --version' > /dev/null 2>&1 ; \ then install-info --info-dir=$(infodir) gawk.info ; \ ! else true ; fi $(mandir)/gawk$(manext): gawk.1 $(INSTALL_DATA) $(srcdir)/gawk.1 $(mandir)/gawk$(manext) --- 79,85 ---- done; \ if $(SHELL) -c 'install-info --version' > /dev/null 2>&1 ; \ then install-info --info-dir=$(infodir) gawk.info ; \ ! else true ; fi; exit 0 $(mandir)/gawk$(manext): gawk.1 $(INSTALL_DATA) $(srcdir)/gawk.1 $(mandir)/gawk$(manext) *************** *** 108,114 **** dvips -o gawk.ps gawk.dvi awkcard.tr: awkcard.in ! sed 's/SRCDIR/$(srcdir)/' < $(srcdir)/awkcard.in > awkcard.tr awkcard.ps: $(CARDFILES) $(TROFF) $(CARDSRC) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps --- 108,114 ---- dvips -o gawk.ps gawk.dvi awkcard.tr: awkcard.in ! sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr awkcard.ps: $(CARDFILES) $(TROFF) $(CARDSRC) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps diff -crN gawk-3.0.2/doc/colors gawk-3.0.3/doc/colors *** gawk-3.0.2/doc/colors Mon Nov 4 13:16:49 1996 --- gawk-3.0.3/doc/colors Wed May 14 21:36:22 1997 *************** *** 1,7 **** .\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu .\" This file sets the colors to use. .\" ! .\" Copyright (C) 1996 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission --- 1,7 ---- .\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu .\" This file sets the colors to use. .\" ! .\" Copyright (C) 1996,97 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission *************** *** 31,42 **** CD - color dark, i.e. black CX - color boX, i.e. for the surrounding boxes (red for now) .. ! .ds CR \X'ps: exec .768 0 .047 setrgbcolor' ! .ds CG \X'ps: exec 0 .819 .259 setrgbcolor' ! .\" this is deepskyblue3, pretty good ! ...ds CL \X'ps: exec 0 .604 .804 setrgbcolor' ! .\" this is deepskyblue2, even better, use this for now ! .ds CL \X'ps: exec 0 .698 .933 setrgbcolor' ! .ds CB \X'ps: exec 0 .219 .941 setrgbcolor' ! .ds CD \X'ps: exec 0 0 0 setrgbcolor' .ds CX \*(CG --- 31,39 ---- CD - color dark, i.e. black CX - color boX, i.e. for the surrounding boxes (red for now) .. ! .ds CR \X'ps: exec 0 .96 .65 0 setcmykcolor' ! .ds CG \X'ps: exec 1.0 0 .51 .43 setcmykcolor' ! .ds CL \X'ps: exec .69 .34 0 0 setcmykcolor' ! .ds CB \X'ps: exec 1 .72 0 .06 setcmykcolor' ! .ds CD \X'ps: exec 1 1 1 1 setcmykcolor' .ds CX \*(CG diff -crN gawk-3.0.2/doc/gawk.info gawk-3.0.3/doc/gawk.info *** gawk-3.0.2/doc/gawk.info Sun Dec 22 22:58:15 1996 --- gawk-3.0.3/doc/gawk.info Sat Mar 15 22:07:30 1997 *************** *** 1,4 **** ! This is Info file gawk.info, produced by Makeinfo version 1.66 from the input file ./gawk.texi. INFO-DIR-SECTION Programming Languages --- 1,4 ---- ! This is Info file gawk.info, produced by Makeinfo version 1.67 from the input file ./gawk.texi. INFO-DIR-SECTION Programming Languages *************** *** 9,18 **** This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. ! This is Edition 1.0.2 of `The GNU Awk User's Guide', for the ! 3.0.2 version of the GNU implementation of AWK. ! Copyright (C) 1989, 1991, 92, 93, 96 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are --- 9,19 ---- This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. ! This is Edition 1.0.3 of `Effective AWK Programming', for the ! 3.0.3 version of the GNU implementation of AWK. ! Copyright (C) 1989, 1991, 92, 93, 96, 97 Free Software Foundation, ! Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are *************** *** 37,44 **** This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. ! This is Edition 1.0.2 of `The GNU Awk User's Guide', ! for the 3.0.2 version of the GNU implementation of AWK. * Menu: --- 38,45 ---- This file documents `awk', a program that you can use to select particular records in a file and perform operations upon them. ! This is Edition 1.0.3 of `Effective AWK Programming', ! for the 3.0.3 version of the GNU implementation of AWK. * Menu: *************** *** 434,458 **** PUBLIC LICENSE: Copying.). The GPL applies to the C language source code for `gawk'. ! As of this writing (1995), the only major component of the GNU ! environment still uncompleted is the operating system kernel, and work ! proceeds apace on that. A shell, an editor (Emacs), highly portable ! optimizing C, C++, and Objective-C compilers, a symbolic debugger, and ! dozens of large and small utilities (such as `gawk'), have all been ! completed and are freely available. ! ! Until the GNU operating system is released, the FSF recommends the ! use of Linux, a freely distributable, Unix-like operating system for ! 80386 and other systems. There are many books on Linux. One freely ! available one is `Linux Installation and Getting Started', by Matt ! Welsh. Many Linux distributions are available, often in computer ! stores or bundled on CD-ROM with books about Linux. Also, the FSF ! provides a Linux distribution ("Debian"); contact them for more ! information. *Note Getting the `gawk' Distribution: Getting, for the ! FSF's contact information. (There are two other freely available, ! Unix-like operating systems for 80386 and other systems, NetBSD and ! FreeBSD. Both are based on the 4.4-Lite Berkeley Software Distribution, ! and both use recent versions of `gawk' for their versions of `awk'.) This Info file itself has gone through several previous, preliminary editions. I started working on a preliminary draft of `The GAWK --- 435,457 ---- PUBLIC LICENSE: Copying.). The GPL applies to the C language source code for `gawk'. ! A shell, an editor (Emacs), highly portable optimizing C, C++, and ! Objective-C compilers, a symbolic debugger, and dozens of large and ! small utilities (such as `gawk'), have all been completed and are ! freely available. As of this writing (early 1997), the GNU operating ! system kernel (the HURD), has been released, but is still in an early ! stage of development. ! ! Until the GNU operating system is more fully developed, you should ! consider using Linux, a freely distributable, Unix-like operating ! system for 80386, DEC Alpha, Sun SPARC and other systems. There are ! many books on Linux. One freely available one is `Linux Installation ! and Getting Started', by Matt Welsh. Many Linux distributions are ! available, often in computer stores or bundled on CD-ROM with books ! about Linux. (There are three other freely available, Unix-like ! operating systems for 80386 and other systems, NetBSD, FreeBSD,and ! OpenBSD. All are based on the 4.4-Lite Berkeley Software Distribution, ! and they use recent versions of `gawk' for their versions of `awk'.) This Info file itself has gone through several previous, preliminary editions. I started working on a preliminary draft of `The GAWK *************** *** 468,479 **** 0.14 of November 1992 that was published by the FSF in January of 1993, and Edition 0.16 of August 1993. ! Edition 1.0 of `The GNU Awk User's Guide' represents a significant re-working of `The GAWK Manual', with much additional material. The FSF and I agree that I am now the primary author. I also felt that it needed a more descriptive title. ! `The GNU Awk User's Guide' will undoubtedly continue to evolve. An electronic version comes with the `gawk' distribution from the FSF. If you find an error in this Info file, please report it! *Note Reporting Problems and Bugs: Bugs, for information on submitting problem reports --- 467,478 ---- 0.14 of November 1992 that was published by the FSF in January of 1993, and Edition 0.16 of August 1993. ! Edition 1.0 of `Effective AWK Programming' represents a significant re-working of `The GAWK Manual', with much additional material. The FSF and I agree that I am now the primary author. I also felt that it needed a more descriptive title. ! `Effective AWK Programming' will undoubtedly continue to evolve. An electronic version comes with the `gawk' distribution from the FSF. If you find an error in this Info file, please report it! *Note Reporting Problems and Bugs: Bugs, for information on submitting problem reports *************** *** 507,513 **** Miriam Robbins, and Michal Jaegermann. The following people provided many helpful comments for Edition 1.0 ! of `The GNU Awk User's Guide': Karl Berry, Michael Brennan, Darrel Hankerson, Michal Jaegermann, Michael Lijewski, and Miriam Robbins. Pat Rankin, Michal Jaegermann, Darrel Hankerson and Scott Deifik updated their respective sections for Edition 1.0. --- 506,512 ---- Miriam Robbins, and Michal Jaegermann. The following people provided many helpful comments for Edition 1.0 ! of `Effective AWK Programming': Karl Berry, Michael Brennan, Darrel Hankerson, Michal Jaegermann, Michael Lijewski, and Miriam Robbins. Pat Rankin, Michal Jaegermann, Darrel Hankerson and Scott Deifik updated their respective sections for Edition 1.0. *************** *** 555,561 **** Arnold Robbins Atlanta, Georgia ! January, 1996  File: gawk.info, Node: What Is Awk, Next: Getting Started, Prev: Preface, Up: Top --- 554,560 ---- Arnold Robbins Atlanta, Georgia ! February, 1997  File: gawk.info, Node: What Is Awk, Next: Getting Started, Prev: Preface, Up: Top *************** *** 656,661 **** --- 655,663 ---- Dark Corners ------------ + Who opened that window shade?!? + Count Dracula + Until the POSIX standard (and `The Gawk Manual'), many features of `awk' were either poorly documented, or not documented at all. Descriptions of such features (often called "dark corners") are noted *************** *** 3120,3127 **** `"\n\n+"' to `RS'. This regexp matches the newline at the end of the record, and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when ! there is a choice (*note How Much Text Matches?: Leftmost Longest.) So ! the next record doesn't start until the first non-blank line that follows--no matter how many blank lines appear in a row, they are considered one record-separator. --- 3122,3129 ---- `"\n\n+"' to `RS'. This regexp matches the newline at the end of the record, and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when ! there is a choice (*note How Much Text Matches?: Leftmost Longest.). ! So the next record doesn't start until the first non-blank line that follows--no matter how many blank lines appear in a row, they are considered one record-separator. *************** *** 4906,4911 **** --- 4908,4916 ---- String Concatenation ==================== + It seemed like a good idea at the time. + Brian Kernighan + There is only one string operation: concatenation. It does not have a specific operator to represent it. Instead, concatenation is performed by writing expressions next to one another, with no operator. *************** *** 5192,5197 **** --- 5197,5205 ---- Variable Typing and Comparison Expressions ========================================== + The Guide is definitive. Reality is frequently inaccurate. + The Hitchhiker's Guide to the Galaxy + Unlike other programming languages, `awk' variables do not have a fixed type. Instead, they can be either a number or a string, depending upon the value that is assigned to them. *************** *** 5875,5881 **** statement (not discussed yet, *note The `next' Statement: Next Statement.), which causes `awk' to skip any further processing of the current record and start over again with the next input record. Such a ! program would like this: /^%$/,/^%$/ { next } { print } --- 5883,5889 ---- statement (not discussed yet, *note The `next' Statement: Next Statement.), which causes `awk' to skip any further processing of the current record and start over again with the next input record. Such a ! program would look like this: /^%$/,/^%$/ { next } { print } *************** *** 6690,6695 **** --- 6698,6704 ---- the `gensub', `gsub', `index', `match', `split' and `sub' functions, record termination with `RS', and field splitting with `FS' all ignore case when doing their particular regexp operations. + The value of `IGNORECASE' does *not* affect array subscripting. *Note Case-sensitivity in Matching: Case-sensitivity. If `gawk' is in compatibility mode (*note Command Line Options: *************** *** 6961,6966 **** --- 6970,6993 ---- } } + To actually get the options into the `awk' program, you have to end + the `awk' options with `--', and then supply your options, like so: + + awk -f myprog -- -v -d file1 file2 ... + + This is not necessary in `gawk': Unless `--posix' has been + specified, `gawk' silently puts any unrecognized options into `ARGV' + for the `awk' program to deal with. + + As soon as it sees an unknown option, `gawk' stops looking for other + options it might otherwise recognize. The above example with `gawk' + would be: + + gawk -f myprog -d -v file1 file2 ... + + Since `-d' is not a valid `gawk' option, the following `-v' is passed + on to the `awk' program. +  File: gawk.info, Node: Arrays, Next: Built-in, Prev: Built-in Variables, Up: Top *************** *** 7078,7083 **** --- 7105,7114 ---- strings; this is discussed in more detail in *Note Using Numbers to Subscript Arrays: Numeric Array Subscripts.) + The value of `IGNORECASE' has no effect upon array subscripting. + You must use the exact same string value to retrieve an array element + as you used to store it. + When `awk' creates an array for you, e.g., with the `split' built-in function, that array's indices are consecutive integers starting at one. (*Note Built-in Functions for String Manipulation: String Functions.) *************** *** 7415,7422 **** print l[i] } ! Here, the `++' forces `l' to be numeric, thus making the "old value" ! numeric zero, which is then converted to `"0"' as the array subscript. As we have just seen, even though it is somewhat unusual, the null string (`""') is a valid array subscript (d.c.). If `--lint' is provided --- 7446,7454 ---- print l[i] } ! Here, the `++' forces `lines' to be numeric, thus making the "old ! value" numeric zero, which is then converted to `"0"' as the array ! subscript. As we have just seen, even though it is somewhat unusual, the null string (`""') is a valid array subscript (d.c.). If `--lint' is provided *************** *** 8149,8156 **** (1) This consequence was certainly unintended. ! (2) As of December 1995, with final approval and publication ! hopefully sometime in 1996.  File: gawk.info, Node: I/O Functions, Next: Time Functions, Prev: String Functions, Up: Built-in --- 8181,8188 ---- (1) This consequence was certainly unintended. ! (2) As of February 1997, with final approval and publication ! hopefully sometime in 1997.  File: gawk.info, Node: I/O Functions, Next: Time Functions, Prev: String Functions, Up: Built-in *************** *** 9316,9322 **** current version, or that are still supported but deprecated (meaning that they will *not* be in the next release). ! For version 3.0.2 of `gawk', there are no command line options or other deprecated features from the previous version of `gawk'. This node is thus essentially a place holder, in case some option becomes obsolete in a future version of `gawk'. --- 9348,9354 ---- current version, or that are still supported but deprecated (meaning that they will *not* be in the next release). ! For version 3.0.3 of `gawk', there are no command line options or other deprecated features from the previous version of `gawk'. This node is thus essentially a place holder, in case some option becomes obsolete in a future version of `gawk'. *************** *** 9327,9332 **** --- 9359,9367 ---- Undocumented Options and Features ================================= + Use the Source, Luke! + Obi-Wan + This section intentionally left blank.  *************** *** 12953,12963 **** removed. `extract.awk' uses the `join' library function (*note Merging an Array Into a String: Join Function.). ! The example programs in the on-line Texinfo source for `The GNU Awk ! User's Guide' (`gawk.texi') have all been bracketed inside `file', and ! `endfile' lines. The `gawk' distribution uses a copy of `extract.awk' ! to extract the sample programs and install many of them in a standard ! directory, where `gawk' can find them. `extract.awk' begins by setting `IGNORECASE' to one, so that mixed upper-case and lower-case letters in the directives won't matter. --- 12988,12998 ---- removed. `extract.awk' uses the `join' library function (*note Merging an Array Into a String: Join Function.). ! The example programs in the on-line Texinfo source for `Effective ! AWK Programming' (`gawk.texi') have all been bracketed inside `file', ! and `endfile' lines. The `gawk' distribution uses a copy of ! `extract.awk' to extract the sample programs and install many of them ! in a standard directory, where `gawk' can find them. `extract.awk' begins by setting `IGNORECASE' to one, so that mixed upper-case and lower-case letters in the directives won't matter. *************** *** 13394,13400 **** Otherwise, the file name is concatenated with the name of each directory in the path, and an attempt is made to open the generated file name. The only way in `awk' to test if a file can be read is to go ! ahead and try to read it with `getline'; that is what `pathto' does. If the file can be read, it is closed, and the file name is returned. gawk -- ' --- 13429,13435 ---- Otherwise, the file name is concatenated with the name of each directory in the path, and an attempt is made to open the generated file name. The only way in `awk' to test if a file can be read is to go ! ahead and try to read it with `getline'; that is what `pathto' does.(1) If the file can be read, it is closed, and the file name is returned. gawk -- ' *************** *** 13530,13535 **** --- 13565,13575 ---- directives, `default.awk' could simply contain `@include' statements for the desired library functions. + ---------- Footnotes ---------- + + (1) On some very old versions of `awk', the test `getline junk < t' + can loop forever if the file exists but is empty. Caveat Emptor. +  File: gawk.info, Node: Language History, Next: Gawk Summary, Prev: Sample Programs, Up: Top *************** *** 14140,14146 **** `!~', and the `gensub', `gsub', `index', `match', `split' and `sub' built-in functions all ignore case when doing regular expression operations, and all string comparisons are done ! ignoring case. `NF' The number of fields in the current input record. --- 14180,14187 ---- `!~', and the `gensub', `gsub', `index', `match', `split' and `sub' built-in functions all ignore case when doing regular expression operations, and all string comparisons are done ! ignoring case. The value of `IGNORECASE' does *not* affect array ! subscripting. `NF' The number of fields in the current input record. *************** *** 15242,15262 **** `gawk' is distributed as a `tar' file compressed with the GNU Zip program, `gzip'. ! Once you have the distribution (for example, `gawk-3.0.2.tar.gz'), first use `gzip' to expand the file, and then use `tar' to extract it. You can use the following pipeline to produce the `gawk' distribution: # Under System V, add 'o' to the tar flags ! gzip -d -c gawk-3.0.2.tar.gz | tar -xvpf - ! This will create a directory named `gawk-3.0.2' in the current directory. The distribution file name is of the form `gawk-V.R.N.tar.gz'. The V represents the major version of `gawk', the R represents the current release of version V, and the N represents a "patch level", meaning that minor bugs have been fixed in the release. The current patch ! level is 0, but when retrieving distributions, you should get the version with the highest version, release, and patch level. (Note that release levels greater than or equal to 90 denote "beta," or non-production software; you may not wish to retrieve such a version --- 15283,15303 ---- `gawk' is distributed as a `tar' file compressed with the GNU Zip program, `gzip'. ! Once you have the distribution (for example, `gawk-3.0.3.tar.gz'), first use `gzip' to expand the file, and then use `tar' to extract it. You can use the following pipeline to produce the `gawk' distribution: # Under System V, add 'o' to the tar flags ! gzip -d -c gawk-3.0.3.tar.gz | tar -xvpf - ! This will create a directory named `gawk-3.0.3' in the current directory. The distribution file name is of the form `gawk-V.R.N.tar.gz'. The V represents the major version of `gawk', the R represents the current release of version V, and the N represents a "patch level", meaning that minor bugs have been fixed in the release. The current patch ! level is 3, but when retrieving distributions, you should get the version with the highest version, release, and patch level. (Note that release levels greater than or equal to 90 denote "beta," or non-production software; you may not wish to retrieve such a version *************** *** 15388,15397 **** extracted into ready to use files. They are installed as part of the installation process. - `amiga/*' - Files needed for building `gawk' on an Amiga. *Note Installing - `gawk' on an Amiga: Amiga Installation, for details. - `atari/*' Files needed for building `gawk' on an Atari ST. *Note Installing `gawk' on the Atari ST: Atari Installation, for details. --- 15429,15434 ---- *************** *** 15433,15439 **** ------------------------- After you have extracted the `gawk' distribution, `cd' to ! `gawk-3.0.2'. Like most GNU software, `gawk' is configured automatically for your Unix system by running the `configure' program. This program is a Bourne shell script that was generated automatically using GNU `autoconf'. (The `autoconf' software is described fully --- 15470,15476 ---- ------------------------- After you have extracted the `gawk' distribution, `cd' to ! `gawk-3.0.3'. Like most GNU software, `gawk' is configured automatically for your Unix system by running the `configure' program. This program is a Bourne shell script that was generated automatically using GNU `autoconf'. (The `autoconf' software is described fully *************** *** 15864,15876 **** ============================= You can install `gawk' on an Amiga system using a Unix emulation ! environment available via anonymous `ftp' from `wuarchive.wustl.edu' in ! the directory `pub/aminet/dev/gcc'. This includes a shell based on `pdksh'. The primary component of this environment is a Unix emulation library, `ixemul.lib'. ! A more complete distribution for the Amiga is available on the ! FreshFish CD-ROM from: CRONUS 1840 E. Warner Road #105-265 --- 15901,15913 ---- ============================= You can install `gawk' on an Amiga system using a Unix emulation ! environment available via anonymous `ftp' from `ftp.ninemoons.com' in ! the directory `pub/ade/current'. This includes a shell based on `pdksh'. The primary component of this environment is a Unix emulation library, `ixemul.lib'. ! A more complete distribution for the Amiga is available on the Geek ! Gadgets CD-ROM from: CRONUS 1840 E. Warner Road #105-265 *************** *** 15885,15891 **** Once you have the distribution, you can configure `gawk' simply by running `configure': ! configure -v m68k-cbm-amigados Then run `make', and you should be all set! (If these steps do not work, please send in a bug report; *note Reporting Problems and Bugs: --- 15922,15928 ---- Once you have the distribution, you can configure `gawk' simply by running `configure': ! configure -v m68k-amigaos Then run `make', and you should be all set! (If these steps do not work, please send in a bug report; *note Reporting Problems and Bugs: *************** *** 15897,15902 **** --- 15934,15942 ---- Reporting Problems and Bugs =========================== + There is nothing more dangerous than a bored archeologist. + The Hitchhiker's Guide to the Galaxy + If you have problems with `gawk' or think that you have found a bug, please report it to the developers; we cannot promise to do anything but we might well want to fix it. *************** *** 16160,16167 **** new sections and or chapters for this Info file. If at all possible, please use real Texinfo, instead of just supplying unformatted ASCII text (although even that is better than no ! documentation at all). Conventions to be followed in `The GNU Awk ! User's Guide' are provided after the `@bye' at the end of the Texinfo source file. If possible, please update the man page as well. --- 16200,16207 ---- new sections and or chapters for this Info file. If at all possible, please use real Texinfo, instead of just supplying unformatted ASCII text (although even that is better than no ! documentation at all). Conventions to be followed in `Effective ! AWK Programming' are provided after the `@bye' at the end of the Texinfo source file. If possible, please update the man page as well. *************** *** 17161,17168 **** * ! operator: Boolean Ops. * != operator: Typing and Comparison. * !~ operator <1>: Regexp Constants. ! * !~ operator <2>: Regexp Usage. ! * !~ operator <3>: Typing and Comparison. * !~ operator <4>: Case-sensitivity. * !~ operator: Computed Regexps. * # (comment): Comments. --- 17201,17208 ---- * ! operator: Boolean Ops. * != operator: Typing and Comparison. * !~ operator <1>: Regexp Constants. ! * !~ operator <2>: Typing and Comparison. ! * !~ operator <3>: Regexp Usage. * !~ operator <4>: Case-sensitivity. * !~ operator: Computed Regexps. * # (comment): Comments. *************** *** 17183,17192 **** * --traditional option: Options. * --usage option: Options. * --version option: Options. ! * -f option <1>: Long. ! * -f option: Options. * -F option <1>: Command Line Field Separator. * -F option: Options. * -v option: Options. * -W option: Options. * /dev/fd: Special Files. --- 17223,17232 ---- * --traditional option: Options. * --usage option: Options. * --version option: Options. ! * -f option: Long. * -F option <1>: Command Line Field Separator. * -F option: Options. + * -f option: Options. * -v option: Options. * -W option: Options. * /dev/fd: Special Files. *************** *** 17241,17251 **** * argument processing: Getopt Function. * arguments in function call: Function Calls. * arguments, command line: Invoking Gawk. ! * ARGV <1>: Other Arguments. ! * ARGV: Auto-set. * arithmetic operators: Arithmetic Ops. * array assignment: Assigning Elements. * array reference: Reference to Elements. * array subscripts, uninitialized variables: Uninitialized Subscripts. * arrays: Array Intro. * arrays, associative: Array Intro. --- 17281,17292 ---- * argument processing: Getopt Function. * arguments in function call: Function Calls. * arguments, command line: Invoking Gawk. ! * ARGV <1>: Auto-set. ! * ARGV: Other Arguments. * arithmetic operators: Arithmetic Ops. * array assignment: Assigning Elements. * array reference: Reference to Elements. + * Array subscripts and IGNORECASE: Array Intro. * array subscripts, uninitialized variables: Uninitialized Subscripts. * arrays: Array Intro. * arrays, associative: Array Intro. *************** *** 17269,17298 **** * atari: Atari Installation. * automatic initialization: More Complex. * awk language, POSIX version <1>: OFMT. ! * awk language, POSIX version <2>: Field Splitting Summary. ! * awk language, POSIX version <3>: Break Statement. * awk language, POSIX version <4>: Format Modifiers. ! * awk language, POSIX version <5>: String Functions. ! * awk language, POSIX version <6>: Continue Statement. ! * awk language, POSIX version <7>: Definition Syntax. * awk language, POSIX version <8>: Precedence. ! * awk language, POSIX version <9>: Next Statement. * awk language, POSIX version <10>: String Functions. ! * awk language, POSIX version <11>: User-modified. ! * awk language, POSIX version <12>: Precedence. ! * awk language, POSIX version <13>: Escape Sequences. ! * awk language, POSIX version <14>: Conversion. ! * awk language, POSIX version <15>: Arithmetic Ops. ! * awk language, POSIX version <16>: Regexp Operators. ! * awk language, POSIX version <17>: Assignment Ops. ! * awk language, POSIX version: Regexp Operators. ! * awk language, V.4 version <1>: Escape Sequences. ! * awk language, V.4 version <2>: SVR4. * awk language, V.4 version: Escape Sequences. * AWKPATH environment variable: AWKPATH Variable. * awksed: Simple Sed. ! * backslash continuation <1>: Egrep Program. ! * backslash continuation: Statements/Lines. * backslash continuation and comments: Statements/Lines. * backslash continuation in csh <1>: More Complex. * backslash continuation in csh: Statements/Lines. --- 17310,17338 ---- * atari: Atari Installation. * automatic initialization: More Complex. * awk language, POSIX version <1>: OFMT. ! * awk language, POSIX version <2>: Next Statement. ! * awk language, POSIX version <3>: Continue Statement. * awk language, POSIX version <4>: Format Modifiers. ! * awk language, POSIX version <5>: Field Splitting Summary. ! * awk language, POSIX version <6>: Arithmetic Ops. ! * awk language, POSIX version <7>: User-modified. * awk language, POSIX version <8>: Precedence. ! * awk language, POSIX version <9>: Assignment Ops. * awk language, POSIX version <10>: String Functions. ! * awk language, POSIX version <11>: Regexp Operators. ! * awk language, POSIX version <12>: Escape Sequences. ! * awk language, POSIX version <13>: Regexp Operators. ! * awk language, POSIX version <14>: String Functions. ! * awk language, POSIX version <15>: Definition Syntax. ! * awk language, POSIX version <16>: Break Statement. ! * awk language, POSIX version <17>: Regexp Operators. ! * awk language, POSIX version: Conversion. ! * awk language, V.4 version <1>: SVR4. * awk language, V.4 version: Escape Sequences. * AWKPATH environment variable: AWKPATH Variable. * awksed: Simple Sed. ! * backslash continuation <1>: Statements/Lines. ! * backslash continuation: Egrep Program. * backslash continuation and comments: Statements/Lines. * backslash continuation in csh <1>: More Complex. * backslash continuation in csh: Statements/Lines. *************** *** 17306,17314 **** * boolean operators: Boolean Ops. * break statement: Break Statement. * break, outside of loops: Break Statement. ! * Brennan, Michael <1>: Simple Sed. * Brennan, Michael <2>: Delete. ! * Brennan, Michael: Other Versions. * buffer matching operators: GNU Regexp Operators. * buffering output: I/O Functions. * buffering, interactive vs. non-interactive: I/O Functions. --- 17346,17355 ---- * boolean operators: Boolean Ops. * break statement: Break Statement. * break, outside of loops: Break Statement. ! * Brennan, Michael <1>: Other Versions. * Brennan, Michael <2>: Delete. ! * Brennan, Michael <3>: Other Versions. ! * Brennan, Michael: Simple Sed. * buffer matching operators: GNU Regexp Operators. * buffering output: I/O Functions. * buffering, interactive vs. non-interactive: I/O Functions. *************** *** 17333,17340 **** * character list, complemented: Regexp Operators. * character sets: Ordinal Functions. * chr: Ordinal Functions. ! * close <1>: Close Files And Pipes. ! * close: I/O Functions. * closing input files and pipes: Close Files And Pipes. * closing output files and pipes: Close Files And Pipes. * coding style used in gawk: Adding Code. --- 17374,17381 ---- * character list, complemented: Regexp Operators. * character sets: Ordinal Functions. * chr: Ordinal Functions. ! * close <1>: I/O Functions. ! * close: Close Files And Pipes. * closing input files and pipes: Close Files And Pipes. * closing output files and pipes: Close Files And Pipes. * coding style used in gawk: Adding Code. *************** *** 17346,17354 **** * comments: Comments. * comments and backslash continuation: Statements/Lines. * common mistakes <1>: Typing and Comparison. ! * common mistakes <2>: Computed Regexps. ! * common mistakes <3>: Print Examples. ! * common mistakes: Basic Field Splitting. * comp.lang.awk: Bugs. * comparison expressions: Typing and Comparison. * comparisons, string vs. regexp: Typing and Comparison. --- 17387,17395 ---- * comments: Comments. * comments and backslash continuation: Statements/Lines. * common mistakes <1>: Typing and Comparison. ! * common mistakes <2>: Print Examples. ! * common mistakes <3>: Basic Field Splitting. ! * common mistakes: Computed Regexps. * comp.lang.awk: Bugs. * comparison expressions: Typing and Comparison. * comparisons, string vs. regexp: Typing and Comparison. *************** *** 17369,17411 **** * conversion of strings and numbers: Conversion. * conversions, during subscripting: Numeric Array Subscripts. * converting dates to timestamps: Mktime Function. ! * CONVFMT <1>: User-modified. ! * CONVFMT <2>: Numeric Array Subscripts. ! * CONVFMT: Conversion. * cos: Numeric Functions. ! * csh, backslash continuation <1>: Statements/Lines. ! * csh, backslash continuation: More Complex. * curly braces: Action Overview. * custom.h configuration file: Configuration Philosophy. * cut utility: Cut Program. * cut.awk: Cut Program. * d.c., see "dark corner": This Manual. ! * dark corner <1>: Assignment Options. ! * dark corner <2>: Using Constant Regexps. ! * dark corner <3>: Conversion. ! * dark corner <4>: Using Constant Regexps. ! * dark corner <5>: Truth Values. * dark corner <6>: Auto-set. ! * dark corner <7>: Plain Getline. ! * dark corner <8>: Other Arguments. ! * dark corner <9>: Records. ! * dark corner <10>: Uninitialized Subscripts. ! * dark corner <11>: Multiple Line. ! * dark corner <12>: Auto-set. * dark corner <13>: Break Statement. ! * dark corner <14>: Single Character Fields. ! * dark corner <15>: Getline Summary. ! * dark corner <16>: OFMT. ! * dark corner <17>: Escape Sequences. ! * dark corner <18>: Exit Statement. ! * dark corner <19>: Invoking Gawk. ! * dark corner <20>: String Functions. ! * dark corner <21>: This Manual. ! * dark corner <22>: Continue Statement. ! * dark corner <23>: Using BEGIN/END. ! * dark corner <24>: Format Modifiers. ! * dark corner <25>: Control Letters. ! * dark corner: Field Splitting Summary. * data-driven languages: Getting Started. * dates, converting to timestamps: Mktime Function. * decrement operators: Increment Ops. --- 17410,17452 ---- * conversion of strings and numbers: Conversion. * conversions, during subscripting: Numeric Array Subscripts. * converting dates to timestamps: Mktime Function. ! * CONVFMT <1>: Numeric Array Subscripts. ! * CONVFMT <2>: Conversion. ! * CONVFMT: User-modified. * cos: Numeric Functions. ! * csh, backslash continuation <1>: More Complex. ! * csh, backslash continuation: Statements/Lines. * curly braces: Action Overview. * custom.h configuration file: Configuration Philosophy. * cut utility: Cut Program. * cut.awk: Cut Program. * d.c., see "dark corner": This Manual. ! * dark corner <1>: Control Letters. ! * dark corner <2>: Continue Statement. ! * dark corner <3>: Using Constant Regexps. ! * dark corner <4>: Single Character Fields. ! * dark corner <5>: OFMT. * dark corner <6>: Auto-set. ! * dark corner <7>: Truth Values. ! * dark corner <8>: Field Splitting Summary. ! * dark corner <9>: Assignment Options. ! * dark corner <10>: This Manual. ! * dark corner <11>: Escape Sequences. ! * dark corner <12>: Format Modifiers. * dark corner <13>: Break Statement. ! * dark corner <14>: Invoking Gawk. ! * dark corner <15>: Plain Getline. ! * dark corner <16>: Using Constant Regexps. ! * dark corner <17>: Getline Summary. ! * dark corner <18>: Multiple Line. ! * dark corner <19>: String Functions. ! * dark corner <20>: Conversion. ! * dark corner <21>: Uninitialized Subscripts. ! * dark corner <22>: Auto-set. ! * dark corner <23>: Records. ! * dark corner <24>: Exit Statement. ! * dark corner <25>: Other Arguments. ! * dark corner: Using BEGIN/END. * data-driven languages: Getting Started. * dates, converting to timestamps: Mktime Function. * decrement operators: Increment Ops. *************** *** 17420,17444 **** * deprecated features: Obsolete. * deprecated options: Obsolete. * differences between gawk and awk <1>: Records. ! * differences between gawk and awk <2>: Redirection. ! * differences between gawk and awk <3>: Close Files And Pipes. ! * differences between gawk and awk <4>: Case-sensitivity. * differences between gawk and awk <5>: Calling Built-in. ! * differences between gawk and awk <6>: AWKPATH Variable. ! * differences between gawk and awk <7>: Single Character Fields. ! * differences between gawk and awk <8>: Conditional Exp. ! * differences between gawk and awk <9>: String Functions. ! * differences between gawk and awk <10>: Scalar Constants. ! * differences between gawk and awk <11>: Special Files. ! * differences between gawk and awk <12>: Close Files And Pipes. * differences between gawk and awk <13>: I/O And BEGIN/END. ! * differences between gawk and awk <14>: String Functions. ! * differences between gawk and awk <15>: Arithmetic Ops. * differences between gawk and awk <16>: Using Constant Regexps. ! * differences between gawk and awk <17>: Getline Intro. ! * differences between gawk and awk <18>: Delete. ! * differences between gawk and awk <19>: Getline Summary. ! * differences between gawk and awk: Nextfile Statement. * directory search: AWKPATH Variable. * division: Arithmetic Ops. * documenting awk programs <1>: Library Names. --- 17461,17487 ---- * deprecated features: Obsolete. * deprecated options: Obsolete. * differences between gawk and awk <1>: Records. ! * differences between gawk and awk <2>: Scalar Constants. ! * differences between gawk and awk <3>: Getline Summary. ! * differences between gawk and awk <4>: ARGC and ARGV. * differences between gawk and awk <5>: Calling Built-in. ! * differences between gawk and awk <6>: Nextfile Statement. ! * differences between gawk and awk <7>: AWKPATH Variable. ! * differences between gawk and awk <8>: Getline Intro. ! * differences between gawk and awk <9>: Special Files. ! * differences between gawk and awk <10>: Conditional Exp. ! * differences between gawk and awk <11>: Arithmetic Ops. ! * differences between gawk and awk <12>: String Functions. * differences between gawk and awk <13>: I/O And BEGIN/END. ! * differences between gawk and awk <14>: Redirection. ! * differences between gawk and awk <15>: Case-sensitivity. * differences between gawk and awk <16>: Using Constant Regexps. ! * differences between gawk and awk <17>: Close Files And Pipes. ! * differences between gawk and awk <18>: String Functions. ! * differences between gawk and awk <19>: Close Files And Pipes. ! * differences between gawk and awk <20>: Delete. ! * differences between gawk and awk <21>: Single Character Fields. ! * differences between gawk and awk: Records. * directory search: AWKPATH Variable. * division: Arithmetic Ops. * documenting awk programs <1>: Library Names. *************** *** 17455,17464 **** * empty action: Very Simple. * empty pattern: Empty. * empty program: Invoking Gawk. ! * empty string <1>: Regexp Field Splitting. ! * empty string <2>: Records. ! * empty string <3>: Truth Values. ! * empty string: Conversion. * END special pattern: BEGIN/END. * endfile: Filetrans Function. * endgrent: Group Functions. --- 17498,17507 ---- * empty action: Very Simple. * empty pattern: Empty. * empty program: Invoking Gawk. ! * empty string <1>: Truth Values. ! * empty string <2>: Conversion. ! * empty string <3>: Regexp Field Splitting. ! * empty string: Records. * END special pattern: BEGIN/END. * endfile: Filetrans Function. * endgrent: Group Functions. *************** *** 17467,17479 **** * environment variable, AWKPATH: AWKPATH Variable. * environment variable, POSIXLY_CORRECT: Options. * equivalence classes: Regexp Operators. ! * ERRNO <1>: Auto-set. * ERRNO <2>: Close Files And Pipes. ! * ERRNO: Getline Intro. ! * errors, common <1>: Print Examples. * errors, common <2>: Computed Regexps. ! * errors, common <3>: Typing and Comparison. ! * errors, common: Basic Field Splitting. * escape processing, sub et. al.: String Functions. * escape sequence notation: Escape Sequences. * evaluation, order of: Calling Built-in. --- 17510,17522 ---- * environment variable, AWKPATH: AWKPATH Variable. * environment variable, POSIXLY_CORRECT: Options. * equivalence classes: Regexp Operators. ! * ERRNO <1>: Getline Intro. * ERRNO <2>: Close Files And Pipes. ! * ERRNO: Auto-set. ! * errors, common <1>: Typing and Comparison. * errors, common <2>: Computed Regexps. ! * errors, common <3>: Basic Field Splitting. ! * errors, common: Print Examples. * escape processing, sub et. al.: String Functions. * escape sequence notation: Escape Sequences. * evaluation, order of: Calling Built-in. *************** *** 17502,17510 **** * FIELDWIDTHS: User-modified. * file descriptors: Special Files. * file, awk program: Long. ! * FILENAME <1>: Auto-set. * FILENAME <2>: Getline Summary. ! * FILENAME: Reading Files. * FILENAME, being set by getline: Getline Summary. * Fish, Fred: Bugs. * flushing buffers: I/O Functions. --- 17545,17553 ---- * FIELDWIDTHS: User-modified. * file descriptors: Special Files. * file, awk program: Long. ! * FILENAME <1>: Reading Files. * FILENAME <2>: Getline Summary. ! * FILENAME: Auto-set. * FILENAME, being set by getline: Getline Summary. * Fish, Fred: Bugs. * flushing buffers: I/O Functions. *************** *** 17517,17532 **** * format, numeric output: OFMT. * formatted output: Printf. * formatted timestamps: Gettimeofday Function. ! * Free Software Foundation <1>: Manual History. * Free Software Foundation: Getting. * FreeBSD: Manual History. * Friedl, Jeffrey: Acknowledgements. ! * FS <1>: User-modified. ! * FS: Basic Field Splitting. * ftp, anonymous <1>: Getting. * ftp, anonymous: Other Versions. ! * function call <1>: Function Caveats. ! * function call: Function Calls. * function definition: Definition Syntax. * function, recursive: Definition Syntax. * functions, undefined: Function Caveats. --- 17560,17576 ---- * format, numeric output: OFMT. * formatted output: Printf. * formatted timestamps: Gettimeofday Function. ! * Free Software Foundation <1>: Getting. ! * Free Software Foundation <2>: Manual History. * Free Software Foundation: Getting. * FreeBSD: Manual History. * Friedl, Jeffrey: Acknowledgements. ! * FS <1>: Basic Field Splitting. ! * FS: User-modified. * ftp, anonymous <1>: Getting. * ftp, anonymous: Other Versions. ! * function call <1>: Function Calls. ! * function call: Function Caveats. * function definition: Definition Syntax. * function, recursive: Definition Syntax. * functions, undefined: Function Caveats. *************** *** 17558,17568 **** * gsub, third argument of: String Functions. * Hankerson, Darrel <1>: Bugs. * Hankerson, Darrel: Acknowledgements. ! * historical features <1>: Break Statement. ! * historical features <2>: Continue Statement. ! * historical features <3>: Historical Features. ! * historical features <4>: String Functions. ! * historical features: Command Line Field Separator. * history of awk: History. * histsort.awk: History Sorting. * how awk works: Two Rules. --- 17602,17612 ---- * gsub, third argument of: String Functions. * Hankerson, Darrel <1>: Bugs. * Hankerson, Darrel: Acknowledgements. ! * historical features <1>: Command Line Field Separator. ! * historical features <2>: String Functions. ! * historical features <3>: Break Statement. ! * historical features <4>: Continue Statement. ! * historical features: Historical Features. * history of awk: History. * histsort.awk: History Sorting. * how awk works: Two Rules. *************** *** 17572,17579 **** * id.awk: Id Program. * if-else statement: If Statement. * igawk.sh: Igawk Program. ! * IGNORECASE <1>: Case-sensitivity. ! * IGNORECASE: User-modified. * ignoring case: Case-sensitivity. * implementation limits <1>: Getline Summary. * implementation limits: Redirection. --- 17616,17625 ---- * id.awk: Id Program. * if-else statement: If Statement. * igawk.sh: Igawk Program. ! * IGNORECASE <1>: User-modified. ! * IGNORECASE <2>: Array Intro. ! * IGNORECASE: Case-sensitivity. ! * IGNORECASE and array subscripts: Array Intro. * ignoring case: Case-sensitivity. * implementation limits <1>: Getline Summary. * implementation limits: Redirection. *************** *** 17609,17633 **** * Jaegermann, Michal <1>: Acknowledgements. * Jaegermann, Michal: Bugs. * join: Join Function. ! * Kernighan, Brian <1>: Acknowledgements. ! * Kernighan, Brian <2>: History. * Kernighan, Brian <3>: Other Versions. ! * Kernighan, Brian: BTL. * known bugs: Known Bugs. * labels.awk: Labels Program. * language, awk: This Manual. * language, data-driven: Getting Started. * language, procedural: Getting Started. ! * leftmost longest match <1>: Leftmost Longest. ! * leftmost longest match: Multiple Line. * length: String Functions. ! * limitations <1>: Getline Summary. ! * limitations: Redirection. * line break: Statements/Lines. ! * line continuation <1>: Conditional Exp. ! * line continuation <2>: Boolean Ops. ! * line continuation <3>: Print Examples. ! * line continuation: Statements/Lines. * Linux <1>: Manual History. * Linux: Atari Compiling. * locale, definition of: Time Functions. --- 17655,17680 ---- * Jaegermann, Michal <1>: Acknowledgements. * Jaegermann, Michal: Bugs. * join: Join Function. ! * Kernighan, Brian <1>: Concatenation. ! * Kernighan, Brian <2>: Acknowledgements. * Kernighan, Brian <3>: Other Versions. ! * Kernighan, Brian <4>: BTL. ! * Kernighan, Brian: History. * known bugs: Known Bugs. * labels.awk: Labels Program. * language, awk: This Manual. * language, data-driven: Getting Started. * language, procedural: Getting Started. ! * leftmost longest match <1>: Multiple Line. ! * leftmost longest match: Leftmost Longest. * length: String Functions. ! * limitations <1>: Redirection. ! * limitations: Getline Summary. * line break: Statements/Lines. ! * line continuation <1>: Boolean Ops. ! * line continuation <2>: Print Examples. ! * line continuation <3>: Statements/Lines. ! * line continuation: Conditional Exp. * Linux <1>: Manual History. * Linux: Atari Compiling. * locale, definition of: Time Functions. *************** *** 17643,17656 **** * mark parity: Ordinal Functions. * match: String Functions. * matching ranges of lines: Ranges. ! * matching, leftmost longest <1>: Leftmost Longest. ! * matching, leftmost longest: Multiple Line. * mawk: Other Versions. * merging strings: Join Function. * metacharacters: Regexp Operators. ! * mistakes, common <1>: Computed Regexps. ! * mistakes, common <2>: Basic Field Splitting. ! * mistakes, common <3>: Typing and Comparison. * mistakes, common: Print Examples. * mktime: Mktime Function. * modifiers (in format specifiers): Format Modifiers. --- 17690,17703 ---- * mark parity: Ordinal Functions. * match: String Functions. * matching ranges of lines: Ranges. ! * matching, leftmost longest <1>: Multiple Line. ! * matching, leftmost longest: Leftmost Longest. * mawk: Other Versions. * merging strings: Join Function. * metacharacters: Regexp Operators. ! * mistakes, common <1>: Basic Field Splitting. ! * mistakes, common <2>: Typing and Comparison. ! * mistakes, common <3>: Computed Regexps. * mistakes, common: Print Examples. * mktime: Mktime Function. * modifiers (in format specifiers): Format Modifiers. *************** *** 17671,17685 **** * next, inside a user-defined function: Next Statement. * nextfile function: Nextfile Function. * nextfile statement: Nextfile Statement. ! * NF <1>: Auto-set. ! * NF: Fields. * non-interactive buffering vs. interactive: I/O Functions. * not operator: Boolean Ops. ! * NR <1>: Records. ! * NR: Auto-set. ! * null string <1>: Truth Values. ! * null string <2>: Conversion. ! * null string: Regexp Field Splitting. * null string, as array subscript: Uninitialized Subscripts. * number of fields, NF: Fields. * number of records, NR, FNR: Records. --- 17718,17732 ---- * next, inside a user-defined function: Next Statement. * nextfile function: Nextfile Function. * nextfile statement: Nextfile Statement. ! * NF <1>: Fields. ! * NF: Auto-set. * non-interactive buffering vs. interactive: I/O Functions. * not operator: Boolean Ops. ! * NR <1>: Auto-set. ! * NR: Records. ! * null string <1>: Conversion. ! * null string <2>: Regexp Field Splitting. ! * null string: Truth Values. * null string, as array subscript: Uninitialized Subscripts. * number of fields, NF: Fields. * number of records, NR, FNR: Records. *************** *** 17691,17699 **** * numeric value: Scalar Constants. * obsolete features: Obsolete. * obsolete options: Obsolete. ! * OFMT <1>: OFMT. ! * OFMT <2>: Conversion. ! * OFMT: User-modified. * OFS <1>: Output Separators. * OFS: User-modified. * old awk: History. --- 17738,17746 ---- * numeric value: Scalar Constants. * obsolete features: Obsolete. * obsolete options: Obsolete. ! * OFMT <1>: User-modified. ! * OFMT <2>: OFMT. ! * OFMT: Conversion. * OFS <1>: Output Separators. * OFS: User-modified. * old awk: History. *************** *** 17716,17723 **** * or operator: Boolean Ops. * ord: Ordinal Functions. * order of evaluation: Calling Built-in. ! * ORS <1>: User-modified. ! * ORS: Output Separators. * output: Printing. * output field separator, OFS: Output Separators. * output format specifier, OFMT: OFMT. --- 17763,17770 ---- * or operator: Boolean Ops. * ord: Ordinal Functions. * order of evaluation: Calling Built-in. ! * ORS <1>: Output Separators. ! * ORS: User-modified. * output: Printing. * output field separator, OFS: Output Separators. * output format specifier, OFMT: OFMT. *************** *** 17741,17772 **** * PERL: Future Extensions. * pipeline, input: Getline/Pipe. * pipes for output: Redirection. ! * portability issues <1>: Portability Notes. ! * portability issues <2>: Delete. ! * portability issues <3>: Escape Sequences. ! * portability issues <4>: Statements/Lines. * portability issues <5>: Definition Syntax. ! * portability issues <6>: String Functions. ! * portability issues <7>: Close Files And Pipes. ! * portability issues: I/O Functions. * porting gawk: New Ports. ! * POSIX awk <1>: Field Splitting Summary. ! * POSIX awk <2>: User-modified. ! * POSIX awk <3>: Assignment Ops. ! * POSIX awk <4>: Precedence. ! * POSIX awk <5>: Arithmetic Ops. ! * POSIX awk <6>: Break Statement. ! * POSIX awk <7>: Precedence. ! * POSIX awk <8>: Next Statement. ! * POSIX awk <9>: OFMT. ! * POSIX awk <10>: Continue Statement. ! * POSIX awk <11>: String Functions. ! * POSIX awk <12>: Format Modifiers. ! * POSIX awk <13>: Conversion. ! * POSIX awk <14>: String Functions. * POSIX awk <15>: Regexp Operators. ! * POSIX awk <16>: Escape Sequences. ! * POSIX awk <17>: Definition Syntax. * POSIX awk: Regexp Operators. * POSIX mode: Options. * POSIXLY_CORRECT environment variable: Options. --- 17788,17819 ---- * PERL: Future Extensions. * pipeline, input: Getline/Pipe. * pipes for output: Redirection. ! * portability issues <1>: Delete. ! * portability issues <2>: Statements/Lines. ! * portability issues <3>: String Functions. ! * portability issues <4>: Close Files And Pipes. * portability issues <5>: Definition Syntax. ! * portability issues <6>: I/O Functions. ! * portability issues <7>: Portability Notes. ! * portability issues: Escape Sequences. * porting gawk: New Ports. ! * POSIX awk <1>: Assignment Ops. ! * POSIX awk <2>: Field Splitting Summary. ! * POSIX awk <3>: Format Modifiers. ! * POSIX awk <4>: String Functions. ! * POSIX awk <5>: OFMT. ! * POSIX awk <6>: Escape Sequences. ! * POSIX awk <7>: Definition Syntax. ! * POSIX awk <8>: Arithmetic Ops. ! * POSIX awk <9>: Precedence. ! * POSIX awk <10>: Conversion. ! * POSIX awk <11>: User-modified. ! * POSIX awk <12>: Next Statement. ! * POSIX awk <13>: Continue Statement. ! * POSIX awk <14>: Break Statement. * POSIX awk <15>: Regexp Operators. ! * POSIX awk <16>: String Functions. ! * POSIX awk <17>: Precedence. * POSIX awk: Regexp Operators. * POSIX mode: Options. * POSIXLY_CORRECT environment variable: Options. *************** *** 17789,17796 **** * pwcat program: Passwd Functions. * pwcat.c: Passwd Functions. * quotient: Arithmetic Ops. ! * quoting, shell <1>: Read Terminal. ! * quoting, shell: Long. * Rakitzis, Byron: History Sorting. * rand: Numeric Functions. * random numbers, seed of: Numeric Functions. --- 17836,17843 ---- * pwcat program: Passwd Functions. * pwcat.c: Passwd Functions. * quotient: Arithmetic Ops. ! * quoting, shell <1>: Long. ! * quoting, shell: Read Terminal. * Rakitzis, Byron: History Sorting. * rand: Numeric Functions. * random numbers, seed of: Numeric Functions. *************** *** 17814,17821 **** * regexp comparison vs. string comparison: Typing and Comparison. * regexp constant: Regexp Usage. * regexp constants, difference between slashes and quotes: Computed Regexps. ! * regexp match/non-match operators <1>: Typing and Comparison. ! * regexp match/non-match operators: Regexp Usage. * regexp matching operators: Regexp Usage. * regexp operators: Regexp Operators. * regexp operators, GNU specific: GNU Regexp Operators. --- 17861,17868 ---- * regexp comparison vs. string comparison: Typing and Comparison. * regexp constant: Regexp Usage. * regexp constants, difference between slashes and quotes: Computed Regexps. ! * regexp match/non-match operators <1>: Regexp Usage. ! * regexp match/non-match operators: Typing and Comparison. * regexp matching operators: Regexp Usage. * regexp operators: Regexp Operators. * regexp operators, GNU specific: GNU Regexp Operators. *************** *** 17835,17845 **** * return statement: Return Statement. * RFC-1036: Time Functions. * RFC-822: Time Functions. ! * RLENGTH <1>: Auto-set. ! * RLENGTH: String Functions. * Robbins, Miriam: Acknowledgements. ! * Rommel, Kai Uwe <1>: Acknowledgements. ! * Rommel, Kai Uwe: Bugs. * round: Round Function. * rounding: Round Function. * RS <1>: User-modified. --- 17882,17892 ---- * return statement: Return Statement. * RFC-1036: Time Functions. * RFC-822: Time Functions. ! * RLENGTH <1>: String Functions. ! * RLENGTH: Auto-set. * Robbins, Miriam: Acknowledgements. ! * Rommel, Kai Uwe <1>: Bugs. ! * Rommel, Kai Uwe: Acknowledgements. * round: Round Function. * rounding: Round Function. * RS <1>: User-modified. *************** *** 17847,17854 **** * RSTART <1>: String Functions. * RSTART: Auto-set. * RT <1>: Records. ! * RT <2>: Multiple Line. ! * RT: Auto-set. * rule, definition of: Getting Started. * running awk programs: Running gawk. * running long programs: Long. --- 17894,17901 ---- * RSTART <1>: String Functions. * RSTART: Auto-set. * RT <1>: Records. ! * RT <2>: Auto-set. ! * RT: Multiple Line. * rule, definition of: Getting Started. * running awk programs: Running gawk. * running long programs: Long. *************** *** 17886,17894 **** * Stallman, Richard <1>: Acknowledgements. * Stallman, Richard: Manual History. * standard error output: Special Files. ! * standard input <1>: Reading Files. ! * standard input <2>: Read Terminal. ! * standard input: Special Files. * standard output: Special Files. * statement, compound: Statements. * stream editor: Field Splitting Summary. --- 17933,17941 ---- * Stallman, Richard <1>: Acknowledgements. * Stallman, Richard: Manual History. * standard error output: Special Files. ! * standard input <1>: Special Files. ! * standard input <2>: Reading Files. ! * standard input: Read Terminal. * standard output: Special Files. * statement, compound: Statements. * stream editor: Field Splitting Summary. *************** *** 17957,18192 ****  Tag Table: ! Node: Top1225 ! Node: Preface20713 ! Node: History22063 ! Node: Manual History23421 ! Node: Acknowledgements27011 ! Node: What Is Awk30636 ! Node: This Manual32290 ! Node: Conventions34932 ! Node: Sample Data Files36224 ! Node: Getting Started39307 ! Node: Names41615 ! Node: Running gawk43185 ! Node: One-shot44346 ! Node: Read Terminal45733 ! Node: Long47345 ! Node: Executable Scripts48738 ! Node: Comments50993 ! Node: Very Simple52153 ! Node: Two Rules54200 ! Node: More Complex56379 ! Node: Statements/Lines59495 ! Node: Other Features63768 ! Node: When64494 ! Node: One-liners66429 ! Node: Regexp69316 ! Node: Regexp Usage70642 ! Node: Escape Sequences72792 ! Node: Regexp Operators78244 ! Node: GNU Regexp Operators89277 ! Node: Case-sensitivity92981 ! Node: Leftmost Longest96097 ! Node: Computed Regexps97632 ! Node: Reading Files100289 ! Node: Records102057 ! Node: Fields108552 ! Node: Non-Constant Fields111621 ! Node: Changing Fields113908 ! Node: Field Separators118315 ! Node: Basic Field Splitting119017 ! Node: Regexp Field Splitting122246 ! Node: Single Character Fields124813 ! Node: Command Line Field Separator125882 ! Node: Field Splitting Summary129123 ! Node: Constant Size131142 ! Node: Multiple Line135179 ! Node: Getline140586 ! Node: Getline Intro141660 ! Node: Plain Getline142623 ! Node: Getline/Variable144887 ! Node: Getline/File146029 ! Node: Getline/Variable/File147339 ! Node: Getline/Pipe149313 ! Node: Getline/Variable/Pipe151403 ! Node: Getline Summary152521 ! Node: Printing154115 ! Node: Print155183 ! Node: Print Examples157283 ! Node: Output Separators159893 ! Node: OFMT161791 ! Node: Printf163193 ! Node: Basic Printf164097 ! Node: Control Letters165631 ! Node: Format Modifiers168319 ! Node: Printf Examples172468 ! Node: Redirection175246 ! Node: Special Files179885 ! Node: Close Files And Pipes185122 ! Node: Expressions189182 ! Node: Constants191378 ! Node: Scalar Constants191857 ! Node: Regexp Constants192862 ! Node: Using Constant Regexps193324 ! Node: Variables196525 ! Node: Using Variables197179 ! Node: Assignment Options198614 ! Node: Conversion200559 ! Node: Arithmetic Ops203741 ! Node: Concatenation205875 ! Node: Assignment Ops207230 ! Node: Increment Ops212826 ! Node: Truth Values215354 ! Node: Typing and Comparison216402 ! Node: Boolean Ops222302 ! Node: Conditional Exp225995 ! Node: Function Calls227672 ! Node: Precedence230552 ! Node: Patterns and Actions233940 ! Node: Pattern Overview234366 ! Node: Kinds of Patterns235141 ! Node: Regexp Patterns236278 ! Node: Expression Patterns236832 ! Node: Ranges240483 ! Node: BEGIN/END243202 ! Node: Using BEGIN/END243671 ! Node: I/O And BEGIN/END246634 ! Node: Empty248650 ! Node: Action Overview248949 ! Node: Statements251521 ! Node: If Statement253227 ! Node: While Statement254730 ! Node: Do Statement256760 ! Node: For Statement257862 ! Node: Break Statement261119 ! Node: Continue Statement263390 ! Node: Next Statement265386 ! Node: Nextfile Statement267883 ! Node: Exit Statement269797 ! Node: Built-in Variables271807 ! Node: User-modified272903 ! Node: Auto-set277756 ! Node: ARGC and ARGV284286 ! Node: Arrays286988 ! Node: Array Intro288451 ! Node: Reference to Elements292327 ! Node: Assigning Elements294277 ! Node: Array Example294779 ! Node: Scanning an Array296498 ! Node: Delete298828 ! Node: Numeric Array Subscripts300887 ! Node: Uninitialized Subscripts302793 ! Node: Multi-dimensional304433 ! Node: Multi-scanning307528 ! Node: Built-in309171 ! Node: Calling Built-in310160 ! Node: Numeric Functions312131 ! Node: String Functions315950 ! Node: I/O Functions334882 ! Node: Time Functions340467 ! Node: User-defined349320 ! Node: Definition Syntax350033 ! Node: Function Example354282 ! Node: Function Caveats356611 ! Node: Return Statement360481 ! Node: Invoking Gawk363136 ! Node: Options364371 ! Node: Other Arguments373201 ! Node: AWKPATH Variable375849 ! Node: Obsolete378598 ! Node: Undocumented379264 ! Node: Known Bugs379472 ! Node: Library Functions380604 ! Node: Portability Notes383022 ! Node: Nextfile Function384306 ! Node: Assert Function389182 ! Node: Round Function392521 ! Node: Ordinal Functions394165 ! Node: Join Function397617 ! Node: Mktime Function399669 ! Node: Gettimeofday Function411242 ! Node: Filetrans Function415254 ! Node: Getopt Function418931 ! Node: Passwd Functions430287 ! Node: Group Functions438620 ! Node: Library Names446517 ! Node: Sample Programs450442 ! Node: Clones450933 ! Node: Cut Program452027 ! Node: Egrep Program462056 ! Node: Id Program469719 ! Node: Split Program472990 ! Node: Tee Program476358 ! Node: Uniq Program479154 ! Node: Wc Program486699 ! Node: Miscellaneous Programs491117 ! Node: Dupword Program492027 ! Node: Alarm Program493698 ! Node: Translate Program498242 ! Node: Labels Program503054 ! Node: Word Sorting506598 ! Node: History Sorting510943 ! Node: Extract Program512912 ! Node: Simple Sed519869 ! Node: Igawk Program523213 ! Node: Language History536356 ! Node: V7/SVR3.1537589 ! Node: SVR4540244 ! Node: POSIX541766 ! Node: BTL543386 ! Node: POSIX/GNU544149 ! Node: Gawk Summary548581 ! Node: Command Line Summary549403 ! Node: Language Summary552379 ! Node: Variables/Fields554760 ! Node: Fields Summary555494 ! Node: Built-in Summary557280 ! Node: Arrays Summary560925 ! Node: Data Type Summary562218 ! Node: Rules Summary564044 ! Node: Pattern Summary565572 ! Node: Regexp Summary567757 ! Node: Actions Summary571140 ! Node: Operator Summary572972 ! Node: Control Flow Summary574199 ! Node: I/O Summary574756 ! Node: Printf Summary577745 ! Node: Special File Summary581083 ! Node: Built-in Functions Summary582761 ! Node: Time Functions Summary586761 ! Node: String Constants Summary587652 ! Node: Functions Summary588972 ! Node: Historical Features590033 ! Node: Installation591531 ! Node: Gawk Distribution592746 ! Node: Getting593249 ! Node: Extracting596195 ! Node: Distribution contents597582 ! Node: Unix Installation602496 ! Node: Quick Installation603005 ! Node: Configuration Philosophy604523 ! Node: VMS Installation606925 ! Node: VMS Compilation607464 ! Node: VMS Installation Details609068 ! Node: VMS Running610710 ! Node: VMS POSIX612300 ! Node: PC Installation613580 ! Node: Atari Installation616983 ! Node: Atari Compiling618167 ! Node: Atari Using620076 ! Node: Amiga Installation622923 ! Node: Bugs624041 ! Node: Other Versions627010 ! Node: Notes628584 ! Node: Compatibility Mode629191 ! Node: Additions630034 ! Node: Adding Code630732 ! Node: New Ports636071 ! Node: Future Extensions640239 ! Node: Improvements642487 ! Node: Glossary644355 ! Node: Copying661420 ! Node: Index680612  End Tag Table --- 18004,18239 ----  Tag Table: ! Node: Top1230 ! Node: Preface20719 ! Node: History22069 ! Node: Manual History23427 ! Node: Acknowledgements26869 ! Node: What Is Awk30496 ! Node: This Manual32150 ! Node: Conventions34849 ! Node: Sample Data Files36141 ! Node: Getting Started39224 ! Node: Names41532 ! Node: Running gawk43102 ! Node: One-shot44263 ! Node: Read Terminal45650 ! Node: Long47262 ! Node: Executable Scripts48655 ! Node: Comments50910 ! Node: Very Simple52070 ! Node: Two Rules54117 ! Node: More Complex56296 ! Node: Statements/Lines59412 ! Node: Other Features63685 ! Node: When64411 ! Node: One-liners66346 ! Node: Regexp69233 ! Node: Regexp Usage70559 ! Node: Escape Sequences72709 ! Node: Regexp Operators78161 ! Node: GNU Regexp Operators89194 ! Node: Case-sensitivity92898 ! Node: Leftmost Longest96014 ! Node: Computed Regexps97549 ! Node: Reading Files100206 ! Node: Records101974 ! Node: Fields108469 ! Node: Non-Constant Fields111538 ! Node: Changing Fields113825 ! Node: Field Separators118232 ! Node: Basic Field Splitting118934 ! Node: Regexp Field Splitting122163 ! Node: Single Character Fields124730 ! Node: Command Line Field Separator125799 ! Node: Field Splitting Summary129040 ! Node: Constant Size131059 ! Node: Multiple Line135096 ! Node: Getline140504 ! Node: Getline Intro141578 ! Node: Plain Getline142541 ! Node: Getline/Variable144805 ! Node: Getline/File145947 ! Node: Getline/Variable/File147257 ! Node: Getline/Pipe149231 ! Node: Getline/Variable/Pipe151321 ! Node: Getline Summary152439 ! Node: Printing154033 ! Node: Print155101 ! Node: Print Examples157201 ! Node: Output Separators159811 ! Node: OFMT161709 ! Node: Printf163111 ! Node: Basic Printf164015 ! Node: Control Letters165549 ! Node: Format Modifiers168237 ! Node: Printf Examples172386 ! Node: Redirection175164 ! Node: Special Files179803 ! Node: Close Files And Pipes185040 ! Node: Expressions189100 ! Node: Constants191296 ! Node: Scalar Constants191775 ! Node: Regexp Constants192780 ! Node: Using Constant Regexps193242 ! Node: Variables196443 ! Node: Using Variables197097 ! Node: Assignment Options198532 ! Node: Conversion200477 ! Node: Arithmetic Ops203659 ! Node: Concatenation205793 ! Node: Assignment Ops207215 ! Node: Increment Ops212811 ! Node: Truth Values215339 ! Node: Typing and Comparison216387 ! Node: Boolean Ops222394 ! Node: Conditional Exp226087 ! Node: Function Calls227764 ! Node: Precedence230644 ! Node: Patterns and Actions234032 ! Node: Pattern Overview234458 ! Node: Kinds of Patterns235233 ! Node: Regexp Patterns236370 ! Node: Expression Patterns236924 ! Node: Ranges240575 ! Node: BEGIN/END243299 ! Node: Using BEGIN/END243768 ! Node: I/O And BEGIN/END246731 ! Node: Empty248747 ! Node: Action Overview249046 ! Node: Statements251618 ! Node: If Statement253324 ! Node: While Statement254827 ! Node: Do Statement256857 ! Node: For Statement257959 ! Node: Break Statement261216 ! Node: Continue Statement263487 ! Node: Next Statement265483 ! Node: Nextfile Statement267980 ! Node: Exit Statement269894 ! Node: Built-in Variables271904 ! Node: User-modified273000 ! Node: Auto-set277922 ! Node: ARGC and ARGV284452 ! Node: Arrays287798 ! Node: Array Intro289261 ! Node: Reference to Elements293301 ! Node: Assigning Elements295251 ! Node: Array Example295753 ! Node: Scanning an Array297472 ! Node: Delete299802 ! Node: Numeric Array Subscripts301861 ! Node: Uninitialized Subscripts303767 ! Node: Multi-dimensional305411 ! Node: Multi-scanning308506 ! Node: Built-in310149 ! Node: Calling Built-in311138 ! Node: Numeric Functions313109 ! Node: String Functions316928 ! Node: I/O Functions335860 ! Node: Time Functions341445 ! Node: User-defined350298 ! Node: Definition Syntax351011 ! Node: Function Example355260 ! Node: Function Caveats357589 ! Node: Return Statement361459 ! Node: Invoking Gawk364114 ! Node: Options365349 ! Node: Other Arguments374179 ! Node: AWKPATH Variable376827 ! Node: Obsolete379576 ! Node: Undocumented380242 ! Node: Known Bugs380491 ! Node: Library Functions381623 ! Node: Portability Notes384041 ! Node: Nextfile Function385325 ! Node: Assert Function390201 ! Node: Round Function393540 ! Node: Ordinal Functions395184 ! Node: Join Function398636 ! Node: Mktime Function400688 ! Node: Gettimeofday Function412261 ! Node: Filetrans Function416273 ! Node: Getopt Function419950 ! Node: Passwd Functions431306 ! Node: Group Functions439639 ! Node: Library Names447536 ! Node: Sample Programs451461 ! Node: Clones451952 ! Node: Cut Program453046 ! Node: Egrep Program463075 ! Node: Id Program470738 ! Node: Split Program474009 ! Node: Tee Program477377 ! Node: Uniq Program480173 ! Node: Wc Program487718 ! Node: Miscellaneous Programs492136 ! Node: Dupword Program493046 ! Node: Alarm Program494717 ! Node: Translate Program499261 ! Node: Labels Program504073 ! Node: Word Sorting507617 ! Node: History Sorting511962 ! Node: Extract Program513931 ! Node: Simple Sed520889 ! Node: Igawk Program524233 ! Node: Language History537554 ! Node: V7/SVR3.1538787 ! Node: SVR4541442 ! Node: POSIX542964 ! Node: BTL544584 ! Node: POSIX/GNU545347 ! Node: Gawk Summary549779 ! Node: Command Line Summary550601 ! Node: Language Summary553577 ! Node: Variables/Fields555958 ! Node: Fields Summary556692 ! Node: Built-in Summary558478 ! Node: Arrays Summary562193 ! Node: Data Type Summary563486 ! Node: Rules Summary565312 ! Node: Pattern Summary566840 ! Node: Regexp Summary569025 ! Node: Actions Summary572408 ! Node: Operator Summary574240 ! Node: Control Flow Summary575467 ! Node: I/O Summary576024 ! Node: Printf Summary579013 ! Node: Special File Summary582351 ! Node: Built-in Functions Summary584029 ! Node: Time Functions Summary588029 ! Node: String Constants Summary588920 ! Node: Functions Summary590240 ! Node: Historical Features591301 ! Node: Installation592799 ! Node: Gawk Distribution594014 ! Node: Getting594517 ! Node: Extracting597463 ! Node: Distribution contents598850 ! Node: Unix Installation603626 ! Node: Quick Installation604135 ! Node: Configuration Philosophy605653 ! Node: VMS Installation608055 ! Node: VMS Compilation608594 ! Node: VMS Installation Details610198 ! Node: VMS Running611840 ! Node: VMS POSIX613430 ! Node: PC Installation614710 ! Node: Atari Installation618113 ! Node: Atari Compiling619297 ! Node: Atari Using621206 ! Node: Amiga Installation624053 ! Node: Bugs625164 ! Node: Other Versions628240 ! Node: Notes629814 ! Node: Compatibility Mode630421 ! Node: Additions631264 ! Node: Adding Code631962 ! Node: New Ports637302 ! Node: Future Extensions641470 ! Node: Improvements643718 ! Node: Glossary645586 ! Node: Copying662651 ! Node: Index681843  End Tag Table diff -crN gawk-3.0.2/doc/gawk.texi gawk-3.0.3/doc/gawk.texi *** gawk-3.0.2/doc/gawk.texi Sun Dec 22 22:41:10 1996 --- gawk-3.0.3/doc/gawk.texi Thu Mar 6 21:34:52 1997 *************** *** 19,30 **** @c The following information should be updated here only! @c This sets the edition of the document, the version of gawk it @c applies to, and when the document was updated. ! @set TITLE The GNU Awk User's Guide ! @set SUBTITLE Effective AWK Programming ! @set PATCHLEVEL 2 @set EDITION 1.0.@value{PATCHLEVEL} @set VERSION 3.0 ! @set UPDATE-MONTH December 1996 @iftex @set DOCUMENT book @end iftex --- 19,30 ---- @c The following information should be updated here only! @c This sets the edition of the document, the version of gawk it @c applies to, and when the document was updated. ! @set TITLE Effective AWK Programming ! @set SUBTITLE A User's Guide for GNU Awk ! @set PATCHLEVEL 3 @set EDITION 1.0.@value{PATCHLEVEL} @set VERSION 3.0 ! @set UPDATE-MONTH February 1997 @iftex @set DOCUMENT book @end iftex *************** *** 74,80 **** This is Edition @value{EDITION} of @cite{@value{TITLE}}, for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK. ! Copyright (C) 1989, 1991, 92, 93, 96 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice --- 74,80 ---- This is Edition @value{EDITION} of @cite{@value{TITLE}}, for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK. ! Copyright (C) 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice *************** *** 106,114 **** @subtitle Edition @value{EDITION} @subtitle @value{UPDATE-MONTH} @author Arnold D. Robbins ! @sp @author Based on @cite{The GAWK Manual}, @author by Robbins, Close, Rubin, and Stallman @c Include the Distribution inside the titlepage environment so @c that headings are turned off. Headings on and off do not work. --- 106,116 ---- @subtitle Edition @value{EDITION} @subtitle @value{UPDATE-MONTH} @author Arnold D. Robbins ! @ignore ! @sp 1 @author Based on @cite{The GAWK Manual}, @author by Robbins, Close, Rubin, and Stallman + @end ignore @c Include the Distribution inside the titlepage environment so @c that headings are turned off. Headings on and off do not work. *************** *** 136,157 **** Registered Trademark of Paramount Pictures Corporation. @* @c sorry, i couldn't resist @sp 3 ! Copyright @copyright{} 1989, 1991, 92, 93, 96 Free Software Foundation, Inc. @sp 2 This is Edition @value{EDITION} of @cite{@value{TITLE}}, @* for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU implementation of AWK. @sp 2 ! Published by the Free Software Foundation @* ! 59 Temple Place --- Suite 330 @* ! Boston, MA 02111-1307 USA @* ! Phone: +1-617-542-5942 @* ! Fax (including Japan): +1-617-542-2652 @* ! Printed copies are available for $25 each. @* ! @c this ISBN can change! Check with the FSF office... ! @c This one is correct for gawk 3.0 and edition 1.0 ! ISBN 1-882114-26-4 @* Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice --- 138,168 ---- Registered Trademark of Paramount Pictures Corporation. @* @c sorry, i couldn't resist @sp 3 ! Copyright @copyright{} 1989, 1991, 92, 93, 96, 97 Free Software Foundation, Inc. @sp 2 This is Edition @value{EDITION} of @cite{@value{TITLE}}, @* for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU implementation of AWK. @sp 2 ! @center Published jointly by: ! ! @multitable {Specialized Systems Consultants, Inc. (SSC)} {Boston, MA 02111-1307 USA} ! @item Specialized Systems Consultants, Inc. (SSC) @tab Free Software Foundation ! @item PO Box 55549 @tab 59 Temple Place --- Suite 330 ! @item Seattle, WA 98155 USA @tab Boston, MA 02111-1307 USA ! @item Phone: +1-206-782-7733 @tab Phone: +1-617-542-5942 ! @item Fax: +1-206-782-7191 @tab Fax: +1-617-542-2652 ! @item E-mail: @code{sales@@ssc.com} @tab E-mail: @code{gnu@@prep.ai.mit.edu} ! @item URL: @code{http://www.ssc.com/} @tab URL: @code{http://www.fsf.org/} ! @end multitable ! ! @sp 1 ! @c this ISBN can change! Check with SSC ! @c This one is correct for gawk 3.0 and edition 1.0 from the FSF ! @c ISBN 1-882114-26-4 @* ! @c This one is correct for gawk 3.0.3 and edition 1.0.3 from SSC ! ISBN 1-57831-000-8 @* Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice *************** *** 167,173 **** except that this permission notice may be stated in a translation approved by the Foundation. @sp 2 ! Cover art by Etienne Suvasa. @end titlepage @c Thanks to Bob Chassell for directions on doing dedications. --- 178,185 ---- except that this permission notice may be stated in a translation approved by the Foundation. @sp 2 ! @c Cover art by Etienne Suvasa. ! Cover art by Amy Wells Wood. @end titlepage @c Thanks to Bob Chassell for directions on doing dedications. *************** *** 177,187 **** @w{ } @sp 9 @center @i{To Miriam, for making me complete.} ! @sp @center @i{To Chana, for the joy you bring us.} ! @sp @center @i{To Rivka, for the exponential increase.} ! @sp @center @i{To Nachum, for the added dimension.} @page @w{ } --- 189,199 ---- @w{ } @sp 9 @center @i{To Miriam, for making me complete.} ! @sp 1 @center @i{To Chana, for the joy you bring us.} ! @sp 1 @center @i{To Rivka, for the exponential increase.} ! @sp 1 @center @i{To Nachum, for the added dimension.} @page @w{ } *************** *** 191,197 **** @iftex @headings off ! @evenheading @thispage@ @ @ @strong{@thistitle} @| @| @oddheading @| @| @strong{@thischapter}@ @ @ @thispage @ifset DRAFT @evenfooting @today{} @| @emph{DRAFT!} @| Please Do Not Redistribute --- 203,209 ---- @iftex @headings off ! @evenheading @thispage@ @ @ @strong{@value{TITLE}} @| @| @oddheading @| @| @strong{@thischapter}@ @ @ @thispage @ifset DRAFT @evenfooting @today{} @| @emph{DRAFT!} @| Please Do Not Redistribute *************** *** 610,637 **** (@pxref{Copying, ,GNU GENERAL PUBLIC LICENSE}). The GPL applies to the C language source code for @code{gawk}. ! As of this writing (1995), the only major component of the ! GNU environment still uncompleted is the operating system kernel, and ! work proceeds apace on that. A shell, an editor (Emacs), highly portable ! optimizing C, C++, and Objective-C compilers, a symbolic debugger, and dozens ! of large and small utilities (such as @code{gawk}), ! have all been completed and are freely available. @cindex Linux @cindex NetBSD @cindex FreeBSD ! Until the GNU operating system is released, the FSF recommends the use ! of Linux, a freely distributable, Unix-like operating system for 80386 ! and other systems. There are many books on Linux. One freely available one ! is @cite{Linux Installation and Getting Started}, by Matt Welsh. Many Linux distributions are available, often in computer stores or ! bundled on CD-ROM with books about Linux. Also, the FSF provides a Linux ! distribution (``Debian''); contact them for more information. ! @xref{Getting, ,Getting the @code{gawk} Distribution}, for the FSF's contact ! information. ! (There are two other freely available, Unix-like operating systems for ! 80386 and other systems, NetBSD and FreeBSD. Both are based on the ! 4.4-Lite Berkeley Software Distribution, and both use recent versions of @code{gawk} for their versions of @code{awk}.) @iftex --- 622,647 ---- (@pxref{Copying, ,GNU GENERAL PUBLIC LICENSE}). The GPL applies to the C language source code for @code{gawk}. ! A shell, an editor (Emacs), highly portable optimizing C, C++, and ! Objective-C compilers, a symbolic debugger, and dozens of large and ! small utilities (such as @code{gawk}), have all been completed and are ! freely available. As of this writing (early 1997), the GNU operating ! system kernel (the HURD), has been released, but is still in an early ! stage of development. @cindex Linux @cindex NetBSD @cindex FreeBSD ! Until the GNU operating system is more fully developed, you should ! consider using Linux, a freely distributable, Unix-like operating ! system for 80386, DEC Alpha, Sun SPARC and other systems. There are ! many books on Linux. One freely available one is @cite{Linux ! Installation and Getting Started}, by Matt Welsh. Many Linux distributions are available, often in computer stores or ! bundled on CD-ROM with books about Linux. ! (There are three other freely available, Unix-like operating systems for ! 80386 and other systems, NetBSD, FreeBSD,and OpenBSD. All are based on the ! 4.4-Lite Berkeley Software Distribution, and they use recent versions of @code{gawk} for their versions of @code{awk}.) @iftex *************** *** 646,652 **** was the @value{DOCUMENT}'s nice printing and binding, and the publisher's associated costs to produce it. We have made an effort to keep these costs reasonable; most people would prefer a bound book to ! over 300 pages of photo-copied text that would then have to be held in a loose-leaf binder (not to mention the time and labor involved in doing the copying). The same is true of producing this @value{DOCUMENT} from the machine readable source; the retail price is --- 656,662 ---- was the @value{DOCUMENT}'s nice printing and binding, and the publisher's associated costs to produce it. We have made an effort to keep these costs reasonable; most people would prefer a bound book to ! over 330 pages of photo-copied text that would then have to be held in a loose-leaf binder (not to mention the time and labor involved in doing the copying). The same is true of producing this @value{DOCUMENT} from the machine readable source; the retail price is *************** *** 770,776 **** @noindent Arnold Robbins @* Atlanta, Georgia @* ! January, 1996 @ignore Stuff still not covered anywhere: --- 780,786 ---- @noindent Arnold Robbins @* Atlanta, Georgia @* ! February, 1997 @ignore Stuff still not covered anywhere: *************** *** 899,904 **** --- 909,919 ---- @c fakenode --- for prepinfo @unnumberedsubsec Dark Corners + @display + @i{Who opened that window shade?!?} + Count Dracula + @end display + @sp 1 @cindex d.c., see ``dark corner'' @cindex dark corner *************** *** 931,940 **** --- 946,957 ---- by the glyph ``@error{}''. For example: @example + @group $ echo hi on stdout @print{} hi on stdout $ echo hello on stderr 1>&2 @error{} hello on stderr + @end group @end example @iftex *************** *** 3968,3974 **** at the end of the record, and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when there is a choice ! (@pxref{Leftmost Longest, ,How Much Text Matches?}) So the next record doesn't start until the first non-blank line that follows---no matter how many blank lines appear in a row, they are considered one record-separator. --- 3985,3991 ---- at the end of the record, and one or more blank lines after the record. In addition, a regular expression always matches the longest possible sequence when there is a choice ! (@pxref{Leftmost Longest, ,How Much Text Matches?}). So the next record doesn't start until the first non-blank line that follows---no matter how many blank lines appear in a row, they are considered one record-separator. *************** *** 5313,5319 **** @cindex differences between @code{gawk} and @code{awk} @cindex limitations @cindex implementation limits ! Many @code{awk} implementations limit the number of pipelines an @code{awk} program may have open to just one! In @code{gawk}, there is no such limit. You can open as many pipelines as the underlying operating system will permit. --- 5330,5344 ---- @cindex differences between @code{gawk} and @code{awk} @cindex limitations @cindex implementation limits ! @iftex ! As mentioned earlier ! (@pxref{Getline Summary, , Summary of @code{getline} Variants}), ! many ! @end iftex ! @ifinfo ! Many ! @end ifinfo ! @code{awk} implementations limit the number of pipelines an @code{awk} program may have open to just one! In @code{gawk}, there is no such limit. You can open as many pipelines as the underlying operating system will permit. *************** *** 6108,6113 **** --- 6133,6144 ---- @node Concatenation, Assignment Ops, Arithmetic Ops, Expressions @section String Concatenation + @cindex Kernighan, Brian + @display + @i{It seemed like a good idea at the time.} + Brian Kernighan + @end display + @sp 1 @cindex string operators @cindex operators, string *************** *** 6145,6153 **** --- 6176,6186 ---- as you might expect: @example + @group file = "file" name = "name" print "something meaningful" > file name + @end group @end example @noindent *************** *** 6220,6229 **** --- 6253,6264 ---- @code{foo} has a numeric value at first, and a string value later on: @example + @group foo = 1 print foo foo = "bar" print foo + @end group @end example @noindent *************** *** 6466,6473 **** @cindex regexp match/non-match operators @cindex variable typing @cindex types of variables - @c 2e: consider splitting this section into subsections Unlike other programming languages, @code{awk} variables do not have a fixed type. Instead, they can be either a number or a string, depending --- 6501,6512 ---- @cindex regexp match/non-match operators @cindex variable typing @cindex types of variables @c 2e: consider splitting this section into subsections + @display + @i{The Guide is definitive. Reality is frequently inaccurate.} + The Hitchhiker's Guide to the Galaxy + @end display + @sp 1 Unlike other programming languages, @code{awk} variables do not have a fixed type. Instead, they can be either a number or a string, depending *************** *** 7051,7058 **** Here is a table of @code{awk}'s operators, in order from highest precedence to lowest: - @c NEEDED - @page @c use @code in the items, looks better in TeX w/o all the quotes @table @code @item (@dots{}) --- 7090,7095 ---- *************** *** 7346,7352 **** (not discussed yet, @pxref{Next Statement, , The @code{next} Statement}), which causes @code{awk} to skip any further processing of the current record and start over again with the next input record. Such a program ! would like this: @example /^%$/,/^%$/ @{ next @} --- 7383,7389 ---- (not discussed yet, @pxref{Next Statement, , The @code{next} Statement}), which causes @code{awk} to skip any further processing of the current record and start over again with the next input record. Such a program ! would look like this: @example /^%$/,/^%$/ @{ next @} *************** *** 8331,8336 **** --- 8368,8374 ---- @code{gsub}, @code{index}, @code{match}, @code{split} and @code{sub} functions, record termination with @code{RS}, and field splitting with @code{FS} all ignore case when doing their particular regexp operations. + The value of @code{IGNORECASE} does @emph{not} affect array subscripting. @xref{Case-sensitivity, ,Case-sensitivity in Matching}. If @code{gawk} is in compatibility mode *************** *** 8643,8648 **** --- 8681,8711 ---- @end group @end example + To actually get the options into the @code{awk} program, you have to + end the @code{awk} options with @samp{--}, and then supply your options, + like so: + + @example + awk -f myprog -- -v -d file1 file2 @dots{} + @end example + + @cindex differences between @code{gawk} and @code{awk} + This is not necessary in @code{gawk}: Unless @samp{--posix} has been + specified, @code{gawk} silently puts any unrecognized options into + @code{ARGV} for the @code{awk} program to deal with. + + As soon as it + sees an unknown option, @code{gawk} stops looking for other options it might + otherwise recognize. The above example with @code{gawk} would be: + + @example + gawk -f myprog -d -v file1 file2 @dots{} + @end example + + @noindent + Since @samp{-d} is not a valid @code{gawk} option, the following @samp{-v} + is passed on to the @code{awk} program. + @node Arrays, Built-in, Built-in Variables, Top @chapter Arrays in @code{awk} *************** *** 8795,8800 **** --- 8858,8870 ---- in more detail in @ref{Numeric Array Subscripts, ,Using Numbers to Subscript Arrays}.) + @cindex Array subscripts and @code{IGNORECASE} + @cindex @code{IGNORECASE} and array subscripts + @vindex IGNORECASE + The value of @code{IGNORECASE} has no effect upon array subscripting. + You must use the exact same string value to retrieve an array element + as you used to store it. + When @code{awk} creates an array for you, e.g., with the @code{split} built-in function, that array's indices are consecutive integers starting at one. *************** *** 9202,9208 **** @} @end example ! Here, the @samp{++} forces @code{l} to be numeric, thus making the ``old value'' numeric zero, which is then converted to @code{"0"} as the array subscript. --- 9272,9278 ---- @} @end example ! Here, the @samp{++} forces @code{lines} to be numeric, thus making the ``old value'' numeric zero, which is then converted to @code{"0"} as the array subscript. *************** *** 10095,10102 **** @c I can say that, 'cause I was involved in making this change @end enumerate ! The POSIX standard is under revision.@footnote{As of December 1995, ! with final approval and publication hopefully sometime in 1996.} Because of the above problems, proposed text for the revised standard reverts to rules that correspond more closely to the original existing practice. The proposed rules have special cases that make it possible --- 10165,10172 ---- @c I can say that, 'cause I was involved in making this change @end enumerate ! The POSIX standard is under revision.@footnote{As of @value{UPDATE-MONTH}, ! with final approval and publication hopefully sometime in 1997.} Because of the above problems, proposed text for the revised standard reverts to rules that correspond more closely to the original existing practice. The proposed rules have special cases that make it possible *************** *** 11589,11594 **** --- 11659,11669 ---- @node Undocumented, Known Bugs, Obsolete, Invoking Gawk @section Undocumented Options and Features @cindex undocumented features + @display + @i{Use the Source, Luke!} + Obi-Wan + @end display + @sp 1 This section intentionally left blank. *************** *** 16472,16478 **** directory in the path, and an attempt is made to open the generated file name. The only way in @code{awk} to test if a file can be read is to go ahead and try to read it with @code{getline}; that is what @code{pathto} ! does. If the file can be read, it is closed, and the file name is returned. @ignore An alternative way to test for the file's existence would be to call --- 16547,16556 ---- directory in the path, and an attempt is made to open the generated file name. The only way in @code{awk} to test if a file can be read is to go ahead and try to read it with @code{getline}; that is what @code{pathto} ! does.@footnote{On some very old versions of @code{awk}, the test ! @samp{getline junk < t} can loop forever if the file exists but is empty. ! Caveat Emptor.} ! If the file can be read, it is closed, and the file name is returned. @ignore An alternative way to test for the file's existence would be to call *************** *** 17364,17369 **** --- 17442,17448 ---- @code{match}, @code{split} and @code{sub} built-in functions all ignore case when doing regular expression operations, and all string comparisons are done ignoring case. + The value of @code{IGNORECASE} does @emph{not} affect array subscripting. @item NF The number of fields in the current input record. *************** *** 18538,18544 **** The @var{V} represents the major version of @code{gawk}, the @var{R} represents the current release of version @var{V}, and the @var{n} represents a @dfn{patch level}, meaning that minor bugs have ! been fixed in the release. The current patch level is 0, but when retrieving distributions, you should get the version with the highest version, release, and patch level. (Note that release levels greater than or equal to 90 denote ``beta,'' or non-production software; you may not wish --- 18617,18624 ---- The @var{V} represents the major version of @code{gawk}, the @var{R} represents the current release of version @var{V}, and the @var{n} represents a @dfn{patch level}, meaning that minor bugs have ! been fixed in the release. The current patch level is @value{PATCHLEVEL}, ! but when retrieving distributions, you should get the version with the highest version, release, and patch level. (Note that release levels greater than or equal to 90 denote ``beta,'' or non-production software; you may not wish *************** *** 18671,18680 **** are extracted into ready to use files. They are installed as part of the installation process. - @item amiga/* - Files needed for building @code{gawk} on an Amiga. - @xref{Amiga Installation, ,Installing @code{gawk} on an Amiga}, for details. - @item atari/* Files needed for building @code{gawk} on an Atari ST. @xref{Atari Installation, ,Installing @code{gawk} on the Atari ST}, for details. --- 18751,18756 ---- *************** *** 19181,19193 **** @cindex installation, amiga You can install @code{gawk} on an Amiga system using a Unix emulation environment available via anonymous @code{ftp} from ! @code{wuarchive.wustl.edu} in the directory @file{pub/aminet/dev/gcc}. This includes a shell based on @code{pdksh}. The primary component of this environment is a Unix emulation library, @file{ixemul.lib}. @c could really use more background here, who wrote this, etc. A more complete distribution for the Amiga is available on ! the FreshFish CD-ROM from: @quotation CRONUS @* --- 19257,19269 ---- @cindex installation, amiga You can install @code{gawk} on an Amiga system using a Unix emulation environment available via anonymous @code{ftp} from ! @code{ftp.ninemoons.com} in the directory @file{pub/ade/current}. This includes a shell based on @code{pdksh}. The primary component of this environment is a Unix emulation library, @file{ixemul.lib}. @c could really use more background here, who wrote this, etc. A more complete distribution for the Amiga is available on ! the Geek Gadgets CD-ROM from: @quotation CRONUS @* *************** *** 19205,19211 **** running @code{configure}: @example ! configure -v m68k-cbm-amigados @end example Then run @code{make}, and you should be all set! --- 19281,19287 ---- running @code{configure}: @example ! configure -v m68k-amigaos @end example Then run @code{make}, and you should be all set! *************** *** 19214,19219 **** --- 19290,19301 ---- @node Bugs, Other Versions, Amiga Installation, Installation @appendixsec Reporting Problems and Bugs + @display + @i{There is nothing more dangerous than a bored archeologist.} + The Hitchhiker's Guide to the Galaxy + @c the radio show, not the book. :-) + @end display + @sp 1 If you have problems with @code{gawk} or think that you have found a bug, please report it to the developers; we cannot promise to do anything *************** *** 19267,19272 **** --- 19349,19356 ---- distribution. Information in the @file{README} file should be considered authoritative if it conflicts with this @value{DOCUMENT}. + @c NEEDED for looks + @page The people maintaining the non-Unix ports of @code{gawk} are: @cindex Deifik, Scott *************** *** 19299,19307 **** @node Other Versions, , Bugs, Installation @appendixsec Other Freely Available @code{awk} Implementations - @cindex Brennan, Michael - @display @ignore From: emory!amc.com!brennan (Michael Brennan) Subject: C++ comments in awk programs --- 19383,19389 ---- *************** *** 19309,19318 **** --- 19391,19402 ---- Date: Wed, 4 Sep 1996 08:11:48 -0700 (PDT) @end ignore + @display @i{It's kind of fun to put comments like this in your awk code.} @code{// Do C++ comments work? answer: yes! of course} Michael Brennan @end display + @sp 1 There are two other freely available @code{awk} implementations. This section briefly describes where to get them. *************** *** 19647,19653 **** @node Future Extensions, Improvements, Additions, Notes @appendixsec Probable Future Extensions - @ignore From emory!scalpel.netlabs.com!lwall Tue Oct 31 12:43:17 1995 Return-Path: --- 19731,19736 ---- *************** *** 19682,19688 **** Larry @end ignore - @cindex PERL @cindex Wall, Larry @display --- 19765,19770 ---- *************** *** 19692,19697 **** --- 19774,19780 ---- @i{Hey!} Larry Wall @end display + @sp 1 This section briefly lists extensions and possible improvements that indicate the directions we are diff -crN gawk-3.0.2/eval.c gawk-3.0.3/eval.c *** gawk-3.0.2/eval.c Sun Oct 20 21:11:12 1996 --- gawk-3.0.3/eval.c Tue May 6 16:39:55 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 25,30 **** --- 25,32 ---- #include "awk.h" + #include + extern double pow P((double x, double y)); extern double modf P((double x, double *yp)); extern double fmod P((double x, double y)); *************** *** 33,39 **** static NODE *op_assign P((NODE *tree)); static NODE *func_call P((NODE *name, NODE *arg_list)); static NODE *match_op P((NODE *tree)); ! static char *nodetype2str P((NODETYPE type)); #if __GNUC__ < 2 NODE *_t; /* used as a temporary in macros */ --- 35,46 ---- static NODE *op_assign P((NODE *tree)); static NODE *func_call P((NODE *name, NODE *arg_list)); static NODE *match_op P((NODE *tree)); ! static void push_args P((int count, NODE *arglist, NODE **oldstack, char *func_name)); ! static void pop_fcall_stack P((void)); ! static void pop_fcall P((void)); ! static int in_function P((void)); ! char *nodetype2str P((NODETYPE type)); ! char *flags2str P((int flagval)); #if __GNUC__ < 2 NODE *_t; /* used as a temporary in macros */ *************** *** 235,241 **** NULL }; ! static char * nodetype2str(type) NODETYPE type; { --- 242,248 ---- NULL }; ! char * nodetype2str(type) NODETYPE type; { *************** *** 248,253 **** --- 255,345 ---- return buf; } + /* flags2str --- make a flags value readable */ + + char * + flags2str(flagval) + int flagval; + { + static char buffer[BUFSIZ]; + char *sp; + + sp = buffer; + + if (flagval & MALLOC) { + strcpy(sp, "MALLOC"); + sp += strlen(sp); + } + if (flagval & TEMP) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "TEMP"); + sp += strlen(sp); + } + if (flagval & PERM) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "PERM"); + sp += strlen(sp); + } + if (flagval & STRING) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "STRING"); + sp += strlen(sp); + } + if (flagval & STR) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "STR"); + sp += strlen(sp); + } + if (flagval & NUM) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "NUM"); + sp += strlen(sp); + } + if (flagval & NUMBER) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "NUMBER"); + sp += strlen(sp); + } + if (flagval & MAYBE_NUM) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "MAYBE_NUM"); + sp += strlen(sp); + } + if (flagval & ARRAYMAXED) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "ARRAYMAXED"); + sp += strlen(sp); + } + if (flagval & SCALAR) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "SCALAR"); + sp += strlen(sp); + } + if (flagval & FUNC) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "FUNC"); + sp += strlen(sp); + } + if (flagval & FIELD) { + if (sp != buffer) + *sp++ = '|'; + strcpy(sp, "FIELD"); + sp += strlen(sp); + } + + return buffer; + } + /* * interpret: * Tree is a bunch of rules to run. Returns zero if it hit an exit() *************** *** 432,437 **** --- 524,531 ---- } if (! do_traditional || do_posix) fatal("use of `break' outside a loop is not allowed"); + if (in_function()) + pop_fcall_stack(); longjmp(rule_tag, TAG_CONTINUE); } else longjmp(loop_tag, TAG_BREAK); *************** *** 452,457 **** --- 546,553 ---- } if (! do_traditional || do_posix) fatal("use of `continue' outside a loop is not allowed"); + if (in_function()) + pop_fcall_stack(); longjmp(rule_tag, TAG_CONTINUE); } else longjmp(loop_tag, TAG_CONTINUE); *************** *** 466,482 **** break; case Node_K_delete: ! if (tree->rnode != NULL) /* delete array */ ! do_delete(tree->lnode, tree->rnode); ! else ! assoc_clear(tree->lnode); break; case Node_K_next: longjmp(rule_tag, TAG_CONTINUE); break; case Node_K_nextfile: do_nextfile(); break; --- 562,579 ---- break; case Node_K_delete: ! do_delete(tree->lnode, tree->rnode); break; case Node_K_next: + if (in_function()) + pop_fcall_stack(); longjmp(rule_tag, TAG_CONTINUE); break; case Node_K_nextfile: + if (in_function()) + pop_fcall_stack(); do_nextfile(); break; *************** *** 1034,1040 **** case Node_assign_mod: if (rval == (AWKNUM) 0) ! fatal("division by zero attempted in %="); #ifdef HAVE_FMOD *lhs = make_number(fmod(lval, rval)); #else /* ! HAVE_FMOD */ --- 1131,1137 ---- case Node_assign_mod: if (rval == (AWKNUM) 0) ! fatal("division by zero attempted in %%="); #ifdef HAVE_FMOD *lhs = make_number(fmod(lval, rval)); #else /* ! HAVE_FMOD */ *************** *** 1060,1105 **** return *lhs; } ! /* func_call --- call a function, call by reference for arrays */ ! NODE **stack_ptr; ! static NODE * ! func_call(name, arg_list) ! NODE *name; /* name is a Node_val giving function name */ ! NODE *arg_list; /* Node_expression_list of calling args. */ { ! register NODE *arg, *argp, *r; ! NODE *n, *f; ! jmp_buf volatile func_tag_stack; ! jmp_buf volatile loop_tag_stack; ! int volatile save_loop_tag_valid = FALSE; ! NODE **volatile save_stack, *save_ret_node; ! NODE **volatile local_stack = NULL, **sp; int count; ! extern NODE *ret_node; - /* retrieve function definition node */ - f = lookup(name->stptr); - if (f == NULL || f->type != Node_func) - fatal("function `%s' not defined", name->stptr); - #ifdef FUNC_TRACE - fprintf(stderr, "function %s called\n", name->stptr); - #endif - count = f->lnode->param_cnt; if (count > 0) ! emalloc(local_stack, NODE **, count*sizeof(NODE *), "func_call"); ! sp = local_stack; /* for each calling arg. add NODE * on stack */ ! for (argp = arg_list; count > 0 && argp != NULL; argp = argp->rnode) { arg = argp->lnode; getnode(r); r->type = Node_var; /* call by reference for arrays; see below also */ if (arg->type == Node_param_list) ! arg = stack_ptr[arg->param_cnt]; if (arg->type == Node_var_array) *r = *arg; else { --- 1157,1290 ---- return *lhs; } ! static struct fcall { ! char *fname; ! unsigned long count; ! NODE *arglist; ! NODE **prevstack; ! NODE **stack; ! } *fcall_list = NULL; ! static long fcall_list_size = 0; ! static long curfcall = -1; ! /* in_function --- return true/false if we need to unwind awk functions */ ! ! static int ! in_function() { ! return (curfcall >= 0); ! } ! ! /* pop_fcall --- pop off a single function call */ ! ! static void ! pop_fcall() ! { ! NODE *n, **sp, *arg, *argp; int count; ! struct fcall *f; ! ! assert(curfcall >= 0); ! f = & fcall_list[curfcall]; ! stack_ptr = f->prevstack; ! ! /* ! * here, we pop each parameter and check whether ! * it was an array. If so, and if the arg. passed in was ! * a simple variable, then the value should be copied back. ! * This achieves "call-by-reference" for arrays. ! */ ! sp = f->stack; ! count = f->count; ! ! for (argp = f->arglist; count > 0 && argp != NULL; argp = argp->rnode) { ! arg = argp->lnode; ! if (arg->type == Node_param_list) ! arg = stack_ptr[arg->param_cnt]; ! n = *sp++; ! if ((arg->type == Node_var || arg->type == Node_var_array) ! && n->type == Node_var_array) { ! /* should we free arg->var_value ? */ ! arg->var_array = n->var_array; ! arg->type = Node_var_array; ! arg->array_size = n->array_size; ! arg->table_size = n->table_size; ! arg->flags = n->flags; ! } ! /* n->lnode overlays the array size, don't unref it if array */ ! if (n->type != Node_var_array) ! unref(n->lnode); ! freenode(n); ! count--; ! } ! while (count-- > 0) { ! n = *sp++; ! /* if n is a local array, all the elements should be freed */ ! if (n->type == Node_var_array) ! assoc_clear(n); ! unref(n->lnode); ! freenode(n); ! } ! if (f->stack) ! free((char *) f->stack); ! memset(f, '\0', sizeof(struct fcall)); ! curfcall--; ! } ! ! /* pop_fcall_stack --- pop off all function args, don't leak memory */ ! ! static void ! pop_fcall_stack() ! { ! while (curfcall >= 0) ! pop_fcall(); ! } ! ! /* push_args --- push function arguments onto the stack */ ! ! static void ! push_args(count, arglist, oldstack, func_name) ! int count; ! NODE *arglist; ! NODE **oldstack; ! char *func_name; ! { ! struct fcall *f; ! NODE *arg, *argp, *r, **sp, *n; ! ! if (fcall_list_size == 0) { /* first time */ ! emalloc(fcall_list, struct fcall *, 10 * sizeof(struct fcall), ! "push_args"); ! fcall_list_size = 10; ! } ! ! if (++curfcall >= fcall_list_size) { ! fcall_list_size *= 2; ! erealloc(fcall_list, struct fcall *, ! fcall_list_size * sizeof(struct fcall), "push_args"); ! } ! f = & fcall_list[curfcall]; ! memset(f, '\0', sizeof(struct fcall)); if (count > 0) ! emalloc(f->stack, NODE **, count*sizeof(NODE *), "func_call"); ! f->count = count; ! f->fname = func_name; /* not used, for debugging, just in case */ ! f->arglist = arglist; ! f->prevstack = oldstack; ! ! sp = f->stack; /* for each calling arg. add NODE * on stack */ ! for (argp = arglist; count > 0 && argp != NULL; argp = argp->rnode) { arg = argp->lnode; getnode(r); r->type = Node_var; /* call by reference for arrays; see below also */ if (arg->type == Node_param_list) ! arg = f->prevstack[arg->param_cnt]; if (arg->type == Node_var_array) *r = *arg; else { *************** *** 1116,1122 **** if (argp != NULL) /* left over calling args. */ warning( "function `%s' called with more arguments than declared", ! name->stptr); /* add remaining params. on stack with null value */ while (count-- > 0) { --- 1301,1307 ---- if (argp != NULL) /* left over calling args. */ warning( "function `%s' called with more arguments than declared", ! func_name); /* add remaining params. on stack with null value */ while (count-- > 0) { *************** *** 1129,1134 **** --- 1314,1357 ---- } /* + * We have to reassign f. Why, you may ask? It is possible that + * other functions were called during the course of tree_eval()-ing + * the arguments to this function. As a result of that, fcall_list + * may have been realloc()'ed, with the result that f is now + * pointing into free()'d space. This was a nasty one to track down. + */ + f = & fcall_list[curfcall]; + + stack_ptr = f->stack; + } + + /* func_call --- call a function, call by reference for arrays */ + + NODE **stack_ptr; + + static NODE * + func_call(name, arg_list) + NODE *name; /* name is a Node_val giving function name */ + NODE *arg_list; /* Node_expression_list of calling args. */ + { + register NODE *r; + NODE *f; + jmp_buf volatile func_tag_stack; + jmp_buf volatile loop_tag_stack; + int volatile save_loop_tag_valid = FALSE; + NODE *save_ret_node; + extern NODE *ret_node; + + /* retrieve function definition node */ + f = lookup(name->stptr); + if (f == NULL || f->type != Node_func) + fatal("function `%s' not defined", name->stptr); + #ifdef FUNC_TRACE + fprintf(stderr, "function %s called\n", name->stptr); + #endif + push_args(f->lnode->param_cnt, arg_list, stack_ptr, name->stptr); + + /* * Execute function body, saving context, as a return statement * will longjmp back here. * *************** *** 1146,1153 **** PUSH_BINDING(loop_tag_stack, loop_tag, junk); loop_tag_valid = FALSE; } - save_stack = stack_ptr; - stack_ptr = local_stack; PUSH_BINDING(func_tag_stack, func_tag, func_tag_valid); save_ret_node = ret_node; ret_node = Nnull_string; /* default return value */ --- 1369,1374 ---- *************** *** 1157,1202 **** r = ret_node; ret_node = (NODE *) save_ret_node; RESTORE_BINDING(func_tag_stack, func_tag, func_tag_valid); ! stack_ptr = (NODE **) save_stack; ! ! /* ! * here, we pop each parameter and check whether ! * it was an array. If so, and if the arg. passed in was ! * a simple variable, then the value should be copied back. ! * This achieves "call-by-reference" for arrays. ! */ ! sp = local_stack; ! count = f->lnode->param_cnt; ! for (argp = arg_list; count > 0 && argp != NULL; argp = argp->rnode) { ! arg = argp->lnode; ! if (arg->type == Node_param_list) ! arg = stack_ptr[arg->param_cnt]; ! n = *sp++; ! if ((arg->type == Node_var || arg->type == Node_var_array) ! && n->type == Node_var_array) { ! /* should we free arg->var_value ? */ ! arg->var_array = n->var_array; ! arg->type = Node_var_array; ! arg->array_size = n->array_size; ! arg->table_size = n->table_size; ! arg->flags = n->flags; ! } ! /* n->lnode overlays the array size, don't unref it if array */ ! if (n->type != Node_var_array) ! unref(n->lnode); ! freenode(n); ! count--; ! } ! while (count-- > 0) { ! n = *sp++; ! /* if n is a local array, all the elements should be freed */ ! if (n->type == Node_var_array) ! assoc_clear(n); ! unref(n->lnode); ! freenode(n); ! } ! if (local_stack) ! free((char *) local_stack); /* Restore the loop_tag stuff if necessary. */ if (save_loop_tag_valid) { --- 1378,1384 ---- r = ret_node; ret_node = (NODE *) save_ret_node; RESTORE_BINDING(func_tag_stack, func_tag, func_tag_valid); ! pop_fcall(); /* Restore the loop_tag stuff if necessary. */ if (save_loop_tag_valid) { diff -crN gawk-3.0.2/field.c gawk-3.0.3/field.c *** gawk-3.0.2/field.c Sun Dec 8 22:13:05 1996 --- gawk-3.0.3/field.c Thu May 1 21:36:20 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 61,66 **** --- 61,67 ---- int field0_valid; /* $(>0) has not been changed yet */ int default_FS; /* TRUE when FS == " " */ Regexp *FS_regexp = NULL; + static NODE *Null_field = NULL; /* init_fields --- set up the fields array to start with */ *************** *** 72,81 **** emalloc(fields_arr, NODE **, sizeof(NODE *), "init_fields"); getnode(n); *n = *Nnull_string; ! n->flags |= (SCALAR|PERM); fields_arr[0] = n; parse_extent = fields_arr[0]->stptr; save_FS = dupnode(FS_node->var_value); field0_valid = TRUE; } --- 73,87 ---- emalloc(fields_arr, NODE **, sizeof(NODE *), "init_fields"); getnode(n); *n = *Nnull_string; ! n->flags |= (SCALAR|FIELD); ! n->flags &= ~PERM; fields_arr[0] = n; parse_extent = fields_arr[0]->stptr; save_FS = dupnode(FS_node->var_value); + getnode(Null_field); + *Null_field = *Nnull_string; + Null_field->flags |= (SCALAR|FIELD); + Null_field->flags &= ~(NUM|NUMBER|MAYBE_NUM|PERM); field0_valid = TRUE; } *************** *** 91,98 **** erealloc(fields_arr, NODE **, (num + 1) * sizeof(NODE *), "grow_fields_arr"); for (t = nf_high_water + 1; t <= num; t++) { getnode(n); ! *n = *Nnull_string; ! n->flags |= SCALAR; fields_arr[t] = n; } nf_high_water = num; --- 97,103 ---- erealloc(fields_arr, NODE **, (num + 1) * sizeof(NODE *), "grow_fields_arr"); for (t = nf_high_water + 1; t <= num; t++) { getnode(n); ! *n = *Null_field; fields_arr[t] = n; } nf_high_water = num; *************** *** 115,121 **** n = fields_arr[num]; n->stptr = str; n->stlen = len; ! n->flags = (PERM|STR|STRING|MAYBE_NUM|SCALAR); } /* rebuild_record --- Someone assigned a value to $(something). --- 120,126 ---- n = fields_arr[num]; n->stptr = str; n->stlen = len; ! n->flags = (STR|STRING|MAYBE_NUM|SCALAR|FIELD); } /* rebuild_record --- Someone assigned a value to $(something). *************** *** 191,201 **** cops += fields_arr[i]->stlen + ofslen; } - fields_arr[0]->flags &= ~PERM; unref(fields_arr[0]); fields_arr[0] = tmp; - fields_arr[0]->flags |= PERM; field0_valid = TRUE; } --- 196,204 ---- *************** *** 217,224 **** for (i = 1; i <= parse_high_water; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Nnull_string; ! n->flags |= SCALAR; fields_arr[i] = n; } --- 220,226 ---- for (i = 1; i <= parse_high_water; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Null_field; fields_arr[i] = n; } *************** *** 240,249 **** n->stref = 1; n->type = Node_val; n->stfmt = -1; ! n->flags = (STRING|STR|PERM|MAYBE_NUM|SCALAR); fields_arr[0] = n; } ! fields_arr[0]->flags |= (MAYBE_NUM|PERM); field0_valid = TRUE; } --- 242,251 ---- n->stref = 1; n->type = Node_val; n->stfmt = -1; ! n->flags = (STRING|STR|MAYBE_NUM|SCALAR|FIELD); fields_arr[0] = n; } ! fields_arr[0]->flags |= MAYBE_NUM; field0_valid = TRUE; } *************** *** 273,288 **** for (i = parse_high_water + 1; i <= NF; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Nnull_string; ! n->flags |= SCALAR; fields_arr[i] = n; } } else if (parse_high_water > 0) { for (i = NF + 1; i <= parse_high_water; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Nnull_string; ! n->flags |= SCALAR; fields_arr[i] = n; } parse_high_water = NF; --- 275,288 ---- for (i = parse_high_water + 1; i <= NF; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Null_field; fields_arr[i] = n; } } else if (parse_high_water > 0) { for (i = NF + 1; i <= parse_high_water; i++) { unref(fields_arr[i]); getnode(n); ! *n = *Null_field; fields_arr[i] = n; } parse_high_water = NF; *************** *** 691,697 **** NF = requested; parse_high_water = requested; } else ! return &Nnull_string; } return &fields_arr[requested]; --- 691,697 ---- NF = requested; parse_high_water = requested; } else ! return &Null_field; } return &fields_arr[requested]; diff -crN gawk-3.0.2/gawkmisc.c gawk-3.0.3/gawkmisc.c *** gawk-3.0.2/gawkmisc.c Sun Oct 20 21:11:33 1996 --- gawk-3.0.3/gawkmisc.c Sun May 11 14:47:43 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991 - 96 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991 - 97 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 27,33 **** /* some old compilers don't grok #elif. sigh */ ! #if defined(MSDOS) || defined(OS2) #include "gawkmisc.pc" #else #if defined(VMS) --- 27,33 ---- /* some old compilers don't grok #elif. sigh */ ! #if defined(MSDOS) || defined(OS2) || defined(WIN32) #include "gawkmisc.pc" #else #if defined(VMS) *************** *** 36,49 **** #if defined(atarist) #include "atari/gawkmisc.atr" #else - #if defined(__amigados__) - #include "amiga/gawkmisc.ami" - #else #include "posix/gawkmisc.c" #endif #endif #endif - #endif /* xmalloc --- provide this so that other GNU library routines work */ --- 36,45 ---- *************** *** 65,68 **** return p; } - --- 61,63 ---- diff -crN gawk-3.0.2/getopt.h gawk-3.0.3/getopt.h *** gawk-3.0.2/getopt.h Wed Aug 16 01:11:46 1995 --- gawk-3.0.3/getopt.h Sun Jan 26 22:56:53 1997 *************** *** 1,19 **** /* Declarations for getopt. ! Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2, or (at your option) any ! later version. ! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef _GETOPT_H #define _GETOPT_H 1 --- 1,23 ---- /* Declarations for getopt. ! Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. ! This file is part of the GNU C Library. Its master source is NOT part of ! the C library, however. The master source lives in /gd/gnu/lib. ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! You should have received a copy of the GNU Library General Public ! License along with the GNU C Library; see the file COPYING.LIB. If not, ! write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ #ifndef _GETOPT_H #define _GETOPT_H 1 *************** *** 36,42 **** On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns EOF, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next --- 40,46 ---- On entry to `getopt', zero means this is the first call; initialize. ! When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next diff -crN gawk-3.0.2/getopt1.c gawk-3.0.3/getopt1.c *** gawk-3.0.2/getopt1.c Fri Dec 20 08:59:32 1996 --- gawk-3.0.3/getopt1.c Sun Jan 26 22:56:52 1997 *************** *** 1,35 **** /* getopt_long and getopt_long_only entry points for GNU getopt. ! Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 ! Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify it ! under the terms of the GNU General Public License as published by the ! Free Software Foundation; either version 2, or (at your option) any ! later version. ! This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CONFIG_H - #if defined (emacs) || defined (CONFIG_BROKETS) - /* We use instead of "config.h" so that a compilation - using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h - (which it would do because it found this file in $srcdir). */ #include - #else - #include "config.h" - #endif #endif #include "getopt.h" ! #ifndef __STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const --- 1,31 ---- /* getopt_long and getopt_long_only entry points for GNU getopt. ! Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc. ! This file is part of the GNU C Library. Its master source is NOT part of ! the C library, however. The master source lives in /gd/gnu/lib. ! The GNU C Library is free software; you can redistribute it and/or ! modify it under the terms of the GNU Library General Public License as ! published by the Free Software Foundation; either version 2 of the ! License, or (at your option) any later version. ! ! The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ! Library General Public License for more details. ! You should have received a copy of the GNU Library General Public ! License along with the GNU C Library; see the file COPYING.LIB. If not, ! write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ! Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include "getopt.h" ! #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const *************** *** 47,64 **** program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ ! /* Unfortunately, for gawk, this version is New And Improved, and must ! be used. This will be fixed for GNU LIBC 2 ! #if defined (_LIBC) || !defined (__GNU_LIBRARY__) ! */ /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ ! #if defined(__GNU_LIBRARY__) || defined(OS2) || defined(MSDOS) || defined(atarist) #include - #else - char *getenv (); #endif #ifndef NULL --- 43,63 ---- program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ ! #define GETOPT_INTERFACE_VERSION 2 ! #if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 ! #include ! #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION ! #define ELIDE_CODE ! #endif ! #endif ! ! #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ ! #ifdef __GNU_LIBRARY__ #include #endif #ifndef NULL *************** *** 93,100 **** } ! /* no close on purpose (gawk) ! #endif /* _LIBC or not __GNU_LIBRARY__. */ #ifdef TEST --- 92,98 ---- } ! #endif /* Not ELIDE_CODE. */ #ifdef TEST *************** *** 125,131 **** c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); ! if (c == EOF) break; switch (c) --- 123,129 ---- c = getopt_long (argc, argv, "abc:d:0123456789", long_options, &option_index); ! if (c == -1) break; switch (c) diff -crN gawk-3.0.2/io.c gawk-3.0.3/io.c *** gawk-3.0.2/io.c Thu Nov 7 20:59:05 1996 --- gawk-3.0.3/io.c Wed May 14 08:10:02 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 24,31 **** --- 24,33 ---- */ #include "awk.h" + #undef HAVE_MMAP /* for now, probably forever */ #ifdef HAVE_SYS_PARAM_H + #undef RE_DUP_MAX /* avoid spurious conflict w/regex.h */ #include #endif /* HAVE_SYS_PARAM_H */ *************** *** 65,71 **** #include #endif ! #if defined(MSDOS) || defined(OS2) #define PIPES_SIMULATED #endif --- 67,73 ---- #include #endif ! #if defined(MSDOS) || defined(OS2) || defined(WIN32) #define PIPES_SIMULATED #endif *************** *** 79,85 **** static int wait_any P((int interesting)); #endif static IOBUF *gawk_popen P((char *cmd, struct redirect *rp)); ! static IOBUF *iop_open P((const char *file, const char *how)); static int gawk_pclose P((struct redirect *rp)); static int do_pathopen P((const char *file)); static int get_a_record P((char **out, IOBUF *iop, int rs, Regexp *RSre, int *errcode)); --- 81,88 ---- static int wait_any P((int interesting)); #endif static IOBUF *gawk_popen P((char *cmd, struct redirect *rp)); ! static IOBUF *iop_open P((const char *file, const char *how, IOBUF *buf)); ! static IOBUF *iop_alloc P((int fd, const char *name, IOBUF *buf)); static int gawk_pclose P((struct redirect *rp)); static int do_pathopen P((const char *file)); static int get_a_record P((char **out, IOBUF *iop, int rs, Regexp *RSre, int *errcode)); *************** *** 122,128 **** static jmp_buf filebuf; /* for do_nextfile() */ ! /* do_nextfile --- implement gawk "next file" extension */ void do_nextfile() --- 125,131 ---- static jmp_buf filebuf; /* for do_nextfile() */ ! /* do_nextfile --- implement gawk "nextfile" extension */ void do_nextfile() *************** *** 141,146 **** --- 144,151 ---- static int files = 0; NODE *arg; static IOBUF *curfile = NULL; + static IOBUF mybuf; + const char *fname; if (skipping) { if (curfile != NULL) *************** *** 166,176 **** } if (! arg_assign(arg->stptr)) { files++; ! curfile = iop_open(arg->stptr, "r"); if (curfile == NULL) ! fatal("cannot open file `%s' for reading (%s)", ! arg->stptr, strerror(errno)); ! /* NOTREACHED */ /* This is a kludge. */ unref(FILENAME_node->var_value); FILENAME_node->var_value = dupnode(arg); --- 171,181 ---- } if (! arg_assign(arg->stptr)) { files++; ! fname = arg->stptr; ! curfile = iop_open(fname, "r", &mybuf); if (curfile == NULL) ! goto give_up; ! curfile->flag |= IOP_NOFREE_OBJ; /* This is a kludge. */ unref(FILENAME_node->var_value); FILENAME_node->var_value = dupnode(arg); *************** *** 184,192 **** /* no args. -- use stdin */ /* FNR is init'ed to 0 */ FILENAME_node->var_value = make_string("-", 1); ! curfile = iop_alloc(fileno(stdin), "stdin"); } return curfile; } /* set_FNR --- update internal FNR from awk variable */ --- 189,207 ---- /* no args. -- use stdin */ /* FNR is init'ed to 0 */ FILENAME_node->var_value = make_string("-", 1); ! fname = "-"; ! curfile = iop_open(fname, "r", &mybuf); ! if (curfile == NULL) ! goto give_up; ! curfile->flag |= IOP_NOFREE_OBJ; } return curfile; + + give_up: + fatal("cannot open file `%s' for reading (%s)", + fname, strerror(errno)); + /* NOTREACHED */ + return 0; } /* set_FNR --- update internal FNR from awk variable */ *************** *** 260,266 **** /* Don't close standard files or else crufty code elsewhere will lose */ if (iop->fd == fileno(stdin) || iop->fd == fileno(stdout) ! || iop->fd == fileno(stderr)) ret = 0; else ret = close(iop->fd); --- 275,282 ---- /* Don't close standard files or else crufty code elsewhere will lose */ if (iop->fd == fileno(stdin) || iop->fd == fileno(stdout) ! || iop->fd == fileno(stderr) ! || (iop->flag & IOP_MMAPPED) != 0) ret = 0; else ret = close(iop->fd); *************** *** 282,288 **** t = make_string(fields_arr[0]->stptr, fields_arr[0]->stlen); unref(fields_arr[0]); ! fields_arr [0] = t; reset_record(); } if ((iop->flag & IOP_MMAPPED) == 0) --- 298,304 ---- t = make_string(fields_arr[0]->stptr, fields_arr[0]->stlen); unref(fields_arr[0]); ! fields_arr[0] = t; reset_record(); } if ((iop->flag & IOP_MMAPPED) == 0) *************** *** 292,298 **** (void) munmap(iop->buf, iop->size); #endif } ! free((char *) iop); } return ret == -1 ? 1 : 0; } --- 308,315 ---- (void) munmap(iop->buf, iop->size); #endif } ! if ((iop->flag & IOP_NOFREE_OBJ) == 0) ! free((char *) iop); } return ret == -1 ? 1 : 0; } *************** *** 441,452 **** break; case Node_redirect_input: direction = "from"; ! rp->iop = iop_open(str, "r"); break; default: cant_happen(); } if (mode != NULL) { fd = devopen(str, mode); if (fd > INVALID_HANDLE) { if (fd == fileno(stdin)) --- 458,470 ---- break; case Node_redirect_input: direction = "from"; ! rp->iop = iop_open(str, "r", NULL); break; default: cant_happen(); } if (mode != NULL) { + errno = 0; fd = devopen(str, mode); if (fd > INVALID_HANDLE) { if (fd == fileno(stdin)) *************** *** 469,474 **** --- 487,497 ---- /* too many files open -- close one and try again */ if (errno == EMFILE || errno == ENFILE) close_one(); + #ifdef HAVE_MMAP + /* this works for solaris 2.5, not sunos */ + else if (errno == 0) /* HACK! */ + close_one(); + #endif else { /* * Some other reason for failure. *************** *** 564,572 **** && STREQN(rp->value, tmp->stptr, tmp->stlen)) break; } ! free_temp(tmp); ! if (rp == NULL) /* no match */ return tmp_number((AWKNUM) 0.0); fflush(stdout); /* synchronize regular output */ tmp = tmp_number((AWKNUM) close_redir(rp, FALSE)); rp = NULL; --- 587,600 ---- && STREQN(rp->value, tmp->stptr, tmp->stlen)) break; } ! if (rp == NULL) { /* no match */ ! if (do_lint) ! warning("close: `%.*s' is not an open file or pipe", ! tmp->stlen, tmp->stptr); ! free_temp(tmp); return tmp_number((AWKNUM) 0.0); + } + free_temp(tmp); fflush(stdout); /* synchronize regular output */ tmp = tmp_number((AWKNUM) close_redir(rp, FALSE)); rp = NULL; *************** *** 650,659 **** status++; } if (fflush(stderr)) { - #ifndef __amigados__ /* HACK (fnf) */ warning("error writing standard error (%s)", strerror(errno)); status++; - #endif } for (rp = red_head; rp != NULL; rp = rp->next) /* flush both files and pipes, what the heck */ --- 678,685 ---- *************** *** 698,707 **** status++; } if (fflush(stderr)) { - #ifndef __amigados__ /* HACK (fnf) */ warning("error writing standard error (%s)", strerror(errno)); status++; - #endif } return status; } --- 724,731 ---- *************** *** 819,824 **** --- 843,849 ---- iop->end = iop->buf + len; iop->fd = -1; iop->flag = IOP_IS_INTERNAL; + iop->getrec = get_a_record; } /* specfdopen --- open an fd special file */ *************** *** 834,840 **** fd = devopen(name, mode); if (fd == INVALID_HANDLE) return INVALID_HANDLE; ! tp = iop_alloc(fd, name); if (tp == NULL) { /* don't leak fd's */ close(fd); --- 859,865 ---- fd = devopen(name, mode); if (fd == INVALID_HANDLE) return INVALID_HANDLE; ! tp = iop_alloc(fd, name, NULL); if (tp == NULL) { /* don't leak fd's */ close(fd); *************** *** 924,936 **** /* iop_open --- handle special and regular files for input */ static IOBUF * ! iop_open(name, mode) const char *name, *mode; { int openfd = INVALID_HANDLE; int flag = 0; struct stat buf; - IOBUF *iop; static struct internal { const char *name; int compare; --- 949,961 ---- /* iop_open --- handle special and regular files for input */ static IOBUF * ! iop_open(name, mode, iop) const char *name, *mode; + IOBUF *iop; { int openfd = INVALID_HANDLE; int flag = 0; struct stat buf; static struct internal { const char *name; int compare; *************** *** 985,992 **** if (openfd != INVALID_HANDLE && fstat(openfd, &buf) > 0) if ((buf.st_mode & S_IFMT) == S_IFDIR) fatal("file `%s' is a directory", name); ! iop = iop_alloc(openfd, name); ! return iop; } #ifndef PIPES_SIMULATED /* real pipes */ --- 1010,1016 ---- if (openfd != INVALID_HANDLE && fstat(openfd, &buf) > 0) if ((buf.st_mode & S_IFMT) == S_IFDIR) fatal("file `%s' is a directory", name); ! return iop_alloc(openfd, name, iop); } #ifndef PIPES_SIMULATED /* real pipes */ *************** *** 1019,1032 **** if (pid == redp->pid) { redp->pid = -1; redp->status = status; - if (redp->fp != NULL) { - pclose(redp->fp); - redp->fp = NULL; - } - if (redp->iop != NULL) { - (void) iop_close(redp->iop); - redp->iop = NULL; - } break; } } --- 1043,1048 ---- *************** *** 1074,1080 **** rp->pid = pid; if (close(p[1]) == -1) fatal("close of pipe failed (%s)", strerror(errno)); ! rp->iop = iop_alloc(p[0], cmd); if (rp->iop == NULL) (void) close(p[0]); return (rp->iop); --- 1090,1096 ---- rp->pid = pid; if (close(p[1]) == -1) fatal("close of pipe failed (%s)", strerror(errno)); ! rp->iop = iop_alloc(p[0], cmd, NULL); if (rp->iop == NULL) (void) close(p[0]); return (rp->iop); *************** *** 1117,1123 **** if ((current = popen(cmd, "r")) == NULL) return NULL; ! rp->iop = iop_alloc(fileno(current), cmd); if (rp->iop == NULL) { (void) fclose(current); current = NULL; --- 1133,1139 ---- if ((current = popen(cmd, "r")) == NULL) return NULL; ! rp->iop = iop_alloc(fileno(current), cmd, NULL); if (rp->iop == NULL) { (void) fclose(current); current = NULL; *************** *** 1169,1175 **** return NULL; pipes[current].name = name; pipes[current].command = strdup(cmd); ! rp->iop = iop_alloc(current, name); if (rp->iop == NULL) (void) close(current); return (rp->iop); --- 1185,1191 ---- return NULL; pipes[current].name = name; pipes[current].command = strdup(cmd); ! rp->iop = iop_alloc(current, name, NULL); if (rp->iop == NULL) (void) close(current); return (rp->iop); *************** *** 1392,1408 **** /* iop_alloc --- allocate an IOBUF structure for an open fd */ ! IOBUF * ! iop_alloc(fd, name) int fd; const char *name; { - IOBUF *iop; struct stat sbuf; if (fd == INVALID_HANDLE) return NULL; ! emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); iop->flag = 0; if (isatty(fd)) iop->flag |= IOP_IS_TTY; --- 1408,1425 ---- /* iop_alloc --- allocate an IOBUF structure for an open fd */ ! static IOBUF * ! iop_alloc(fd, name, iop) int fd; const char *name; + IOBUF *iop; { struct stat sbuf; if (fd == INVALID_HANDLE) return NULL; ! if (iop == NULL) ! emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); iop->flag = 0; if (isatty(fd)) iop->flag |= IOP_IS_TTY; *************** *** 1418,1423 **** --- 1435,1442 ---- iop->getrec = get_a_record; #ifdef HAVE_MMAP if (S_ISREG(sbuf.st_mode) && sbuf.st_size > 0) { + register char *cp; + iop->buf = iop->off = mmap((caddr_t) 0, sbuf.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0L); *************** *** 1429,1441 **** --- 1448,1475 ---- iop->flag |= IOP_MMAPPED; iop->size = sbuf.st_size; + iop->secsiz = 0; iop->end = iop->buf + iop->size; iop->cnt = sbuf.st_size; iop->getrec = mmap_get_record; + (void) close(fd); + iop->fd = INVALID_HANDLE; #if defined(HAVE_MADVISE) && defined(MADV_SEQUENTIAL) madvise(iop->buf, iop->size, MADV_SEQUENTIAL); #endif + /* + * The following is a really gross hack. + * We want to ensure that we have a copy of the input + * data that won't go away, on the off chance that someone + * will truncate the data file we've just mmap'ed. + * So, we go through and touch each page, forcing the + * system to give us a private copy. A page size of 512 + * guarantees this will work, even on the least common + * denominator system (like, oh say, a VAX). + */ + for (cp = iop->buf; cp < iop->end; cp += 512) + *cp = *cp; } out: #endif /* HAVE_MMAP */ *************** *** 1669,1675 **** } /* search for RS, #2, RS = */ if (onecase) { ! while (casetable[*bp++] != rs) continue; } else { while (*bp++ != rs) --- 1703,1709 ---- } /* search for RS, #2, RS = */ if (onecase) { ! while (casetable[(int) *bp++] != rs) continue; } else { while (*bp++ != rs) *************** *** 1698,1704 **** bstart = iop->off = bp; bp--; ! if (onecase ? casetable[*bp] != rs : *bp != rs) { bp++; bstart = bp; } --- 1732,1738 ---- bstart = iop->off = bp; bp--; ! if (onecase ? casetable[(int) *bp] != rs : *bp != rs) { bp++; bstart = bp; } *************** *** 1733,1739 **** bufsize = atoi(argv[1]); if (argc > 2) rs[0] = *argv[2]; ! iop = iop_alloc(0, "stdin"); while ((cnt = get_a_record(&out, iop, rs[0], NULL, NULL)) > 0) { fwrite(out, 1, cnt, stdout); fwrite(rs, 1, 1, stdout); --- 1767,1773 ---- bufsize = atoi(argv[1]); if (argc > 2) rs[0] = *argv[2]; ! iop = iop_alloc(0, "stdin", NULL); while ((cnt = get_a_record(&out, iop, rs[0], NULL, NULL)) > 0) { fwrite(out, 1, cnt, stdout); fwrite(rs, 1, 1, stdout); *************** *** 1760,1765 **** --- 1794,1800 ---- Regexp *rsre = NULL; int onecase; register char *end = iop->end; + int cnt; /* first time through */ if (RS_null_re == NULL) { *************** *** 1862,1879 **** while (bp < end && *bp++ != rs) continue; } if (bp >= iop->end) { /* at end, may have actually seen rs, or may not */ if (*(bp-1) == rs) set_RT(bp - 1, 1); /* real RS seen */ ! else set_RT_to_null(); } else set_RT(bp - 1, 1); iop->off = bp; *out = start; ! return bp - 1 - start; } #endif /* HAVE_MMAP */ --- 1897,1917 ---- while (bp < end && *bp++ != rs) continue; } + cnt = (bp - start) - 1; if (bp >= iop->end) { /* at end, may have actually seen rs, or may not */ if (*(bp-1) == rs) set_RT(bp - 1, 1); /* real RS seen */ ! else { ! cnt++; set_RT_to_null(); + } } else set_RT(bp - 1, 1); iop->off = bp; *out = start; ! return cnt; } #endif /* HAVE_MMAP */ diff -crN gawk-3.0.2/main.c gawk-3.0.3/main.c *** gawk-3.0.2/main.c Mon Nov 4 12:59:20 1996 --- gawk-3.0.3/main.c Tue May 13 12:58:52 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 340,346 **** * Do this again, after argument processing, since do_posix * and do_traditional are now paid attention to by resetup(). */ ! if (do_traditional || do_posix) { resetup(); /* now handle RS and FS. have to be careful with FS */ --- 340,346 ---- * Do this again, after argument processing, since do_posix * and do_traditional are now paid attention to by resetup(). */ ! if (do_traditional || do_posix || do_intervals) { resetup(); /* now handle RS and FS. have to be careful with FS */ *************** *** 450,456 **** copyleft() { static char blurb_part1[] = ! "Copyright (C) 1989, 1991-1996 Free Software Foundation.\n\ \n\ This program is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\ --- 450,456 ---- copyleft() { static char blurb_part1[] = ! "Copyright (C) 1989, 1991-1997 Free Software Foundation.\n\ \n\ This program is free software; you can redistribute it and/or modify\n\ it under the terms of the GNU General Public License as published by\n\ *************** *** 702,707 **** --- 702,708 ---- || sig == SIGBUS #endif ) { + set_loc(__FILE__, __LINE__); msg("fatal error: internal error"); /* fatal won't abort() if not compiled for debugging */ abort(); diff -crN gawk-3.0.2/missing/strerror.c gawk-3.0.3/missing/strerror.c *** gawk-3.0.2/missing/strerror.c Tue Dec 19 17:00:53 1995 --- gawk-3.0.3/missing/strerror.c Thu May 1 21:36:23 1997 *************** *** 1,27 **** ! /* ! * strerror.c --- ANSI C compatible system error routine ! */ ! /* ! * Copyright (C) 1986, 1988, 1989, 1991 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 ! */ #if 0 #include --- 1,20 ---- ! /* strerror.c --- ANSI C compatible system error routine ! Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if 0 #include diff -crN gawk-3.0.2/missing/strftime.c gawk-3.0.3/missing/strftime.c *** gawk-3.0.2/missing/strftime.c Thu Mar 14 06:34:10 1996 --- gawk-3.0.3/missing/strftime.c Tue May 6 12:23:31 1997 *************** *** 92,114 **** #ifndef __STDC__ #define const /**/ - extern void *malloc(); - extern void *realloc(); extern void tzset(); - extern char *strchr(); - extern char *getenv(); static int weeknumber(); adddecl(static int iso8601wknum();) #else - extern void *malloc(unsigned count); - extern void *realloc(void *ptr, unsigned count); extern void tzset(void); - extern char *strchr(const char *str, int ch); - extern char *getenv(const char *v); static int weeknumber(const struct tm *timeptr, int firstweekday); adddecl(static int iso8601wknum(const struct tm *timeptr);) #endif #ifdef __GNUC__ #define inline __inline__ #else --- 92,116 ---- #ifndef __STDC__ #define const /**/ extern void tzset(); static int weeknumber(); adddecl(static int iso8601wknum();) #else extern void tzset(void); static int weeknumber(const struct tm *timeptr, int firstweekday); adddecl(static int iso8601wknum(const struct tm *timeptr);) #endif + #ifdef STDC_HEADERS + #include + #include + #else + extern void *malloc(); + extern void *realloc(); + extern char *getenv(); + extern char *strchr(); + #endif + #ifdef __GNUC__ #define inline __inline__ #else *************** *** 504,510 **** #ifdef VMS_EXT case 'v': /* date as dd-bbb-YYYY */ ! sprintf(tbuf, "%02d-%3.3s-%4d", range(1, timeptr->tm_mday, 31), months_a[range(0, timeptr->tm_mon, 11)], timeptr->tm_year + 1900); --- 506,512 ---- #ifdef VMS_EXT case 'v': /* date as dd-bbb-YYYY */ ! sprintf(tbuf, "%2d-%3.3s-%4d", range(1, timeptr->tm_mday, 31), months_a[range(0, timeptr->tm_mon, 11)], timeptr->tm_year + 1900); diff -crN gawk-3.0.2/missing/strtod.c gawk-3.0.3/missing/strtod.c *** gawk-3.0.2/missing/strtod.c Tue Jun 16 22:14:39 1992 --- gawk-3.0.3/missing/strtod.c Thu May 1 21:36:24 1997 *************** *** 28,34 **** extern double atof(); double ! strtod (s, ptr) register char *s; register char **ptr; { --- 28,34 ---- extern double atof(); double ! strtod(s, ptr) register char *s; register char **ptr; { *************** *** 105,111 **** } #ifdef TEST ! main (argc, argv) int argc; char **argv; { --- 105,112 ---- } #ifdef TEST ! int ! main(argc, argv) int argc; char **argv; { *************** *** 116,120 **** --- 117,123 ---- d = strtod (*argv, & p); printf ("%lf [%s]\n", d, p); } + + return 0; } #endif diff -crN gawk-3.0.2/missing/system.c gawk-3.0.3/missing/system.c *** gawk-3.0.2/missing/system.c Tue Dec 19 17:01:10 1995 --- gawk-3.0.3/missing/system.c Thu May 1 21:36:24 1997 *************** *** 1,27 **** ! /* ! * system.c --- replacement system() for systems missing one ! */ ! /* ! * Copyright (C) 1986, 1988, 1989, 1991 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 ! */ extern void fatal(); --- 1,20 ---- ! /* system.c --- replacement system() for systems missing one ! Copyright (C) 1986, 1988, 1989, 1991 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ extern void fatal(); diff -crN gawk-3.0.2/msg.c gawk-3.0.3/msg.c *** gawk-3.0.2/msg.c Sun Oct 20 21:12:55 1996 --- gawk-3.0.3/msg.c Thu May 1 21:36:24 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 28,33 **** --- 28,36 ---- int sourceline = 0; char *source = NULL; + static char *srcfile = NULL; + static int srcline; + /* prototype needed for ansi / gcc */ void err P((const char *s, const char *emsg, va_list argp)); *************** *** 44,49 **** --- 47,58 ---- (void) fflush(stdout); (void) fprintf(stderr, "%s: ", myname); + #ifdef DEBUG + if (srcfile != NULL) { + fprintf(stderr, "%s:%d:", srcfile, srcline); + srcfile = NULL; + } + #endif /* DEBUG */ if (sourceline != 0) { if (source != NULL) (void) fprintf(stderr, "%s:", source); *************** *** 138,152 **** va_end(args); } /* fatal --- print an error message and die */ #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ void ! fatal(char *mesg, ...) #else /*VARARGS0*/ void ! fatal(va_alist) va_dcl #endif { --- 147,172 ---- va_end(args); } + /* set_loc --- set location where a fatal error happened */ + + void + set_loc(file, line) + char *file; + int line; + { + srcfile = file; + srcline = line; + } + /* fatal --- print an error message and die */ #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ void ! r_fatal(char *mesg, ...) #else /*VARARGS0*/ void ! r_fatal(va_alist) va_dcl #endif { diff -crN gawk-3.0.2/node.c gawk-3.0.3/node.c *** gawk-3.0.2/node.c Sun Oct 20 21:13:05 1996 --- gawk-3.0.3/node.c Thu May 1 21:36:25 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 79,84 **** --- 79,92 ---- return n->numbr; } + #ifdef NONDECDATA + errno = 0; + if (! do_traditional && isnondecimal(cp)) { + n->numbr = nondec2awknum(cp, cpend - cp); + goto finish; + } + #endif /* NONDECDATA */ + errno = 0; save = *cpend; *cpend = '\0'; *************** *** 88,93 **** --- 96,102 ---- while (ISSPACE(*ptr)) ptr++; *cpend = save; + finish: /* the >= should be ==, but for SunOS 3.5 strtod() */ if (errno == 0 && ptr >= cpend) n->flags |= newflags; *************** *** 257,263 **** r->flags = flags | SCALAR; #ifdef DEBUG r->stref = 1; ! r->stptr = 0; r->stlen = 0; #endif return r; --- 266,272 ---- r->flags = flags | SCALAR; #ifdef DEBUG r->stref = 1; ! r->stptr = NULL; r->stlen = 0; #endif return r; *************** *** 343,352 **** /* get more nodes and initialize list */ emalloc(nextfree, NODE *, NODECHUNK * sizeof(NODE), "newnode"); ! for (np = nextfree; np < &nextfree[NODECHUNK - 1]; np++) { np->flags = 0; np->nextp = np + 1; } np->nextp = NULL; np = nextfree; nextfree = nextfree->nextp; --- 352,362 ---- /* get more nodes and initialize list */ emalloc(nextfree, NODE *, NODECHUNK * sizeof(NODE), "newnode"); ! for (np = nextfree; np <= &nextfree[NODECHUNK - 1]; np++) { np->flags = 0; np->nextp = np + 1; } + --np; np->nextp = NULL; np = nextfree; nextfree = nextfree->nextp; *************** *** 393,398 **** --- 403,413 ---- free(tmp->stptr); } freenode(tmp); + return; + } + if ((tmp->flags & FIELD) != 0) { + freenode(tmp); + return; } } diff -crN gawk-3.0.2/patchlevel.h gawk-3.0.3/patchlevel.h *** gawk-3.0.2/patchlevel.h Tue Dec 24 14:53:25 1996 --- gawk-3.0.3/patchlevel.h Thu May 15 12:49:01 1997 *************** *** 1 **** ! #define PATCHLEVEL 2 --- 1 ---- ! #define PATCHLEVEL 3 diff -crN gawk-3.0.2/pc/ChangeLog gawk-3.0.3/pc/ChangeLog *** gawk-3.0.2/pc/ChangeLog Wed Dec 25 11:26:12 1996 --- gawk-3.0.3/pc/ChangeLog Thu May 15 12:50:40 1997 *************** *** 1,3 **** --- 1,31 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Tues May 13 20:06:09 1997 Darrel Hankerson + + * vcWin32 target added. Some new tests for WIN32 in gawkmisc.c + io.c, and regex.c. Makefile changes for nmake, which can't + expand $($x). + + * config.h updated for BITOPS and NONDECDATA (also in Makefile). + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Fri Jan 17 19:20:45 1997 Darrel Hankerson + + * Makefile: add KUR's emxnt target for emx+RSXNT. Create awk.exe + "link" to gawk.exe for djgpp target. (Suggested by Eli Zaretskii. + Should be done as part of a smarter install, since awk.exe only + works with djgpp gawk.exe.) Separate djgpp-v1 into djgppv1 + target. Install awk.exe if present. + + * install.awk: install awk.exe if present (only for djgpp) + + * config.h: additional include for emx+RSXNT. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/pc/Makefile gawk-3.0.3/pc/Makefile *** gawk-3.0.2/pc/Makefile Sat Dec 7 11:31:10 1996 --- gawk-3.0.3/pc/Makefile Sun May 4 19:27:33 1997 *************** *** 1,31 **** ! # Makefile for gawk (GNU awk) 7 Oct 1996 # ! # - for GNU C (djgpp) [executable for DOS (32-bit)] ! # - for GNU C (emx) [executable for OS/2 2.x or DOS (32-bit)] ! # - for Microsoft C 7 [ececutable for DOS (16-bit)] ! # - for Microsoft C 6.00A [executable for OS/2 or DOS (16-bit)] ! # - for Microsoft C 5.1 [executable for OS/2 or DOS (16-bit)] ! ! # Tested with GNU make and dmake-3.8 under OS/2 and DOS, and ndmake ! # under DOS. Compiling with dmake under DOS may require the DOS-only ! # version of dmake (so that swapping works). default: @echo "Enter $(MAK) target " @echo " where 'target' is chosen from " ! @echo " djgpp ... DOS 32-bit exe [GNU C, Delorie, v1 or v2] " @echo " emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] " @echo " emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc] " @echo " msc ..... DOS exe [Microsoft C 7 & 8 (AKA 1.52)] " @echo " msc6 .... DOS exe [Microsoft C 6.00a] " @echo " msc6os2 . OS/2 exe [Microsoft C 6.00a] " @echo " msc6bnd . OS/2 and DOS exe [Microsoft C 6.00a] " ! @echo " msvc32 .. DOS exe [Microsoft Visual C] " @echo " ----------------------------------------------------- " @echo " test .... Perform tests (see README_d/README.pc) " @echo " install . Install gawk under $(prefix)/ " # Support dropped in 3.0 # @echo " msc51 DOS exe [Microsoft C 5.1] " # @echo " msc51bnd OS/2 and DOS exe [Microsoft C 5.1] " --- 1,35 ---- ! # Makefile for gawk (GNU awk) 2 Jan 1997 # ! # - for GNU C (djgpp) [32bit executable for DOS] ! # - for GNU C (emx) [32bit executable for OS/2 or DOS or Win32] ! # - for MS-Visual C/C++ 4.x [Win32 executable for Windows 95 & NT] ! # - for Microsoft C 7 [16bit ececutable for DOS] ! # - for Microsoft C 6.00A [16bit executable for OS/2 or DOS] ! ! # Tested with GNU make and dmake-3.8 under OS/2 and DOS, and ndmake and ! # Microsoft nmake under DOS. Compiling with dmake under DOS may require the ! # DOS-only version of dmake (so that swapping works). nmake requires a ! # few edits in the configuration section below. default: @echo "Enter $(MAK) target " @echo " where 'target' is chosen from " ! @echo " djgpp ... DOS 32-bit exe [GNU C, Delorie, v2] " ! @echo " djgppv1 . DOS 32-bit exe [GNU C, Delorie, v1] " @echo " emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] " + @echo " emxnt ... NT exe [emx/gcc with RSXNT] " @echo " emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc] " @echo " msc ..... DOS exe [Microsoft C 7 & 8 (AKA 1.52)] " @echo " msc6 .... DOS exe [Microsoft C 6.00a] " @echo " msc6os2 . OS/2 exe [Microsoft C 6.00a] " @echo " msc6bnd . OS/2 and DOS exe [Microsoft C 6.00a] " ! @echo " vcWin32 . Win32 exe [Microsoft Visual C] " @echo " ----------------------------------------------------- " @echo " test .... Perform tests (see README_d/README.pc) " @echo " install . Install gawk under $(prefix)/ " # Support dropped in 3.0 + # - for Microsoft C 5.1 [16bit executable for OS/2 or DOS] # @echo " msc51 DOS exe [Microsoft C 5.1] " # @echo " msc51bnd OS/2 and DOS exe [Microsoft C 5.1] " *************** *** 68,73 **** --- 72,87 ---- # Define the install method. Method 1 is Unix-like (and requires cat, # cp, mkdir, sed, and sh); method 2 uses gawk and batch files. install = 1 + #------------------------------------------------------------------------ + # To work around command-line length problems, this makefile assumes + # that $($X) can be expanded. If using a make (such as nmake) which + # cannot handle such macros, define DO_LNK and DO_BIND for your target + # as $(L) and $(B), resp.; e.g., + #DO_LNK = $(LvcWin32) + #DO_BIND= $(BvcWin32) + # and then comment the following: + DO_LNK = $($(LNK)) + DO_BIND= $($(BIND)) #======================================================================== # End of general configuration. Some platform-specific configuration # notes appear below. *************** *** 77,85 **** #========================== DJGPP ======================================= #======================================================================== ! LDJG = $(CC) $(LF) -o gawk $(LDRSP) $(LF2) ! #BDJG = coff2exe -s /djgpp/bin/go32.exe gawk ! BDJG = coff2exe gawk djgpp: $(MAK) all \ --- 91,98 ---- #========================== DJGPP ======================================= #======================================================================== ! LDJG = $(CC) $(LF) -o gawk.exe $(LDRSP) $(LF2) ! BDJG = stubify -g awk.exe | stubedit awk.exe runfile=gawk djgpp: $(MAK) all \ *************** *** 93,98 **** --- 106,121 ---- LNK=LDJG LF2=-lm \ BIND=BDJG + LDJGv1 = $(CC) $(LF) -o gawk $(LDRSP) $(LF2) + #BDJGv1 = coff2exe -s /djgpp/bin/go32.exe gawk + BDJGv1 = coff2exe gawk + + djgppv1: + $(MAK) all \ + CC=gcc O=.o CF=-O \ + LNK=LDJGv1 LF=-s LF2=-lm \ + BIND=BDJGv1 + #======================================================================== #========================== EMX ========================================= #======================================================================== *************** *** 112,117 **** --- 135,145 ---- "CC=gcc -Zomf" O=.obj "CF=-O -DOS2" \ LNK=LEMX "LF=-s -Zcrtdll -Zstack 512" RSP= + emxnt: + $(MAK) all \ + "CC=gcc -Zwin32 -Zcrtdll=rsxntcs" O=.o "CF=-O -DOS2" \ + LNK=LEMX "LF=-s -Zstack 512" RSP= + emxbnd: $(MAK) all \ CC=gcc O=.o "CF=-O -DOS2 -DMSDOS" OBJ=popen.o \ *************** *** 120,126 **** emxbnd-debug: $(MAK) all \ ! CC=gcc O=.o CF="-g -DOS2 -DMSDOS" OBJ=popen.o \ LNK=LEMXBND \ BIND=BEMXD "P=|tr \" \" \"\n\"" --- 148,154 ---- emxbnd-debug: $(MAK) all \ ! CC=gcc O=.o "CF=-g -DOS2 -DMSDOS" OBJ=popen.o \ LNK=LEMXBND \ BIND=BEMXD "P=|tr \" \" \"\n\"" *************** *** 146,158 **** MSCCL = -FPi #MSCCL = -FPc ! LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x5900,nul # CLMSC-linking works when building under OS/2 CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00 BMSC = bind $@ /n DOSMAKEPIPE DOSCWAIT # Ugly hack: config.h defines __STDC__ if not defined on command-line. # OS/2 versions can't use -Za in getid.c. MSC7 uses stub headers in pc/ # due to ANSI conflicts. MSC 5.1 defines __STDC__=0 regardless of ANSI flag. --- 174,187 ---- MSCCL = -FPi #MSCCL = -FPc ! LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x5420,nul # CLMSC-linking works when building under OS/2 CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00 BMSC = bind $@ /n DOSMAKEPIPE DOSCWAIT + # Ugly hack: config.h defines __STDC__ if not defined on command-line. # OS/2 versions can't use -Za in getid.c. MSC7 uses stub headers in pc/ # due to ANSI conflicts. MSC 5.1 defines __STDC__=0 regardless of ANSI flag. *************** *** 168,173 **** --- 197,204 ---- "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include $(MSCOPT)" \ OBJ=popen.obj \ LNK=LMSC P=+ + Lmsc = $(LMSC) # for broken makes (nmake) which cannot expand $($X) + Bmsc = msc-debug: $(MAK) all \ *************** *** 182,187 **** --- 213,220 ---- "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT)" \ OBJ=popen.obj \ LNK=LMSC P=+ + Lmsc6 = $(LMSC) # for broken makes (nmake) which cannot expand $($X) + Bmsc6 = msc6os2: $(MAK) builtin.obj \ *************** *** 198,203 **** --- 231,248 ---- OBJ=popen.obj \ LNK=LMSC "LF2=p,gawk.def" P=+ \ BIND=BMSC + Lmsc6bnd = $(LMSC) # for broken makes (nmake) which cannot expand $($X) + Bmsc6bnd = $(BMSC) + + + # Windows '95 / NT + LvcWin32 = link -nologo -subsystem:console -release -out:$@ $(LNKRSP) + + vcWin32: + $(MAK) all \ + "CC=cl -nologo" O=.obj "CF=-o2 -DWIN32 -D__STDC__=0" \ + LNK=LvcWin32 + # Support dropped in 3.0 #msc51: *************** *** 212,235 **** # OBJ=popen.obj \ # LNK=CLMSC "LF=-Lp -Fb" "LF2=gawk.def" - - # The msvc32 target was supplied by a user, and is untested by the - # OS/2 and DOS maintainers. Bug reports welcomed. - - LNKMSVC32="link -out:gawk.exe $(LNKRSP)" - - msvc32: - $(MAK) all \ - "CC=cl -nologo" O=.obj "CF=-DMSDOS -D__STDC__=0" \ - OBJ=popen.obj \ - LNK=LNKMSVC32 - #======================================================================== # Define BIND for BINDless compiles, otherwise $($(BIND)) may break. BIND = EMPTY EMPTY= CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H # object files --- 257,270 ---- # OBJ=popen.obj \ # LNK=CLMSC "LF=-Lp -Fb" "LF2=gawk.def" #======================================================================== # Define BIND for BINDless compiles, otherwise $($(BIND)) may break. BIND = EMPTY EMPTY= + # bitwise operations (-DBITOPS) and non-decimal input data (-DNONDECDATA) are + # undocumented in 3.0.3. They may be enabled in config.h, or added to CFLAGS. CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H # object files *************** *** 256,264 **** all : gawk.exe gawk.exe:: $(GAWKOBJS) $(RSP) ! $($(LNK)) ! $($(BIND)) ! $(RSPFILE) : $(GAWKOBJS) echo $(AWKOBJS1)$P > $@ echo $(AWKOBJS2)$P >> $@ --- 291,299 ---- all : gawk.exe gawk.exe:: $(GAWKOBJS) $(RSP) ! $(DO_LNK) ! $(DO_BIND) ! $(RSPFILE) : $(GAWKOBJS) echo $(AWKOBJS1)$P > $@ echo $(AWKOBJS2)$P >> $@ *************** *** 293,299 **** sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat sh mkinstal.sh $(prefix)/bin sh mkinstal.sh $(prefix)/lib/awk $(prefix)/man/man1 $(prefix)/info ! cp gawk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin cp awklib/eg/lib/* pc/awklib/igawk.awk $(prefix)/lib/awk cp doc/*.1 $(prefix)/man/man1 cp doc/gawk.info $(prefix)/info --- 328,334 ---- sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat sh mkinstal.sh $(prefix)/bin sh mkinstal.sh $(prefix)/lib/awk $(prefix)/man/man1 $(prefix)/info ! cp *awk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin cp awklib/eg/lib/* pc/awklib/igawk.awk $(prefix)/lib/awk cp doc/*.1 $(prefix)/man/man1 cp doc/gawk.info $(prefix)/info diff -crN gawk-3.0.2/pc/Makefile.tst gawk-3.0.3/pc/Makefile.tst *** gawk-3.0.2/pc/Makefile.tst Sat Dec 7 20:19:36 1996 --- gawk-3.0.3/pc/Makefile.tst Wed May 14 19:37:58 1997 *************** *** 1,6 **** # Makefile for GNU Awk test suite. # ! # Copyright (C) 1988-1996 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,6 ---- # Makefile for GNU Awk test suite. # ! # Copyright (C) 1988-1997 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 70,76 **** # Using EMXSHELL=/bin/sh with emx versions can exhaust lower mem. # Lower mem can also be exhausted on some of the tests even with MSC gawk. # The .SWAP setting forces (DOS-only) dmake to swap itself out. ! .SWAP: childin fflush getlnhd tweakfld # This won't work unless you have "sh" and set SHELL equal to it (Make 3.74 # or later which comes with DJGPP will work with SHELL=/bin/sh if you have --- 70,76 ---- # Using EMXSHELL=/bin/sh with emx versions can exhaust lower mem. # Lower mem can also be exhausted on some of the tests even with MSC gawk. # The .SWAP setting forces (DOS-only) dmake to swap itself out. ! .SWAP: childin fflush getlnhd tweakfld pipeio1 # This won't work unless you have "sh" and set SHELL equal to it (Make 3.74 # or later which comes with DJGPP will work with SHELL=/bin/sh if you have *************** *** 100,107 **** #MKDIR = true && command -c mkdir # Set your unix-style date function here - #DATE = date DATE = gdate # ============================================================================ # You shouldn't need to modify anything below this line. --- 100,107 ---- #MKDIR = true && command -c mkdir # Set your unix-style date function here DATE = gdate + #DATE = date # ============================================================================ # You shouldn't need to modify anything below this line. *************** *** 119,130 **** numsubstr pcntplus prmreuse math fldchg fldchgnf reindops \ sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ ! back89 tradanch nlfldsep splitvar ! unix-tests: poundba fflush getlnhd gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ ! badargs strftime gensub gnureops extra: regtes inftest --- 119,131 ---- numsubstr pcntplus prmreuse math fldchg fldchgnf reindops \ sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ ! back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \ ! noparms funstack clobber delarprm prdupval ! unix-tests: poundba fflush getlnhd pipeio1 pipeio2 strftlng pid gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ ! badargs strftime gensub gnureops reint nondec extra: regtes inftest *************** *** 207,212 **** --- 208,216 ---- @$(MKDIR) junk @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@ @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ + @echo 'If manyfiles says "junk/*: No such file or directory",' + @echo 'use the line on test/Makefile which invokes wc' + @echo 'without quoting the "junk/*" argument.' # @echo "This number better be 1 ->" | tr -d '\012' @echo "This number better be 1 ->" | tr -d '\012\015' # @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l *************** *** 318,328 **** strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results ! # @date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; ! @$(DATE) | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ print > "strftime.ok" ; \ print strftime() > "'_$@'" }' ! $(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ --- 322,336 ---- strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results ! # @LC_ALL=C; export LC_ALL; LANC=C; export LANG; \ ! # date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ ! # This was changed for DOS to avoid the command-line length limit. ! @LC_ALL=C; export LC_ALL; LANC=C; export LANG; $(DATE) > strf ! @cat strf | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ print > "strftime.ok" ; \ print strftime() > "'_$@'" }' ! # $(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 ! $(CMP) strftime.ok _$@ && rm -f _$@ strf strftime.ok || exit 0 litoct:: @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ *************** *** 480,494 **** $(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ nlfldsep:: ! AWK=$(AWK); export AWK; $(srcdir)/nlfldsep.sh > _$@ $(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ splitvar:: @$(AWK) -f $(srcdir)/splitvar.awk $(srcdir)/splitvar.in >_$@ $(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ clean: ! rm -fr _* core junk out1 out2 out3 strftime.ok *~ distclean: clean rm -f Makefile --- 488,588 ---- $(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ nlfldsep:: ! @$(AWK) -f $(srcdir)/nlfldsep.awk $(srcdir)/nlfldsep.in > _$@ $(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ splitvar:: @$(AWK) -f $(srcdir)/splitvar.awk $(srcdir)/splitvar.in >_$@ $(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ + intest:: + @$(AWK) -f $(srcdir)/intest.awk >_$@ + $(CMP) $(srcdir)/intest.ok _$@ && rm -f _$@ + + # AIX /bin/sh exec's the last command in a list, therefore issue a ":" + # command so that pid.sh is fork'ed as a child before being exec'ed. + pid:: + @echo 'Expect pid to fail in DOS.' + @AWKPATH=$(srcdir) AWK=$(AWK) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : + -$(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in + + strftlng:: + @echo 'Edit test/Makefile if you use MSC6, since strftlng will fail.' + @TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ + @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ + TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ + fi + $(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ + + nfldstr:: + @echo | $(AWK) '$$1 == 0 { print "bug" }' > _$@ + $(CMP) $(srcdir)/nfldstr.ok _$@ && rm -f _$@ + + nors:: + # @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ + @echo A B C D E | tr -d '\15\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ + $(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ + + fnarydel:: + @$(AWK) -f $(srcdir)/fnarydel.awk >_$@ + $(CMP) $(srcdir)/fnarydel.ok _$@ && rm -f _$@ + + reint:: + @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ + $(CMP) $(srcdir)/reint.ok _$@ && rm -f _$@ + + noparms:: + @-AWKPATH=$(srcdir) $(AWK) -f noparms.awk >_$@ 2>&1 || exit 0 + $(CMP) $(srcdir)/noparms.ok _$@ && rm -f _$@ + + pipeio1:: + @echo 'Pipeio1 is set to ignore errors. However, there should not be any.' + @echo 'If pipeio1 fails, set sh to swap to disk only (in sh.rc).' + @echo 'If it still hangs with EMX gawk type ^C, then try the test when' + @echo 'not using DPMI and RSX (in particular, run outside MS-Windows).' + @$(AWK) -f $(srcdir)/pipeio1.awk >_$@ + @rm -f test1 test2 + -$(CMP) $(srcdir)/pipeio1.ok _$@ && rm -f _$@ + + pipeio2:: + # This would fail were it not for the "cat" line due to DOS's ECHO command. + @echo 'pipeio may fail due to the way that your tr & echo work in DOS' + @$(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@ + @cat _$@ | $(AWK) '{ sub("ECHO is.*","",$$0); print $$0 } ' > _$@.2 + # $(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@ + -diff -w $(srcdir)/pipeio2.ok _$@.2 && rm -f _$@ _$@.2 + + funstack:: + @echo 'Expect funstack to fail with MSC DOS versions.' + -@$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@ && $(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@ + + clobber:: + @$(AWK) -f $(srcdir)/clobber.awk >_$@ + $(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@ + @rm -f seq + + delarprm:: + @$(AWK) -f $(srcdir)/delarprm.awk >_$@ + $(CMP) $(srcdir)/delarprm.ok _$@ && rm -f _$@ + + prdupval:: + @$(AWK) -f $(srcdir)/prdupval.awk $(srcdir)/prdupval.in >_$@ + $(CMP) $(srcdir)/prdupval.ok _$@ && rm -f _$@ + + nondec:: + # This was changed for DOS to avoid the command-line length limit. + # @if grep BITOP ../config.h | grep define > /dev/null; \ + # then \ + # $(AWK) -f $(srcdir)/nondec.awk >_$@; \ + # else \ + # cp $(srcdir)/nondec.ok _$@; \ + # fi + @echo "Don't worry if nondec fails" + $(AWK) -f $(srcdir)/nondec.awk >_$@; + -$(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@ + clean: ! rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~ distclean: clean rm -f Makefile diff -crN gawk-3.0.2/pc/config.h gawk-3.0.3/pc/config.h *** gawk-3.0.2/pc/config.h Mon Oct 7 19:36:28 1996 --- gawk-3.0.3/pc/config.h Wed May 14 21:36:34 1997 *************** *** 5,11 **** */ /* ! * Copyright (C) 1995 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. --- 5,11 ---- */ /* ! * Copyright (C) 1995-1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. *************** *** 128,133 **** --- 128,136 ---- #define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ #define SPRINTF_RET int /* return type of sprintf */ + /* #define BITOPS 1 */ /* bitwise ops (undocumented feature) */ + /* #define NONDECDATA 1 */ /* non-decimal input data (undocumented feature) */ + /* Define if you have the fmod function. */ #define HAVE_FMOD 1 *************** *** 210,213 **** --- 213,220 ---- #if defined(DJGPP) # define HAVE_LIMITS_H + #endif + + #if defined(__WIN32__) && defined(__CRTRSXNT__) + #include #endif diff -crN gawk-3.0.2/pc/install.awk gawk-3.0.3/pc/install.awk *** gawk-3.0.2/pc/install.awk Tue Jan 9 21:10:11 1996 --- gawk-3.0.3/pc/install.awk Fri Jan 17 20:06:32 1997 *************** *** 53,59 **** printf("@sh %s/bin/igawk %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9", prefix) > igawk_bat # Do common ! cp(igawk " gawk.exe " prefix "/bin") mkinstalldirs(prefix "/lib/awk " prefix "/man/man1 " prefix "/info") cp("awklib/eg/lib/* pc/awklib/igawk.awk " prefix "/lib/awk"); cp("doc/*.1 " prefix "/man/man1"); --- 53,59 ---- printf("@sh %s/bin/igawk %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9", prefix) > igawk_bat # Do common ! cp(igawk " *awk.exe " prefix "/bin") mkinstalldirs(prefix "/lib/awk " prefix "/man/man1 " prefix "/info") cp("awklib/eg/lib/* pc/awklib/igawk.awk " prefix "/lib/awk"); cp("doc/*.1 " prefix "/man/man1"); diff -crN gawk-3.0.2/posix/ChangeLog gawk-3.0.3/posix/ChangeLog *** gawk-3.0.2/posix/ChangeLog Wed Dec 25 11:26:23 1996 --- gawk-3.0.3/posix/ChangeLog Thu May 15 12:50:47 1997 *************** *** 1,3 **** --- 1,11 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/posix/gawkmisc.c gawk-3.0.3/posix/gawkmisc.c *** gawk-3.0.2/posix/gawkmisc.c Sun Oct 20 21:13:56 1996 --- gawk-3.0.3/posix/gawkmisc.c Thu May 1 21:36:26 1997 *************** *** 1,27 **** ! /* ! * gawkmisc.c --- miscellanious gawk routines that are OS specific. ! */ ! /* ! * Copyright (C) 1986, 1988, 1989, 1991 - 96 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 ! */ char quote = '\''; char *defpath = DEFPATH; --- 1,20 ---- ! /* gawkmisc.c --- miscellanious gawk routines that are OS specific. ! ! Copyright (C) 1986, 1988, 1989, 1991 - 96 the Free Software Foundation, Inc. ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ char quote = '\''; char *defpath = DEFPATH; diff -crN gawk-3.0.2/regex.c gawk-3.0.3/regex.c *** gawk-3.0.2/regex.c Sun Oct 6 22:19:33 1996 --- gawk-3.0.3/regex.c Tue May 13 12:41:04 1997 *************** *** 1,9 **** /* Extended regular expression matching and search library, version 0.12. ! (Implements POSIX draft P10003.2/D11.2, except for internationalization features.) ! Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,9 ---- /* Extended regular expression matching and search library, version 0.12. ! (Implements POSIX draft P1003.2/D11.2, except for some of the internationalization features.) ! Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. 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 *************** *** 16,24 **** 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. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (REGEX_MALLOC) --- 16,23 ---- 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. */ /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (REGEX_MALLOC) *************** *** 39,44 **** --- 38,50 ---- #include #endif + /* For platform which support the ISO C amendement 1 functionality we + support user defined character classes. */ + #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) + # include + # include + #endif + /* This is for other GNU distributions with internationalized messages. */ #if HAVE_LIBINTL_H || defined (_LIBC) # include *************** *** 501,507 **** } while (0) #ifdef DEBUG ! static void extract_number _RE_ARGS((int *dest, unsigned char *source)); static void extract_number (dest, source) int *dest; --- 507,513 ---- } while (0) #ifdef DEBUG ! static void extract_number _RE_ARGS ((int *dest, unsigned char *source)); static void extract_number (dest, source) int *dest; *************** *** 529,536 **** } while (0) #ifdef DEBUG ! static void extract_number_and_incr _RE_ARGS((int *destination, ! unsigned char **source)); static void extract_number_and_incr (destination, source) int *destination; --- 535,542 ---- } while (0) #ifdef DEBUG ! static void extract_number_and_incr _RE_ARGS ((int *destination, ! unsigned char **source)); static void extract_number_and_incr (destination, source) int *destination; *************** *** 615,620 **** --- 621,627 ---- unsigned char *end; { int mcnt, mcnt2; + unsigned char *p1; unsigned char *p = start; unsigned char *pend = end; *************** *** 756,775 **** case succeed_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); ! printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2); break; case jump_n: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); ! printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2); break; case set_number_at: extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt2, &p); ! printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2); break; case wordbound: --- 763,785 ---- case succeed_n: extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); ! printf ("/succeed_n to %d, %d times", p1 - start, mcnt2); break; case jump_n: extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); ! printf ("/jump_n to %d, %d times", p1 - start, mcnt2); break; case set_number_at: extract_number_and_incr (&mcnt, &p); + p1 = p + mcnt; extract_number_and_incr (&mcnt2, &p); ! printf ("/set_number_at location %d to %d", p1 - start, mcnt2); break; case wordbound: *************** *** 847,853 **** unsigned char *buffer = bufp->buffer; print_partial_compiled_pattern (buffer, buffer + bufp->used); ! printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated); if (bufp->fastmap_accurate && bufp->fastmap) { --- 857,864 ---- unsigned char *buffer = bufp->buffer; print_partial_compiled_pattern (buffer, buffer + bufp->used); ! printf ("%ld bytes used/%ld bytes allocated.\n", ! bufp->used, bufp->allocated); if (bufp->fastmap_accurate && bufp->fastmap) { *************** *** 862,868 **** printf ("no_sub: %d\t", bufp->no_sub); printf ("not_bol: %d\t", bufp->not_bol); printf ("not_eol: %d\t", bufp->not_eol); ! printf ("syntax: %d\n", bufp->syntax); /* Perhaps we should print the translate table? */ } --- 873,879 ---- printf ("no_sub: %d\t", bufp->no_sub); printf ("not_bol: %d\t", bufp->not_bol); printf ("not_eol: %d\t", bufp->not_eol); ! printf ("syntax: %lx\n", bufp->syntax); /* Perhaps we should print the translate table? */ } *************** *** 875,881 **** int size1; int size2; { ! unsigned this_char; if (where == NULL) printf ("(null)"); --- 886,892 ---- int size1; int size2; { ! int this_char; if (where == NULL) printf ("(null)"); *************** *** 896,904 **** void printchar (c) ! int c; { ! putc(c, stderr); } #else /* not DEBUG */ --- 907,915 ---- void printchar (c) ! int c; { ! putc (c, stderr); } #else /* not DEBUG */ *************** *** 1031,1045 **** #ifdef INT_IS_16BIT #if defined (MATCH_MAY_ALLOCATE) ! long re_max_failures = 20000; #else ! long re_max_failures = 2000; #endif union fail_stack_elt { unsigned char *pointer; ! long integer; }; typedef union fail_stack_elt fail_stack_elt_t; --- 1042,1058 ---- #ifdef INT_IS_16BIT #if defined (MATCH_MAY_ALLOCATE) ! /* 4400 was enough to cause a crash on Alpha OSF/1, ! whose default stack limit is 2mb. */ ! long int re_max_failures = 4000; #else ! long int re_max_failures = 2000; #endif union fail_stack_elt { unsigned char *pointer; ! long int integer; }; typedef union fail_stack_elt fail_stack_elt_t; *************** *** 1047,1054 **** typedef struct { fail_stack_elt_t *stack; ! unsigned long size; ! unsigned long avail; /* Offset of next open position. */ } fail_stack_type; #else /* not INT_IS_16BIT */ --- 1060,1067 ---- typedef struct { fail_stack_elt_t *stack; ! unsigned long int size; ! unsigned long int avail; /* Offset of next open position. */ } fail_stack_type; #else /* not INT_IS_16BIT */ *************** *** 1118,1124 **** REGEX_REALLOCATE_STACK requires `destination' be declared. */ #define DOUBLE_FAIL_STACK(fail_stack) \ ! ((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \ ? 0 \ : ((fail_stack).stack = (fail_stack_elt_t *) \ REGEX_REALLOCATE_STACK ((fail_stack).stack, \ --- 1131,1137 ---- REGEX_REALLOCATE_STACK requires `destination' be declared. */ #define DOUBLE_FAIL_STACK(fail_stack) \ ! ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ ? 0 \ : ((fail_stack).stack = (fail_stack_elt_t *) \ REGEX_REALLOCATE_STACK ((fail_stack).stack, \ *************** *** 1189,1196 **** char *destination; \ /* Must be int, so when we don't save any registers, the arithmetic \ of 0 + -1 isn't done as unsigned. */ \ ! /* Can't be int, since there is not a shred of a guarantee that int \ ! is wide enough to hold a value of something to which pointer can \ be assigned */ \ s_reg_t this_reg; \ \ --- 1202,1209 ---- char *destination; \ /* Must be int, so when we don't save any registers, the arithmetic \ of 0 + -1 isn't done as unsigned. */ \ ! /* Can't be int, since there is not a shred of a guarantee that int \ ! is wide enough to hold a value of something to which pointer can \ be assigned */ \ s_reg_t this_reg; \ \ *************** *** 1248,1254 **** DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ PUSH_FAILURE_INT (highest_active_reg); \ \ ! DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ PUSH_FAILURE_POINTER (pattern_place); \ \ --- 1261,1267 ---- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ PUSH_FAILURE_INT (highest_active_reg); \ \ ! DEBUG_PRINT2 (" Pushing pattern 0x%x:\n", pattern_place); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ PUSH_FAILURE_POINTER (pattern_place); \ \ *************** *** 1332,1338 **** DEBUG_PRINT1 ("'\n"); \ \ pat = (unsigned char *) POP_FAILURE_POINTER (); \ ! DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ \ /* Restore register info. */ \ --- 1345,1351 ---- DEBUG_PRINT1 ("'\n"); \ \ pat = (unsigned char *) POP_FAILURE_POINTER (); \ ! DEBUG_PRINT2 (" Popping pattern 0x%x:\n", pat); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ \ /* Restore register info. */ \ *************** *** 1435,1459 **** /* Subroutine declarations and macros for regex_compile. */ ! static reg_errcode_t regex_compile _RE_ARGS((const char *pattern, size_t size, ! reg_syntax_t syntax, ! struct re_pattern_buffer *bufp)); ! static void store_op1 _RE_ARGS((re_opcode_t op, unsigned char *loc, int arg)); ! static void store_op2 _RE_ARGS((re_opcode_t op, unsigned char *loc, ! int arg1, int arg2)); ! static void insert_op1 _RE_ARGS((re_opcode_t op, unsigned char *loc, ! int arg, unsigned char *end)); ! static void insert_op2 _RE_ARGS((re_opcode_t op, unsigned char *loc, ! int arg1, int arg2, unsigned char *end)); ! static boolean at_begline_loc_p _RE_ARGS((const char *pattern, const char *p, ! reg_syntax_t syntax)); ! static boolean at_endline_loc_p _RE_ARGS((const char *p, const char *pend, ! reg_syntax_t syntax)); ! static reg_errcode_t compile_range _RE_ARGS((const char **p_ptr, ! const char *pend, ! char *translate, ! reg_syntax_t syntax, ! unsigned char *b)); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant --- 1448,1472 ---- /* Subroutine declarations and macros for regex_compile. */ ! static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, ! reg_syntax_t syntax, ! struct re_pattern_buffer *bufp)); ! static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); ! static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, ! int arg1, int arg2)); ! static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, ! int arg, unsigned char *end)); ! static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, ! int arg1, int arg2, unsigned char *end)); ! static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p, ! reg_syntax_t syntax)); ! static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend, ! reg_syntax_t syntax)); ! static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, ! const char *pend, ! char *translate, ! reg_syntax_t syntax, ! unsigned char *b)); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant *************** *** 1495,1501 **** /* Make sure we have at least N more bytes of space in buffer. */ #define GET_BUFFER_SPACE(n) \ ! while (b - bufp->buffer + (n) > bufp->allocated) \ EXTEND_BUFFER () /* Make sure we have one more byte of buffer space and then add C to it. */ --- 1508,1514 ---- /* Make sure we have at least N more bytes of space in buffer. */ #define GET_BUFFER_SPACE(n) \ ! while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ EXTEND_BUFFER () /* Make sure we have one more byte of buffer space and then add C to it. */ *************** *** 1528,1546 **** /* Store a jump with opcode OP at LOC to location TO. We store a relative address offset by the three bytes the jump itself occupies. */ #define STORE_JUMP(op, loc, to) \ ! store_op1 (op, loc, (int)((to) - (loc) - 3)) /* Likewise, for a two-argument jump. */ #define STORE_JUMP2(op, loc, to, arg) \ ! store_op2 (op, loc, (int)((to) - (loc) - 3), arg) /* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP(op, loc, to) \ ! insert_op1 (op, loc, (int)((to) - (loc) - 3), b) /* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP2(op, loc, to, arg) \ ! insert_op2 (op, loc, (int)((to) - (loc) - 3), arg, b) /* This is not an arbitrary limit: the arguments which represent offsets --- 1541,1559 ---- /* Store a jump with opcode OP at LOC to location TO. We store a relative address offset by the three bytes the jump itself occupies. */ #define STORE_JUMP(op, loc, to) \ ! store_op1 (op, loc, (int) ((to) - (loc) - 3)) /* Likewise, for a two-argument jump. */ #define STORE_JUMP2(op, loc, to, arg) \ ! store_op2 (op, loc, (int) ((to) - (loc) - 3), arg) /* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP(op, loc, to) \ ! insert_op1 (op, loc, (int) ((to) - (loc) - 3), b) /* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ #define INSERT_JUMP2(op, loc, to, arg) \ ! insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b) /* This is not an arbitrary limit: the arguments which represent offsets *************** *** 1551,1565 **** MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up reallocating to 0 bytes. Such thing is not going to work too well. You have been warned!! */ ! #ifdef _MSC_VER /* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. The REALLOC define eliminates a flurry of conversion warnings, but is not required. */ #define MAX_BUF_SIZE 65500L ! #define REALLOC(p,s) realloc((p), (size_t) (s)) #else #define MAX_BUF_SIZE (1L << 16) ! #define REALLOC realloc #endif /* Extend the buffer by twice its current size via realloc and --- 1564,1578 ---- MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up reallocating to 0 bytes. Such thing is not going to work too well. You have been warned!! */ ! #if defined(_MSC_VER) && !defined(WIN32) /* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. The REALLOC define eliminates a flurry of conversion warnings, but is not required. */ #define MAX_BUF_SIZE 65500L ! #define REALLOC(p,s) realloc ((p), (size_t) (s)) #else #define MAX_BUF_SIZE (1L << 16) ! #define REALLOC(p,s) realloc ((p), (s)) #endif /* Extend the buffer by twice its current size via realloc and *************** *** 1574,1580 **** bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ ! bufp->buffer = (unsigned char *) REALLOC(bufp->buffer, bufp->allocated);\ if (bufp->buffer == NULL) \ return REG_ESPACE; \ /* If the buffer moved, move all the pointers into it. */ \ --- 1587,1593 ---- bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ ! bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ if (bufp->buffer == NULL) \ return REG_ESPACE; \ /* If the buffer moved, move all the pointers into it. */ \ *************** *** 1606,1612 **** /* Since offsets can go either forwards or backwards, this type needs to be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ ! /* int may be not enough when sizeof(int) == 2 */ typedef long pattern_offset_t; typedef struct --- 1619,1625 ---- /* Since offsets can go either forwards or backwards, this type needs to be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ ! /* int may be not enough when sizeof(int) == 2. */ typedef long pattern_offset_t; typedef struct *************** *** 1659,1673 **** } \ } ! #define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ ! #define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ || STREQ (string, "lower") || STREQ (string, "digit") \ || STREQ (string, "alnum") || STREQ (string, "xdigit") \ || STREQ (string, "space") || STREQ (string, "print") \ || STREQ (string, "punct") || STREQ (string, "graph") \ || STREQ (string, "cntrl") || STREQ (string, "blank")) #ifndef MATCH_MAY_ALLOCATE --- 1672,1700 ---- } \ } ! #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) ! /* The GNU C library provides support for user-defined character classes ! and the functions from ISO C amendement 1. */ ! # ifdef CHARCLASS_NAME_MAX ! # define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX ! # else ! /* This shouldn't happen but some implementation might still have this ! problem. Use a reasonable default value. */ ! # define CHAR_CLASS_MAX_LENGTH 256 ! # endif ! ! # define IS_CHAR_CLASS(string) wctype (string) ! #else ! # define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ ! # define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ || STREQ (string, "lower") || STREQ (string, "digit") \ || STREQ (string, "alnum") || STREQ (string, "xdigit") \ || STREQ (string, "space") || STREQ (string, "print") \ || STREQ (string, "punct") || STREQ (string, "graph") \ || STREQ (string, "cntrl") || STREQ (string, "blank")) + #endif #ifndef MATCH_MAY_ALLOCATE *************** *** 1717,1725 **** #endif /* not MATCH_MAY_ALLOCATE */ ! static boolean group_in_compile_stack _RE_ARGS((compile_stack_type ! compile_stack, ! regnum_t regnum)); /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. Returns one of error codes defined in `regex.h', or zero for success. --- 1744,1752 ---- #endif /* not MATCH_MAY_ALLOCATE */ ! static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type ! compile_stack, ! regnum_t regnum)); /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. Returns one of error codes defined in `regex.h', or zero for success. *************** *** 2145,2150 **** --- 2172,2205 ---- the leading `:' and `[' (but set bits for them). */ if (c == ':' && *p == ']') { + #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) + boolean is_lower = STREQ (str, "lower"); + boolean is_upper = STREQ (str, "upper"); + wctype_t wt; + int ch; + + wt = wctype (str); + if (wt == 0) + FREE_STACK_RETURN (REG_ECTYPE); + + /* Throw away the ] at the end of the character + class. */ + PATFETCH (c); + + if (p == pend) FREE_STACK_RETURN (REG_EBRACK); + + for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) + { + if (iswctype (btowc (ch), wt)) + SET_LIST_BIT (ch); + + if (translate && (is_upper || is_lower) + && (ISUPPER (ch) || ISLOWER (ch))) + SET_LIST_BIT (ch); + } + + had_char_class = true; + #else int ch; boolean is_alnum = STREQ (str, "alnum"); boolean is_alpha = STREQ (str, "alpha"); *************** *** 2187,2197 **** || (is_upper && ISUPPER (ch)) || (is_xdigit && ISXDIGIT (ch))) SET_LIST_BIT (ch); ! if ( translate && (is_upper || is_lower) ! && (ISUPPER(ch) || ISLOWER(ch))) SET_LIST_BIT (ch); } had_char_class = true; } else { --- 2242,2253 ---- || (is_upper && ISUPPER (ch)) || (is_xdigit && ISXDIGIT (ch))) SET_LIST_BIT (ch); ! if ( translate && (is_upper || is_lower) ! && (ISUPPER (ch) || ISLOWER (ch))) SET_LIST_BIT (ch); } had_char_class = true; + #endif /* libc || wctype.h */ } else { *************** *** 2616,2622 **** case 'w': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; laststart = b; BUF_PUSH (wordchar); break; --- 2672,2678 ---- case 'w': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; laststart = b; BUF_PUSH (wordchar); break; *************** *** 2624,2630 **** case 'W': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; laststart = b; BUF_PUSH (notwordchar); break; --- 2680,2686 ---- case 'W': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; laststart = b; BUF_PUSH (notwordchar); break; *************** *** 2632,2668 **** case '<': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordbeg); break; case '>': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordend); break; case 'b': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordbound); break; case 'B': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (notwordbound); break; case '`': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (begbuf); break; case '\'': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (endbuf); break; --- 2688,2724 ---- case '<': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordbeg); break; case '>': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordend); break; case 'b': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (wordbound); break; case 'B': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (notwordbound); break; case '`': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (begbuf); break; case '\'': if (re_syntax_options & RE_NO_GNU_OPS) ! goto normal_char; BUF_PUSH (endbuf); break; *************** *** 2677,2683 **** FREE_STACK_RETURN (REG_ESUBREG); /* Can't back reference to a subexpression if inside of it. */ ! if (group_in_compile_stack (compile_stack, (regnum_t)c1)) goto normal_char; laststart = b; --- 2733,2739 ---- FREE_STACK_RETURN (REG_ESUBREG); /* Can't back reference to a subexpression if inside of it. */ ! if (group_in_compile_stack (compile_stack, (regnum_t) c1)) goto normal_char; laststart = b; *************** *** 2961,2967 **** unsigned this_char; const char *p = *p_ptr; ! int range_start, range_end; if (p == pend) return REG_ERANGE; --- 3017,3023 ---- unsigned this_char; const char *p = *p_ptr; ! unsigned int range_start, range_end; if (p == pend) return REG_ERANGE; *************** *** 3611,3627 **** } #endif /* not emacs */ ! static boolean group_match_null_string_p _RE_ARGS((unsigned char **p, ! unsigned char *end, ! register_info_type *reg_info)); ! static boolean alt_match_null_string_p _RE_ARGS((unsigned char *p, ! unsigned char *end, ! register_info_type *reg_info)); ! static boolean common_op_match_null_string_p _RE_ARGS((unsigned char **p, ! unsigned char *end, register_info_type *reg_info)); ! static int bcmp_translate _RE_ARGS((const char *s1, const char *s2, ! int len, char *translate)); /* re_match_2 matches the compiled pattern in BUFP against the the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 --- 3667,3683 ---- } #endif /* not emacs */ ! static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p, ! unsigned char *end, ! register_info_type *reg_info)); ! static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p, ! unsigned char *end, ! register_info_type *reg_info)); ! static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p, ! unsigned char *end, register_info_type *reg_info)); ! static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2, ! int len, char *translate)); /* re_match_2 matches the compiled pattern in BUFP against the the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 *************** *** 3835,3841 **** /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. Also initialize the register information struct. */ ! for (mcnt = 1; mcnt < num_regs; mcnt++) { regstart[mcnt] = regend[mcnt] = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; --- 3891,3897 ---- /* Initialize subexpression text positions to -1 to mark ones that no start_memory/stop_memory has been seen for. Also initialize the register information struct. */ ! for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) { regstart[mcnt] = regend[mcnt] = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; *************** *** 3887,3893 **** dend = end_match_2; } ! DEBUG_PRINT1 ("The compiled pattern is: "); DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); DEBUG_PRINT1 ("The string to match is: `"); DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); --- 3943,3949 ---- dend = end_match_2; } ! DEBUG_PRINT1 ("The compiled pattern is:\n"); DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); DEBUG_PRINT1 ("The string to match is: `"); DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); *************** *** 3898,3904 **** --- 3954,3964 ---- fails at this starting point in the input data. */ for (;;) { + #ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); + #else DEBUG_PRINT2 ("\n0x%x: ", p); + #endif if (p == pend) { /* End of pattern means we might have succeeded. */ *************** *** 3935,3941 **** DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); ! for (mcnt = 1; mcnt < num_regs; mcnt++) { best_regstart[mcnt] = regstart[mcnt]; best_regend[mcnt] = regend[mcnt]; --- 3995,4001 ---- DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); ! for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) { best_regstart[mcnt] = regstart[mcnt]; best_regend[mcnt] = regend[mcnt]; *************** *** 3961,3967 **** dend = ((d >= string1 && d <= end1) ? end_match_1 : end_match_2); ! for (mcnt = 1; mcnt < num_regs; mcnt++) { regstart[mcnt] = best_regstart[mcnt]; regend[mcnt] = best_regend[mcnt]; --- 4021,4027 ---- dend = ((d >= string1 && d <= end1) ? end_match_1 : end_match_2); ! for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) { regstart[mcnt] = best_regstart[mcnt]; regend[mcnt] = best_regend[mcnt]; *************** *** 4026,4032 **** /* Go through the first `min (num_regs, regs->num_regs)' registers, since that is all we initialized. */ ! for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++) { if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) regs->start[mcnt] = regs->end[mcnt] = -1; --- 4086,4093 ---- /* Go through the first `min (num_regs, regs->num_regs)' registers, since that is all we initialized. */ ! for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); ! mcnt++) { if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) regs->start[mcnt] = regs->end[mcnt] = -1; *************** *** 4044,4050 **** we (re)allocated the registers, this is the case, because we always allocate enough to have at least one -1 at the end. */ ! for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++) regs->start[mcnt] = regs->end[mcnt] = -1; } /* regs && !bufp->no_sub */ --- 4105,4111 ---- we (re)allocated the registers, this is the case, because we always allocate enough to have at least one -1 at the end. */ ! for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++) regs->start[mcnt] = regs->end[mcnt] = -1; } /* regs && !bufp->no_sub */ *************** *** 4316,4322 **** EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; /* Restore this and inner groups' (if any) registers. */ ! for (r = *p; r < *p + *(p + 1); r++) { regstart[r] = old_regstart[r]; --- 4377,4384 ---- EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; /* Restore this and inner groups' (if any) registers. */ ! for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1); ! r++) { regstart[r] = old_regstart[r]; *************** *** 4475,4481 **** --- 4537,4547 ---- DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); + #ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt); + #else DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); + #endif PUSH_FAILURE_POINT (p + mcnt, NULL, -2); break; *************** *** 4498,4504 **** --- 4564,4574 ---- DEBUG_PRINT1 ("EXECUTING on_failure_jump"); EXTRACT_NUMBER_AND_INCR (mcnt, p); + #ifdef _LIBC + DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt); + #else DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); + #endif /* If this on_failure_jump comes right before a group (i.e., the original * applied to a group), save the information *************** *** 4626,4635 **** --- 4696,4712 ---- = *p2 == (unsigned char) endline ? '\n' : p2[2]; #endif + #if 0 if ((re_opcode_t) p1[3] == exactn && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] && (p2[2 + p1[5] / BYTEWIDTH] & (1 << (p1[5] % BYTEWIDTH))))) + #else + if ((re_opcode_t) p1[3] == exactn + && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] + && (p2[2 + p1[4] / BYTEWIDTH] + & (1 << (p1[4] % BYTEWIDTH))))) + #endif { p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", *************** *** 4704,4719 **** dummy_low_reg, dummy_high_reg, reg_dummy, reg_dummy, reg_info_dummy); } ! /* Note fall through. */ /* Unconditionally jump (without popping any failure points). */ case jump: - unconditional_jump: EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); p += mcnt; /* Do the jump. */ DEBUG_PRINT2 ("(to 0x%x).\n", p); break; --- 4781,4806 ---- dummy_low_reg, dummy_high_reg, reg_dummy, reg_dummy, reg_info_dummy); } ! /* Note fall through. */ + unconditional_jump: + #ifdef _LIBC + DEBUG_PRINT2 ("\n%p: ", p); + #else + DEBUG_PRINT2 ("\n0x%x: ", p); + #endif + /* Note fall through. */ /* Unconditionally jump (without popping any failure points). */ case jump: EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); p += mcnt; /* Do the jump. */ + #ifdef _LIBC + DEBUG_PRINT2 ("(to %p).\n", p); + #else DEBUG_PRINT2 ("(to 0x%x).\n", p); + #endif break; *************** *** 4762,4772 **** mcnt--; p += 2; STORE_NUMBER_AND_INCR (p, mcnt); ! DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt); } else if (mcnt == 0) { DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; goto on_failure; --- 4849,4867 ---- mcnt--; p += 2; STORE_NUMBER_AND_INCR (p, mcnt); ! #ifdef _LIBC ! DEBUG_PRINT3 (" Setting %p to %d.\n", p - 2, mcnt); ! #else ! DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - 2, mcnt); ! #endif } else if (mcnt == 0) { + #ifdef _LIBC + DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2); + #else DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); + #endif p[2] = (unsigned char) no_op; p[3] = (unsigned char) no_op; goto on_failure; *************** *** 4782,4787 **** --- 4877,4887 ---- { mcnt--; STORE_NUMBER (p + 2, mcnt); + #ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p + 2, mcnt); + #else + DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + 2, mcnt); + #endif goto unconditional_jump; } /* If don't have to jump any more, skip over the rest of command. */ *************** *** 4796,4802 **** --- 4896,4906 ---- EXTRACT_NUMBER_AND_INCR (mcnt, p); p1 = p + mcnt; EXTRACT_NUMBER_AND_INCR (mcnt, p); + #ifdef _LIBC + DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt); + #else DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); + #endif STORE_NUMBER (p1, mcnt); break; } *************** *** 5252,5259 **** register int len; RE_TRANSLATE_TYPE translate; { ! register const unsigned char *p1 = (const unsigned char *) s1, ! *p2 = (const unsigned char *) s2; while (len) { if (translate[*p1++] != translate[*p2++]) return 1; --- 5356,5363 ---- register int len; RE_TRANSLATE_TYPE translate; { ! register const unsigned char *p1 = (const unsigned char *) s1; ! register const unsigned char *p2 = (const unsigned char *) s2; while (len) { if (translate[*p1++] != translate[*p2++]) return 1; *************** *** 5366,5371 **** --- 5470,5476 ---- return 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); } + #endif /* _REGEX_RE_COMP */ /* POSIX.2 functions. Don't define these for Emacs. */ *************** *** 5560,5566 **** size_t msg_size; if (errcode < 0 ! || errcode >= (sizeof (re_error_msgid) / sizeof (re_error_msgid[0]))) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. --- 5665,5672 ---- size_t msg_size; if (errcode < 0 ! || errcode >= (int) (sizeof (re_error_msgid) ! / sizeof (re_error_msgid[0]))) /* Only error codes returned by the rest of the code should be passed to this routine. If we are given anything else, or if other regex code generates an invalid error code, then the program has a bug. diff -crN gawk-3.0.2/regex.h gawk-3.0.3/regex.h *** gawk-3.0.2/regex.h Sun Oct 20 21:14:51 1996 --- gawk-3.0.3/regex.h Tue May 13 12:40:38 1997 *************** *** 1,7 **** /* Definitions for data structures and routines for the regular expression library, version 0.12. ! ! Copyright (C) 1985, 89, 90, 91, 92, 93, 95, 96 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,6 ---- /* Definitions for data structures and routines for the regular expression library, version 0.12. ! Copyright (C) 1985,89,90,91,92,93,95,96,97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 14,26 **** 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. */ #ifndef __REGEXP_LIBRARY_H__ #define __REGEXP_LIBRARY_H__ /* POSIX says that must be included (by the caller) before . */ --- 13,29 ---- 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. */ #ifndef __REGEXP_LIBRARY_H__ #define __REGEXP_LIBRARY_H__ + /* Allow the use in C++ code. */ + #ifdef __cplusplus + extern "C" { + #endif + /* POSIX says that must be included (by the caller) before . */ *************** *** 30,56 **** #include #endif - /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two types is 2 for Microsoft C. Ugh... */ ! typedef long s_reg_t; ! typedef unsigned long active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ ! typedef unsigned long reg_syntax_t; /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ ! #define RE_BACKSLASH_ESCAPE_IN_LISTS (1L) /* If this bit is not set, then + and ? are operators, and \+ and \? are ! literals. If set, then \+ and \? are operators and + and ? are literals. */ #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) --- 33,58 ---- #include #endif /* The following two types have to be signed and unsigned integer type wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two types is 2 for Microsoft C. Ugh... */ ! typedef long int s_reg_t; ! typedef unsigned long int active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ ! typedef unsigned long int reg_syntax_t; /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ ! #define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1) /* If this bit is not set, then + and ? are operators, and \+ and \? are ! literals. If set, then \+ and \? are operators and + and ? are literals. */ #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1) *************** *** 66,72 **** ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or ! before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. --- 68,74 ---- ^ is an anchor if it is at the beginning of a regular expression or after an open-group or an alternation operator; $ is an anchor if it is at the end of a regular expression, or ! before a close-group or an alternation operator. This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because POSIX draft 11.2 says that * etc. in leading positions is undefined. *************** *** 77,83 **** /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in ! some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) --- 79,85 ---- /* If this bit is set, then special characters are always special regardless of where they are in the pattern. If this bit is not set, then special characters are special only in ! some contexts; otherwise they are ordinary. Specifically, * + ? and intervals are only special when not after the beginning, open-group, or alternation operator. */ #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1) *************** *** 99,105 **** #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an ! interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) --- 101,107 ---- #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1) /* If this bit is set, either \{...\} or {...} defines an ! interval, depending on RE_NO_BK_BRACES. If not set, \{, \}, {, and } are literals. */ #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1) *************** *** 124,130 **** If not set, then \ is a back-reference. */ #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) ! /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) --- 126,132 ---- If not set, then \ is a back-reference. */ #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1) ! /* If this bit is set, then | is an alternation operator, and \| is literal. If not set, then \| is an alternation operator, and | is literal. */ #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1) *************** *** 138,150 **** If not set, then an unmatched ) is invalid. */ #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) - /* If this bit is set, do not process the GNU regex operators. - IF not set, then the GNU regex operators are recognized. */ - #define RE_NO_GNU_OPS (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) - /* If this bit is set, succeed as soon as we match the whole pattern, without further backtracking. */ ! #define RE_NO_POSIX_BACKTRACKING (RE_NO_GNU_OPS << 1) /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. --- 140,152 ---- If not set, then an unmatched ) is invalid. */ #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1) /* If this bit is set, succeed as soon as we match the whole pattern, without further backtracking. */ ! #define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1) ! ! /* If this bit is set, do not process the GNU regex operators. ! If not set, then the GNU regex operators are recognized. */ ! #define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1) /* If this bit is set, turn on internal regex debugging. If not set, and debugging was on, turn it off. *************** *** 152,158 **** We define this bit always, so that all that's needed to turn on debugging is to recompile regex.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ ! #define RE_DEBUG (RE_NO_POSIX_BACKTRACKING << 1) /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is --- 154,160 ---- We define this bit always, so that all that's needed to turn on debugging is to recompile regex.c; the calling code can always have this bit set, and it won't affect anything in the normal case. */ ! #define RE_DEBUG (RE_NO_GNU_OPS << 1) /* This global variable defines the particular regexp syntax to use (for some interfaces). When a regexp is compiled, the syntax used is *************** *** 162,181 **** /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so ! don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 #define RE_SYNTAX_AWK \ ! (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ ! | RE_NO_BK_PARENS | RE_NO_BK_REFS \ ! | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ ! | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) ! #define RE_SYNTAX_GNU_AWK \ ! ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ ! & ~(RE_DOT_NOT_NULL|RE_INTERVALS|RE_CONTEXT_INDEP_OPS)) #define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ --- 164,183 ---- /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so ! don't delete them!) */ /* [[[begin syntaxes]]] */ #define RE_SYNTAX_EMACS 0 #define RE_SYNTAX_AWK \ ! (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \ ! | RE_NO_BK_PARENS | RE_NO_BK_REFS \ ! | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \ ! | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \ | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS) ! #define RE_SYNTAX_GNU_AWK \ ! ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \ ! & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS)) #define RE_SYNTAX_POSIX_AWK \ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \ *************** *** 235,242 **** #ifdef RE_DUP_MAX #undef RE_DUP_MAX #endif ! /* if sizeof(int) == 2, then ((1 << 15) - 1) overflows */ ! #define RE_DUP_MAX (0x7fff) /* POSIX `cflags' bits (i.e., information for `regcomp'). */ --- 237,244 ---- #ifdef RE_DUP_MAX #undef RE_DUP_MAX #endif ! /* If sizeof(int) == 2, then ((1 << 15) - 1) overflows. */ ! #define RE_DUP_MAX (0x7fff) /* POSIX `cflags' bits (i.e., information for `regcomp'). */ *************** *** 248,254 **** /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) ! /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ --- 250,256 ---- /* If this bit is set, then ignore case when matching. If not set, then case is significant. */ #define REG_ICASE (REG_EXTENDED << 1) ! /* If this bit is set, then anchors do not match at newline characters in the string. If not set, then anchors do match at newlines. */ *************** *** 287,293 **** REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ ! REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ --- 289,295 ---- REG_EESCAPE, /* Trailing backslash. */ REG_ESUBREG, /* Invalid back reference. */ REG_EBRACK, /* Unmatched left bracket. */ ! REG_EPAREN, /* Parenthesis imbalance. */ REG_EBRACE, /* Unmatched \{. */ REG_BADBR, /* Invalid contents of \{\}. */ REG_ERANGE, /* Invalid range end. */ *************** *** 306,312 **** compiled, the `re_nsub' field is available. All other fields are private to the regex routines. */ ! #ifndef RE_TRANSLATE_TYPE #define RE_TRANSLATE_TYPE char * #endif --- 308,314 ---- compiled, the `re_nsub' field is available. All other fields are private to the regex routines. */ ! #ifndef RE_TRANSLATE_TYPE #define RE_TRANSLATE_TYPE char * #endif *************** *** 319,328 **** unsigned char *buffer; /* Number of bytes to which `buffer' points. */ ! unsigned long allocated; /* Number of bytes actually used in `buffer'. */ ! unsigned long used; /* Syntax setting with which the pattern was compiled. */ reg_syntax_t syntax; --- 321,330 ---- unsigned char *buffer; /* Number of bytes to which `buffer' points. */ ! unsigned long int allocated; /* Number of bytes actually used in `buffer'. */ ! unsigned long int used; /* Syntax setting with which the pattern was compiled. */ reg_syntax_t syntax; *************** *** 366,372 **** unsigned no_sub : 1; /* If set, a beginning-of-line anchor doesn't match at the ! beginning of the string. */ unsigned not_bol : 1; /* Similarly for an end-of-line anchor. */ --- 368,374 ---- unsigned no_sub : 1; /* If set, a beginning-of-line anchor doesn't match at the ! beginning of the string. */ unsigned not_bol : 1; /* Similarly for an end-of-line anchor. */ *************** *** 473,479 **** /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ ! extern int re_match_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, struct re_registers *regs, int stop)); --- 475,481 ---- /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ ! extern int re_match_2 _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, int length1, const char *string2, int length2, int start, struct re_registers *regs, int stop)); *************** *** 512,517 **** --- 514,524 ---- _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)); extern void regfree _RE_ARGS ((regex_t *preg)); + + + #ifdef __cplusplus + } + #endif /* C++ */ #endif /* not __REGEXP_LIBRARY_H__ */ diff -crN gawk-3.0.2/stamp-h.in gawk-3.0.3/stamp-h.in *** gawk-3.0.2/stamp-h.in Wed Dec 18 10:27:30 1996 --- gawk-3.0.3/stamp-h.in Tue May 13 20:58:45 1997 *************** *** 1 **** ! Wed Dec 18 10:27:30 EST 1996 --- 1 ---- ! Tue May 13 20:58:45 EDT 1997 diff -crN gawk-3.0.2/test/ChangeLog gawk-3.0.3/test/ChangeLog *** gawk-3.0.2/test/ChangeLog Wed Dec 25 11:26:33 1996 --- gawk-3.0.3/test/ChangeLog Thu May 15 12:50:54 1997 *************** *** 1,3 **** --- 1,107 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Tue May 13 12:53:46 1997 Arnold D. Robbins + + * Makefile.in (messages): more testing for OK failure on Linux. + + Sun May 11 14:57:11 1997 Arnold D. Robbins + + * Makefile.in (nondec): new test case. + * nondec.awk, nondec.ok: new files. + + Sun May 11 07:07:05 1997 Arnold D. Robbins + + * Makefile.in (prdupval): new test case. + * prdupval.awk, prdupval.in, prdupval.ok: new files. + + Wed May 7 21:54:34 1997 Arnold D. Robbins + + * Makefile.in (delarprm): new test case. + * delarprm.awk, delarprm.ok: new files. + + Wed May 7 17:54:00 1997 Arnold D. Robbins + + * Makefile.in (pid): several fixes from ghazi@caip.rutgers.edu. + + Tue May 6 20:28:30 1997 Arnold D. Robbins + + * Makefile.in (strftime): Use the right locale stuff. + (clobber): don't need an input file. + + Thu Apr 24 22:24:42 1997 Arnold D. Robbins + + * Makefile.in (pid): new test case, from jco@convex.com. + (specfile): removed test case, pid does it better. + * pid.awk, pid.ok, pid.sh: new files. + * specfile.awk: removed. + + Wed Apr 23 23:37:10 1997 Arnold D. Robbins + + * Makefile.in (pipeio2): new test case. + * pipeio2.awk, pipeio2.ok, pipeio2.in: new files. + + Sun Apr 20 12:22:52 1997 Arnold D. Robbins + + * Makefile.in (clobber): new test case. + * clobber.awk, clobber.ok: new files. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Tue Apr 15 05:57:29 1997 Arnold D. Robbins + + * Makefile.in (strftlng): More wizardry for bizarre Unix systems. + (nlfldsep): use program and input file, not shell script + (basic, unix-tests, gawk.extensions): moved specfile, pipeio1 + and strftlng into unix-tests per Pat Rankin. + * nlfldsep.awk, nlfldsep.in: new files. + * nlfldsep.sh: removed. + + Wed Apr 9 23:32:47 1997 Arnold D. Robbins + + * Makefile.in (funstack): new test case. + * funstack.awk, funstack.in, funstack.ok: new files. + * substr.awk: added many more tests. + * substr.ok: updated + + Wed Mar 19 20:10:21 1997 Arnold D. Robbins + + * Makefile.in (pipeio1): new test case. + * pipeio1.awk, pipeio1.ok: new files. + + Tue Mar 18 06:38:36 1997 Arnold D. Robbins + + * Makefile.in (noparm): new test case. + * noparm.awk, noparm.ok: new files. + + Fri Feb 21 06:30:18 1997 Arnold D. Robbins + + * Makefile.in (reint): new test case. + * reint.awk, reint.in, reint.ok: new files. + + Wed Feb 5 18:17:51 1997 Arnold D. Robbins + + * Makefile.in (fnarydel): new test case. + * fnarydel.awk, fnarydel.ok: new files. + + Sun Jan 19 17:06:18 1997 Arnold D. Robbins + + * Makefile.in (nors): new test case. + * nors.ok: new file. + + Sun Jan 19 17:06:18 1997 Arnold D. Robbins + + * Makefile.in (specfile, strftlng, nfldstr): new test cases. + * specfile.awk, strftlng.awk, strftlng.ok, nfldstr.ok: new files. + + Fri Dec 27 11:27:13 1996 Arnold D. Robbins + + * Makefile.in (intest): new test case. + * intest.awk, intest.ok: new files. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/test/Makefile.in gawk-3.0.3/test/Makefile.in *** gawk-3.0.2/test/Makefile.in Thu Nov 7 09:10:34 1996 --- gawk-3.0.3/test/Makefile.in Tue May 13 12:53:25 1997 *************** *** 1,6 **** # Makefile for GNU Awk test suite. # ! # Copyright (C) 1988-1996 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,6 ---- # Makefile for GNU Awk test suite. # ! # Copyright (C) 1988-1997 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 36,53 **** numsubstr pcntplus prmreuse math fldchg fldchgnf reindops \ sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ ! back89 tradanch nlfldsep splitvar ! unix-tests: poundbang fflush getlnhd gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ ! badargs strftime gensub gnureops extra: regtest inftest poundbang:: ! cp $(AWK) /tmp/gawk && $(srcdir)/poundbang $(srcdir)/poundbang >_`basename $@` ! rm -f /tmp/gawk $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` msg:: --- 36,54 ---- numsubstr pcntplus prmreuse math fldchg fldchgnf reindops \ sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ ! back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \ ! noparms funstack clobber delarprm prdupval ! unix-tests: poundbang fflush getlnhd pipeio1 pipeio2 strftlng pid gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ ! badargs strftime gensub gnureops reint nondec extra: regtest inftest poundbang:: ! @cp $(AWK) /tmp/gawk && $(srcdir)/poundbang $(srcdir)/poundbang >_`basename $@` ! @rm -f /tmp/gawk $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` msg:: *************** *** 62,68 **** messages:: @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3 ! { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3; } || { test -d /dev/fd && echo IT IS OK THAT THIS TEST FAILED; } argarray:: @case $(srcdir) in \ --- 63,72 ---- messages:: @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3 ! { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && \ ! $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3; } || \ ! { { test -d /dev/fd || test -d /proc/self/fd; } && \ ! echo IT IS OK THAT THIS TEST FAILED; } argarray:: @case $(srcdir) in \ *************** *** 207,213 **** strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results ! @date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ print > "strftime.ok" ; \ print strftime() > "'_$@'" }' $(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 --- 211,218 ---- strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results ! @LC_ALL=C; export LC_ALL; LANC=C; export LANG; \ ! date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; \ print > "strftime.ok" ; \ print strftime() > "'_$@'" }' $(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 *************** *** 358,372 **** $(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ nlfldsep:: ! AWK=$(AWK); export AWK; $(srcdir)/nlfldsep.sh > _$@ $(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ splitvar:: @$(AWK) -f $(srcdir)/splitvar.awk $(srcdir)/splitvar.in >_$@ $(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ clean: ! rm -fr _* core junk out1 out2 out3 strftime.ok *~ distclean: clean rm -f Makefile --- 363,449 ---- $(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ nlfldsep:: ! @$(AWK) -f $(srcdir)/nlfldsep.awk $(srcdir)/nlfldsep.in > _$@ $(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ splitvar:: @$(AWK) -f $(srcdir)/splitvar.awk $(srcdir)/splitvar.in >_$@ $(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ + intest:: + @$(AWK) -f $(srcdir)/intest.awk >_$@ + $(CMP) $(srcdir)/intest.ok _$@ && rm -f _$@ + + # AIX /bin/sh exec's the last command in a list, therefore issue a ":" + # command so that pid.sh is fork'ed as a child before being exec'ed. + pid:: + @AWKPATH=$(srcdir) AWK=$(AWK) $(SHELL) $(srcdir)/pid.sh $$$$ > _`basename $@` ; : + $(CMP) $(srcdir)/pid.ok _`basename $@` && rm -f _`basename $@` _`basename $@`.in + + strftlng:: + @TZ=UTC; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ + @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ + TZ=UTC0; export TZ; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ + fi + $(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ + + nfldstr:: + @echo | $(AWK) '$$1 == 0 { print "bug" }' > _$@ + $(CMP) $(srcdir)/nfldstr.ok _$@ && rm -f _$@ + + nors:: + @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ + $(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ + + fnarydel:: + @$(AWK) -f $(srcdir)/fnarydel.awk >_$@ + $(CMP) $(srcdir)/fnarydel.ok _$@ && rm -f _$@ + + reint:: + @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ + $(CMP) $(srcdir)/reint.ok _$@ && rm -f _$@ + + noparms:: + @-AWKPATH=$(srcdir) $(AWK) -f noparms.awk >_$@ 2>&1 || exit 0 + $(CMP) $(srcdir)/noparms.ok _$@ && rm -f _$@ + + pipeio1:: + @$(AWK) -f $(srcdir)/pipeio1.awk >_$@ + @rm -f test1 test2 + $(CMP) $(srcdir)/pipeio1.ok _$@ && rm -f _$@ + + pipeio2:: + @$(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@ + $(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@ + + funstack:: + @$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@ + $(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@ + + clobber:: + @$(AWK) -f $(srcdir)/clobber.awk >_$@ + $(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@ + @rm -f seq + + delarprm:: + @$(AWK) -f $(srcdir)/delarprm.awk >_$@ + $(CMP) $(srcdir)/delarprm.ok _$@ && rm -f _$@ + + prdupval:: + @$(AWK) -f $(srcdir)/prdupval.awk $(srcdir)/prdupval.in >_$@ + $(CMP) $(srcdir)/prdupval.ok _$@ && rm -f _$@ + + nondec:: + @if grep BITOP ../config.h | grep define > /dev/null; \ + then \ + $(AWK) -f $(srcdir)/nondec.awk >_$@; \ + else \ + cp $(srcdir)/nondec.ok _$@; \ + fi + $(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@ + clean: ! rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~ distclean: clean rm -f Makefile diff -crN gawk-3.0.2/test/clobber.awk gawk-3.0.3/test/clobber.awk *** gawk-3.0.2/test/clobber.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/clobber.awk Thu May 1 21:36:34 1997 *************** *** 0 **** --- 1,98 ---- + BEGIN { + print "000800" > "seq" + close("seq") + ARGV[1] = "seq" + ARGC = 2 + } + + { printf "%06d", $1 + 1 >"seq"; + printf "%06d", $1 + 1 } + # Date: Mon, 20 Jan 1997 15:14:06 -0600 (CST) + # From: Dave Bodenstab + # To: bug-gnu-utils@prep.ai.mit.edu + # Subject: GNU awk 3.0.2 core dump + # Cc: arnold@gnu.ai.mit.edu + # + # The following program produces a core file on my FreeBSD system: + # + # bash$ echo 000800 >/tmp/seq + # bash$ gawk '{ printf "%06d", $1 + 1 >"/tmp/seq"; + # printf "%06d", $1 + 1 }' /tmp/seq + # + # This fragment comes from mgetty+sendfax. + # + # Here is the trace: + # + # Script started on Mon Jan 20 15:09:04 1997 + # bash$ gawk --version + # GNU Awk 3.0.2 + # Copyright (C) 1989, 1991-1996 Free Software Foundation. + # + # 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 + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # bash$ gdb gawk + # GDB is free software and you are welcome to distribute copies of it + # under certain conditions; type "show copying" to see the conditions. + # There is absolutely no warranty for GDB; type "show warranty" for details. + # GDB 4.13 (i386-unknown-freebsd), + # Copyright 1994 Free Software Foundation, Inc... + # (gdb) shell echo 000800 >/tmp/seq + # (gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }(gdb) r '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq + # Starting program: /scratch/archive/src/cmd/gnuawk-3.0.2/gawk '{ printf "%06d", $1 + 1 >"/tmp/seq"; printf "%06d", $1 + 1 }' /tmp/seq + # + # Program received signal SIGBUS, Bus error. + # 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240, rp=0x0, + # set=0xce6c , n=0x0) at field.c:391 + # 391 sav = *end; + # (gdb) bt + # #0 0xd86f in def_parse_field (up_to=1, buf=0x37704, len=6, fs=0x3b240, + # rp=0x0, set=0xce6c , n=0x0) at field.c:391 + # #1 0xddb1 in get_field (requested=1, assign=0x0) at field.c:669 + # #2 0xc25d in r_get_lhs (ptr=0x3b9b4, assign=0x0) at eval.c:1339 + # #3 0x9ab0 in r_tree_eval (tree=0x3b9b4, iscond=0) at eval.c:604 + # #4 0xa5f1 in r_tree_eval (tree=0x3b9fc, iscond=0) at eval.c:745 + # #5 0x4661 in format_tree (fmt_string=0x3e040 "%06d", n0=0, carg=0x3ba20) + # at builtin.c:620 + # #6 0x5beb in do_sprintf (tree=0x3b96c) at builtin.c:809 + # #7 0x5cd5 in do_printf (tree=0x3ba8c) at builtin.c:844 + # #8 0x9271 in interpret (tree=0x3ba8c) at eval.c:465 + # #9 0x8ca3 in interpret (tree=0x3bbd0) at eval.c:308 + # #10 0x8c34 in interpret (tree=0x3bc18) at eval.c:292 + # #11 0xf069 in do_input () at io.c:312 + # #12 0x12ba9 in main (argc=3, argv=0xefbfd538) at main.c:393 + # (gdb) l + # 386 *buf += len; + # 387 return nf; + # 388 } + # 389 + # 390 /* before doing anything save the char at *end */ + # 391 sav = *end; + # 392 /* because it will be destroyed now: */ + # 393 + # 394 *end = ' '; /* sentinel character */ + # 395 for (; nf < up_to; scan++) { + # (gdb) print end + # $1 = 0x804d006 + # (gdb) print buf + # $2 = (char **) 0x37704 + # (gdb) print *buf + # $3 = 0x804d000 + # (gdb) q + # The program is running. Quit anyway (and kill it)? (y or n) y + # bash$ exit + # + # Script done on Mon Jan 20 15:11:07 1997 + # + # Dave Bodenstab + # imdave@synet.net diff -crN gawk-3.0.2/test/delarprm.awk gawk-3.0.3/test/delarprm.awk *** gawk-3.0.2/test/delarprm.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/delarprm.awk Wed May 7 21:53:19 1997 *************** *** 0 **** --- 1,50 ---- + # From dragon!unagi.cis.upenn.edu!sjanet Tue Mar 25 17:12:20 1997 + # Return-Path: + # Received: by skeeve.atl.ga.us (/\==/\ Smail3.1.22.1 #22.1) + # id ; Tue, 25 Mar 97 17:12 EST + # Received: by vecnet.com (DECUS UUCP /2.0/2.0/2.0/); + # Tue, 25 Mar 97 16:58:36 EDT + # Received: from gnu-life.ai.mit.edu by antaries.vec.net (MX V4.2 VAX) with SMTP; + # Tue, 25 Mar 1997 16:58:26 EST + # Received: from linc.cis.upenn.edu by gnu-life.ai.mit.edu (8.8.5/8.6.12GNU) with + # ESMTP id QAA24350 for ; Tue, 25 Mar + # 1997 16:56:59 -0500 (EST) + # Received: from unagi.cis.upenn.edu (UNAGI.CIS.UPENN.EDU [158.130.8.153]) by + # linc.cis.upenn.edu (8.8.5/8.8.5) with ESMTP id QAA09424; Tue, 25 Mar + # 1997 16:56:54 -0500 (EST) + # Received: (from sjanet@localhost) by unagi.cis.upenn.edu (8.8.5/8.8.5) id + # QAA03969; Tue, 25 Mar 1997 16:56:50 -0500 (EST) + # Date: Tue, 25 Mar 1997 16:56:50 -0500 (EST) + # From: Stan Janet + # Message-ID: <199703252156.QAA03969@unagi.cis.upenn.edu> + # To: bug-gnu-utils@prep.ai.mit.edu + # CC: arnold@gnu.ai.mit.edu + # Subject: GNU awk 3.0.2 bug: fatal error deleting local array inside function + # Status: ORf + # + # Version: GNU Awk 3.0.2 + # Platforms: SunOS 4.1.1 (compiled with Sun cc) + # IRIX 5.3 (compiled with SGI cc) + # Problem: Deleting local array inside function causes fatal internal error (and + # core dump. The error does not occur when the variable "x", unused in + # the example, is removed or when the function is declared foo(x,p). + # When the function is declared foo(p,x), adding a dummy line that uses + # "x", e.g. "x=1" does not prevent the error. If "p" is not deleted, + # there is no error. If "p[1]" is used to delete the lone element, there + # is no error. + # + # ==== The program x.gawk ==== + + function foo(p,x) { + p[1]="bar" + delete p + return 0 + } + + BEGIN { + foo() + } + + # ==== The output for "gawk -f x.gawk" (SunOS) ==== + # + # gawk: x.gawk:4: fatal error: internal error diff -crN gawk-3.0.2/test/fnarydel.awk gawk-3.0.3/test/fnarydel.awk *** gawk-3.0.2/test/fnarydel.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/fnarydel.awk Wed Feb 5 18:15:46 1997 *************** *** 0 **** --- 1,60 ---- + #!/usr/local/bin/gawk -f + BEGIN { + process() + } + + function process(aa,a) { + delete aa + } + + BEGIN { + for (i = 1; i < 10; i++) + a[i] = i; + + print "first loop" + for (i in a) + print a[i] + + delete a + + print "second loop" + for (i in a) + print a[i] + + for (i = 1; i < 10; i++) + a[i] = i; + + print "third loop" + for (i in a) + print a[i] + + print "call func" + delit(a) + + print "fourth loop" + for (i in a) + print a[i] + + stressit() + } + + function delit(arr) + { + delete arr + } + + function stressit( array, i) + { + delete array + array[4] = 4 + array[5] = 5 + delete array[5] + print "You should just see: 4 4" + for (i in array) + print i, array[i] + delete array + print "You should see nothing between this line" + for (i in array) + print i, array[i] + print "And this one" + } diff -crN gawk-3.0.2/test/fnarydel.ok gawk-3.0.3/test/fnarydel.ok *** gawk-3.0.2/test/fnarydel.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/fnarydel.ok Wed Feb 5 18:16:01 1997 *************** *** 0 **** --- 1,27 ---- + first loop + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 2 + 3 + second loop + third loop + 4 + 5 + 6 + 7 + 8 + 9 + 1 + 2 + 3 + call func + fourth loop + You should just see: 4 4 + 4 4 + You should see nothing between this line + And this one diff -crN gawk-3.0.2/test/funstack.awk gawk-3.0.3/test/funstack.awk *** gawk-3.0.2/test/funstack.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/funstack.awk Wed Apr 9 22:34:37 1997 *************** *** 0 **** --- 1,977 ---- + ### ==================================================================== + ### @Awk-file{ + ### author = "Nelson H. F. Beebe", + ### version = "1.00", + ### date = "09 October 1996", + ### time = "15:57:06 MDT", + ### filename = "journal-toc.awk", + ### address = "Center for Scientific Computing + ### Department of Mathematics + ### University of Utah + ### Salt Lake City, UT 84112 + ### USA", + ### telephone = "+1 801 581 5254", + ### FAX = "+1 801 581 4148", + ### URL = "http://www.math.utah.edu/~beebe", + ### checksum = "25092 977 3357 26493", + ### email = "beebe@math.utah.edu (Internet)", + ### codetable = "ISO/ASCII", + ### keywords = "BibTeX, bibliography, HTML, journal table of + ### contents", + ### supported = "yes", + ### docstring = "Create a journal cover table of contents from + ### Article{...} entries in a journal BibTeX + ### .bib file for checking the bibliography + ### database against the actual journal covers. + ### The output can be either plain text, or HTML. + ### + ### Usage: + ### bibclean -max-width 0 BibTeX-file(s) | \ + ### bibsort -byvolume | \ + ### awk -f journal-toc.awk \ + ### [-v HTML=nnn] [-v INDENT=nnn] \ + ### [-v BIBFILEURL=url] >foo.toc + ### + ### or if the bibliography is already sorted + ### by volume, + ### + ### bibclean -max-width 0 BibTeX-file(s) | \ + ### awk -f journal-toc.awk \ + ### [-v HTML=nnn] [-v INDENT=nnn] \ + ### [-v BIBFILEURL=url] >foo.toc + ### + ### A non-zero value of the command-line option, + ### HTML=nnn, results in HTML output instead of + ### the default plain ASCII text (corresponding + ### to HTML=0). The + ### + ### The INDENT=nnn command-line option specifies + ### the number of blanks to indent each logical + ### level of HTML. The default is INDENT=4. + ### INDENT=0 suppresses indentation. The INDENT + ### option has no effect when the default HTML=0 + ### (plain text output) option is in effect. + ### + ### When HTML output is selected, the + ### BIBFILEURL=url command-line option provides a + ### way to request hypertext links from table of + ### contents page numbers to the complete BibTeX + ### entry for the article. These links are + ### created by appending a sharp (#) and the + ### citation label to the BIBFILEURL value, which + ### conforms with the practice of + ### bibtex-to-html.awk. + ### + ### The HTML output form may be useful as a more + ### compact representation of journal article + ### bibliography data than the original BibTeX + ### file provides. Of course, the + ### table-of-contents format provides less + ### information, and is considerably more + ### troublesome for a computer program to parse. + ### + ### When URL key values are provided, they will + ### be used to create hypertext links around + ### article titles. This supports journals that + ### provide article contents on the World-Wide + ### Web. + ### + ### For parsing simplicity, this program requires + ### that BibTeX + ### + ### key = "value" + ### + ### and + ### + ### @String{name = "value"} + ### + ### specifications be entirely contained on + ### single lines, which is readily provided by + ### the `bibclean -max-width 0' filter. It also + ### requires that bibliography entries begin and + ### end at the start of a line, and that + ### quotation marks, rather than balanced braces, + ### delimit string values. This is a + ### conventional format that again can be + ### guaranteed by bibclean. + ### + ### This program requires `new' awk, as described + ### in the book + ### + ### Alfred V. Aho, Brian W. Kernighan, and + ### Peter J. Weinberger, + ### ``The AWK Programming Language'', + ### Addison-Wesley (1988), ISBN + ### 0-201-07981-X, + ### + ### such as provided by programs named (GNU) + ### gawk, nawk, and recent AT&T awk. + ### + ### The checksum field above contains a CRC-16 + ### checksum as the first value, followed by the + ### equivalent of the standard UNIX wc (word + ### count) utility output of lines, words, and + ### characters. This is produced by Robert + ### Solovay's checksum utility.", + ### } + ### ==================================================================== + + BEGIN { initialize() } + + /^ *@ *[Ss][Tt][Rr][Ii][Nn][Gg] *{/ { do_String(); next } + + /^ *@ *[Pp][Rr][Ee][Aa][Mm][Bb][Ll][Ee]/ { next } + + /^ *@ *[Aa][Rr][Tt][Ii][Cc][Ll][Ee]/ { do_Article(); next } + + /^ *@/ { do_Other(); next } + + /^ *author *= *\"/ { do_author(); next } + + /^ *journal *= */ { do_journal(); next } + + /^ *volume *= *\"/ { do_volume(); next } + + /^ *number *= *\"/ { do_number(); next } + + /^ *year *= *\"/ { do_year(); next } + + /^ *month *= */ { do_month(); next } + + /^ *title *= *\"/ { do_title(); next } + + /^ *pages *= *\"/ { do_pages(); next } + + /^ *URL *= *\"/ { do_URL(); next } + + /^ *} *$/ { if (In_Article) do_end_entry(); next } + + END { terminate() } + + + ######################################################################## + # NB: The programming conventions for variables in this program are: # + # UPPERCASE global constants and user options # + # Initialuppercase global variables # + # lowercase local variables # + # Any deviation is an error! # + ######################################################################## + + + function do_Article() + { + In_Article = 1 + + Citation_label = $0 + sub(/^[^\{]*{/,"",Citation_label) + sub(/ *, *$/,"",Citation_label) + + Author = "" + Title = "" + Journal = "" + Volume = "" + Number = "" + Month = "" + Year = "" + Pages = "" + Url = "" + } + + + function do_author() + { + Author = TeX_to_HTML(get_value($0)) + } + + + function do_end_entry( k,n,parts) + { + n = split(Author,parts," and ") + if (Last_number != Number) + do_new_issue() + for (k = 1; k < n; ++k) + print_toc_line(parts[k] " and", "", "") + Title_prefix = html_begin_title() + Title_suffix = html_end_title() + if (html_length(Title) <= (MAX_TITLE_CHARS + MIN_LEADERS)) # complete title fits on line + print_toc_line(parts[n], Title, html_begin_pages() Pages html_end_pages()) + else # need to split long title over multiple lines + do_long_title(parts[n], Title, html_begin_pages() Pages html_end_pages()) + } + + + function do_journal() + { + if ($0 ~ /[=] *"/) # have journal = "quoted journal name", + Journal = get_value($0) + else # have journal = journal-abbreviation, + { + Journal = get_abbrev($0) + if (Journal in String) # replace abbrev by its expansion + Journal = String[Journal] + } + gsub(/\\-/,"",Journal) # remove discretionary hyphens + } + + + function do_long_title(author,title,pages, last_title,n) + { + title = trim(title) # discard leading and trailing space + while (length(title) > 0) + { + n = html_breakpoint(title,MAX_TITLE_CHARS+MIN_LEADERS) + last_title = substr(title,1,n) + title = substr(title,n+1) + sub(/^ +/,"",title) # discard any leading space + print_toc_line(author, last_title, (length(title) == 0) ? pages : "") + author = "" + } + } + + + function do_month( k,n,parts) + { + Month = ($0 ~ /[=] *"/) ? get_value($0) : get_abbrev($0) + gsub(/[\"]/,"",Month) + gsub(/ *# *\\slash *# */," / ",Month) + gsub(/ *# *-+ *# */," / ",Month) + n = split(Month,parts," */ *") + Month = "" + for (k = 1; k <= n; ++k) + Month = Month ((k > 1) ? " / " : "") \ + ((parts[k] in Month_expansion) ? Month_expansion[parts[k]] : parts[k]) + } + + + function do_new_issue() + { + Last_number = Number + if (HTML) + { + if (Last_volume != Volume) + { + Last_volume = Volume + print_line(prefix(2) "
") + } + html_end_toc() + html_begin_issue() + print_line(prefix(2) Journal "
") + } + else + { + print_line("") + print_line(Journal) + } + + print_line(strip_html(vol_no_month_year())) + + if (HTML) + { + html_end_issue() + html_toc_entry() + html_begin_toc() + } + else + print_line("") + } + + + function do_number() + { + Number = get_value($0) + } + + + function do_Other() + { + In_Article = 0 + } + + + function do_pages() + { + Pages = get_value($0) + sub(/--[?][?]/,"",Pages) + } + + + function do_String() + { + sub(/^[^\{]*\{/,"",$0) # discard up to and including open brace + sub(/\} *$/,"",$0) # discard from optional whitespace and trailing brace to end of line + String[get_key($0)] = get_value($0) + } + + + function do_title() + { + Title = TeX_to_HTML(get_value($0)) + } + + + function do_URL( parts) + { + Url = get_value($0) + split(Url,parts,"[,;]") # in case we have multiple URLs + Url = trim(parts[1]) + } + + + function do_volume() + { + Volume = get_value($0) + } + + + function do_year() + { + Year = get_value($0) + } + + + function get_abbrev(s) + { # return abbrev from ``key = abbrev,'' + sub(/^[^=]*= */,"",s) # discard text up to start of non-blank value + sub(/ *,? *$/,"",s) # discard trailing optional whitspace, quote, + # optional comma, and optional space + return (s) + } + + + function get_key(s) + { # return kay from ``key = "value",'' + sub(/^ */,"",s) # discard leading space + sub(/ *=.*$/,"",s) # discard everthing after key + + return (s) + } + + + function get_value(s) + { # return value from ``key = "value",'' + sub(/^[^\"]*\" */,"",s) # discard text up to start of non-blank value + sub(/ *\",? *$/,"",s) # discard trailing optional whitspace, quote, + # optional comma, and optional space + return (s) + } + + + function html_accents(s) + { + if (index(s,"\\") > 0) # important optimization + { + # Convert common lower-case accented letters according to the + # table on p. 169 of in Peter Flynn's ``The World Wide Web + # Handbook'', International Thomson Computer Press, 1995, ISBN + # 1-85032-205-8. The official table of ISO Latin 1 SGML + # entities used in HTML can be found in the file + # /usr/local/lib/html-check/lib/ISOlat1.sgml (your path + # may differ). + + gsub(/{\\\a}/, "\\à", s) + gsub(/{\\'a}/, "\\á", s) + gsub(/{\\[\^]a}/,"\\â", s) + gsub(/{\\~a}/, "\\ã", s) + gsub(/{\\\"a}/, "\\ä", s) + gsub(/{\\aa}/, "\\å", s) + gsub(/{\\ae}/, "\\æ", s) + + gsub(/{\\c{c}}/,"\\ç", s) + + gsub(/{\\\e}/, "\\è", s) + gsub(/{\\'e}/, "\\é", s) + gsub(/{\\[\^]e}/,"\\ê", s) + gsub(/{\\\"e}/, "\\ë", s) + + gsub(/{\\\i}/, "\\ì", s) + gsub(/{\\'i}/, "\\í", s) + gsub(/{\\[\^]i}/,"\\î", s) + gsub(/{\\\"i}/, "\\ï", s) + + # ignore eth and thorn + + gsub(/{\\~n}/, "\\ñ", s) + + gsub(/{\\\o}/, "\\ò", s) + gsub(/{\\'o}/, "\\ó", s) + gsub(/{\\[\^]o}/, "\\ô", s) + gsub(/{\\~o}/, "\\õ", s) + gsub(/{\\\"o}/, "\\ö", s) + gsub(/{\\o}/, "\\ø", s) + + gsub(/{\\\u}/, "\\ù", s) + gsub(/{\\'u}/, "\\ú", s) + gsub(/{\\[\^]u}/,"\\û", s) + gsub(/{\\\"u}/, "\\ü", s) + + gsub(/{\\'y}/, "\\ý", s) + gsub(/{\\\"y}/, "\\ÿ", s) + + # Now do the same for upper-case accents + + gsub(/{\\\A}/, "\\À", s) + gsub(/{\\'A}/, "\\Á", s) + gsub(/{\\[\^]A}/, "\\Â", s) + gsub(/{\\~A}/, "\\Ã", s) + gsub(/{\\\"A}/, "\\Ä", s) + gsub(/{\\AA}/, "\\Å", s) + gsub(/{\\AE}/, "\\Æ", s) + + gsub(/{\\c{C}}/,"\\Ç", s) + + gsub(/{\\\e}/, "\\È", s) + gsub(/{\\'E}/, "\\É", s) + gsub(/{\\[\^]E}/, "\\Ê", s) + gsub(/{\\\"E}/, "\\Ë", s) + + gsub(/{\\\I}/, "\\Ì", s) + gsub(/{\\'I}/, "\\Í", s) + gsub(/{\\[\^]I}/, "\\Î", s) + gsub(/{\\\"I}/, "\\Ï", s) + + # ignore eth and thorn + + gsub(/{\\~N}/, "\\Ñ", s) + + gsub(/{\\\O}/, "\\Ò", s) + gsub(/{\\'O}/, "\\Ó", s) + gsub(/{\\[\^]O}/, "\\Ô", s) + gsub(/{\\~O}/, "\\Õ", s) + gsub(/{\\\"O}/, "\\Ö", s) + gsub(/{\\O}/, "\\Ø", s) + + gsub(/{\\\U}/, "\\Ù", s) + gsub(/{\\'U}/, "\\Ú", s) + gsub(/{\\[\^]U}/, "\\Û", s) + gsub(/{\\\"U}/, "\\Ü", s) + + gsub(/{\\'Y}/, "\\Ý", s) + + gsub(/{\\ss}/, "\\ß", s) + + # Others not mentioned in Flynn's book + gsub(/{\\'\\i}/,"\\í", s) + gsub(/{\\'\\j}/,"j", s) + } + return (s) + } + + + function html_begin_issue() + { + print_line("") + print_line(prefix(2) "
") + print_line("") + print_line(prefix(2) "

") + print_line(prefix(3) "") + } + + + function html_begin_pages() + { + return ((HTML && (BIBFILEURL != "")) ? ("") : "") + } + + + function html_begin_pre() + { + In_PRE = 1 + print_line("
")
+ }
+ 
+ 
+ function html_begin_title()
+ {
+ 	return ((HTML && (Url != "")) ? ("") : "")
+ }
+ 
+ 
+ function html_begin_toc()
+ {
+ 	html_end_toc()
+ 	html_begin_pre()
+ }
+ 
+ 
+ function html_body( k)
+ {
+ 	for (k = 1; k <= BodyLines; ++k)
+ 		print Body[k]
+ }
+ 
+ function html_breakpoint(title,maxlength, break_after,k)
+ {
+ 	# Return the largest character position in title AFTER which we
+ 	# can break the title across lines, without exceeding maxlength
+ 	# visible characters.
+ 	if (html_length(title) > maxlength)	# then need to split title across lines
+ 	{
+ 		# In the presence of HTML markup, the initialization of
+ 		# k here is complicated, because we need to advance it
+ 		# until html_length(title) is at least maxlength,
+ 		# without invoking the expensive html_length() function
+ 		# too frequently.  The need to split the title makes the
+ 		# alternative of delayed insertion of HTML markup much
+ 		# more complicated.
+ 		break_after = 0
+ 		for (k = min(maxlength,length(title)); k < length(title); ++k)
+ 		{
+ 			if (substr(title,k+1,1) == " ")
+ 			{		# could break after position k
+ 				if (html_length(substr(title,1,k)) <= maxlength)
+ 					break_after = k
+ 				else	# advanced too far, retreat back to last break_after
+ 					break
+ 			}
+ 		}
+ 		if (break_after == 0)		# no breakpoint found by forward scan
+ 		{				# so switch to backward scan
+ 			for (k = min(maxlength,length(title)) - 1; \
+ 				(k > 0) && (substr(title,k+1,1) != " "); --k)
+ 				;		# find space at which to break title
+ 			if (k < 1)		# no break point found
+ 				k = length(title) # so must print entire string
+ 		}
+ 		else
+ 			k = break_after
+ 	}
+ 	else					# title fits on one line
+ 		k = length(title)
+ 	return (k)
+ }
+ 
+ 
+ 
+ function html_end_issue()
+ {
+ 	print_line(prefix(3) "")
+ 	print_line(prefix(2) "

") + } + + + function html_end_pages() + { + return ((HTML && (BIBFILEURL != "")) ? "" : "") + } + + + function html_end_pre() + { + if (In_PRE) + { + print_line("") + In_PRE = 0 + } + } + + + function html_end_title() + { + return ((HTML && (Url != "")) ? "" : "") + } + + + function html_end_toc() + { + html_end_pre() + } + + + function html_fonts(s, arg,control_word,k,level,n,open_brace) + { + open_brace = index(s,"{") + if (open_brace > 0) # important optimization + { + level = 1 + for (k = open_brace + 1; (level != 0) && (k <= length(s)); ++k) + { + if (substr(s,k,1) == "{") + level++ + else if (substr(s,k,1) == "}") + level-- + } + + # {...} is now found at open_brace ... (k-1) + for (control_word in Font_decl_map) # look for {\xxx ...} + { + if (substr(s,open_brace+1,length(control_word)+1) ~ \ + ("\\" control_word "[^A-Za-z]")) + { + n = open_brace + 1 + length(control_word) + arg = trim(substr(s,n,k - n)) + if (Font_decl_map[control_word] == "toupper") # arg -> ARG + arg = toupper(arg) + else if (Font_decl_map[control_word] != "") # arg -> arg + arg = "<" Font_decl_map[control_word] ">" arg "" + return (substr(s,1,open_brace-1) arg html_fonts(substr(s,k))) + } + } + for (control_word in Font_cmd_map) # look for \xxx{...} + { + if (substr(s,open_brace - length(control_word),length(control_word)) ~ \ + ("\\" control_word)) + { + n = open_brace + 1 + arg = trim(substr(s,n,k - n)) + if (Font_cmd_map[control_word] == "toupper") # arg -> ARG + arg = toupper(arg) + else if (Font_cmd_map[control_word] != "") # arg -> arg + arg = "<" Font_cmd_map[control_word] ">" arg "" + n = open_brace - length(control_word) - 1 + return (substr(s,1,n) arg html_fonts(substr(s,k))) + } + } + } + return (s) + } + + + function html_header() + { + USER = ENVIRON["USER"] + if (USER == "") + USER = ENVIRON["LOGNAME"] + if (USER == "") + USER = "????" + "hostname" | getline HOSTNAME + "date" | getline DATE + ("ypcat passwd | grep '^" USER ":' | awk -F: '{print $5}'") | getline PERSONAL_NAME + if (PERSONAL_NAME == "") + ("grep '^" USER ":' /etc/passwd | awk -F: '{print $5}'") | getline PERSONAL_NAME + + + print "" + print "" + print "" + print "" + print "" + print "" + print "" + print "" + print "" + print prefix(1) "" + print prefix(2) "" + print prefix(3) Journal + print prefix(2) "" + print prefix(2) "" + print prefix(1) "" + print "" + print prefix(1) "" + } + + + function html_label( label) + { + label = Volume "(" Number "):" Month ":" Year + gsub(/[^A-Za-z0-9():,;.\/\-]/,"",label) + return (label) + } + + + function html_length(s) + { # Return visible length of s, ignoring any HTML markup + if (HTML) + { + gsub(/<\/?[^>]*>/,"",s) # remove SGML tags + gsub(/&[A-Za-z0-9]+;/,"",s) # remove SGML entities + } + return (length(s)) + } + + + function html_toc() + { + print prefix(2) "

" + print prefix(3) "Table of contents for issues of " Journal + print prefix(2) "

" + print HTML_TOC + } + + + function html_toc_entry() + { + HTML_TOC = HTML_TOC " " + HTML_TOC = HTML_TOC vol_no_month_year() + HTML_TOC = HTML_TOC "
" "\n" + } + + + function html_trailer() + { + html_end_pre() + print prefix(1) "" + print "" + } + + + function initialize() + { + # NB: Update these when the program changes + VERSION_DATE = "[09-Oct-1996]" + VERSION_NUMBER = "1.00" + + HTML = (HTML == "") ? 0 : (0 + HTML) + + if (INDENT == "") + INDENT = 4 + + if (HTML == 0) + INDENT = 0 # indentation suppressed in ASCII mode + + LEADERS = " . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ." + + MAX_TITLE_CHARS = 36 # 36 produces a 79-char output line when there is + # just an initial page number. If this is + # increased, the LEADERS string may need to be + # lengthened. + + MIN_LEADERS = 4 # Minimum number of characters from LEADERS + # required when leaders are used. The total + # number of characters that can appear in a + # title line is MAX_TITLE_CHARS + MIN_LEADERS. + # Leaders are omitted when the title length is + # between MAX_TITLE_CHARS and this sum. + + MIN_LEADERS_SPACE = " " # must be at least MIN_LEADERS characters long + + Month_expansion["jan"] = "January" + Month_expansion["feb"] = "February" + Month_expansion["mar"] = "March" + Month_expansion["apr"] = "April" + Month_expansion["may"] = "May" + Month_expansion["jun"] = "June" + Month_expansion["jul"] = "July" + Month_expansion["aug"] = "August" + Month_expansion["sep"] = "September" + Month_expansion["oct"] = "October" + Month_expansion["nov"] = "November" + Month_expansion["dec"] = "December" + + Font_cmd_map["\\emph"] = "EM" + Font_cmd_map["\\textbf"] = "B" + Font_cmd_map["\\textit"] = "I" + Font_cmd_map["\\textmd"] = "" + Font_cmd_map["\\textrm"] = "" + Font_cmd_map["\\textsc"] = "toupper" + Font_cmd_map["\\textsl"] = "I" + Font_cmd_map["\\texttt"] = "t" + Font_cmd_map["\\textup"] = "" + + Font_decl_map["\\bf"] = "B" + Font_decl_map["\\em"] = "EM" + Font_decl_map["\\it"] = "I" + Font_decl_map["\\rm"] = "" + Font_decl_map["\\sc"] = "toupper" + Font_decl_map["\\sf"] = "" + Font_decl_map["\\tt"] = "TT" + Font_decl_map["\\itshape"] = "I" + Font_decl_map["\\upshape"] = "" + Font_decl_map["\\slshape"] = "I" + Font_decl_map["\\scshape"] = "toupper" + Font_decl_map["\\mdseries"] = "" + Font_decl_map["\\bfseries"] = "B" + Font_decl_map["\\rmfamily"] = "" + Font_decl_map["\\sffamily"] = "" + Font_decl_map["\\ttfamily"] = "TT" + } + + function min(a,b) + { + return (a < b) ? a : b + } + + + function prefix(level) + { + # Return a prefix of up to 60 blanks + + if (In_PRE) + return ("") + else + return (substr(" ", \ + 1, INDENT * level)) + } + + + function print_line(line) + { + if (HTML) # must buffer in memory so that we can accumulate TOC + Body[++BodyLines] = line + else + print line + } + + + function print_toc_line(author,title,pages, extra,leaders,n,t) + { + # When we have a multiline title, the hypertext link goes only + # on the first line. A multiline hypertext link looks awful + # because of long underlines under the leading indentation. + + if (pages == "") # then no leaders needed in title lines other than last one + t = sprintf("%31s %s%s%s", author, Title_prefix, title, Title_suffix) + else # last title line, with page number + { + n = html_length(title) # potentially expensive + extra = n % 2 # extra space for aligned leader dots + if (n <= MAX_TITLE_CHARS) # then need leaders + leaders = substr(LEADERS, 1, MAX_TITLE_CHARS + MIN_LEADERS - extra - \ + min(MAX_TITLE_CHARS,n)) + else # title (almost) fills line, so no leaders + leaders = substr(MIN_LEADERS_SPACE,1, \ + (MAX_TITLE_CHARS + MIN_LEADERS - extra - n)) + t = sprintf("%31s %s%s%s%s%s %4s", \ + author, Title_prefix, title, Title_suffix, \ + (extra ? " " : ""), leaders, pages) + } + + Title_prefix = "" # forget any hypertext + Title_suffix = "" # link material + + # Efficency note: an earlier version accumulated the body in a + # single scalar like this: "Body = Body t". Profiling revealed + # this statement as the major hot spot, and the change to array + # storage made the program more than twice as fast. This + # suggests that awk might benefit from an optimization of + # "s = s t" that uses realloc() instead of malloc(). + if (HTML) + Body[++BodyLines] = t + else + print t + } + + + function protect_SGML_characters(s) + { + gsub(/&/,"\\&",s) # NB: this one MUST be first + gsub(//,"\\>",s) + gsub(/\"/,"\\"",s) + return (s) + } + + + function strip_braces(s, k) + { # strip non-backslashed braces from s and return the result + + return (strip_char(strip_char(s,"{"),"}")) + } + + + function strip_char(s,c, k) + { # strip non-backslashed instances of c from s, and return the result + k = index(s,c) + if (k > 0) # then found the character + { + if (substr(s,k-1,1) != "\\") # then not backslashed char + s = substr(s,1,k-1) strip_char(substr(s,k+1),c) # so remove it (recursively) + else # preserve backslashed char + s = substr(s,1,k) strip_char(s,k+1,c) + } + return (s) + } + + + function strip_html(s) + { + gsub(/<\/?[^>]*>/,"",s) + return (s) + } + + + function terminate() + { + if (HTML) + { + html_end_pre() + + HTML = 0 # NB: stop line buffering + html_header() + html_toc() + html_body() + html_trailer() + } + } + + + function TeX_to_HTML(s, k,n,parts) + { + # First convert the four SGML reserved characters to SGML entities + if (HTML) + { + gsub(/>/, "\\>", s) + gsub(/ 1) ? "$" : "") \ + ((k % 2) ? strip_braces(TeX_to_HTML_nonmath(parts[k])) : \ + TeX_to_HTML_math(parts[k])) + + gsub(/[$][$][$]/,"$$",s) # restore display math + + return (s) + } + + + function TeX_to_HTML_math(s) + { + # Mostly a dummy for now, but HTML 3 could support some math translation + + gsub(/\\&/,"\\&",s) # reduce TeX ampersands to SGML entities + + return (s) + } + + + function TeX_to_HTML_nonmath(s) + { + if (index(s,"\\") > 0) # important optimization + { + gsub(/\\slash +/,"/",s) # replace TeX slashes with conventional ones + gsub(/ *\\emdash +/," --- ",s) # replace BibNet emdashes with conventional ones + gsub(/\\%/,"%",s) # reduce TeX percents to conventional ones + gsub(/\\[$]/,"$",s) # reduce TeX dollars to conventional ones + gsub(/\\#/,"#",s) # reduce TeX sharps to conventional ones + + if (HTML) # translate TeX markup to HTML + { + gsub(/\\&/,"\\&",s) # reduce TeX ampersands to SGML entities + s = html_accents(s) + s = html_fonts(s) + } + else # plain ASCII text output: discard all TeX markup + { + gsub(/\\\&/, "\\&", s) # reduce TeX ampersands to conventional ones + + gsub(/\\[a-z][a-z] +/,"",s) # remove TeX font changes + gsub(/\\[^A-Za-z]/,"",s) # remove remaining TeX control symbols + } + } + return (s) + } + + + function trim(s) + { + gsub(/^[ \t]+/,"",s) + gsub(/[ \t]+$/,"",s) + return (s) + } + + + function vol_no_month_year() + { + return ("Volume " wrap(Volume) ", Number " wrap(Number) ", " wrap(Month) ", " wrap(Year)) + } + + + function wrap(value) + { + return (HTML ? ("" value "") : value) + } diff -crN gawk-3.0.2/test/funstack.in gawk-3.0.3/test/funstack.in *** gawk-3.0.2/test/funstack.in Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/funstack.in Mon May 5 06:41:29 1997 *************** *** 0 **** --- 1,206 ---- + %%% ==================================================================== + %%% BibTeX-file{ + %%% author = "Nelson H. F. Beebe", + %%% version = "2.09", + %%% date = "26 March 1997", + %%% time = "08:21:19 MST", + %%% filename = "cacm1970.bib", + %%% address = "Center for Scientific Computing + %%% Department of Mathematics + %%% University of Utah + %%% Salt Lake City, UT 84112 + %%% USA", + %%% telephone = "+1 801 581 5254", + %%% FAX = "+1 801 581 4148", + %%% checksum = "50673 40670 196033 1787829", + %%% email = "beebe at math.utah.edu (Internet)", + %%% codetable = "ISO/ASCII", + %%% keywords = "bibliography, CACM, Communications of the + %%% ACM", + %%% supported = "yes", + %%% docstring = "This is a bibliography of the journal + %%% Communications of the ACM, covering + %%% (incompletely) 1970 -- 1979. + %%% + %%% At version 2.09, the year coverage looked + %%% like this: + %%% + %%% 1961 ( 1) 1972 (168) 1983 ( 0) + %%% 1962 ( 1) 1973 (158) 1984 ( 0) + %%% 1963 ( 2) 1974 (127) 1985 ( 2) + %%% 1964 ( 2) 1975 (107) 1986 ( 0) + %%% 1965 ( 1) 1976 ( 97) 1987 ( 0) + %%% 1966 ( 2) 1977 (117) 1988 ( 0) + %%% 1967 ( 1) 1978 (118) 1989 ( 0) + %%% 1968 ( 1) 1979 ( 78) 1990 ( 2) + %%% 1969 ( 3) 1980 ( 1) 1991 ( 4) + %%% 1970 (157) 1981 ( 2) 1992 ( 1) + %%% 1971 (104) 1982 ( 1) + %%% + %%% Article: 1252 + %%% Book: 2 + %%% InProceedings: 1 + %%% Manual: 1 + %%% MastersThesis: 1 + %%% PhdThesis: 1 + %%% + %%% Total entries: 1258 + %%% + %%% The size of the original cacm.bib file + %%% covering 1958--1996 became too large (about + %%% 4000 entries) for BibTeX and TeX to handle, + %%% so at version 1.44, it was split into + %%% cacm1950.bib, cacm1960.bib, cacm1970.bib, + %%% cacm1980.bib, and cacm1990.bib, each covering + %%% the decade starting with the year embedded in + %%% the filename. Version numbers for these + %%% files begin at 2.00. + %%% + %%% Volumes from the 1990s average more than 200 + %%% articles yearly, so a complete bibliography + %%% for this journal could contain more than 6000 + %%% entries from 1958 to 2000. + %%% + %%% These bibliographies also include ACM + %%% Algorithms 1--492. For Algorithms 493--686, + %%% including Algorithm 568, published in ACM + %%% Transactions on Programming Languages and + %%% Systems (TOPLAS), see the companion + %%% bibliographies, toms.bib and toplas.bib. + %%% + %%% All published Remarks and Corrigenda are + %%% cross-referenced in both directions, so + %%% that citing a paper will automatically + %%% generate citations for those Remarks and + %%% Corrigenda. Cross-referenced entries are + %%% duplicated in cacm19*.bib and toms.bib, so + %%% that each is completely self-contained. + %%% + %%% Source code for ACM Algorithms from 380 + %%% onwards, with some omissions, is available + %%% via the Netlib service at + %%% http://netlib.ornl.gov/, and + %%% ftp://netlib.bell-labs.com/netlib/toms. + %%% + %%% There is a World Wide Web search facility + %%% for articles published in this journal from + %%% 1959 to 1979 at + %%% http://ciir.cs.umass.edu/cgi-bin/web_query_form/public/cacm2.1. + %%% + %%% The initial draft of entries for 1981 -- + %%% 1990 was extracted from the ACM Computing + %%% Archive CD ROM for the 1980s, with manual + %%% corrections and additions. Additions were + %%% then made from all of the bibliographies in + %%% the TeX User Group collection, from + %%% bibliographies in the author's personal + %%% files, from the Compendex database + %%% (1970--1979), from the IEEE INSPEC database + %%% (1970--1979), from tables of contents + %%% information at http://www.acm.org/pubs/cacm/, + %%% from Zentralblatt fur Mathematik Mathematics + %%% Abstracts at + %%% http://www.emis.de/cgi-bin/MATH/, from + %%% bibliographies at Internet host + %%% netlib.bell-labs.com, and from the computer + %%% science bibliography collection on + %%% ftp.ira.uka.de in /pub/bibliography to which + %%% many people of have contributed. The + %%% snapshot of this collection was taken on + %%% 5-May-1994, and it consists of 441 BibTeX + %%% files, 2,672,675 lines, 205,289 entries, and + %%% 6,375 String{} abbreviations, occupying + %%% 94.8MB of disk space. + %%% + %%% Numerous errors in the sources noted above + %%% have been corrected. Spelling has been + %%% verified with the UNIX spell and GNU ispell + %%% programs using the exception dictionary + %%% stored in the companion file with extension + %%% .sok. + %%% + %%% BibTeX citation tags are uniformly chosen + %%% as name:year:abbrev, where name is the + %%% family name of the first author or editor, + %%% year is a 4-digit number, and abbrev is a + %%% 3-letter condensation of important title + %%% words. Citation tags were automatically + %%% generated by software developed for the + %%% BibNet Project. + %%% + %%% In this bibliography, entries are sorted in + %%% publication order within each journal, + %%% using bibsort -byvolume. + %%% + %%% The checksum field above contains a CRC-16 + %%% checksum as the first value, followed by the + %%% equivalent of the standard UNIX wc (word + %%% count) utility output of lines, words, and + %%% characters. This is produced by Robert + %%% Solovay's checksum utility.", + %%% } + %%% ==================================================================== + + @Preamble{"\input bibnames.sty " # "\input path.sty " # "\def \TM {${}^{\sc TM}$} " # "\hyphenation{ al-pha-mer-ic Balz-er Blom-quist Bo-ta-fo-go Bran-din Brans-comb Bu-tera Chris-tina Christ-o-fi-des Col-lins Cor-dell data-base econ-omies Fletch-er + flow-chart flow-charts Fry-styk ge-dank-en Gar-fink-el Ge-ha-ni Glush-ko Goud-reau Gua-dan-go Hari-di Haw-thorn Hem-men-ding-er Hor-o-witz Hour-vitz Hirsch-berg Ike-da Ka-chi-tvi-chyan-u-kul Kat-ze-nel-son Kitz-miller Ko-ba-yashi Le-Me-tay-er Ken-ne-dy + Law-rence Mac-kay Mai-net-ti Mar-sa-glia Max-well Mer-ner Mo-ran-di Na-ray-an New-ell Nich-ols para-digm pat-ent-ed Phi-lo-kyp-rou Prep-a-ra-ta pseu-do-chain-ing QUIK-SCRIPT Rad-e-mach-er re-eval-u-a-tion re-wind Ros-witha Scheu-er-mann Schwach-heim + Schob-bens Schon-berg Sho-sha-ni Si-tha-ra-ma Skwa-rec-ki Streck-er Strin-gi-ni Tes-ler Te-zu-ka Teu-ho-la Till-quist Town-send Tsi-chri-tzis Tur-ski Vuille-min Wald-ing-er Za-bo-row-ski Za-mora }"} + + %======================================================================= + % Acknowledgement abbreviations: + + @String{ack-nhfb = "Nelson H. F. Beebe, Center for Scientific Computing, Department of Mathematics, University of Utah, Salt Lake City, UT 84112, USA, Tel: +1 801 581 5254, FAX: +1 801 581 4148, e-mail: \path|beebe@math.utah.edu|"} + + @String{ack-nj = "Norbert Juffa, 2445 Mission College Blvd. Santa Clara, CA 95054 USA email: \path=norbert@iit.com="} + + %======================================================================= + % Journal abbreviations: + + @String{j-CACM = "Communications of the ACM"} + + @String{j-COMP-SURV = "Computing Surveys"} + + @String{j-J-ACM = "Journal of the ACM"} + + @String{j-MANAGEMENT-SCIENCE = "Management Science"} + + @String{j-SIAM-J-COMPUT = "SIAM Journal of Computing"} + + @String{j-SPE = "Software --- Practice and Experience"} + + @String{j-TOMS = "ACM Transactions on Mathematical Software"} + + %======================================================================= + % Publisher abbreviations: + + @String{pub-ANSI = "American National Standards Institute"} + + @String{pub-ANSI:adr = "1430 Broadway, New York, NY 10018, USA"} + + @String{pub-AW = "Ad{\-d}i{\-s}on-Wes{\-l}ey"} + + @String{pub-AW:adr = "Reading, MA, USA"} + + @String{pub-SUCSLI = "Stanford University Center for the Study of Language and Information"} + + @String{pub-SUCSLI:adr = "Stanford, CA, USA"} + + @String{pub-SV = "Spring{\-}er-Ver{\-}lag"} + + @String{pub-SV:adr = "Berlin, Germany~/ Heidelberg, Germany~/ London, UK~/ etc."} + @MastersThesis{Dittmer:1976:IEP, + author = "Ingo Dittmer", + title = "{Implementation eines Einschrittcompilers f{\"u}r die Progammiersprache PASCAL auf der Rechenanlage IBM\slash 360 der Universit{\"a}t M{\"u}nster}. ({English} title: Implementation of a One-Step Compiler for the Programming Language + {PASCAL} on the {IBM}\slash 360 of the {University of Muenster})", + type = "Diplomearbeit", + school = "Universit{\"a}t M{\"u}nster", + address = "M{\"u}nster, Germany", + pages = "??", + month = "??", + year = "1976", + bibdate = "Sat Feb 17 13:24:29 1996", + note = "Diplomearbeit M{\"u}nster 1976 und doert angegebene Literatur (English: Muenster diploma work 1976 and the literature cited therein). The hashing method was rediscovered fourteen years later by Pearson \cite{Pearson:1990:FHV}, and then + commented on by several authors \cite{Dittmer:1991:NFH,Savoy:1991:NFH,Litsios:1991:NFH,Pearson:1991:NFH}.", + acknowledgement = ack-nhfb, + xxnote = "Cannot find in Dissertation Abstracts, European.", + } diff -crN gawk-3.0.2/test/intest.awk gawk-3.0.3/test/intest.awk *** gawk-3.0.2/test/intest.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/intest.awk Fri Dec 27 11:24:37 1996 *************** *** 0 **** --- 1,4 ---- + BEGIN { + bool = ((b = 1) in c); + print bool, b # gawk-3.0.1 prints "0 "; should print "0 1" + } diff -crN gawk-3.0.2/test/intest.ok gawk-3.0.3/test/intest.ok *** gawk-3.0.2/test/intest.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/intest.ok Fri Dec 27 11:26:39 1996 *************** *** 0 **** --- 1 ---- + 0 1 diff -crN gawk-3.0.2/test/nlfldsep.awk gawk-3.0.3/test/nlfldsep.awk *** gawk-3.0.2/test/nlfldsep.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/nlfldsep.awk Tue Apr 15 06:22:40 1997 *************** *** 0 **** --- 1,2 ---- + BEGIN { RS = "A" } + {print NF; for (i = 1; i <= NF; i++) print $i ; print ""} diff -crN gawk-3.0.2/test/nlfldsep.in gawk-3.0.3/test/nlfldsep.in *** gawk-3.0.2/test/nlfldsep.in Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/nlfldsep.in Tue Apr 15 06:22:00 1997 *************** *** 0 **** --- 1,5 ---- + some stuff + more stuffA + junk + stuffA + final diff -crN gawk-3.0.2/test/nondec.awk gawk-3.0.3/test/nondec.awk *** gawk-3.0.2/test/nondec.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/nondec.awk Sun May 11 14:56:27 1997 *************** *** 0 **** --- 1 ---- + BEGIN { print 0x81c3e8, 0x744018 } diff -crN gawk-3.0.2/test/nondec.ok gawk-3.0.3/test/nondec.ok *** gawk-3.0.2/test/nondec.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/nondec.ok Sun May 11 15:22:56 1997 *************** *** 0 **** --- 1 ---- + 8504296 7618584 diff -crN gawk-3.0.2/test/noparms.awk gawk-3.0.3/test/noparms.awk *** gawk-3.0.2/test/noparms.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/noparms.awk Tue Mar 18 06:33:52 1997 *************** *** 0 **** --- 1 ---- + function x(a, b, c , ,) {} diff -crN gawk-3.0.2/test/noparms.ok gawk-3.0.3/test/noparms.ok *** gawk-3.0.2/test/noparms.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/noparms.ok Tue Mar 18 06:36:08 1997 *************** *** 0 **** --- 1,4 ---- + gawk: noparms.awk:1: function x(a, b, c , ,) {} + gawk: noparms.awk:1: ^ parse error + gawk: noparms.awk:1: function x(a, b, c , ,) {} + gawk: noparms.awk:1: ^ parse error diff -crN gawk-3.0.2/test/nors.ok gawk-3.0.3/test/nors.ok *** gawk-3.0.2/test/nors.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/nors.ok Mon Jan 20 00:20:17 1997 *************** *** 0 **** --- 1,2 ---- + E + E diff -crN gawk-3.0.2/test/pid.awk gawk-3.0.3/test/pid.awk *** gawk-3.0.2/test/pid.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pid.awk Thu May 1 21:36:35 1997 *************** *** 0 **** --- 1,44 ---- + # From: John C. Oppenheimer + # Subject: gawk-3.0.2 pid test + # To: arnold@skeeve.atl.ga.us + # Date: Mon, 10 Feb 1997 08:31:55 -0600 (CST) + # + # Thanks for the very quick reply. + # + # This all started when I was looking for how to do the equivalent of + # "nextfile." I was after documentation and found our gawk down a few + # revs. + # + # Looks like the nextfile functionality was added somewhere around + # 2.15.5. There wasn't a way to do it, until now! Thanks for the + # functionality! + # + # Saw the /dev/xxx capability and just tried it. + # + # Anyway, I wrote a pid test. I hope that it is portable. Wanted to + # make a user test, but looks like id(1) is not very portable. But a + # little test is better than none. + # + # John + # + # pid.ok is a zero length file + # + # ================== pid.awk ============ + BEGIN { + getline pid <"/dev/pid" + getline ppid <"/dev/ppid" + } + NR == 1 { + if (pid != $0) { + printf "Bad pid %d, wanted %d\n", $0, pid + } + } + NR == 2 { + if (ppid != $0) { + printf "Bad ppid %d, wanted %d\n", $0, ppid + } + } + END { # ADR --- added + close("/dev/pid") + close("/dev/ppid") + } diff -crN gawk-3.0.2/test/pid.sh gawk-3.0.3/test/pid.sh *** gawk-3.0.2/test/pid.sh Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pid.sh Thu May 1 21:36:36 1997 *************** *** 0 **** --- 1,5 ---- + #! /bin/sh + AWK=${AWK-../gawk} + echo $$ > _pid.in + echo $1 >> _pid.in + exec $AWK -f pid.awk _pid.in diff -crN gawk-3.0.2/test/pipeio1.awk gawk-3.0.3/test/pipeio1.awk *** gawk-3.0.2/test/pipeio1.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pipeio1.awk Wed Mar 19 20:08:27 1997 *************** *** 0 **** --- 1,31 ---- + # From dragon!gamgee.acad.emich.edu!dhw Tue Mar 18 01:12:15 1997 + # Return-Path: + # Message-ID: + # Date: Mon, 17 Mar 97 20:48 CST + # From: dhw@gamgee.acad.emich.edu (David H. West) + # To: arnold@gnu.ai.mit.edu + # Subject: gawk 3.0.2 bug report (cc of msg to bug-gnu-utils) + # Status: OR + # Content-Length: 869 + # X-Lines: 20 + # X-Display-Position: 2 + # + # Nature of bug: operation on a pipe side-effects a different pipe. + # Observed-With: gawk 3.0.2, Linux kernel 2.0.28 + # Reproduce-By: running the following script, without and with the "close" + # statement uncommented. + # -----------------cut here-------------------------- + BEGIN {FILE1="test1"; FILE2="test2"; + print "1\n" > FILE1; close(FILE1); + print "2\n" > FILE2; close(FILE2); + cmd1="cat " FILE1; cmd2="cat " FILE2; + #end of preparing commands which give easily-predictable output + + while( (cmd1 | getline)==1) { #terminates as file has only 1 line + #and we never close cmd1 + cmd2 | getline L; + #BUG: uncommenting the following line causes an infinite loop + close(cmd2); + print $0,L; + } + } diff -crN gawk-3.0.2/test/pipeio1.ok gawk-3.0.3/test/pipeio1.ok *** gawk-3.0.2/test/pipeio1.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pipeio1.ok Wed Mar 19 20:11:59 1997 *************** *** 0 **** --- 1,2 ---- + 1 2 + 2 diff -crN gawk-3.0.2/test/pipeio2.awk gawk-3.0.3/test/pipeio2.awk *** gawk-3.0.2/test/pipeio2.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pipeio2.awk Mon May 5 07:25:27 1997 *************** *** 0 **** --- 1,67 ---- + # From: megaadm@rina.quantum.de + # Subject: Bug report - closing down pipes which read from shell com + # To: bug-gnu-utils@prep.ai.mit.edu + # Date: Thu, 27 Feb 1997 23:19:16 +0100 (CET) + # CC: arnold@gnu.ai.mit.edu + # + # Hello people, + # + # i think i found a bug or something mysterious behaviour in + # gawk Version 3.0 patchlevel 0. + # + # I am running on linux 2.0.25 under bash. + # + # Could you please have a look at the following awk program + # an let me please know, if this is what i expect it to, + # namely a bug. + # + # ----------- cut here -------------------------------------------- + BEGIN { + # OS is linux 2.0.25 + # shell is bash + # Gnu Awk (gawk) 3.0, patchlevel 0 + # The command i typed on the shell was "gawk -f -" + + #com = "cal 01 1997" + com = ("cat " SRCDIR "/pipeio2.in") + + while ((com | getline fnam) > 0) { + + com_tr = "echo " fnam " | tr [0-9]. ..........." + print "\'" com_tr "\'" + + com_tr | getline nam + print nam + + # please run that program and take a look at the + # output. I think this is what was expected. + + # Then comment in the following 4 lines and see + # what happens. I expect the first pipe "com | getline" + # not to be close, but i think this is exactly what happens + # So, is this ok ? + + if (close(com_tr) < 0) { + print ERRNO + break + } + } + + close(com) + } + # ----------- cut here -------------------------------------------- + # + # There is another thing i do not understand. + # Why doesn't the awk - command "close" reports an + # error, if i would say close("abc") which i had never + # openend ? + # + # Regards, + # Ulrich Gvbel + # -- + # /********************************************************\ + # * Ulrich Gvbel, goebel@quantum.de * + # * Quantum Gesellschaft f|r Software mbH, Dortmund * + # * phone : +49-231-9749-201 fax: +49-231-9749-3 * + # * private: +49-231-803994 fax: +49-231-803994 * + # \********************************************************/ diff -crN gawk-3.0.2/test/pipeio2.in gawk-3.0.3/test/pipeio2.in *** gawk-3.0.2/test/pipeio2.in Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pipeio2.in Mon May 5 07:22:52 1997 *************** *** 0 **** --- 1,8 ---- + January 1997 + S M Tu W Th F S + 1 2 3 4 + 5 6 7 8 9 10 11 + 12 13 14 15 16 17 18 + 19 20 21 22 23 24 25 + 26 27 28 29 30 31 + diff -crN gawk-3.0.2/test/pipeio2.ok gawk-3.0.3/test/pipeio2.ok *** gawk-3.0.2/test/pipeio2.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/pipeio2.ok Mon May 5 07:31:30 1997 *************** *** 0 **** --- 1,16 ---- + 'echo January 1997 | tr [0-9]. ...........' + January .... + 'echo S M Tu W Th F S | tr [0-9]. ...........' + S M Tu W Th F S + 'echo 1 2 3 4 | tr [0-9]. ...........' + . . . . + 'echo 5 6 7 8 9 10 11 | tr [0-9]. ...........' + . . . . . .. .. + 'echo 12 13 14 15 16 17 18 | tr [0-9]. ...........' + .. .. .. .. .. .. .. + 'echo 19 20 21 22 23 24 25 | tr [0-9]. ...........' + .. .. .. .. .. .. .. + 'echo 26 27 28 29 30 31 | tr [0-9]. ...........' + .. .. .. .. .. .. + 'echo | tr [0-9]. ...........' + diff -crN gawk-3.0.2/test/prdupval.awk gawk-3.0.3/test/prdupval.awk *** gawk-3.0.2/test/prdupval.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/prdupval.awk Sun May 11 07:06:28 1997 *************** *** 0 **** --- 1 ---- + { print NF, $NF, "abc" $NF } diff -crN gawk-3.0.2/test/prdupval.in gawk-3.0.3/test/prdupval.in *** gawk-3.0.2/test/prdupval.in Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/prdupval.in Sun May 11 07:06:15 1997 *************** *** 0 **** --- 1 ---- + one diff -crN gawk-3.0.2/test/prdupval.ok gawk-3.0.3/test/prdupval.ok *** gawk-3.0.2/test/prdupval.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/prdupval.ok Sun May 11 07:08:31 1997 *************** *** 0 **** --- 1 ---- + 1 one abcone diff -crN gawk-3.0.2/test/reint.awk gawk-3.0.3/test/reint.awk *** gawk-3.0.2/test/reint.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/reint.awk Fri Feb 21 06:28:26 1997 *************** *** 0 **** --- 1 ---- + { print match($0, /a{3}/) } diff -crN gawk-3.0.2/test/reint.in gawk-3.0.3/test/reint.in *** gawk-3.0.2/test/reint.in Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/reint.in Fri Feb 21 06:28:26 1997 *************** *** 0 **** --- 1 ---- + match this: aaa diff -crN gawk-3.0.2/test/reint.ok gawk-3.0.3/test/reint.ok *** gawk-3.0.2/test/reint.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/reint.ok Fri Feb 21 06:28:26 1997 *************** *** 0 **** --- 1 ---- + 13 diff -crN gawk-3.0.2/test/strftlng.awk gawk-3.0.3/test/strftlng.awk *** gawk-3.0.2/test/strftlng.awk Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/strftlng.awk Wed Feb 5 21:07:05 1997 *************** *** 0 **** --- 1,11 ---- + # test file from Paul Eggert, eggert@twinsun.com + # modified for portability (%c doesn't cut it) + + BEGIN { + BUFSIZ = 1024 + simpleformat = format = "%m/%d/%y %H:%M:%S\n" + clen = length(strftime(format, 0)) + for (i = 1; i < BUFSIZ / clen + 1; i++) + format = format simpleformat + printf "%s", strftime(format, 0) + } diff -crN gawk-3.0.2/test/strftlng.ok gawk-3.0.3/test/strftlng.ok *** gawk-3.0.2/test/strftlng.ok Wed Dec 31 19:00:00 1969 --- gawk-3.0.3/test/strftlng.ok Tue Feb 11 06:34:49 1997 *************** *** 0 **** --- 1,58 ---- + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 + 01/01/70 00:00:00 diff -crN gawk-3.0.2/test/substr.awk gawk-3.0.3/test/substr.awk *** gawk-3.0.2/test/substr.awk Tue May 21 23:16:08 1996 --- gawk-3.0.3/test/substr.awk Wed Apr 9 23:32:13 1997 *************** *** 1,5 **** BEGIN { ! x = "A" ! printf("%-39s\n", substr(x,1,39)) ! exit (0) } --- 1,14 ---- BEGIN { ! x = "A" ! printf("%-39s\n", substr(x,1,39)) ! print substr("abcdef", 0, 2) ! print substr("abcdef", 2.3, 2) ! print substr("abcdef", -1, 2) ! print substr("abcdef", 1, 0) ! print substr("abcdef", 1, -3) ! print substr("abcdef", 1, 2.3) ! print substr("", 1, 2) ! print substr("abcdef", 5, 5) ! print substr("abcdef", 7, 2) ! exit (0) } diff -crN gawk-3.0.2/test/substr.ok gawk-3.0.3/test/substr.ok *** gawk-3.0.2/test/substr.ok Tue May 21 23:22:06 1996 --- gawk-3.0.3/test/substr.ok Tue Apr 15 09:01:09 1997 *************** *** 1 **** --- 1,10 ---- A + ab + bc + ab + + + ab + + ef + diff -crN gawk-3.0.2/vms/ChangeLog gawk-3.0.3/vms/ChangeLog *** gawk-3.0.2/vms/ChangeLog Wed Dec 25 11:26:42 1996 --- gawk-3.0.3/vms/ChangeLog Thu May 15 12:51:00 1997 *************** *** 1,3 **** --- 1,70 ---- + Thu May 15 12:49:08 1997 Arnold D. Robbins + + * Release 3.0.3: Release tar file made. + + Mon May 12 18:39:30 1997 Pat Rankin + + * vmstest.com (delarprm, prdupval): new `basic' tests. + (nondec): new `gawk.extensions' test (commented out for now). + (reint): move from `basic' to `gawk.extensions'. + + Mon May 5 21:40:07 1997 Pat Rankin + + * vmstest.com (clobber): new `basic' test. + (pid): new test, replacing `specfile'. + (pipeio2): new for `unix-tests'; can't execute this one under VMS. + + Mon May 5 21:23:52 1997 Pat Rankin + + * vms_args.c (vms_arg_fixup): for the 2>&1 case, don't set the + output filename to "sys$error" because that results in an extra + empty file being created. + + * vms_misc.c (vms_open): explicitly specify stream_lf format + when creating files rather than letting DECC$SHR make a new file + inherit its record format from any earlier version of that file. + + Suggested by Pete Cascio : + + * vms_misc.c (vms_open): use full record sharing options when + reading any record-oriented file, regardless of its organization. + + Mon Apr 21 19:22:12 1997 Pat Rankin + + * vmstest.com (funstack): new `basic' test. + (reint): add missing entry to `basic'. + (pipeio1, specfile, strftlng): move from `basic' to `unix-tests'. + (childin): skip due to known failure. + (specfile): skip due to potentially confusing feedback. + + Thu Apr 24 23:18:04 1997 Arnold D. Robbins + + * vms_popen.c, vms_misc.c, vms_gawk.c, vms_fwrite.c, + vms_args.c: moved to generic GPL statement at top. + + Fri Apr 18 07:55:47 1997 Arnold D. Robbins + + * BETA Release 3.0.34: Release tar file made. + + Wed Apr 2 18:17:30 1997 Pat Rankin + + * descrip.mms, vmsbuild.com (PATCHLVL): update to 3. + + * vmstest.com (nlfldsep, splitvar, intest, nfldstr, nors, + fnarydel, noparms, pipeio1): new tests. + + Wed Jan 15 15:21:01 1997 Pat Rankin + + * redirect.h (stat, fstat): do not declare these functions; + rely on to do so. There are too many DEC C version + variants to handle otherwise. + + From Martin Zinser : + + * descrip.mms (gawk.dvi): update to build in [.doc] directory + using texindex.c retained from an earlier gawk 2.x distribution. + (texindex.exe): don't assume VAX C. + Wed Dec 25 11:25:22 1996 Arnold D. Robbins * Release 3.0.2: Release tar file made. diff -crN gawk-3.0.2/vms/descrip.mms gawk-3.0.3/vms/descrip.mms *** gawk-3.0.2/vms/descrip.mms Wed Nov 20 21:57:49 1996 --- gawk-3.0.3/vms/descrip.mms Tue Apr 15 06:19:58 1997 *************** *** 31,36 **** --- 31,37 ---- # If you have TeX, you can make the target 'gawk.dvi' to process # _The_GAWK_Manual_ from gawk.texi. You'll need to use a device # specific post-processor on gawk.dvi in order to get printable data. + # The full output is approximately 325 pages. # # location of various source files, relative to the 'main' directory *************** *** 128,134 **** # Release of gawk REL=3.0 ! PATCHLVL=1 # generic target all : gawk --- 129,135 ---- # Release of gawk REL=3.0 ! PATCHLVL=3 # generic target all : gawk *************** *** 207,243 **** - delete *.obj;*,gawk.opt;* spotless : clean tidy ! - delete gawk.dvi;*,gawk.exe;*,[.support]texindex.exe;* # ! # note: this is completely out of date # ! # build gawk.dvi from within the 'support' subdirectory # ! gawk.dvi : [.support]texindex.exe gawk.texi ! @ set default [.support] @ write sys$output " Warnings from TeX are expected during the first pass" ! TeX [-]gawk.texi mcr []texindex gawk.cp gawk.fn gawk.ky gawk.pg gawk.tp gawk.vr @ write sys$output " Second pass" ! TeX [-]gawk.texi mcr []texindex gawk.cp gawk.fn gawk.ky gawk.pg gawk.tp gawk.vr @ write sys$output " Third (final) pass" ! TeX [-]gawk.texi -@ purge -@ delete gawk.lis;,.aux;,gawk.%%;,.cps;,.fns;,.kys;,.pgs;,.toc;,.tps;,.vrs; @ rename/new_vers gawk.dvi [-]*.* @ set default [-] # ! # note: besides being out of date, this assumes VAX C ! # ! ! [.support]texindex.exe : [.support]texindex.c ! @ set default [.support] $(CC) /noOpt/noList/Define=("lines=tlines") texindex.c ! $(LINK) /noMap texindex.obj,sys$library:vaxcrtl.olb/Lib ! -@ delete texindex.obj;* @ set default [-] #eof --- 208,253 ---- - delete *.obj;*,gawk.opt;* spotless : clean tidy ! - if f$search("gawk.exe").nes."" then delete gawk.exe;* ! - if f$search("gawk.dvi").nes."" then delete gawk.dvi;* ! - if f$search("[.doc]texindex.exe").nes."" then delete [.doc]texindex.exe;* # ! # Note: this only works if you kept a copy of [.support]texindex.c ! # from a gawk 2.x distribution and put it into [.doc]texindex.c. ! # Also, depending on the fonts available with the version of TeX ! # you have, you might need to edit [.doc]texinfo.tex and change ! # the reference to "lcircle10" to be "circle10". # ! # build gawk.dvi from within the 'doc' subdirectory # ! gawk.dvi : [.doc]texindex.exe [.doc]gawk.texi ! @ set default [.doc] @ write sys$output " Warnings from TeX are expected during the first pass" ! TeX gawk.texi mcr []texindex gawk.cp gawk.fn gawk.ky gawk.pg gawk.tp gawk.vr @ write sys$output " Second pass" ! TeX gawk.texi mcr []texindex gawk.cp gawk.fn gawk.ky gawk.pg gawk.tp gawk.vr @ write sys$output " Third (final) pass" ! TeX gawk.texi -@ purge -@ delete gawk.lis;,.aux;,gawk.%%;,.cps;,.fns;,.kys;,.pgs;,.toc;,.tps;,.vrs; @ rename/new_vers gawk.dvi [-]*.* @ set default [-] + # Note: [.doc]texindex.c is not included with the gawk 3.x distribution. + # Expect lots of "implicitly declared function" diagnostics from DEC C. # ! [.doc]texindex.exe : [.doc]texindex.c ! @ set default [.doc] $(CC) /noOpt/noList/Define=("lines=tlines") texindex.c ! @ open/Write opt texindex.opt ! @ write opt "texindex.obj" ! @ write opt "$(LIBS)" ! @ close opt ! $(LINK) /noMap/Exe=texindex.exe texindex.opt/Options ! -@ delete texindex.obj;*,texindex.opt;* @ set default [-] #eof diff -crN gawk-3.0.2/vms/gawk.hlp gawk-3.0.3/vms/gawk.hlp *** gawk-3.0.2/vms/gawk.hlp Sun Aug 13 00:55:28 1995 --- gawk-3.0.3/vms/gawk.hlp Mon May 5 07:36:07 1997 *************** *** 3,8 **** --- 3,9 ---- ! revised, Jun'91 ! revised, Jul'92 ! revised, Jan'95 + ! revised, Apr'97 ! Online help for GAWK. ! 1 GAWK *************** *** 47,54 **** --- 48,60 ---- and get the behavior of UN*X awk. -W copyright [or -W copyleft] display an abbreviated version of the GNU copyright information + -W help list command line options (same as -W usage) -W lint warn about suspect or non-portable awk program code + -W lint-old warn about constructs not available in original awk -W posix compatibility mode with additional restrictions + -W re-interval evaluate '{' and '}' as intervals in regular expressions + -W traditional suppress POSIX and GNU regular expression extensions + -W usage list command line options (same as -W help) -W version display program version number -- don't check further arguments for leading dash 3 program_text *************** *** 111,116 **** --- 117,125 ---- are used as wildcards in filenames. '*' and '%' have their usual VMS meanings of multiple character and single character wildcards, respectively, and '?' is also treated as a single character wildcard. + Wildcard expansion only works for filenames specified in native VMS + filename syntax (eg, "[-.sibling]*"), not for ones specified pseudo- + Unix syntax (eg, "../sibling/*"). When a command line argument that should be a filename contains any of the wildcard characters, a directory lookup is attempted for files *************** *** 223,229 **** Print a brief version of GAWK's copyright notice. /USAGE ! /USAGE (no corresponding GNU_syntax option) Print a compact summary of the command line options. --- 232,238 ---- Print a brief version of GAWK's copyright notice. /USAGE ! /USAGE (comparable to -"W usage" or -"W help" option) Print a compact summary of the command line options. *************** *** 440,445 **** --- 449,463 ---- and/or a through e) digits; if more than two digits follow, the result is undefined; not recognized if POSIX compatibility mode is specified. + + When a regular expression is represented in string form ("regex" + as opposed to /regex/), backslashes need to be paired. The first + one quotes the second during string processing, and the second one + remains to be used to quote whatever follows in regular expression + processing. For example, to match variable `xxx' against a period + character, use (xxx ~ "\\.") or (xxx ~ /\./); if you tried to use + (xxx ~ "\."), after string processing it would operate as (xxx ~ /./) + and end up matching any single character rather than just a period. 3 statements A statement refers to a unit of instruction found in the action part of an awk rule, and also found in the definition of a function. *************** *** 577,584 **** 4 other_statements The delete statement is used to remove an element from an array. The syntax is 'delete' keyword followed by array name, followed ! by index value enclosed in square brackets ([]). Starting with ! gawk version 2.15.4, 'delete' may also be used on an entire array. The return statement is used in user-defined functions. The syntax is the keyword 'return' optionally followed by a string or numeric --- 595,603 ---- 4 other_statements The delete statement is used to remove an element from an array. The syntax is 'delete' keyword followed by array name, followed ! by index value enclosed in square brackets ([]). 'delete' may ! also used on an array name, without any index specified, to delete ! all its elements in a single operation. The return statement is used in user-defined functions. The syntax is the keyword 'return' optionally followed by a string or numeric *************** *** 640,648 **** the -F option (or /field_separator); the value can be a regular expression RS input record separator; default value is a newline ("\n"); ! only a single character is allowed [no regular expressions ! or multi-character strings; expected to be remedied in a ! future release of gawk] OFS output field separator; value to place between variables in a 'print' statement; default is one space; can be arbitrary string --- 659,665 ---- the -F option (or /field_separator); the value can be a regular expression RS input record separator; default value is a newline ("\n"); ! the value can be multiple characters or a regular expression OFS output field separator; value to place between variables in a 'print' statement; default is one space; can be arbitrary string *************** *** 651,658 **** string OFMT default output format used for printing numbers; default value is "%.6g" ! CONVFMT conversion format used for string-to-number conversions; ! default value is also "%.6g", like OFMT SUBSEP subscript separator for array indices; used when an array subscript is specified as a comma separated list of values: the comma is replaced by SUBSEP and the resulting index --- 668,677 ---- string OFMT default output format used for printing numbers; default value is "%.6g" ! CONVFMT conversion format used for number-to-string conversions; ! default value is also "%.6g", like OFMT; not used when the ! number has a value which may be represented internally as ! an exact integer (typically within -2147483648 to 2147483647) SUBSEP subscript separator for array indices; used when an array subscript is specified as a comma separated list of values: the comma is replaced by SUBSEP and the resulting index *************** *** 662,668 **** (non-zero) matching ignores differences between upper and lower case letters; affects the '~' and '!~' operators, the 'index', 'match', 'split', 'sub', and 'gsub' functions, ! and the field splitting based on FS; default value is false (0); has no effect if GAWK is in strict compatibility mode FIELDWIDTHS space or tab separated list of width sizes; takes precedence over FS when set, but is cleared if FS has a --- 681,687 ---- (non-zero) matching ignores differences between upper and lower case letters; affects the '~' and '!~' operators, the 'index', 'match', 'split', 'sub', and 'gsub' functions, ! and field splitting based on FS; default value is false (0); has no effect if GAWK is in strict compatibility mode FIELDWIDTHS space or tab separated list of width sizes; takes precedence over FS when set, but is cleared if FS has a *************** *** 676,681 **** --- 695,702 ---- input file is processed by the same program) FNR current record number of the current input file; reset to 0 each time an input file is completed + RT record terminator, the input text which matched RS; not + available when the `-W traditional' option is used RSTART starting position of substring matched by last invocation of the 'match' function; set to 0 if a match fails and at the start of each input record *************** *** 687,693 **** implementation of GAWK provides values for ["USER"] (the username), ["PATH"] (current default directory), ["HOME"] (the user's login directory), and "[TERM]" (terminal type ! if available) [all info provided by VAXCRTL's environ] ERRNO information about the cause of failure for 'getline' or 'close'; "0" if no such failure has occured. ARGC number of elements in the ARGV array, counting [0] which is --- 708,714 ---- implementation of GAWK provides values for ["USER"] (the username), ["PATH"] (current default directory), ["HOME"] (the user's login directory), and "[TERM]" (terminal type ! if available) [all info provided by C RTL's environ] ERRNO information about the cause of failure for 'getline' or 'close'; "0" if no such failure has occured. ARGC number of elements in the ARGV array, counting [0] which is *************** *** 723,730 **** or 0 otherwise. To remove an element from an array, use the 'delete' statement delete Array[Index] ! Note: there is no way to delete an ordinary variable or an entire ! array; 'delete' only works on a specific array element. To process all elements of an array (in succession) when their subscripts might be unknown, use the 'in' variant of the for-loop --- 744,754 ---- or 0 otherwise. To remove an element from an array, use the 'delete' statement delete Array[Index] ! To remove all array elements at once, use ! delete Array ! Note: the latter is a gawk extension; also, there is no way to ! delete an ordinary variable or an entire array; 'delete' only works ! on array elements. To process all elements of an array (in succession) when their subscripts might be unknown, use the 'in' variant of the for-loop *************** *** 800,805 **** --- 824,838 ---- gsub(r,t,s) similar to sub(), but gsub() replaces all nonoverlapping substrings instead of just the first, and the return value is the number of substitutions made + gensub(r,t,n,s) search string s ($0 if omitted) for regexp r and + replace the n'th occurrence with substring t; the + result is the new string and s (or $0) remains + unchanged; if n begins with letter "g" or "G" then + all matches are replaced instead of just the n'th; + if r has parenthesized subexpressions in it, t may + contain the special sequences \\0, \\1, through \\9 + which expand into the value of the corresponding + subexpression; this function is a gawk extension substr(s,p,l) extract a substring l characters long starting at offset p in string s; l is optional, if omitted then the remainder of the string (p thru end) is returned *************** *** 879,884 **** --- 912,920 ---- close(s) close a file or pipe specified by the string s; the string used should have the same value as the one used in a getline or print/printf redirection + fflush(s) flush output stream s; if s is omitted, stdout is + flushed; if it is specified but its value is an + empty string, all output streams are flushed system(s) pass string s to executed by the operating system; the command string is executed in a subprocess 5 redirection *************** *** 955,963 **** g 'fractional' number in either 'e' or 'f' format, whichever produces shorter result ! Three optional modifiers can be placed between the initiating percent sign and the format character (doesn't apply to %%). - left justify (only matters when width specifier is present) NN width ['NN' represents 1 or more decimal digits]; actually minimum width to use, longer items will not be truncated; a leading 0 will cause right-justified numbers to be padded on --- 991,1005 ---- g 'fractional' number in either 'e' or 'f' format, whichever produces shorter result ! Several optional modifiers can be placed between the initiating percent sign and the format character (doesn't apply to %%). - left justify (only matters when width specifier is present) + (space) for numeric specifiers, prefix nonnegative values with + a space and negative values with a minus sign + + for numeric specifiers, prefix nonnegative values with a plus + sign and negative values with a minus sign + # alternate form applicable to several of the format characters + (o, x, X, e, E, f, g, G) NN width ['NN' represents 1 or more decimal digits]; actually minimum width to use, longer items will not be truncated; a leading 0 will cause right-justified numbers to be padded on *************** *** 1002,1008 **** first character of the set is '^', then the sense of match is reversed: [^0-9] matches any non-digit; several characters need to be quoted with backslash (\) if they ! occur in a set: '\', ']', '-', and '^' | alternation (similar to boolean 'or'); match either of two patterns [for example "^start|stop$" matches leading 'start' or trailing 'stop'] --- 1044,1052 ---- first character of the set is '^', then the sense of match is reversed: [^0-9] matches any non-digit; several characters need to be quoted with backslash (\) if they ! occur in a set: '\', ']', '-', and '^'; within sets, ! various special character class designations are recognized, ! such as [:digit:] and [:punct:], as per POSIX | alternation (similar to boolean 'or'); match either of two patterns [for example "^start|stop$" matches leading 'start' or trailing 'stop'] *************** *** 1018,1025 **** ? optional matching; indicates that the pattern can match zero or one times ["[a-z][0-9]?" matches lower case letter alone or followed by a single digit] \ quote; prevent the character which follows from having special ! meaning A regular expression which matches a string or line will match against the first (left-most) substring which meets the pattern and include --- 1062,1074 ---- ? optional matching; indicates that the pattern can match zero or one times ["[a-z][0-9]?" matches lower case letter alone or followed by a single digit] + { } interval specification; {n} to match n times or {m,n} to match + at least m but not more than n times; only functional when + either the `-W posix' or `-W re-interval' options are used \ quote; prevent the character which follows from having special ! meaning; if the regexp is specified as a string, then the ! backslash itself will need to be quoted by preceding it with ! another backslash A regular expression which matches a string or line will match against the first (left-most) substring which meets the pattern and include *************** *** 1030,1045 **** explanation of what an awk program is doing and also who wrote it and when. 3 further_information ! For complete documentation on GAWK, see "The_GAWK_Manual" from FSF. ! Source text for it is present in the file GAWK.TEXINFO. A postscript version is available via anonymous FTP from host prep.ai.mit.edu in ! directory pub/gnu/. ! For additional documentation on awk--above and beyond that provided in ! The_GAWK_Manual--see "The_AWK_Programming_Language" by Aho, Weinberger, ! and Kernighan (2nd edition, 1988), published by Addison-Wesley. It is ! both a reference on the awk language and a tutorial on awk's use, with ! many sample programs. 3 authors The awk programming language was originally created by Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan in 1977. The language --- 1079,1099 ---- explanation of what an awk program is doing and also who wrote it and when. 3 further_information ! For complete documentation on GAWK, see "Effective AWK Programming" ! by Arnold Robbins. The second edition (ISBN 1-57831-000-8) is jointly ! published by SSC and the FSF (http://www.ssc.com). ! ! Source text for it is present in the file GAWK.TEXI. A postscript version is available via anonymous FTP from host prep.ai.mit.edu in ! directory pub/gnu/, file gawk-{version}-doc.tar.gz where {version} ! would be the current version number, such as 3.0.3. ! ! Another source of documentation is "The AWK Programming Language" ! by Aho, Weinberger, and Kernighan (1988), published by Addison-Wesley. ! ISBN code is 0-201-07981-X. ! Each of these works contains both a reference on the awk language ! and a tutorial on awk's use, with many sample programs. 3 authors The awk programming language was originally created by Alfred V. Aho, Peter J. Weinberger, and Brian W. Kernighan in 1977. The language *************** *** 1049,1065 **** and Jay Fenlason, with advice from Richard Stallman, and with contributions from John Woods. In 1988 and 1989, David Trueman and Arnold Robbins revised GAWK for compatibility with the newer awk. GAWK version 2.11.1 was ported to VMS by Pat Rankin in November, 1989, with further revisions in the Spring of 1990. The VMS port was incorporated into the official GNU distribution of version 2.13 in Spring 1991. (Version 2.12 was never publically released.) 2 release_notes ! GAWK 2.15.6 tested under VAX/VMS V5.5-2, January, 1995; should be ! compatible with VMS versions V4.6 and later. Current source code ! compatible with DEC's VAX C v3.x and v2.4, or DEC C v4.x; also ! compiles successfully with GNU C (GNU's gcc). VMS POSIX uses c89 and ! requires VAX C V3.x (DEC C might work too, but hasn't been confirmed). 3 AWK_LIBRARY GAWK uses a built in search path when looking for a program file specified by the -f option (or the /input qualifier) when that file --- 1103,1119 ---- and Jay Fenlason, with advice from Richard Stallman, and with contributions from John Woods. In 1988 and 1989, David Trueman and Arnold Robbins revised GAWK for compatibility with the newer awk. + Arnold Robbins is the current maintainer. GAWK version 2.11.1 was ported to VMS by Pat Rankin in November, 1989, with further revisions in the Spring of 1990. The VMS port was incorporated into the official GNU distribution of version 2.13 in Spring 1991. (Version 2.12 was never publically released.) 2 release_notes ! GAWK 3.0.3 tested under VAX/VMS V6.2 and Alpha/VMS V6.2, April, 1997; ! should be compatible with VMS versions V4.6 and later. Current source ! code is compatible with DEC's DEC C v5.x or VAX C v3.2; also compiles ! successfully with GNU C (tested with gcc-vms 2.7.1). 3 AWK_LIBRARY GAWK uses a built in search path when looking for a program file specified by the -f option (or the /input qualifier) when that file *************** *** 1146,1151 **** --- 1200,1218 ---- failure. The final exit status will be 1 (VMS success) if 0 is used, or even (VMS non-success) if non-zero is used. 3 changes + Changes between version 3.0.3 and 2.15.6 + + General + RS can contain multiple characters or be a regexp + Regular expression interval support added + gensub() and fflush() functions added + memory leak(s) introduced in 3.0.2 or 3.0.1 fixed + the user manual has been substantially revised + + VMS-specific + Switched to build with DEC C by default + + 3 prior_changes Changes between version 2.15.6 and 2.14 General *************** *** 1157,1163 **** `>+ file' binary-mode output redirection added /variable=(foo=42) fixed Floating point number formatting improved ! 3 prior_changes Changes between version 2.14 and 2.13.2: General --- 1224,1230 ---- `>+ file' binary-mode output redirection added /variable=(foo=42) fixed Floating point number formatting improved ! Changes between version 2.14 and 2.13.2: General diff -crN gawk-3.0.2/vms/redirect.h gawk-3.0.3/vms/redirect.h *** gawk-3.0.2/vms/redirect.h Thu Dec 19 23:26:01 1996 --- gawk-3.0.3/vms/redirect.h Sun Jan 19 23:19:41 1997 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 88, 89, 91-93, 1996 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 88, 89, 91-93, 1996, 1997 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 99,109 **** extern int dup P((int)); extern int dup2 P((int, int)); extern int read P((int, void *, int)); - #if defined(__DECC) && !defined(__CAN_USE_EXTERN_PREFIX) - struct stat; - extern int fstat P((int, struct stat *)); - extern int stat P((const char *, struct stat *)); - #endif extern int getpgrp P((void)); #endif /* not VMS_POSIX and not IN_CONFIG_H */ --- 99,104 ---- diff -crN gawk-3.0.2/vms/vms_args.c gawk-3.0.3/vms/vms_args.c *** gawk-3.0.2/vms/vms_args.c Sun Nov 3 10:18:25 1996 --- gawk-3.0.3/vms/vms_args.c Tue May 6 12:30:03 1997 *************** *** 1,28 **** ! /* ! * vms_args.c -- command line parsing, to emulate shell i/o redirection. ! * [ Escape sequence parsing now suppressed. ] ! */ ! /* ! * Copyright (C) 1991-1996 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 ! */ /* * [.vms]vms_arg_fixup - emulate shell's command line processing: handle --- 1,21 ---- ! /* vms_args.c -- command line parsing, to emulate shell i/o redirection. ! [ Escape sequence parsing now suppressed. ] ! Copyright (C) 1991-1996, 1997 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * [.vms]vms_arg_fixup - emulate shell's command line processing: handle *************** *** 206,212 **** fatal("conflicting specifications for stdout"); else { out_to_err_redirect = 1; ! f_out = "SYS$ERROR:"; } break; case '|': /* pipe */ /* command pipelines are not supported */ --- 199,205 ---- fatal("conflicting specifications for stdout"); else { out_to_err_redirect = 1; ! /* f_out = "SYS$ERROR:"; */ } break; case '|': /* pipe */ /* command pipelines are not supported */ diff -crN gawk-3.0.2/vms/vms_fwrite.c gawk-3.0.3/vms/vms_fwrite.c *** gawk-3.0.2/vms/vms_fwrite.c Sun Nov 3 10:18:26 1996 --- gawk-3.0.3/vms/vms_fwrite.c Thu May 1 21:36:40 1997 *************** *** 1,27 **** ! /* ! * vms_fwrite.c - augmentation for the fwrite() function. ! */ ! /* ! * Copyright (C) 1991-1996 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 ! */ #include "awk.h" /* really "../awk.h" */ --- 1,20 ---- ! /* vms_fwrite.c - augmentation for the fwrite() function. ! Copyright (C) 1991-1996 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "awk.h" /* really "../awk.h" */ diff -crN gawk-3.0.2/vms/vms_gawk.c gawk-3.0.3/vms/vms_gawk.c *** gawk-3.0.2/vms/vms_gawk.c Sun Nov 3 10:18:27 1996 --- gawk-3.0.3/vms/vms_gawk.c Thu May 1 21:36:40 1997 *************** *** 1,27 **** ! /* ! * vms_gawk.c -- parse GAWK command line using DCL syntax ! */ ! /* ! * Copyright (C) 1991-1993, 1996 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 ! */ /* * vms_gawk.c - routines to parse the command line as a native DCL command --- 1,21 ---- ! /* vms_gawk.c -- parse GAWK command line using DCL syntax ! Copyright (C) 1991-1993, 1996 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ! /* * vms_gawk.c - routines to parse the command line as a native DCL command diff -crN gawk-3.0.2/vms/vms_misc.c gawk-3.0.3/vms/vms_misc.c *** gawk-3.0.2/vms/vms_misc.c Tue Dec 24 10:28:11 1996 --- gawk-3.0.3/vms/vms_misc.c Tue May 6 12:30:04 1997 *************** *** 1,27 **** ! /* ! * vms_misc.c -- sustitute code for missing/different run-time library routines. ! */ ! ! /* ! * Copyright (C) 1991-1993, 1996 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 ! */ #define creat creat_dummy /* one of gcc-vms's headers has bad prototype */ #include "awk.h" --- 1,20 ---- ! /* vms_misc.c -- sustitute code for missing/different run-time library routines. ! ! Copyright (C) 1991-1993, 1996, 1997 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define creat creat_dummy /* one of gcc-vms's headers has bad prototype */ #include "awk.h" *************** *** 118,134 **** { int result; ! if (mode == (O_WRONLY|O_CREAT|O_TRUNC)) ! result = creat(name, 0, "shr=nil", "mbc=32"); ! else { struct stat stb; ! const char *mbc, *shr = "shr=get"; if (stat((char *)name, &stb) < 0) { /* assume DECnet */ mbc = "mbc=8"; } else { /* ordinary file; allow full sharing iff record format */ mbc = "mbc=32"; ! if (stb.st_fab_rfm < FAB$C_STM) shr = "shr=get,put,upd"; } result = open(name, mode, 0, shr, mbc, "mbf=2"); } --- 111,129 ---- { int result; ! if (mode == (O_WRONLY|O_CREAT|O_TRUNC)) { ! /* explicitly force stream_lf record format to override DECC$SHR's ! defaulting of RFM to earlier file version's when one is present */ ! result = creat(name, 0, "rfm=stmlf", "shr=nil", "mbc=32"); ! } else { struct stat stb; ! const char *mbc, *shr = "shr=get", *ctx = "ctx=stm"; if (stat((char *)name, &stb) < 0) { /* assume DECnet */ mbc = "mbc=8"; } else { /* ordinary file; allow full sharing iff record format */ mbc = "mbc=32"; ! if ((stb.st_fab_rfm & 0x0F) < FAB$C_STM) shr = "shr=get,put,upd"; } result = open(name, mode, 0, shr, mbc, "mbf=2"); } diff -crN gawk-3.0.2/vms/vms_popen.c gawk-3.0.3/vms/vms_popen.c *** gawk-3.0.2/vms/vms_popen.c Tue Dec 17 22:08:32 1996 --- gawk-3.0.3/vms/vms_popen.c Thu May 1 21:36:41 1997 *************** *** 1,27 **** ! /* ! * [.vms]vms_popen.c -- substitute routines for missing pipe calls. ! */ ! /* ! * Copyright (C) 1991-1993, 1996 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 ! */ #ifndef NO_VMS_PIPES --- 1,20 ---- ! /* [.vms]vms_popen.c -- substitute routines for missing pipe calls. ! Copyright (C) 1991-1993, 1996 the Free Software Foundation, Inc. ! ! This program is free software; you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation; either version 2, or (at your option) ! any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program; if not, write to the Free Software Foundation, ! Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef NO_VMS_PIPES diff -crN gawk-3.0.2/vms/vmsbuild.com gawk-3.0.3/vms/vmsbuild.com *** gawk-3.0.2/vms/vmsbuild.com Wed Nov 20 21:57:50 1996 --- gawk-3.0.3/vms/vmsbuild.com Tue Apr 15 06:19:59 1997 *************** *** 7,13 **** $! gawk 3.0.1 revised, Nov'96 $! $ REL = "3.0" !release version number ! $ PATCHLVL = "1" $! $! $ CCFLAGS = "/noList" ! "/noOpt/Debug" --- 7,13 ---- $! gawk 3.0.1 revised, Nov'96 $! $ REL = "3.0" !release version number ! $ PATCHLVL = "3" $! $! $ CCFLAGS = "/noList" ! "/noOpt/Debug" diff -crN gawk-3.0.2/vms/vmstest.com gawk-3.0.3/vms/vmstest.com *** gawk-3.0.2/vms/vmstest.com Wed Nov 20 21:57:50 1996 --- gawk-3.0.3/vms/vmstest.com Tue May 13 12:30:59 1997 *************** *** 31,37 **** $ if bigtest_list.nes."" then goto bigtest_loop $ return $ ! $basic: basic_list = "msg swaplns messages argarray longwrds" - + " getline fstabplus compare arrayref rs fsrs rand" - + " fsbs negexp asgext anchgsub splitargv awkpath nfset" - + " reparse convfmt arrayparm paramdup nonl defref" - --- 31,37 ---- $ if bigtest_list.nes."" then goto bigtest_loop $ return $ ! $basic: basic_lst1 = "msg swaplns messages argarray longwrds" - + " getline fstabplus compare arrayref rs fsrs rand" - + " fsbs negexp asgext anchgsub splitargv awkpath nfset" - + " reparse convfmt arrayparm paramdup nonl defref" - *************** *** 40,53 **** + " prmreuse math fldchg fldchgnf reindops sprintfc" - + " backgsub tweakfld clsflnam mmap8k fnarray dynlj" - + " substr eofsplit prt1eval splitwht back89 tradanch" $ echo "basic" ! $basic_loop: basic_test = f$element(0," ",basic_list) ! $ basic_list = basic_list - basic_test - " " $ if basic_test.nes." " then gosub 'basic_test' ! $ if basic_list.nes."" then goto basic_loop $ return $ ! $unix_tests: unix_tst_list = "poundbang fflush getlnhd" $ echo "unix_tests" $unix_tst_loop: unix_tst_test = f$element(0," ",unix_tst_list) $ unix_tst_list = unix_tst_list - unix_tst_test - " " --- 40,60 ---- + " prmreuse math fldchg fldchgnf reindops sprintfc" - + " backgsub tweakfld clsflnam mmap8k fnarray dynlj" - + " substr eofsplit prt1eval splitwht back89 tradanch" + $ basic_lst2 = "nlfldsep splitvar intest nfldstr nors" - + + " fnarydel noparms funstack clobber delarprm prdupval" $ echo "basic" ! $basic_loop1: basic_test = f$element(0," ",basic_lst1) ! $ basic_lst1 = basic_lst1 - basic_test - " " $ if basic_test.nes." " then gosub 'basic_test' ! $ if basic_lst1.nes."" then goto basic_loop1 ! $basic_loop2: basic_test = f$element(0," ",basic_lst2) ! $ basic_lst2 = basic_lst2 - basic_test - " " ! $ if basic_test.nes." " then gosub 'basic_test' ! $ if basic_lst2.nes."" then goto basic_loop2 $ return $ ! $unix_tests: unix_tst_list = "poundbang fflush getlnhd pipeio1" - ! + " pipeio2 strftlng pid" $ echo "unix_tests" $unix_tst_loop: unix_tst_test = f$element(0," ",unix_tst_list) $ unix_tst_list = unix_tst_list - unix_tst_test - " " *************** *** 56,62 **** $ return $ $gawk_ext: gawk_ext_list = "fieldwdth ignrcase posix manyfiles" - ! + " igncfs argtest badargs strftime gensub gnureops" $ echo "gawk_ext (gawk.extensions)" $gawk_ext_loop: gawk_ext_test = f$element(0," ",gawk_ext_list) $ gawk_ext_list = gawk_ext_list - gawk_ext_test - " " --- 63,70 ---- $ return $ $gawk_ext: gawk_ext_list = "fieldwdth ignrcase posix manyfiles" - ! + " igncfs argtest badargs strftime gensub gnureops reint" - ! + " nondec" $ echo "gawk_ext (gawk.extensions)" $gawk_ext_loop: gawk_ext_test = f$element(0," ",gawk_ext_list) $ gawk_ext_list = gawk_ext_list - gawk_ext_test - " " *************** *** 306,313 **** $ return $ $nonl: echo "nonl" ! $ ! this one might fail, depending on how the distribution was unpacked, ! $ ! because the nonl.awk might actually end up with a final newline $ AWKPATH_srcdir $ gawk --lint -f nonl.awk _NL: >tmp. 2>&1 $ cmp nonl.ok tmp. --- 314,325 ---- $ return $ $nonl: echo "nonl" ! $ ! This one might fail, depending on which C run-time library is used. ! $ ! If VAXCRTL is used by the program that unpacks the distribution, ! $ ! then nonl.awk will actually end with a newline. Even when that's ! $ ! not the case, if gawk itself uses VAXCRTL, an absent newline will ! $ ! be fabricated by the library when gawk reads the file. DECC$SHR ! $ ! doesn't behave this way.... $ AWKPATH_srcdir $ gawk --lint -f nonl.awk _NL: >tmp. 2>&1 $ cmp nonl.ok tmp. *************** *** 401,407 **** $ if $status then rm tmp.; $ return $ ! $! note: this `childin' test currently [gawk 3.0.1] fails for vms $childin: echo "childin" $ echo "note: type ``hi'",- "' if testing appears to hang in `childin'" --- 413,421 ---- $ if $status then rm tmp.; $ return $ ! $childin: echo "childin: currently fails for the VMS port, so skipped" ! $ return ! $! note: this `childin' test currently [gawk 3.0.3] fails for vms $childin: echo "childin" $ echo "note: type ``hi'",- "' if testing appears to hang in `childin'" *************** *** 573,584 **** --- 587,729 ---- $ if $status then rm tmp.; $ return $ + $nlfldsep: echo "nlfldsep" + $ gawk -f nlfldsep.awk nlfldsep.in >tmp. + $ cmp nlfldsep.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $splitvar: echo "splitvar" + $ gawk -f splitvar.awk splitvar.in >tmp. + $ cmp splitvar.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $intest: echo "intest" + $ gawk -f intest.awk >tmp. + $ cmp intest.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $pid: echo "pid" + $ if f$search("pid.ok").eqs."" then create pid.ok + $ open/Write ftmp _pid.in + $ write ftmp f$integer("%x" + f$getjpi("","PID")) + $ write ftmp f$integer("%x" + f$getjpi("","OWNER")) + $ close ftmp + $ gawk -f pid.awk _pid.in >tmp. + $ rm _pid.in; + $ cmp pid.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $strftlng: echo "strftlng" + $ define/User TZ "UTC" !useless + $ gawk -f strftlng.awk >tmp. + $ cmp strftlng.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $nfldstr: echo "nfldstr" + $ if f$search("nfldstr.ok").eqs."" then create nfldstr.ok + $ gawk "$1 == 0 { print ""bug"" }" >tmp. + + $ cmp nfldstr.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $nors: echo "nors" + $!! there's no straightforward way to supply non-terminated input on the fly + $!! @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ + $!! so just read a line from sys$input instead + $ gawk "{ print $NF }" - nors.in >tmp. + A B C D E + $ cmp nors.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $fnarydel: echo "fnarydel" + $ gawk -f fnarydel.awk >tmp. + $ cmp fnarydel.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $reint: echo "reint" + $ gawk --re-interval -f reint.awk reint.in >tmp. + $ cmp reint.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $noparms: echo "noparms" + $ set noOn + $ AWKPATH_srcdir + $ gawk -f noparms.awk >tmp. 2>&1 + $ set On + $ cmp noparms.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $pipeio1: echo "pipeio1" + $ cat = "TYPE" !close enough, as long as we avoid .LIS default suffix + $ define/User test1 []test1. + $ define/User test2 []test2. + $ gawk -f pipeio1.awk >tmp. + $ rm test1.;,test2.; + $ cmp pipeio1.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $pipeio2: + $ echo "pipeio2: uses Unix-specific command so won't work on VMS" + $ return + $!!pipeio2: echo "pipeio2" + $ cat = "gawk -- {print}" + $ tr = "??" !unfortunately, no trivial substitution available... + $ gawk -v "SRCDIR=." -f pipeio2.awk >tmp. + $ cmp pipeio2.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $funstack: echo "funstack" + $ gawk -f funstack.awk funstack.in >tmp. + $ cmp funstack.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $clobber: echo "clobber" + $ gawk -f clobber.awk >tmp. + $ cmp clobber.ok seq. + $ if $status then rm seq.;* + $ cmp clobber.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $delarprm: echo "delarprm" + $ gawk -f delarprm.awk >tmp. + $ cmp delarprm.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $prdupval: echo "prdupval" + $ gawk -f prdupval.awk prdupval.in >tmp. + $ cmp prdupval.ok tmp. + $ if $status then rm tmp.; + $ return + $ + $nondec: echo "nondec" + $ ! gawk -f nondec.awk >tmp. + $ ! cmp nondec.ok tmp. + $ ! if $status then rm tmp.; + $ return $ $clean: $ if f$search("tmp.") .nes."" then rm tmp.;* $ if f$search("tmp.too") .nes."" then rm tmp.too;* $ if f$search("out%.") .nes."" then rm out%.;* $ if f$search("strftime.ok").nes."" then rm strftime.ok;* + $ if f$search("test%.") .nes."" then rm test%.;* + $ if f$search("seq.") .nes."" then rm seq.;* + $ if f$search("_pid.in") .nes."" then rm _pid.in;* $ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;* $ if f$parse("[.junk]") .nes."" then rm []junk.dir;1 $ return EOF # fix modes chmod 644 doc/setter.outline chmod 755 test/pid.sh # remove files and directories that are not needed any more rm -f test/nlfldsep.sh rm -fr amiga # create zero-length files touch test/delarprm.ok touch test/funstack.ok touch test/nlfldstr.ok touch test/pid.ok # files that it's easier to have shars of than to have diffs rm -f doc/awkcard.in cat << \EOF > doc/awkcard.in .\" AWK Reference Card --- Arnold Robbins, arnold@gnu.ai.mit.edu .\" .\" Copyright (C) 1996, 97 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission .\" notice are preserved on all copies. .\" .\" Permission is granted to process this file through troff and print the .\" results, provided the printed document carries copying permission .\" notice identical to this one except for the removal of this paragraph .\" (this paragraph not being relevant to the printed reference card). .\" .\" Permission is granted to copy and distribute modified versions of this .\" reference card under the conditions for verbatim copying, provided that .\" the entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Permission is granted to copy and distribute translations of this .\" reference card into another language, under the above conditions for .\" modified versions, except that this permission notice may be stated in .\" a translation approved by the Foundation. .\" .\" Strings to save typing .ds AK \*(FCawk\*(FR .ds GK \*(FCgawk\*(FR .ds NK Bell Labs \*(FCawk\*(FR .ds MK \*(FCmawk\*(FR .\" .\" .de TD\" tab defaults .ta .2i .78i 1i 1.2i 1.4i 1.7i .. .de TE .TD .. .sp .ce \*(CD\f(HB\s+8AWK REFERENCE\s0\*(FR .sp .\" --- Table Of Contents .ta 2.4i 2.6iR .lc . .ES .in +.2i .nf \*(FRAWK Program Execution 4 Action Statements 7 Arrays 9 Bug Reports 15 Command Line Arguments (standard) 2 Command Line Arguments (\*(GK) 3 Command Line Arguments (\*(MK) 4 Conversions And Comparisons 10 Copying Permissions 16 Definitions 2 Environment Variables 16 Escape Sequences 7 Expressions 9 Fields 6 FTP Information 16 Historical Features (\*(GK) 16 Input Control 11 Lines And Statements 5 .ig Localization 10 .. Numeric Functions 13 Output Control 11 Pattern Elements 7 POSIX Character Classes (\*(GK) 6 Printf Formats 12 Records 6 Regular Expressions 5 Special Filenames 13 String Functions 14 Time Functions (\*(GK) 15 User-defined Functions 15 Variables 8\*(CX .in -.2i .EB "\s+2\f(HBCONTENTS\*(FR\s0" .sp .TD .fi \*(CD\*(FRThis reference card was written by Arnold Robbins. Brian Kernighan and Michael Brennan reviewed it; we thank them for their help. .sp .SL .sp .so SRCDIR/ad.block .\" a subtlety here; this line changes color. We rely on it .\" also to provide a blank line. \*(CD .SL .nf \*(FR\(co Copyright, 1996, 1997 Free Software Foundation 59 Temple Place \(em Suite 330 Boston, MA 02111-1307 USA .nf .BT .\" .\" .\" --- Definitions .fi .ES \*(CDThis card describes POSIX AWK, as well as the three freely available \*(AK implementations (see \fHFTP Information\fP below). \*(CLCommon extensions (in two or more versions) are printed in light blue. \*(CBFeatures specific to just one version\(emusually GNU AWK (\*(GK)\(emare printed in dark blue. \*(CRExceptions and deprecated features are printed in red. \*(CDFeatures mandated by POSIX are printed in black. .sp .5 Several type faces are used to clarify the meaning: .br .nr IN \w'\(bu ' \(bu \*(FC\*(CN\fP is used for computer input. .br .fi .in +\n(INu .ti -\n(INu \(bu\|\^\*(FI\*(IN\fP is used to indicate user input and for syntactic placeholders, such as \*(FIvariable\fP or \*(FIaction\fP. .in -\n(INu .br \(bu \*(RN is used for explanatory text. .sp .5 \*(FInumber\fP \- a floating point number as in ANSI C, such as \*(FC3\*(FR, \*(FC2.3\*(FR, \*(FC.4\*(FR, \*(FC1.4e2\*(FR or \*(FC4.1E5\*(FR. .sp .5 \*(FIescape sequences\fP \- a special sequence of characters beginning with a backslash, used to describe otherwise unprintable characters. (See \fHEscape Sequences\fP below.) .sp .5 \*(FIstring\fP \- a group of characters enclosed in double quotes. Strings may contain \*(FIescape sequences\*(FR. .sp .5 \*(FIregexp\fP \- a regular expression, either a regexp constant enclosed in forward slashes, or a dynamic regexp computed at run-time. Regexp constants may contain \*(FIescape sequences\*(FR. .sp .5 \*(FIname\fP \- a variable, array or function name. .sp .5 \*(FIentry\fP(\*(FIN\fP) \- entry \*(FIentry\fP in section \*(FIN\fP of the UNIX reference manual. .sp .5 \*(FIpattern\fP \- an expression describing an input record to be matched. .sp .5 \*(FIaction\fP \- statements to execute when an input record is matched. .sp .5 \*(FIrule\fP \- a pattern-action pair, where the pattern or action may be missing.\*(CX .EB \s+2\f(HBDEFINITIONS\*(FR\s0 .\" --- Command Line Arguments .ES .fi \*(CDCommand line arguments control setting the field separator, setting variables before the \*(FCBEGIN\fP rule is run, and the location of AWK program source code. Implementation-specific command line arguments change the behavior of the running interpreter. .sp .5 .TS expand; l lw(2.2i). \*(FC\-F \*(FIfs\*(FR use \*(FIfs\fP for the input field separator. \*(FC\-v\*(FI var\*(FC\^=\^\*(FIval\*(FR T{ assign the value \*(FIval\*(FR, to the variable \*(FIvar\*(FR, before execution of the program begins. Such variable values are available to the \*(FCBEGIN\fP rule. T} \*(FC\-f \*(FIprog-file\*(FR T{ read the AWK program source from the file \*(FIprog-file\*(FR, instead of from the first command line argument. Multiple \*(FC\-f\*(FR options may be used. T} \*(FC\-\^\-\*(FR signal the end of options. .TE .sp .5 .fi \*(CLThe following options are accepted by both \*(NK and \*(GK \*(CR(ignored by \*(GK, not in \*(MK).\*(CL .sp .5 .nf .TS expand, tab(%); l lw(2.2i). \*(FC\-mf \*(FIval\*(FR%set the maximum number of fields to \*(FIval\fP \*(FC\-mr \*(FIval\*(FR%set the maximum record size to \*(FIval\fP\*(CX .TE .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (standard)\*(FR\s0" .BT .ES .fi \*(CDThe following options are specific to \*(GK. The \*(FC\-W\*(FR forms are for full POSIX compliance. .sp .5 .ig .\" This option is left undocumented, on purpose. \*(FC\-\^\-nostalgia\*(FR \*(FC\-W nostalgia\*(FR%T{ provide a moment of nostalgia for long time \*(AK users. T} .. .TS expand, tab(%); ls l lw(1.8i). \*(FC\-\^\-field-separator \*(FIfs\*(FR %just like \*(FC\-F\fP \*(FC\-\^\-assign \*(FIvar\*(FC\^=\^\*(FIval\*(FR%just like \*(FC\-v\fP \*(FC\-\^\-file \*(FIprog-file%\*(FRjust like \*(FC\-f\fP \*(FC\-\^\-traditional\*(FR \*(FC\-\^\-compat\*(FR \*(FC\-W compat\*(FR \*(FC\-W traditional\*(FR%T{ turn off \*(GK-specific extensions (\*(FC\-\^\-traditional\*(FR preferred). T} \*(FC\-\^\-copyleft\*(FR \*(FC\-\^\-copyright\*(FR \*(FC\-W copyleft\*(FR \*(FC\-W copyright\*(FR%T{ print the short version of the GNU copyright information on \*(FCstdout\*(FR. T} \*(FC\-\^\-help\*(FR \*(FC\-\^\-usage\*(FR \*(FC\-W help\*(FR \*(FC\-W usage\*(FR%T{ print a short summary of the available options on \*(FCstdout\*(FR, then exit zero. T} \*(FC\-\^\-lint\*(FR \*(FC\-W lint\*(FR%T{ warn about constructs that are dubious or non-portable to other \*(AKs. T} \*(FC\-\^\-lint\-old\*(FR \*(FC\-W lint\-old\*(FR%T{ warn about constructs that are not portable to the original version of Unix \*(AK. T} \*(FC\-\^\-posix\*(FR \*(FC\-W posix\*(FR%T{ disable common and GNU extensions. Enable \*(FIinterval expressions\*(FR in regular expression matching (see \fHRegular Expressions\fP below). T} \*(FC\-\^\-re\-interval\*(FR \*(FC\-W re\-interval\*(FR%T{ enable \*(FIinterval expressions\*(FR in regular expression matching (see \fHRegular Expressions\fP below). Useful if \*(FC\-\^\-posix\*(FR is not specified. T} \*(FC\-\^\-source '\*(FItext\*(FC'\*(FR \*(FC\-W source '\*(FItext\*(FC'\*(FR%use \*(FItext\*(FR as AWK program source code. \*(FC\-\^\-version\*(FR \*(FC\-W version\*(FR%T{ print version information on \*(FCstdout\fP and exit zero. T} .TE .sp .5 .fi In compatibility mode, any other options are flagged as illegal, but are otherwise ignored. In normal operation, as long as program text has been supplied, unknown options are passed on to the AWK program in \*(FCARGV\*(FR for processing. This is most useful for running AWK programs via the \*(FC#!\*(FR executable interpreter mechanism.\*(CB .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0" .BT .ES .fi \*(CDThe following options are specific to \*(MK. .sp .5 .fi .TS expand; l lw(1.8i). \*(FC\-W dump\*(FR T{ print an assembly listing of the program to \*(FCstdout\fP and exit zero. T} \*(FC\-W exec \*(FIfile\*(FR T{ read program text from \*(FIfile\fP. No other options are processed. Useful with \*(FC#!\fP. T} \*(FC\-W interactive\*(FR T{ unbuffer \*(FCstdout\fP and line buffer \*(FCstdin\fP. Lines are always records, ignoring \*(FCRS\fP T} \*(FC\-W posix_space\*(FR T{ \*(FC\en\*(FR separates fields when \*(FCRS = "\^"\fP. T} \*(FC\-W sprintf=\*(FInum\*(FR T{ adjust the size of \*(MK's internal \*(FCsprintf\*(FR buffer. T} \*(FC\-W version\*(FR T{ print version and copyright on \*(FCstdout\fP and limit information on \*(FCstderr\fP and exit zero. T} .TE .sp .5 .fi The options may be abbreviated using just the first letter, e.g., \*(FC\-We\*(FR, \*(FC\-Wv\*(FR and so on.\*(CB .EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(MK\f(HB)\*(FR\s0" .\" --- Awk Program Execution .ES .fi \*(CDAWK programs are a sequence of pattern-action statements and optional function definitions. .sp .5 \*(FIpattern\*(FC { \*(FIaction statements\*(FC }\*(FR .br \*(FCfunction \*(FIname\*(FC(\*(FIparameter list\*(FC) { \*(FIstatements\*(FC }\*(FR .sp .5 \*(AK first reads the program source from the \*(FIprog-file\*(FR(s), if specified, \*(CBfrom arguments to \*(FC\-\^\-source\*(FR,\*(CD or from the first non-option argument on the command line. The program text is read as if all the \*(FIprog-file\*(FR(s) \*(CBand command line source texts\*(CD had been concatenated. .sp .5 AWK programs execute in the following order. First, all variable assignments specified via the \*(FC\-v\fP option are performed. Next, \*(AK executes the code in the \*(FCBEGIN\fP rules(s), if any, and then proceeds to read the files \*(FC1\fP through \*(FCARGC \- 1\fP in the \*(FCARGV\fP array. (Adjusting \*(FCARGC\fP and \*(FCARGV\fP thus provides control over the input files that will be processed.) If there are no files named on the command line, \*(AK reads the standard input. .sp .5 If a command line argument has the form \*(FIvar\*(FC=\*(FIval\*(FR, it is treated as a variable assignment. The variable \*(FIvar\fP will be assigned the value \*(FIval\*(FR. (This happens after any \*(FCBEGIN\fP rule(s) have been run.) ... delete this paragraph if no space Command line variable assignment is most useful for dynamically assigning values to the variables \*(AK uses to control how input is broken into fields and records. It is also useful for controlling state if multiple passes are needed over a single data file. .sp .5 If the value of a particular element of \*(FCARGV\fP is empty (\*(FC"\^"\*(FR), \*(AK skips over it. .sp .5 For each record in the input, \*(AK tests to see if it matches any \*(FIpattern\fP in the AWK program. For each pattern that the record matches, the associated \*(FIaction\fP is executed. The patterns are tested in the order they occur in the program. .sp .5 Finally, after all the input is exhausted, \*(AK executes the code in the \*(FCEND\fP rule(s), if any. .sp .5 If a program only has a \*(FCBEGIN\fP rule, no input files are processed. If a program only has an \*(FCEND\fP rule, the input will be read. \*(CX .EB "\s+2\f(HBAWK PROGRAM EXECUTION\*(FR\s0" .BT .\" --- Lines And Statements .ES .fi \*(CDAWK is a line oriented language. The pattern comes first, and then the action. Action statements are enclosed in \*(FC{\fP and \*(FC}\*(FR. Either the pattern or the action may be missing, but not both. If the pattern is missing, the action will be executed for every input record. A missing action is equivalent to .sp .5 \*(FC{ print }\fP .sp .5 which prints the entire record. .sp .5 Comments begin with the \*(FC#\*(FR character, and continue until the end of the line. Normally, a statement ends with a newline, but lines ending in a ``,'', \*(FC{\*(FR, \*(CB\*(FC?\*(FR, \*(FC:\*(FR,\*(CD \*(FC&&\*(FR or \*(FC||\*(FR are automatically continued. Lines ending in \*(FCdo\fP or \*(FCelse\fP also have their statements automatically continued on the following line. In other cases, a line can be continued by ending it with a ``\e'', in which case the newline will be ignored. However, a ``\e'' after a \*(FC#\*(FR is not special. .sp .5 Multiple statements may be put on one line by separating them with a ``;''. This applies to both the statements within the action part of a pattern-action pair (the usual case) and to the pattern-action statements themselves.\*(CX .EB "\s+2\f(HBLINES AND STATEMENTS\*(FR\s0" .\" --- Regular Expressions .ES .fi \*(CDRegular expressions are the extended kind originally defined by \*(FCegrep\fP. \*(CBAdditional GNU regexp operators are supported by \*(GK. A \*(FIword-constituent\fP character is a letter, digit, or underscore (\*(FC_\fP).\*(CD .sp .5 .TS center, tab(~); cp8 sp8 cp8 sp8 lp8|lp8. .\" .vs 10 _ Summary of Regular Expressions In Decreasing Precedence _ \*(FC(\^\*(FIr\*(FC)\*(FR~regular expression (for grouping) \*(FIc\*(FR~if non-special char, matches itself \*(FC\e\*(FI\^c\*(FR~turn off special meaning of \*(FIc\fP \*(FC^\*(FR~beginning of string (note: \*(FInot\fP line) \*(FC$\*(FR~end of string (note: \*(FInot\fP line) \*(FC.\*(FR~any single character, including newline \*(FC[\*(FR...\*(FC]\*(FR~any one character in ... or range \*(FC[^\*(FR...\*(FC]\*(FR~any one character not in ... or range \*(CB\*(FC\ey\*(FR~word boundary \*(FC\eB\*(FR~middle of a word \*(FC\e<\*(FR~beginning of a word \*(FC\e>\*(FR~end of a word \*(FC\ew\*(FR~any word-constituent character \*(FC\eW\*(FR~any non-word-constituent character \*(FC\e`\*(FR~beginning of a buffer (string) \*(FC\e'\*(FR~end of a buffer (string)\*(CD \*(FIr\*(FC*\*(FR~zero or more occurrences of \*(FIr\*(FR \*(FIr\*(FC+\*(FR~one or more occurrences of \*(FIr\*(FR \*(FIr\*(FC?\*(FR~zero or one occurrences of \*(FIr\*(FR \*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR~\*(FIn\fP to \*(FIm\fP occurrences of \*(FIr\*(FR \*(CR(POSIX: see note below)\*(CD \*(FIr1\*(FC|\|\*(FIr2\*(FR~\*(FIr1\*(FR or \*(FIr2\*(FR .TE .sp .5 .fi \*(CRThe \*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR notation is called an \*(FIinterval expression\fP. POSIX mandates it for AWK regexps, but most \*(AKs don't implement it. \*(CBUse \*(FC\-\^\-re\-interval\*(FR or \*(FC\-\^\-posix\*(FR to enable this feature in \*(GK.\*(CX .EB "\s+2\f(HBREGULAR EXPRESSIONS\*(FR\s0" .BT .\" --- POSIX Character Classes (gawk) .ES .fi \*(CDIn regular expressions, within character ranges (\*(FC[\*(FR...\*(FC]\*(FR), the notation \*(FC[[:\*(FIclass\*(FC:]]\*(FR defines characters classes: .sp .5 .TS center, tab(~); lp8 lp8 lp8 lp8. \*(FCalnum\*(FR~alphanumeric~\*(FClower\*(FR~lower-case \*(FCalpha\*(FR~alphabetic~\*(FCprint\*(FR~printable \*(FCblank\*(FR~space or tab~\*(FCpunct\*(FR~punctuation \*(FCcntrl\*(FR~control~\*(FCspace\*(FR~whitespace \*(FCdigit\*(FR~decimal~\*(FCupper\*(FR~upper-case \*(FCgraph\*(FR~non-spaces~\*(FCxdigit\*(FR~hexadecimal\*(CB .TE .fi .EB "\s+2\f(HBPOSIX CHARACTER CLASSES (\*(GK\f(HB)\*(FR\s0" .\" --- Records .ES .fi \*(CDNormally, records are separated by newline characters. Assigning values to the built-in variable \*(FCRS\*(FR controls how records are separated. If \*(FCRS\fP is any single character, that character separates records. \*(CLOtherwise, \*(FCRS\fP is a regular expression. \*(CR(Not \*(NK.)\*(CL Text in the input that matches this regular expression will separate the record. \*(CB\*(GK sets \*(FCRT\*(FR to the value of the input text that matched the regular expression. The value of \*(FCIGNORECASE\fP will also affect how records are separated when \*(FCRS\fP is a regular expression.\*(CD If \*(FCRS\fP is set to the null string, then records are separated by one or more blank lines. When \*(FCRS\fP is set to the null string, the newline character always acts as a field separator, in addition to whatever value \*(FCFS\fP may have. \*(CB\*(MK does not apply exceptional rules to \*(FCFS\fP when \*(FCRS = "\^"\fP.\*(CX .EB \s+2\f(HBRECORDS\*(FR\s0 .\" --- Fields .ES .fi \*(CDAs each input record is read, \*(AK splits the record into \*(FIfields\*(FR, using the value of the \*(FCFS\fP variable as the field separator. If \*(FCFS\fP is a single character, fields are separated by that character. \*(CLIf \*(FCFS\fP is the null string, then each individual character becomes a separate field.\*(CD Otherwise, \*(FCFS\fP is expected to be a full regular expression. In the special case that \*(FCFS\fP is a single space, fields are separated by runs of spaces and/or tabs \*(CLand/or newlines\*(CD. Leading and trailing whitespace are ignored. \*(CBThe value of \*(FCIGNORECASE\fP will also affect how fields are split when \*(FCFS\fP is a regular expression.\*(CD .sp .5 \*(CBIf the \*(FCFIELDWIDTHS\fP variable is set to a space separated list of numbers, each field is expected to have a fixed width, and \*(GK will split up the record using the specified widths. The value of \*(FCFS\fP is ignored. Assigning a new value to \*(FCFS\fP overrides the use of \*(FCFIELDWIDTHS\*(FR, and restores the default behavior.\*(CD .sp .5 Each field in the input record may be referenced by its position, \*(FC$1\*(FR, \*(FC$2\*(FR and so on. \*(FC$0\fP is the whole record. Fields may also be assigned new values. .sp .5 The variable \*(FCNF\fP is set to the total number of fields in the input record. .sp .5 References to non-existent fields (i.e., fields after \*(FC$NF\*(FR) produce the null-string. However, assigning to a non-existent field (e.g., \*(FC$(NF+2) = 5\*(FR) will increase the value of \*(FCNF\*(FR, create any intervening fields with the null string as their value, and cause the value of \*(FC$0\fP to be recomputed with the fields being separated by the value of \*(FCOFS\*(FR. References to negative numbered fields cause a fatal error. Decreasing the value of \*(FCNF\fP causes the trailing fields to be lost \*(CR(not \*(NK).\*(CX .EB \s+2\f(HBFIELDS\*(FR\s0 .BT .\" --- Pattern Elements .ES .fi \*(CDAWK patterns may be one of the following. .sp .5 .nf \*(FCBEGIN END \*(FIexpression pat1\*(FC,\*(FIpat2\*(FR .sp .5 .fi \*(FCBEGIN\fP and \*(FCEND\fP are special patterns that provide start-up and clean-up actions respectively. They must have actions. There can be multiple \*(FCBEGIN\fP and \*(FCEND\fP rules; they are merged and executed as if there had just been one large rule. They may occur anywhere in a program, including different source files. .sp .5 Expression patterns can be any expression, as described under \fHExpressions\fP. .sp .5 The \*(FIpat1\*(FC,\*(FIpat2\*(FR pattern is called a \*(FIrange pattern\*(FR. It matches all input records starting with a record that matches \*(FIpat1\*(FR, and continuing until a record that matches \*(FIpat2\*(FR, inclusive. It does not combine with any other pattern expression.\*(CX .EB "\s+2\f(HBPATTERN ELEMENTS\*(FR\s0" .\" --- Action Statements .ES .nf \*(CD\*(FCif (\*(FIcondition\*(FC) \*(FIstatement\*(FR [ \*(FCelse\*(FI statement \*(FR] \*(FCwhile (\*(FIcondition\*(FC) \*(FIstatement \*(FR \*(FCdo \*(FIstatement \*(FCwhile (\*(FIcondition\*(FC)\*(FR \*(FCfor (\*(FIexpr1\*(FC; \*(FIexpr2\*(FC; \*(FIexpr3\*(FC) \*(FIstatement\*(FR \*(FCfor (\*(FIvar \*(FCin\*(FI array\*(FC) \*(FIstatement\*(FR .ig \*(CB\*(FCabort\*(FR [ \*(FIexpression\*(FR ]\*(CD .. \*(FCbreak\*(FR \*(FCcontinue\*(FR \*(FCdelete \*(FIarray\^\*(FC[\^\*(FIindex\^\*(FC]\*(FR \*(CL\*(FCdelete \*(FIarray\^\*(FR\*(CD \*(FCexit\*(FR [ \*(FIexpression\*(FR ] \*(FCnext\*(FR \*(CL\*(FCnextfile\*(FR \*(CR(not \*(MK)\*(CD \*(FC{ \*(FIstatements \*(FC}\*(CX .EB "\s+2\f(HBACTION STATEMENTS\*(FR\s0" .\" --- Escape Sequences .ES .fi \*(CDWithin strings constants (\*(FC"..."\fP) and regexp constants (\*(FC/.../\fP), escape sequences may be used to generate otherwise unprintable characters. This table lists the available escape sequences. .sp .5 .ig \*(CB\*(FCPROCINFO\fP T{ elements of this array provide access to info about the running AWK program. See \*(AM for details.\*(CD T} .. .TS center, tab(~); lp8 lp8 lp8 lp8. \*(FC\ea\fP~alert (bell)~\*(FC\er\fP~carriage return \*(FC\eb\fP~backspace~\*(FC\et\fP~horizontal tab \*(FC\ef\fP~form feed~\*(FC\ev\fP~vertical tab \*(FC\en\fP~newline~\*(FC\e\e\fP~backslash \*(FC\e\*(FIddd\*(FR~octal value \*(FIddd\fP~\*(CL\*(FC\ex\*(FIhh\*(FR~hex value \*(FIhh\fP\*(CD \*(FC\e"\fP~double quote~\*(FC\e/\fP~forward slash\*(CX .TE .EB "\s+2\f(HBESCAPE SEQUENCES\*(FR\s0" .BT .\" --- Variables .ES .fi .TS expand; l lw(2i). \*(FCARGC\fP T{ number of command line arguments. T} \*(CB\*(FCARGIND\fP T{ index in \*(FCARGV\fP of current data file.\*(CD T} \*(FCARGV\fP T{ array of command line arguments. Indexed from 0 to \*(FCARGC\fP \- 1. Dynamically changing the contents of \*(FCARGV\fP can control the files used for data. T} \*(FCCONVFMT\fP T{ conversion format for numbers, default value is \*(FC"%.6g"\*(FR. T} \*(FCENVIRON\fP T{ array containing the the current environment. The array is indexed by the environment variables, each element being the value of that variable. T} \*(CB\*(FCERRNO\fP T{ contains a string describing the error when a redirection or read for \*(FCgetline\*(FR fails, or if \*(FCclose()\*(FR fails. T} \*(FCFIELDWIDTHS\fP T{ white-space separated list of fieldwidths. Used to parse the input into fields of fixed width, instead of the value of \*(FCFS\fP.\*(CD T} \*(FCFILENAME\fP T{ name of the current input file. If no files given on the command line, \*(FCFILENAME\fP is ``\-''. \*(FCFILENAME\fP is undefined inside the \*(FCBEGIN\fP rule (unless set by \*(FCgetline\fP). T} \*(FCFNR\fP T{ number of the input record in current input file. T} \*(FCFS\fP T{ input field separator, a space by default (see \fHFields\fP above). T} \*(CB\*(FCIGNORECASE\fP T{ if non-zero, all regular expression and string operations ignore case. \*(CRIn versions of \*(GK prior to 3.0, \*(FCIGNORECASE\fP only affected regular expression operations and \*(FCindex()\*(FR.\*(CD T} \*(FCNF\fP T{ number of fields in the current input record. T} \*(FCNR\fP T{ total number of input records seen so far. T} \*(FCOFMT\fP T{ output format for numbers, \*(FC"%.6g"\*(FR, by default. \*(CROld versions of \*(AK also used this for number to string conversion instead of \*(FCCONVFMT\fP.\*(CD T} \*(FCOFS\fP T{ output field separator, a space by default. T} \*(FCORS\fP T{ output record separator, a newline by default. T} \*(FCRS\fP T{ input record separator, a newline by default (see \fHRecords\fP above). T} \*(CB\*(FCRT\fP T{ record terminator. \*(GK sets \*(FCRT\fP to the input text that matched the character or regular expression specified by \*(FCRS\*(FR.\*(CD T} \*(FCRSTART\fP T{ index of the first character matched by \*(FCmatch()\*(FR; 0 if no match. T} \*(FCRLENGTH\fP T{ length of the string matched by \*(FCmatch()\*(FR; \-1 if no match. T} \*(FCSUBSEP\fP T{ character(s) used to separate multiple subscripts in array elements, by default \*(FC"\e034"\*(FR. (see \fHArrays\fP below).\*(CX T} .TE .EB \s+2\f(HBVARIABLES\*(FR\s0 .BT .\" --- Arrays .ES .fi \*(CDAn arrays subscript is an expression between square brackets (\*(FC[ \*(FRand \*(FC]\*(FR). If the expression is a list \*(FC(\*(FIexpr\*(FC, \*(FIexpr \*(FC...)\*(FR, then the subscript is a string consisting of the concatenation of the (string) value of each expression, separated by the value of the \*(FCSUBSEP\fP variable. This simulates multi-dimensional arrays. For example: .nf .sp .5 \*(FCi = "A";\^ j = "B";\^ k = "C" x[i, j, k] = "hello, world\en"\*(FR .sp .5 .fi assigns \*(FC"hello, world\en"\*(FR to the element of the array \*(FCx\fP indexed by the string \*(FC"A\e034B\e034C"\*(FR. All arrays in AWK are associative, i.e., indexed by string values. .sp .5 Use the special operator \*(FCin\fP in an \*(FCif\fP or \*(FCwhile\fP statement to see if a particular value is an array index. .sp .5 .nf \*(FCif (val in array) print array[val]\*(FR .sp .5 .fi If the array has multiple subscripts, use \*(FC(i, j) in array\*(FR. .sp .5 Use the \*(FCin\fP construct in a \*(FCfor\fP loop to iterate over all the elements of an array. .sp .5 Use the \*(FCdelete\fP statement to delete an element from an array. \*(CLSpecifying just the array name without a subscript in the \*(FCdelete\fP statement deletes the entire contents of an array.\*(CX .EB \s+2\f(HBARRAYS\*(FR\s0 .\" --- Expressions .ES .fi \*(CDExpressions are used as patterns, for controlling conditional action statements, and to produce parameter values when calling functions. Expressions may also be used as simple statements, particularly if they have side-effects such as assignment. Expressions mix \*(FIoperands\fP and \*(FIoperators\fP. Operands are constants, fields, variables, array elements, and the return values from function calls (both built-in and user-defined). .sp .5 Regexp constants (\*(FC/\*(FIpat\*(FC/\*(FR), when used as simple expressions, i.e., not used on the right-hand side of \*(FC~\fP and \*(FC!~\fP, or as arguments to the \*(CB\*(FCgensub()\fP,\*(CD \*(FCgsub()\fP, \*(FCmatch()\fP, \*(FCsplit()\fP, and \*(FCsub()\fP, functions, mean \*(FC$0 ~ /\*(FIpat\*(FC/\*(FR. .sp .5 The AWK operators, in order of decreasing precedence, are .sp .5 .fi .TS expand; l lw(1.8i). \*(FC(\&...)\*(FR grouping \*(FC$\fP field reference \*(FC++ \-\^\-\fP T{ increment and decrement, prefix and postfix T} \*(FC^\fP \*(CL\*(FC**\*(FR\*(CD exponentiation \*(FC+ \- !\fP unary plus, unary minus, and logical negation \*(FC* / %\fP multiplication, division, and modulus \*(FC+ \-\fP addition and subtraction \*(FIspace\fP string concatenation \*(FC< >\fP less than, greater than \*(FC<= >=\fP less than or equal, greater than or equal \*(FC!= ==\fP not equal, equal \*(FC~ !~\fP regular expression match, negated match \*(FCin\fP array membership \*(FC&&\fP logical AND, short circuit \*(FC||\fP logical OR, short circuit \*(FC?\^:\fP in-line conditional expression .T& l s l lw(1.8i). \*(FC=\0+=\0\-=\0*=\0/=\0%=\0^=\0\*(CL**=\*(CD\fP assignment operators\*(CX .TE .EB \s+2\f(HBEXPRESSIONS\*(FR\s0 .BT .\" --- Conversions and Comparisons .ES .fi \*(CDVariables and fields may be (floating point) numbers, strings or both. Context determines how the value of a variable is interpreted. If used in a numeric expression, it will be treated as a number, if used as a string it will be treated as a string. .sp .5 To force a variable to be treated as a number, add 0 to it; to force it to be treated as a string, concatenate it with the null string. .sp .5 When a string must be converted to a number, the conversion is accomplished using \*(FIatof\*(FR(3). A number is converted to a string by using the value of \*(FCCONVFMT\fP as a format string for \*(FIsprintf\*(FR(3), with the numeric value of the variable as the argument. However, even though all numbers in AWK are floating-point, integral values are \*(FIalways\fP converted as integers. .sp .5 Comparisons are performed as follows: If two variables are numeric, they are compared numerically. If one value is numeric and the other has a string value that is a ``numeric string,'' then comparisons are also done numerically. Otherwise, the numeric value is converted to a string, and a string comparison is performed. Two strings are compared, of course, as strings. \*(CRAccording to the POSIX standard, even if two strings are numeric strings, a numeric comparison is performed. However, this is clearly incorrect, and none of the three free \*(AK\*(FRs do this.\*(CD .sp .5 Note that string constants, such as \*(FC"57"\fP, are \*(FInot\fP numeric strings, they are string constants. The idea of ``numeric string'' only applies to fields, \*(FCgetline\fP input, \*(FCFILENAME\*(FR, \*(FCARGV\fP elements, \*(FCENVIRON\fP elements and the elements of an array created by \*(FCsplit()\fP that are numeric strings. The basic idea is that \*(FIuser input\*(FR, and only user input, that looks numeric, should be treated that way. .sp .5 Uninitialized variables have the numeric value 0 and the string value \*(FC"\^"\fP (the null, or empty, string).\*(CX .EB "\s+2\f(HBCONVERSIONS AND COMPARISONS\*(FR\s0" .ig .\" --- Localization .ES .nf .ce 100 \*(CDThis section is under construction. .sp .5 This section is under construction.\*(CB .ce 0 .EB "\s+2\f(HBLOCALIZATION\*(FR\s0" .. .ps +2 .ce 1 \*(CD\fHISBN: 0-916151-97-2\*(FR .ps -2 .BT .\" --- Input Control .ES .fi .TS expand; l lw(1.8i). \*(CD\*(FCclose(\*(FIfile\*(FC)\*(FR close input file or pipe. \*(FCgetline\fP T{ set \*(FC$0\fP from next input record; set \*(FCNF\*(FR, \*(FCNR\*(FR, \*(FCFNR\*(FR. T} \*(FCgetline < \*(FIfile\*(FR set \*(FC$0\fP from next record of \*(FIfile\*(FR; set \*(FCNF\*(FR. \*(FCgetline \*(FIv\*(FR T{ set \*(FIv\fP from next input record; set \*(FCNR\*(FR, \*(FCFNR\*(FR. T} \*(FCgetline \*(FIv \*(FC< \*(FIfile\*(FR set \*(FIv\fP from next record of \*(FIfile\*(FR. \*(FIcmd \*(FC| getline\*(FR pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. \*(FIcmd \*(FC| getline \*(FIv\*(FR pipe into \*(FCgetline\*(FR; set \*(FIv\*(FR. .TE .fi .in +.2i .ti -.2i \*(FCnext\fP .br stop processing the current input record. Read next input record and start over with the first pattern in the program. Upon end of the input data, execute any \*(FCEND\fP rule(s). .br .ti -.2i \*(CL\*(FCnextfile\fP .br stop processing the current input file. The next input record comes from the next input file. \*(FCFILENAME\fP \*(CBand \*(FCARGIND\fP\*(CL are updated, \*(FCFNR\fP is reset to 1, and processing starts over with the first pattern in the AWK program. Upon end of input data, execute any \*(FCEND\fP rule(s). \*(CREarlier versions of \*(GK used \*(FCnext file\*(FR, as two words. This generates a warning message and will eventually be removed. \*(CR\*(MK does not currently support \*(FCnextfile\*(FR.\*(CD .in -.2i .sp .5 .fi \*(FCgetline\*(FR returns 0 on end of file, and \-1 on an error.\*(CX .EB "\s+2\f(HBINPUT CONTROL\*(FR\s0" .\" --- Output Control .ES .fi .in +.2i .ti -.2i \*(CD\*(FCclose(\*(FIfile\*(FC)\*(FR .br close output file or pipe. .ti -.2i \*(CL\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR .br flush any buffers associated with the open output file or pipe \*(FIfile\*(FR.\*(CD \*(CBIf \*(FIfile\fP is missing, then standard output is flushed. If \*(FIfile\fP is the null string, then all open output files and pipes are flushed \*(CR(not \*(NK)\*(CD. .ti -.2i \*(FCprint\fP .br print the current record. The output record is terminated with the value of \*(FCORS\fP. .ti -.2i \*(FCprint \*(FIexpr-list\*(FR .br print expressions. Each expression is separated by the value of \*(FCOFS\fP. The output record is terminated with the value of \*(FCORS\fP. .ti -.2i \*(FCprintf \*(FIfmt\*(FC, \*(FIexpr-list\*(FR .br format and print (see \fHPrintf Formats\fP below). .ti -.2i \*(FCsystem(\*(FIcmd\*(FC)\*(FR .br execute the command \*(FIcmd\*(FR, and return the exit status \*(CR(may not be available on non-POSIX systems)\*(CD. .sp .5 .in -.2i I/O redirections may be used with both \*(FCprint\fP and \*(FCprintf\fP. .sp .5 .in +.2i .ti -.2i \*(CD\*(FCprint "hello" > \*(FIfile\*(FR .br Print data to \*(FIfile\fP. The first time the file is written to, it will be truncated. Subsequent commands append data. .ti -.2i \*(FCprint "hello" >> \*(FIfile\*(FR .br Append data to \*(FIfile\fP. The previous contents of the file are not lost. .ti -.2i \*(FCprint "hello" | \*(FIcmd\*(FR .br Print data down a pipeline to \*(FIcmd\*(FR.\*(CX .in -.2i .EB "\s+2\f(HBOUTPUT CONTROL\*(FR\s0" .BT .\" --- Printf Formats .ES .fi \*(CDThe \*(FCprintf\fP statement and \*(FCsprintf()\fP function accept the following conversion specification formats: .sp .5 .nf \*(FC%c\fP an \s-1ASCII\s+1 character \*(FC%d\fP a decimal number (the integer part) \*(FC%i\fP a decimal number (the integer part) \*(FC%e\fP a floating point number of the form \*(FC[\-]d.dddddde[+\^\-]dd\*(FR \*(FC%E\fP like \*(FC%e\fP, but use \*(FCE\fP instead of \*(FCe\*(FR \*(FC%f\fP a floating point number of the form \*(FC[\-]ddd.dddddd\*(FR \*(FC%g\fP use \*(FC%e\fP or \*(FC%f\fP, whichever is shorter, with nonsignificant zeros suppressed \*(FC%G\fP like \*(FC%g\fP, but use \*(FC%E\fP instead of \*(FC%e\*(FR \*(FC%o\fP an unsigned octal integer \*(FC%s\fP a character string \*(FC%x\fP an unsigned hexadecimal integer \*(FC%X\fP like \*(FC%x\fP, but use \*(FCABCDEF\fP for 10\(en15 \*(FC%%\fP A literal \*(FC%\fP; no argument is converted .sp .5 .fi Optional, additional parameters may lie between the \*(FC%\fP and the control letter: .sp .5 .TS expand; l lw(2.2i). \*(FC\-\fP T{ left-justify the expression within its field. T} \*(FIspace\fP T{ for numeric conversions, prefix positive values with a space and negative values with a minus sign. T} \*(FC+\fP T{ used before the \*(FIwidth\fP modifier means to always supply a sign for numeric conversions, even if the data to be formatted is positive. The \*(FC+\fP overrides the space modifier. T} \*(FC#\fP T{ use an ``alternate form'' for some control letters. T} \*(FC%o\*(FR T{ supply a leading zero. T} \*(FC%x\*(FR, \*(FC%X\*(FR T{ supply a leading \*(FC0x\*(FR or \*(FC0X\*(FR for a nonzero result. T} \*(FC%e\*(FR, \*(FC%E\*(FR, \*(FC%f\*(FR T{ the result always has a decimal point. T} \*(FC%g\*(FR, \*(FC%G\*(FR T{ trailing zeros are not removed. T} \*(FC0\fP T{ a leading zero acts as a flag, indicating output should be padded with zeroes instead of spaces. This applies even to non-numeric output formats. Only has an effect when the field width is wider than the value to be printed. T} \*(FIwidth\fP T{ pad the field to this width. The field is normally padded with spaces. If the \*(FC0\fP flag has been used, pad with zeroes. The meaning of the \*(FIwidth\*(FR varies by control letter: T} \*(FC%d\*(FR, \*(FC%o\*(FR, \*(FC%i\*(FR, \*(FC%u\*(FR, \*(FC%x\*(FR, \*(FC%X\fP T{ the minimum number of digits to print. T} \*(FC%e\*(FR, \*(FC%E\*(FR, \*(FC%f\*(FR T{ the number of digits to print to the right of the decimal point. T} \*(FC%g\*(FR, \*(FC%G\fP T{ the maximum number of significant digits. T} \*(FC%s\fP T{ the maximum number of characters to print. T} .TE .sp .5 .fi The dynamic \*(FIwidth\fP and \*(FIprec\fP capabilities of the ANSI C \*(FCprintf()\fP routines are supported. A \*(FC*\fP in place of either the \*(FIwidth\fP or \*(FIprec\fP specifications will cause their values to be taken from the argument list to \*(FCprintf\fP or \*(FCsprintf()\*(FR.\*(CX .EB "\s+2\f(HBPRINTF FORMATS\*(FR\s0" .BT .\" --- Special Filenames .ES .fi \*(CDWhen doing I/O redirection from either \*(FCprint\fP or \*(FCprintf\fP into a file or via \*(FCgetline\fP from a file, all three implementations of \*(FCawk\fP recognize certain special filenames internally. These filenames allow access to open file descriptors inherited from the parent process (usually the shell). These filenames may also be used on the command line to name data files. The filenames are: .sp .5 .TS expand; l lw(2i). \*(FC"\-"\fP standard input \*(FC/dev/stdin\fP standard input \*(CR(not \*(MK)\*(CD \*(FC/dev/stdout\fP standard output \*(FC/dev/stderr\fP standard error output .TE .sp .5 .fi \*(CBThe following names are specific to \*(GK. .sp .5 .TS expand; l lw(2i). \*(FC/dev/fd/\^\*(FIn\*(FR T{ file associated with the open file descriptor \*(FIn\*(FR T} .TE .sp .5 .fi Other special filenames provide access to information about the running \*(FCgawk\fP process. Reading from these files returns a single record. The filenames and what they return are:\*(FR .sp .5 .TS expand; l lw(2i). \*(FC/dev/pid\fP process ID of current process \*(FC/dev/ppid\fP parent process ID of current process \*(FC/dev/pgrpid\fP process group ID of current process \*(FC/dev/user\fP T{ .nf a single newline-terminated record. The fields are separated with spaces. \*(FC$1\fP is the return value of \*(FIgetuid\*(FR(2), \*(FC$2\fP is the return value of \*(FIgeteuid\*(FR(2), \*(FC$3\fP is the return value of \*(FIgetgid\*(FR(2) , and \*(FC$4\fP is the return value of \*(FIgetegid\*(FR(2). .fi Any additional fields are the group IDs returned by \*(FIgetgroups\*(FR(2). Multiple groups may not be supported on all systems. T} .TE .sp .5 .fi .ig \*(CRThese filenames are now obsolete. Use the \*(FCPROCINFO\fP array to obtain the information they provide.\*(CL .. .\" BEGIN FOR 3.0.x \*(CRThese filenames will become obsolete in \*(GK 3.1. Be aware that you will have to change your programs.\*(CL .\" END FOR 3.0.x .EB "\s+2\f(HBSPECIAL FILENAMES\*(FR\s0" .\" --- Builtin Numeric Functions .ES .fi .TS expand; l lw(2i). \*(CD\*(FCatan2(\*(FIy\*(FC, \*(FIx\*(FC)\*(FR the arctangent of \*(FIy/x\fP in radians. \*(FCcos(\*(FIexpr\*(FC)\*(FR the cosine of \*(FIexpr\fP, which is in radians. \*(FCexp(\*(FIexpr\*(FC)\*(FR the exponential function (\*(FIe \*(FC^ \*(FIx\*(FR). \*(FCint(\*(FIexpr\*(FC)\*(FR truncates to integer. \*(FClog(\*(FIexpr\*(FC)\*(FR the natural logarithm function (base \*(FIe\^\*(FR). \*(FCrand()\fP a random number between 0 and 1. \*(FCsin(\*(FIexpr\*(FC)\*(FR the sine of \*(FIexpr\fP, which is in radians. \*(FCsqrt(\*(FIexpr\*(FC)\*(FR the square root function. \&\*(FCsrand(\*(FR[\*(FIexpr\^\*(FR]\*(FC)\*(FR T{ uses \*(FIexpr\fP as a new seed for the random number generator. If no \*(FIexpr\fP, the time of day is used. Returns previous seed for the random number generator.\*(CX T} .TE .EB "\s+2\f(HBNUMERIC FUNCTIONS\*(FR\s0" .BT .\" --- Builtin String Functions .ES .fi .in +.2i .ti -.2i \*(CB\*(FCgensub(\*(FIr\*(FC, \*(FIs\*(FC, \*(FIh \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR .br search the target string \*(FIt\fP for matches of the regular expression \*(FIr\*(FR. If \*(FIh\fP is a string beginning with \*(FCg\fP or \*(FCG\*(FR, replace all matches of \*(FIr\fP with \*(FIs\*(FR. Otherwise, \*(FIh\fP is a number indicating which match of \*(FIr\fP to replace. If no \*(FIt\fP is supplied, \*(FC$0\fP is used instead. Within the replacement text \*(FIs\*(FR, the sequence \*(FC\e\*(FIn\*(FR, where \*(FIn\fP is a digit from 1 to 9, may be used to indicate just the text that matched the \*(FIn\*(FRth parenthesized subexpression. The sequence \*(FC\e0\fP represents the entire matched text, as does the character \*(FC&\*(FR. Unlike \*(FCsub()\fP and \*(FCgsub()\*(FR, the modified string is returned as the result of the function, and the original target string is \*(FInot\fP changed.\*(CD .ti -.2i \*(FCgsub(\*(FIr\*(FC, \*(FIs \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR .br for each substring matching the regular expression \*(FIr\fP in the string \*(FIt\*(FR, substitute the string \*(FIs\*(FR, and return the number of substitutions. If \*(FIt\fP is not supplied, use \*(FC$0\*(FR. An \*(FC&\fP in the replacement text is replaced with the text that was actually matched. Use \*(FC\e&\fP to get a literal \*(FC&\*(FR. See \*(AM for a fuller discussion of the rules for \*(FC&\*(FR's and backslashes in the replacement text of \*(CB\*(FCgensub()\*(FR,\*(CD \*(FCsub()\*(FR and \*(FCgsub()\*(FR .ti -.2i \*(FCindex(\*(FIs\*(FC, \*(FIt\*(FC)\*(FR .br returns the index of the string \*(FIt\fP in the string \*(FIs\*(FR, or 0 if \*(FIt\fP is not present. .ti -.2i \*(FClength(\*(FR[\*(FIs\*(FR]\*(FC)\*(FR .br returns the length of the string \*(FIs\*(FR, or the length of \*(FC$0\fP if \*(FIs\fP is not supplied. .ti -.2i \*(FCmatch(\*(FIs\*(FC, \*(FIr\*(FC)\*(FR .br returns the position in \*(FIs\fP where the regular expression \*(FIr\fP occurs, or 0 if \*(FIr\fP is not present, and sets the values of variables \*(FCRSTART\fP and \*(FCRLENGTH\*(FR. .ti -.2i \*(FCsplit(\*(FIs\*(FC, \*(FIa \*(FR[\*(FC, \*(FIr\*(FR]\*(FC)\*(FR .br splits the string \*(FIs\fP into the array \*(FIa\fP using the regular expression \*(FIr\*(FR, and returns the number of fields. If \*(FIr\fP is omitted, \*(FCFS\fP is used instead. The array \*(FIa\fP is cleared first. Splitting behaves identically to field splitting. (See \fHFields\fP, above.) .ti -.2i \*(FCsprintf(\*(FIfmt\*(FC, \*(FIexpr-list\*(FC)\*(FR .br prints \*(FIexpr-list\fP according to \*(FIfmt\*(FR, and returns the resulting string. .ti -.2i \*(FCsub(\*(FIr\*(FC, \*(FIs \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR .br just like \*(FCgsub()\*(FR, but only the first matching substring is replaced. .ti -.2i \*(FCsubstr(\*(FIs\*(FC, \*(FIi \*(FR[\*(FC, \*(FIn\*(FR]\*(FC)\*(FR .br returns the at most \*(FIn\*(FR-character substring of \*(FIs\fP starting at \*(FIi\*(FR. If \*(FIn\fP is omitted, the rest of \*(FIs\fP is used. .ti -.2i \*(FCtolower(\*(FIstr\*(FC)\*(FR .br returns a copy of the string \*(FIstr\*(FR, with all the upper-case characters in \*(FIstr\fP translated to their corresponding lower-case counterparts. Non-alphabetic characters are left unchanged. .ti -.2i \*(FCtoupper(\*(FIstr\*(FC)\*(FR .br returns a copy of the string \*(FIstr\*(FR, with all the lower-case characters in \*(FIstr\fP translated to their corresponding upper-case counterparts. Non-alphabetic characters are left unchanged.\*(CX .in -.2i .EB "\s+2\f(HBSTRING FUNCTIONS\*(FR\s0" .BT .\" --- Builtin Time Functions .ES .fi \*(CD\*(GK provides the following functions for obtaining time stamps and formatting them. .sp .5 .fi .in +.2i .ig .ti -.2i \*(FCmktime(\*(FIdatespec\*(FC)\*(FR .br turns \*(FIdatespec\fP into a time stamp of the same form as returned by \*(FCsystime()\*(FR. The \*(FIdatespec\fP is a string of the form \*(FC"\*(FIYYYY MM DD HH MM SS\*(FC"\*(FR. .. .ti -.2i \*(FCstrftime(\*(FR[\*(FIformat \*(FR[\*(FC, \*(FItimestamp\*(FR]]\*(FC)\*(FR .br formats \*(FItimestamp\fP according to the specification in \*(FIformat\*(FR. The \*(FItimestamp\fP should be of the same form as returned by \*(FCsystime()\*(FR. If \*(FItimestamp\fP is missing, the current time of day is used. If \*(FIformat\fP is missing, a default format equivalent to the output of \*(FIdate\*(FR(1) will be used. .ti -.2i \*(FCsystime()\fP .br returns the current time of day as the number of seconds since the Epoch.\*(CB .in -.2i .EB "\s+2\f(HBTIME FUNCTIONS (\*(GK\f(HB)\*(FR\s0" .\" --- User-defined Functions .ES .fi \*(CDFunctions in AWK are defined as follows: .sp .5 .nf \*(FCfunction \*(FIname\*(FC(\*(FIparameter list\*(FC) { \*(FIstatements \*(FC}\*(FR .sp .5 .fi Functions are executed when they are called from within expressions in either patterns or actions. Actual parameters supplied in the function call instantiate the formal parameters declared in the function. Arrays are passed by reference, other variables are passed by value. .sp .5 Local variables are declared as extra parameters in the parameter list. The convention is to separate local variables from real parameters by extra spaces in the parameter list. For example: .sp .5 .nf \*(FC# a & b are local function f(p, q, a, b) { \&..... } .sp .3 /abc/ { ... ; f(1, 2) ; ... }\*(FR .fi .sp .5 The left parenthesis in a function call is required to immediately follow the function name without any intervening white space. This is to avoid a syntactic ambiguity with the concatenation operator. This restriction does not apply to the built-in functions. .sp .5 Functions may call each other and may be recursive. Function parameters used as local variables are initialized to the null string and the number zero upon function invocation. .sp .5 \*(CLThe word \*(FCfunc\fP may be used in place of \*(FCfunction\*(FR. \*(CRNote: This usage is deprecated.\*(CX .EB "\s+2\f(HBUSER-DEFINED FUNCTIONS\*(FR\s0" .\" --- Bug Reports .ES .fi \*(CDIf you find a bug in this reference card, please report it via electronic mail to \*(FCarnold@gnu.ai.mit.edu\*(FR.\*(CX .EB "\s+2\f(HBBUG REPORTS\*(FR\s0" .BT .\" --- Environment Variables .ES .fi \*(CDThe environment variable \*(FCAWKPATH\fP specifies a search path to use when finding source files named with the \*(FC\-f\fP option. The default path is \*(FC".:/usr/local/share/awk"\*(FR, if this variable does not exist. (The actual directory may vary, depending upon how \*(GK was built and installed.) If a file name given to the \*(FC\-f\fP option contains a ``/'' character, no path search is performed. .sp .5 If \*(FCPOSIXLY_CORRECT\fP exists in the environment, then \*(GK behaves exactly as if \*(FC\-\^\-posix\fP had been specified on the command line.\*(CB .EB "\s+2\f(HBENVIRONMENT VARIABLES (\*(GK\f(HB)\*(FR\s0" .\" --- Historical Features .ES .fi \*(CD\*(GK supports two features of historical AWK implementations. First, it is possible to call the \*(FClength()\fP built-in function not only with no argument, but even without parentheses. This feature is marked as ``deprecated'' in the POSIX standard, and \*(GK will issue a warning about its use if \*(FC\-\^\-lint\fP is specified on the command line. .sp .5 The other feature is the use of \*(FCcontinue\fP or \*(FCbreak\fP statements outside the body of a \*(FCwhile\*(FR, \*(FCfor\*(FR, or \*(FCdo\fP loop. Historical AWK implementations have treated such usage as equivalent to the \*(FCnext\fP statement. \*(GK will support this usage if \*(FC\-\^\-traditional\fP has been specified.\*(CB .EB "\s+2\f(HBHISTORICAL FEATURES (\*(GK\f(HB)\*(FR\s0" .\" --- FTP Information .ES .nf \*(CDHost: \*(FCftp.gnu.ai.mit.edu\*(FR File: \*(FC/pub/gnu/gawk-3.0.3.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. .in -.2i .nf .sp .5 Host: \*(FCnetlib.bell-labs.com\*(FR File: \*(FC/netlib/research/awk.bundle.Z\fP .in +.2i .fi \*(NK. This version requires an ANSI C compiler; GCC (the GNU C compiler) works well. .in -.2i .nf .sp .5 Host: \*(FCftp.whidbey.net\*(FR File: \*(FC/pub/brennan/mawk1.3.3.tar.gz\fP .in +.2i .fi Michael Brennan's \*(MK. There may be a newer version.\*(CX .in -.2i .EB "\s+2\f(HBFTP INFORMATION\*(FR\s0" .\" --- Copying Permissions .ES .fi \*(CDCopyright \(co 1996, 1997 Free Software Foundation, Inc. .sp .5 Permission is granted to make and distribute verbatim copies of this reference card provided the copyright notice and this permission notice are preserved on all copies. .sp .5 Permission is granted to copy and distribute modified versions of this reference card under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. .sp .5 Permission is granted to copy and distribute translations of this reference card into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Foundation.\*(CX .EB "\s+2\f(HBCOPYING PERMISSIONS\*(FR\s0" .BT EOF rm -f getopt.c cat << \EOF > getopt.c /* Getopt for GNU. NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. This file is part of the GNU C Library. Its master source is NOT part of the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO #define _NO_PROTO #endif #ifdef HAVE_CONFIG_H #include #endif #if !defined (__STDC__) || !__STDC__ /* This is a separate conditional since some stdc systems reject `defined (const)'. */ #ifndef const #define const #endif #endif #include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C Library, but also included in many other GNU distributions. Compiling and linking in this code is a waste when using the GNU C library (especially if it is a shared library). Rather than having every GNU program understand `configure --with-gnu-libc' and omit the object files, it is simpler to just do this in the source for each such file. */ #define GETOPT_INTERFACE_VERSION 2 #if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 #include #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION #define ELIDE_CODE #endif #endif #ifndef ELIDE_CODE /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ /* Don't include stdlib.h for non-GNU C libraries because some of them contain conflicting prototypes for getopt. */ #include #include #endif /* GNU C library. */ #ifdef VMS #include #if HAVE_STRING_H - 0 #include #endif #endif #if defined (WIN32) && !defined (__CYGWIN32__) /* It's not Unix, really. See? Capital letters. */ #include #define getpid() GetCurrentProcessId() #endif #ifndef _ /* This is for other GNU distributions with internationalized messages. When compiling libc, the _ macro is predefined. */ #ifdef HAVE_LIBINTL_H # include # define _(msgid) gettext (msgid) #else # define _(msgid) (msgid) #endif #endif /* This version of `getopt' appears to the caller like standard Unix `getopt' but it behaves differently for the user, since it allows the user to intersperse the options with the other arguments. As `getopt' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. Setting the environment variable POSIXLY_CORRECT disables permutation. Then the behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, the argument value is returned here. Also, when `ordering' is RETURN_IN_ORDER, each non-option ARGV-element is returned here. */ char *optarg = NULL; /* Index in ARGV of the next element to be scanned. This is used for communication to and from the caller and for communication between successive calls to `getopt'. On entry to `getopt', zero means this is the first call; initialize. When `getopt' returns -1, this is the index of the first of the non-option elements that the caller should itself scan. Otherwise, `optind' communicates from one call to the next how much of ARGV has been scanned so far. */ /* 1003.2 says this must be 1 before any call. */ int optind = 1; /* Formerly, initialization of getopt depended on optind==0, which causes problems with re-calling getopt as programs generally don't know that. */ int __getopt_initialized = 0; /* The next char to be scanned in the option-element in which the last option character we returned was found. This allows us to pick up the scan where we left off. If this is zero, or a null string, it means resume the scan by advancing to the next ARGV-element. */ static char *nextchar; /* Callers store zero here to inhibit the error message for unrecognized options. */ int opterr = 1; /* Set to an option character which was unrecognized. This must be initialized on some systems to avoid linking in the system's own getopt implementation. */ int optopt = '?'; /* Describe how to deal with options that follow non-option ARGV-elements. If the caller did not specify anything, the default is REQUIRE_ORDER if the environment variable POSIXLY_CORRECT is defined, PERMUTE otherwise. REQUIRE_ORDER means don't recognize them as options; stop option processing when the first non-option is seen. This is what Unix does. This mode of operation is selected by either setting the environment variable POSIXLY_CORRECT, or using `+' as the first character of the list of option characters. PERMUTE is the default. We permute the contents of ARGV as we scan, so that eventually all the non-options are at the end. This allows options to be given in any order, even with programs that were not written to expect this. RETURN_IN_ORDER is an option available to programs that were written to expect options and other ARGV-elements in any order and that care about the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. Using `-' as the first character of the list of option characters selects this mode of operation. The special argument `--' forces an end of option-scanning regardless of the value of `ordering'. In the case of RETURN_IN_ORDER, only `--' can cause `getopt' to return -1 with `optind' != ARGC. */ static enum { REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER } ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ #include #define my_index strchr #else /* Avoid depending on library functions or files whose names are inconsistent. */ char *getenv (); static char * my_index (str, chr) const char *str; int chr; { while (*str) { if (*str == chr) return (char *) str; str++; } return 0; } /* If using GCC, we can safely declare strlen this way. If not using GCC, it is ok not to declare it. */ #ifdef __GNUC__ /* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. That was relevant to code that was here before. */ #if !defined (__STDC__) || !__STDC__ /* gcc with -traditional declares the built-in strlen to return int, and has done so at least since version 2.4.5. -- rms. */ extern int strlen (const char *); #endif /* not __STDC__ */ #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have been skipped. `first_nonopt' is the index in ARGV of the first of them; `last_nonopt' is the index after the last of them. */ static int first_nonopt; static int last_nonopt; #ifdef _LIBC /* Bash 2.0 gives us an environment variable containing flags indicating ARGV elements that should not be considered arguments. */ static const char *nonoption_flags; static int nonoption_flags_len; static int original_argc; static char *const *original_argv; /* Make sure the environment variable bash 2.0 puts in the environment is valid for the getopt call we must make sure that the ARGV passed to getopt is that one passed to the process. */ static void store_args (int argc, char *const *argv) __attribute__ ((unused)); static void store_args (int argc, char *const *argv) { /* XXX This is no good solution. We should rather copy the args so that we can compare them later. But we must not use malloc(3). */ original_argc = argc; original_argv = argv; } text_set_element (__libc_subinit, store_args); #endif /* Exchange two adjacent subsequences of ARGV. One subsequence is elements [first_nonopt,last_nonopt) which contains all the non-options that have been skipped so far. The other is elements [last_nonopt,optind), which contains all the options processed since those non-options were skipped. `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ #if defined (__STDC__) && __STDC__ static void exchange (char **); #endif static void exchange (argv) char **argv; { int bottom = first_nonopt; int middle = last_nonopt; int top = optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. That puts the shorter segment into the right place. It leaves the longer segment in the right place overall, but it consists of two parts that need to be swapped next. */ while (top > middle && middle > bottom) { if (top - middle > middle - bottom) { /* Bottom segment is the short one. */ int len = middle - bottom; register int i; /* Swap it with the top part of the top segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[top - (middle - bottom) + i]; argv[top - (middle - bottom) + i] = tem; } /* Exclude the moved bottom segment from further swapping. */ top -= len; } else { /* Top segment is the short one. */ int len = top - middle; register int i; /* Swap it with the bottom part of the bottom segment. */ for (i = 0; i < len; i++) { tem = argv[bottom + i]; argv[bottom + i] = argv[middle + i]; argv[middle + i] = tem; } /* Exclude the moved top segment from further swapping. */ bottom += len; } } /* Update records for the slots the non-options now occupy. */ first_nonopt += (optind - last_nonopt); last_nonopt = optind; } /* Initialize the internal data when the first call is made. */ #if defined (__STDC__) && __STDC__ static const char *_getopt_initialize (int, char *const *, const char *); #endif static const char * _getopt_initialize (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ first_nonopt = last_nonopt = optind = 1; nextchar = NULL; posixly_correct = getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { ordering = REQUIRE_ORDER; ++optstring; } else if (posixly_correct != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; #ifdef _LIBC if (posixly_correct == NULL && argc == original_argc && argv == original_argv) { /* Bash 2.0 puts a special variable in the environment for each command it runs, specifying which ARGV elements are the results of file name wildcard expansion and therefore should not be considered as options. */ char var[100]; sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ()); nonoption_flags = getenv (var); if (nonoption_flags == NULL) nonoption_flags_len = 0; else nonoption_flags_len = strlen (nonoption_flags); } else nonoption_flags_len = 0; #endif return optstring; } /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. If an element of ARGV starts with '-', and is not exactly "-" or "--", then it is an option element. The characters of this element (aside from the initial '-') are option characters. If `getopt' is called repeatedly, it returns successively each of the option characters from each of the option elements. If `getopt' finds another option character, it returns that character, updating `optind' and `nextchar' so that the next call to `getopt' can resume the scan with the following option character or ARGV-element. If there are no more option characters, `getopt' returns -1. Then `optind' is the index in ARGV of the first ARGV-element that is not an option. (The ARGV-elements have been permuted so that those that are not options now come last.) OPTSTRING is a string containing the legitimate option characters. If an option character is seen that is not listed in OPTSTRING, return '?' after printing an error message. If you set `opterr' to zero, the error message is suppressed but we still return '?'. If a char in OPTSTRING is followed by a colon, that means it wants an arg, so the following text in the same ARGV-element, or the text of the following ARGV-element, is returned in `optarg'. Two colons mean an option that wants an optional arg; if there is text in the current ARGV-element, it is returned in `optarg', otherwise `optarg' is set to zero. If OPTSTRING starts with `-' or `+', it requests different methods of handling the non-option ARGV-elements. See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. Long-named options begin with `--' instead of `-'. Their names may be abbreviated as long as the abbreviation is unique or is an exact match for some defined option. If they have an argument, it follows the option name in the same ARGV-element, separated from the option name by a `=', or else the in next ARGV-element. When `getopt' finds a long-named option, it returns 0 if that option's `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. The elements of ARGV aren't really const, because we permute them. But we pretend they're const in the prototype to be compatible with other systems. LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. LONGIND returns the index in LONGOPT of the long-named option found. It is only valid when a long-named option has been found by the most recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce long-named options. */ int _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int argc; char *const *argv; const char *optstring; const struct option *longopts; int *longind; int long_only; { optarg = NULL; if (!__getopt_initialized || optind == 0) { optstring = _getopt_initialize (argc, argv, optstring); optind = 1; /* Don't scan ARGV[0], the program name. */ __getopt_initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. Either it does not have option syntax, or there is an environment flag from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #ifdef _LIBC #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ || (optind < nonoption_flags_len \ && nonoption_flags[optind] == '1')) #else #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') #endif if (nextchar == NULL || *nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ if (last_nonopt > optind) last_nonopt = optind; if (first_nonopt > optind) first_nonopt = optind; if (ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (last_nonopt != optind) first_nonopt = optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ while (optind < argc && NONOPTION_P) optind++; last_nonopt = optind; } /* The special ARGV-element `--' means premature end of options. Skip it like a null option, then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ if (optind != argc && !strcmp (argv[optind], "--")) { optind++; if (first_nonopt != last_nonopt && last_nonopt != optind) exchange ((char **) argv); else if (first_nonopt == last_nonopt) first_nonopt = optind; last_nonopt = argc; optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ if (optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ if (first_nonopt != last_nonopt) optind = first_nonopt; return -1; } /* If we have come to a non-option and did not permute it, either stop the scan or describe it to the caller and pass it by. */ if (NONOPTION_P) { if (ordering == REQUIRE_ORDER) return -1; optarg = argv[optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ nextchar = (argv[optind] + 1 + (longopts != NULL && argv[optind][1] == '-')); } /* Decode the current option-ARGV-element. */ /* Check whether the ARGV-element is a long option. If long_only and the ARGV-element has the form "-f", where f is a valid short option, don't consider it an abbreviated form of a long option that starts with f. Otherwise there would be no way to give the -f short option. On the other hand, if there's a long option "fubar" and the ARGV-element is "-fu", do consider that an abbreviation of the long option, just like "--fu", and not "-f" with arg "u". This distinction seems to be the most useful approach. */ if (longopts != NULL && (argv[optind][1] == '-' || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = -1; int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) if (argv[optind - 1][1] == '-') /* --option */ fprintf (stderr, _("%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name); else /* +option or -option */ fprintf (stderr, _("%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[optind - 1][0], pfound->name); nextchar += strlen (nextchar); optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } /* Can't find it as a long option. If this is not getopt_long_only, or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ if (!long_only || argv[optind][1] == '-' || my_index (optstring, *nextchar) == NULL) { if (opterr) { if (argv[optind][1] == '-') /* --option */ fprintf (stderr, _("%s: unrecognized option `--%s'\n"), argv[0], nextchar); else /* +option or -option */ fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), argv[0], argv[optind][0], nextchar); } nextchar = (char *) ""; optind++; optopt = 0; return '?'; } } /* Look at and handle the next short option-character. */ { char c = *nextchar++; char *temp = my_index (optstring, c); /* Increment `optind' when we start to process its last character. */ if (*nextchar == '\0') ++optind; if (temp == NULL || c == ':') { if (opterr) { if (posixly_correct) /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c); else fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c); } optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ if (temp[0] == 'W' && temp[1] == ';') { char *nameend; const struct option *p; const struct option *pfound = NULL; int exact = 0; int ambig = 0; int indfound = 0; int option_index; /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; return c; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; indfound = option_index; exact = 1; break; } else if (pfound == NULL) { /* First nonexact match found. */ pfound = p; indfound = option_index; } else /* Second or later nonexact match found. */ ambig = 1; } if (ambig && !exact) { if (opterr) fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); nextchar += strlen (nextchar); optind++; return '?'; } if (pfound != NULL) { option_index = indfound; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) optarg = nameend + 1; else { if (opterr) fprintf (stderr, _("\ %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name); nextchar += strlen (nextchar); return '?'; } } else if (pfound->has_arg == 1) { if (optind < argc) optarg = argv[optind++]; else { if (opterr) fprintf (stderr, _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) { *(pfound->flag) = pfound->val; return 0; } return pfound->val; } nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') { if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ if (*nextchar != '\0') { optarg = nextchar; optind++; } else optarg = NULL; nextchar = NULL; } else { /* This is an option that requires an argument. */ if (*nextchar != '\0') { optarg = nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ optind++; } else if (optind == argc) { if (opterr) { /* 1003.2 specifies the format of this message. */ fprintf (stderr, _("%s: option requires an argument -- %c\n"), argv[0], c); } optopt = c; if (optstring[0] == ':') c = ':'; else c = '?'; } else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ optarg = argv[optind++]; nextchar = NULL; } } return c; } } int getopt (argc, argv, optstring) int argc; char *const *argv; const char *optstring; { return _getopt_internal (argc, argv, optstring, (const struct option *) 0, (int *) 0, 0); } #endif /* Not ELIDE_CODE. */ #ifdef TEST /* Compile with -DTEST to make an executable for use in testing the above definition of `getopt'. */ int main (argc, argv) int argc; char **argv; { int c; int digit_optind = 0; while (1) { int this_option_optind = optind ? optind : 1; c = getopt (argc, argv, "abc:d:0123456789"); if (c == -1) break; switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (digit_optind != 0 && digit_optind != this_option_optind) printf ("digits occur in two different argv-elements.\n"); digit_optind = this_option_optind; printf ("option %c\n", c); break; case 'a': printf ("option a\n"); break; case 'b': printf ("option b\n"); break; case 'c': printf ("option c with value `%s'\n", optarg); break; case '?': break; default: printf ("?? getopt returned character code 0%o ??\n", c); } } if (optind < argc) { printf ("non-option ARGV-elements: "); while (optind < argc) printf ("%s ", argv[optind++]); printf ("\n"); } exit (0); } #endif /* TEST */ EOF # files that don't end in newline echo 000801 | tr -d '\12' > test/clobber.ok echo A B C D E | tr -d '\12' > test/nors.in # update mod time touch configure # rename a file mv test/nlfldstr.ok test/nfldstr.ok