summaryrefslogtreecommitdiffstats
path: root/contrib/awk
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/awk')
-rw-r--r--contrib/awk/FREEBSD-upgrade44
-rw-r--r--contrib/awk/awk.h301
-rw-r--r--contrib/awk/builtin.c828
-rw-r--r--contrib/awk/config.h207
-rw-r--r--contrib/awk/dfa.c597
-rw-r--r--contrib/awk/doc/awk.111
-rw-r--r--contrib/awk/eval.c817
-rw-r--r--contrib/awk/field.c206
-rw-r--r--contrib/awk/io.c1305
-rw-r--r--contrib/awk/main.c463
-rw-r--r--contrib/awk/missing.c59
-rw-r--r--contrib/awk/node.c177
-rw-r--r--contrib/awk/random.c524
-rw-r--r--contrib/awk/random.h42
-rw-r--r--contrib/awk/regex.h538
-rw-r--r--contrib/awk/test/ChangeLog585
-rw-r--r--contrib/awk/test/Makefile451
-rw-r--r--contrib/awk/test/Makefile.in1236
-rw-r--r--contrib/awk/test/README18
-rw-r--r--contrib/awk/test/anchgsub.awk1
-rw-r--r--contrib/awk/test/anchgsub.in1
-rw-r--r--contrib/awk/test/anchgsub.ok1
-rw-r--r--contrib/awk/test/argarray.awk14
-rw-r--r--contrib/awk/test/argarray.in1
-rw-r--r--contrib/awk/test/argarray.ok9
-rw-r--r--contrib/awk/test/argtest.awk4
-rw-r--r--contrib/awk/test/argtest.ok4
-rw-r--r--contrib/awk/test/arrayparm.awk21
-rw-r--r--contrib/awk/test/arrayparm.ok1
-rw-r--r--contrib/awk/test/arrayref.awk13
-rw-r--r--contrib/awk/test/arrayref.ok2
-rw-r--r--contrib/awk/test/asgext.awk1
-rw-r--r--contrib/awk/test/asgext.in3
-rw-r--r--contrib/awk/test/asgext.ok6
-rw-r--r--contrib/awk/test/awkpath.ok1
-rw-r--r--contrib/awk/test/back89.in2
-rw-r--r--contrib/awk/test/back89.ok1
-rw-r--r--contrib/awk/test/backgsub.awk4
-rw-r--r--contrib/awk/test/backgsub.in1
-rw-r--r--contrib/awk/test/backgsub.ok1
-rw-r--r--contrib/awk/test/badargs.ok27
-rw-r--r--contrib/awk/test/childin.ok1
-rw-r--r--contrib/awk/test/clobber.awk98
-rw-r--r--contrib/awk/test/clobber.ok1
-rw-r--r--contrib/awk/test/clsflnam.awk12
-rw-r--r--contrib/awk/test/clsflnam.in3
-rw-r--r--contrib/awk/test/clsflnam.ok1
-rw-r--r--contrib/awk/test/compare.awk13
-rw-r--r--contrib/awk/test/compare.in4
-rw-r--r--contrib/awk/test/compare.ok5
-rw-r--r--contrib/awk/test/convfmt.awk10
-rw-r--r--contrib/awk/test/convfmt.ok3
-rw-r--r--contrib/awk/test/defref.awk1
-rw-r--r--contrib/awk/test/defref.ok2
-rw-r--r--contrib/awk/test/delarprm.awk50
-rw-r--r--contrib/awk/test/delarprm.ok0
-rw-r--r--contrib/awk/test/dynlj.awk1
-rw-r--r--contrib/awk/test/dynlj.ok1
-rw-r--r--contrib/awk/test/eofsplit.awk68
-rw-r--r--contrib/awk/test/eofsplit.ok0
-rw-r--r--contrib/awk/test/fflush.ok16
-rwxr-xr-xcontrib/awk/test/fflush.sh16
-rw-r--r--contrib/awk/test/fieldwdth.ok1
-rw-r--r--contrib/awk/test/fldchg.awk8
-rw-r--r--contrib/awk/test/fldchg.in1
-rw-r--r--contrib/awk/test/fldchg.ok3
-rw-r--r--contrib/awk/test/fldchgnf.awk1
-rw-r--r--contrib/awk/test/fldchgnf.in1
-rw-r--r--contrib/awk/test/fldchgnf.ok2
-rw-r--r--contrib/awk/test/fnarray.awk7
-rw-r--r--contrib/awk/test/fnarray.ok1
-rw-r--r--contrib/awk/test/fnarydel.awk60
-rw-r--r--contrib/awk/test/fnarydel.ok27
-rw-r--r--contrib/awk/test/fsbs.in1
-rw-r--r--contrib/awk/test/fsbs.ok1
-rw-r--r--contrib/awk/test/fsrs.awk8
-rw-r--r--contrib/awk/test/fsrs.in7
-rw-r--r--contrib/awk/test/fsrs.ok5
-rw-r--r--contrib/awk/test/fstabplus.awk2
-rw-r--r--contrib/awk/test/fstabplus.ok1
-rw-r--r--contrib/awk/test/funstack.awk977
-rw-r--r--contrib/awk/test/funstack.in206
-rw-r--r--contrib/awk/test/funstack.ok0
-rw-r--r--contrib/awk/test/gensub.awk7
-rw-r--r--contrib/awk/test/gensub.in2
-rw-r--r--contrib/awk/test/gensub.ok4
-rw-r--r--contrib/awk/test/getline.awk1
-rw-r--r--contrib/awk/test/getline.ok2
-rw-r--r--contrib/awk/test/getlnhd.awk10
-rw-r--r--contrib/awk/test/getlnhd.ok2
-rw-r--r--contrib/awk/test/gnureops.awk45
-rw-r--r--contrib/awk/test/gnureops.ok17
-rw-r--r--contrib/awk/test/gsubasgn.awk13
-rw-r--r--contrib/awk/test/gsubasgn.ok4
-rwxr-xr-xcontrib/awk/test/gsubtest.awk8
-rw-r--r--contrib/awk/test/gsubtest.ok6
-rw-r--r--contrib/awk/test/igncfs.awk8
-rw-r--r--contrib/awk/test/igncfs.in2
-rw-r--r--contrib/awk/test/igncfs.ok2
-rw-r--r--contrib/awk/test/ignrcase.ok1
-rw-r--r--contrib/awk/test/inftest.awk5
-rw-r--r--contrib/awk/test/inftest.ok105
-rw-r--r--contrib/awk/test/intest.awk4
-rw-r--r--contrib/awk/test/intest.ok1
-rw-r--r--contrib/awk/test/intprec.awk1
-rw-r--r--contrib/awk/test/intprec.ok1
-rw-r--r--contrib/awk/test/lib/awkpath.awk1
-rw-r--r--contrib/awk/test/litoct.awk1
-rw-r--r--contrib/awk/test/litoct.ok1
-rw-r--r--contrib/awk/test/longwrds.awk20
-rw-r--r--contrib/awk/test/longwrds.ok21
-rw-r--r--contrib/awk/test/manpage200
-rw-r--r--contrib/awk/test/manyfiles.awk1
-rw-r--r--contrib/awk/test/math.awk10
-rw-r--r--contrib/awk/test/math.ok6
-rw-r--r--contrib/awk/test/messages.awk9
-rw-r--r--contrib/awk/test/mmap8k.in143
-rw-r--r--contrib/awk/test/negexp.ok1
-rw-r--r--contrib/awk/test/nfldstr.ok0
-rw-r--r--contrib/awk/test/nfset.awk1
-rw-r--r--contrib/awk/test/nfset.in5
-rw-r--r--contrib/awk/test/nfset.ok5
-rw-r--r--contrib/awk/test/nlfldsep.awk2
-rw-r--r--contrib/awk/test/nlfldsep.in5
-rw-r--r--contrib/awk/test/nlfldsep.ok13
-rw-r--r--contrib/awk/test/noeffect.awk4
-rw-r--r--contrib/awk/test/noeffect.ok4
-rw-r--r--contrib/awk/test/nofmtch.awk1
-rw-r--r--contrib/awk/test/nofmtch.ok2
-rw-r--r--contrib/awk/test/nondec.awk1
-rw-r--r--contrib/awk/test/nondec.ok1
-rw-r--r--contrib/awk/test/nonl.awk1
-rw-r--r--contrib/awk/test/nonl.ok1
-rw-r--r--contrib/awk/test/noparms.awk1
-rw-r--r--contrib/awk/test/noparms.ok4
-rw-r--r--contrib/awk/test/nors.in1
-rw-r--r--contrib/awk/test/nors.ok2
-rw-r--r--contrib/awk/test/numsubstr.awk1
-rw-r--r--contrib/awk/test/numsubstr.in3
-rw-r--r--contrib/awk/test/numsubstr.ok3
-rw-r--r--contrib/awk/test/out1.ok1
-rw-r--r--contrib/awk/test/out2.ok2
-rw-r--r--contrib/awk/test/out3.ok1
-rw-r--r--contrib/awk/test/paramdup.awk8
-rw-r--r--contrib/awk/test/paramdup.ok2
-rw-r--r--contrib/awk/test/pcntplus.awk1
-rw-r--r--contrib/awk/test/pcntplus.ok1
-rw-r--r--contrib/awk/test/pid.awk44
-rw-r--r--contrib/awk/test/pid.ok0
-rwxr-xr-xcontrib/awk/test/pid.sh5
-rw-r--r--contrib/awk/test/pipeio1.awk31
-rw-r--r--contrib/awk/test/pipeio1.ok2
-rw-r--r--contrib/awk/test/pipeio2.awk69
-rw-r--r--contrib/awk/test/pipeio2.in8
-rw-r--r--contrib/awk/test/pipeio2.ok16
-rw-r--r--contrib/awk/test/posix.awk69
-rw-r--r--contrib/awk/test/posix.ok16
-rwxr-xr-xcontrib/awk/test/poundbang3
-rw-r--r--contrib/awk/test/poundbang.ok1
-rw-r--r--contrib/awk/test/prdupval.awk1
-rw-r--r--contrib/awk/test/prdupval.in1
-rw-r--r--contrib/awk/test/prdupval.ok1
-rw-r--r--contrib/awk/test/prmarscl.awk6
-rw-r--r--contrib/awk/test/prmarscl.ok1
-rw-r--r--contrib/awk/test/prmreuse.awk14
-rw-r--r--contrib/awk/test/prmreuse.ok0
-rw-r--r--contrib/awk/test/prt1eval.awk6
-rw-r--r--contrib/awk/test/prt1eval.ok1
-rw-r--r--contrib/awk/test/prtoeval.awk4
-rw-r--r--contrib/awk/test/prtoeval.ok2
-rw-r--r--contrib/awk/test/rand.awk6
-rw-r--r--contrib/awk/test/rand.ok1
-rw-r--r--contrib/awk/test/reg/exp-eq.awk1
-rw-r--r--contrib/awk/test/reg/exp-eq.good3
-rw-r--r--contrib/awk/test/reg/exp-eq.in3
-rw-r--r--contrib/awk/test/reg/exp.awk1
-rw-r--r--contrib/awk/test/reg/exp.good2
-rw-r--r--contrib/awk/test/reg/exp.in0
-rw-r--r--contrib/awk/test/reg/func.awk1
-rw-r--r--contrib/awk/test/reg/func.good1
-rw-r--r--contrib/awk/test/reg/func.in0
-rw-r--r--contrib/awk/test/reg/func2.awk2
-rw-r--r--contrib/awk/test/reg/func2.good2
-rw-r--r--contrib/awk/test/reg/func2.in0
-rw-r--r--contrib/awk/test/reg/log.awk1
-rw-r--r--contrib/awk/test/reg/log.good4
-rw-r--r--contrib/awk/test/reg/log.in0
-rwxr-xr-xcontrib/awk/test/regtest18
-rw-r--r--contrib/awk/test/reindops.awk6
-rw-r--r--contrib/awk/test/reindops.in1
-rw-r--r--contrib/awk/test/reindops.ok1
-rw-r--r--contrib/awk/test/reint.awk1
-rw-r--r--contrib/awk/test/reint.in1
-rw-r--r--contrib/awk/test/reint.ok1
-rw-r--r--contrib/awk/test/reparse.awk7
-rw-r--r--contrib/awk/test/reparse.in1
-rw-r--r--contrib/awk/test/reparse.ok3
-rw-r--r--contrib/awk/test/resplit.ok1
-rw-r--r--contrib/awk/test/rs.in15
-rw-r--r--contrib/awk/test/rs.ok3
-rw-r--r--contrib/awk/test/rswhite.awk2
-rw-r--r--contrib/awk/test/rswhite.in2
-rw-r--r--contrib/awk/test/rswhite.ok2
-rw-r--r--contrib/awk/test/sclforin.awk1
-rw-r--r--contrib/awk/test/sclforin.ok1
-rw-r--r--contrib/awk/test/sclifin.awk7
-rw-r--r--contrib/awk/test/sclifin.ok1
-rw-r--r--contrib/awk/test/splitargv.awk7
-rw-r--r--contrib/awk/test/splitargv.in7
-rw-r--r--contrib/awk/test/splitargv.ok7
-rw-r--r--contrib/awk/test/splitvar.awk5
-rw-r--r--contrib/awk/test/splitvar.in1
-rw-r--r--contrib/awk/test/splitvar.ok1
-rw-r--r--contrib/awk/test/splitwht.awk7
-rw-r--r--contrib/awk/test/splitwht.ok2
-rw-r--r--contrib/awk/test/sprintfc.awk1
-rw-r--r--contrib/awk/test/sprintfc.in3
-rw-r--r--contrib/awk/test/sprintfc.ok3
-rw-r--r--contrib/awk/test/strftlng.awk11
-rw-r--r--contrib/awk/test/strftlng.ok58
-rw-r--r--contrib/awk/test/substr.awk14
-rw-r--r--contrib/awk/test/substr.ok10
-rw-r--r--contrib/awk/test/swaplns.awk7
-rw-r--r--contrib/awk/test/swaplns.in9
-rw-r--r--contrib/awk/test/swaplns.ok9
-rw-r--r--contrib/awk/test/tradanch.awk2
-rw-r--r--contrib/awk/test/tradanch.in2
-rw-r--r--contrib/awk/test/tradanch.ok0
-rw-r--r--contrib/awk/test/tweakfld.awk296
-rw-r--r--contrib/awk/test/tweakfld.in3
-rw-r--r--contrib/awk/test/tweakfld.ok3
231 files changed, 1607 insertions, 10161 deletions
diff --git a/contrib/awk/FREEBSD-upgrade b/contrib/awk/FREEBSD-upgrade
index d2add40f..a820801 100644
--- a/contrib/awk/FREEBSD-upgrade
+++ b/contrib/awk/FREEBSD-upgrade
@@ -1,14 +1,14 @@
+$FreeBSD$
-Import of GNU awk 3.0.3
+Import of GNU awk 3.0.6
-Original source available as ftp://prep.ai.mit.edu/pub/gnu/gawk-3.0.3.tar.gz
+Obtained from: ftp://prep.ai.mit.edu/pub/gnu/gawk/gawk-3.0.6.tar.gz
The following files and directories were removed for this import:
-Makefile.in
README_d/README.VMS
README_d/README.atari
-README_d/README.irix
+README_d/README.beos
README_d/README.linux
README_d/README.pc
README_d/README.sco
@@ -18,43 +18,7 @@ README_d/README.sony
README_d/README.sunos4
README_d/README.ultrix
README_d/README.yacc
-aclocal.m4
-alloca.c
atari/
-awklib/
-awktab.c
-configh.in
-configure
-configure.in
-doc/Makefile.in
-doc/README.card
-doc/ad.block
-doc/awkcard.in
-doc/awkforai.txt
-doc/cardfonts
-doc/colors
-doc/igawk.1
-doc/macros
-doc/no.colors
-doc/setter.outline
-doc/texinfo.tex
-install-sh
missing/
-mkinstalldirs
pc/
-protos.h
-regex.c
-stamp-h.in
vms/
-
-In addition, doc/gawk.1 and doc/gawk.texi were renamed to awk.1 and awk.texi.
-
-The test sub-directory has been left in, as, although not necessary to build
-awk on FreeBSD, it will be useful to anyone changing the code. To use it,
-do something like
-
-cd /usr/src/contrib/awk
-ln -s /path/to/new/awk gawk
-cd test && make
-
-jraynard@freebsd.org 26 Sept 1997
diff --git a/contrib/awk/awk.h b/contrib/awk/awk.h
index 9e872a7..8b3bb1e 100644
--- a/contrib/awk/awk.h
+++ b/contrib/awk/awk.h
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,6 +21,8 @@
* 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
+ *
+ * $FreeBSD$
*/
/* ------------------------------ Includes ------------------------------ */
@@ -48,23 +50,6 @@
#endif /* HAVE_LIMITS_H */
#include <ctype.h>
#include <setjmp.h>
-
-#if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS) && ENABLE_NLS > 0
-#include <libintl.h>
-#else /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */
-#define gettext(msgid) (msgid)
-#define gettext_noop(msgid) msgid
-#define dgettext(domain, msgid) (msgid)
-#define dcgettext(domain, msgid, cat) (msgid)
-#define bindtextdomain(domain, directory) (directory)
-#define textdomain(package) /* nothing */
-#ifndef LOCALEDIR
-#define LOCALEDIR NULL
-#endif /* LOCALEDIR */
-#endif /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */
-#define _(msgid) gettext(msgid)
-#define N_(msgid) msgid
-
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif /* HAVE_LOCALE_H */
@@ -89,35 +74,32 @@ extern int errno;
/* First, get the ctype stuff right; from Jim Meyering */
#if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII))
-#define IN_CTYPE_DOMAIN(c) 1
+#define ISASCII(c) 1
#else
-#define IN_CTYPE_DOMAIN(c) isascii((unsigned char) c)
+#define ISASCII(c) isascii(c)
#endif
#ifdef isblank
-#define ISBLANK(c) (IN_CTYPE_DOMAIN(c) && isblank((unsigned char) c))
+#define ISBLANK(c) (ISASCII(c) && isblank(c))
#else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
-#define ISGRAPH(c) (IN_CTYPE_DOMAIN(c) && isgraph((unsigned char) c))
+#define ISGRAPH(c) (ISASCII(c) && isgraph(c))
#else
-#define ISGRAPH(c) (IN_CTYPE_DOMAIN(c) && isprint((unsigned char) c) && !isspace((unsigned char) c))
+#define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c))
#endif
-#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint ((unsigned char) c))
-#define ISDIGIT(c) (IN_CTYPE_DOMAIN (c) && isdigit ((unsigned char) c))
-#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum ((unsigned char) c))
-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha ((unsigned char) c))
-#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl ((unsigned char) c))
-#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower ((unsigned char) c))
-#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (unsigned char) (c))
-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace ((unsigned char) c))
-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char) c))
-#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char) c))
-
-#define TOUPPER(c) toupper((unsigned char) c)
-#define TOLOWER(c) tolower((unsigned char) c)
+#define ISPRINT(c) (ISASCII (c) && isprint (c))
+#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
+#define ISALNUM(c) (ISASCII (c) && isalnum (c))
+#define ISALPHA(c) (ISASCII (c) && isalpha (c))
+#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
+#define ISLOWER(c) (ISASCII (c) && islower (c))
+#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
+#define ISSPACE(c) (ISASCII (c) && isspace (c))
+#define ISUPPER(c) (ISASCII (c) && isupper (c))
+#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
#ifdef __STDC__
@@ -130,14 +112,18 @@ extern int errno;
#define const
#endif /* not __STDC__ */
-#ifndef VMS
+#if ! defined(VMS) || (! defined(VAXC) && ! defined(__DECC))
#include <sys/types.h>
#include <sys/stat.h>
-#else /* VMS */
-#include <stddef.h>
+#else /* VMS w/ VAXC or DECC */
+#include <types.h>
#include <stat.h>
#include <file.h> /* avoid <fcntl.h> in io.c */
-#endif /* VMS */
+#ifdef __DECC
+/* DEC C implies DECC$SHR, which doesn't have the %g problem of VAXCRTL */
+#undef GFMT_WORKAROUND
+#endif
+#endif /* VMS w/ VAXC or DECC */
#ifdef STDC_HEADERS
#include <stdlib.h>
@@ -169,15 +155,6 @@ extern int errno;
#include <unixlib.h>
#endif /* atarist || VMS */
-#if ! defined(MSDOS) && ! defined(OS2) && ! defined(WIN32)
-#define O_BINARY 0
-#endif
-
-#if defined(TANDEM)
-#define variable variabl
-#define open(name, how, mode) open(name, how) /* !!! ANSI C !!! */
-#endif
-
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
@@ -196,22 +173,21 @@ lose
#define setlocale(locale, val) /* nothing */
#endif /* HAVE_SETLOCALE */
-/* use this as lintwarn("...")
- this is a hack but it gives us the right semantics */
-#define lintwarn (*(set_loc(__FILE__, __LINE__),lintfunc))
-extern void set_prof_file P((const char *filename));
-
#ifdef VMS
#include "vms/redirect.h"
#endif /*VMS*/
#ifdef atarist
-#include "unsupported/atari/redirect.h"
+#include "atari/redirect.h"
#endif
#define GNU_REGEX
#ifdef GNU_REGEX
+#ifdef __FreeBSD__
+#include <gnuregex.h>
+#else
#include "regex.h"
+#endif
#include "dfa.h"
typedef struct Regexp {
struct re_pattern_buffer pat;
@@ -225,12 +201,6 @@ typedef struct Regexp {
#define SUBPATEND(rp,s,n) (rp)->regs.end[n]
#endif /* GNU_REGEX */
-/* Stuff for losing systems. */
-#ifdef STRTOD_NOT_C89
-extern double gawk_strtod();
-#define strtod gawk_strtod
-#endif
-
/* ------------------ Constants, Structures, Typedefs ------------------ */
#ifndef AWKNUM
@@ -340,7 +310,6 @@ typedef enum nodevals {
Node_redirect_pipe, /* subnode is where to redirect */
Node_redirect_pipein, /* subnode is where to redirect */
Node_redirect_input, /* subnode is where to redirect */
- Node_redirect_twoway, /* subnode is where to redirect */
/* Variables */
Node_var, /* rnode is value, lnode is array stuff */
@@ -358,8 +327,8 @@ typedef enum nodevals {
Node_line_range,
/*
- * boolean test of membership in array
- * lnode is string-valued, expression rnode is array name
+ * boolean test of membership in array lnode is string-valued
+ * expression rnode is array name
*/
Node_in_array,
@@ -371,20 +340,17 @@ typedef enum nodevals {
Node_hashnode, /* an identifier in the symbol table */
Node_ahash, /* an array element */
Node_array_ref, /* array passed by ref as parameter */
- Node_BINMODE, /* variables recognized in the grammar */
- Node_CONVFMT,
- Node_FIELDWIDTHS,
+ Node_NF, /* variables recognized in the grammar */
+ Node_NR,
Node_FNR,
Node_FS,
+ Node_RS,
+ Node_FIELDWIDTHS,
Node_IGNORECASE,
- Node_LINT,
- Node_NF,
- Node_NR,
- Node_OFMT,
Node_OFS,
Node_ORS,
- Node_RS,
- Node_TEXTDOMAIN,
+ Node_OFMT,
+ Node_CONVFMT,
Node_final /* sentry value, not legal */
} NODETYPE;
@@ -411,7 +377,6 @@ typedef struct exp_node {
union {
struct exp_node *extra;
long xl;
- char **param_list;
} x;
char *name;
short number;
@@ -464,12 +429,8 @@ typedef struct exp_node {
# define FUNC 1024 /* this parameter is really a
* function name; see awk.y */
# define FIELD 2048 /* this is a field */
-# define INTLSTR 4096 /* use localized version */
-# define UNINITIALIZED 8192 /* value used before set */
- char *vname;
-#ifndef NO_PROFILING
- long exec_count;
-#endif
+
+ char *vname; /* variable's name */
} NODE;
#define lnode sub.nodep.l.lptr
@@ -479,11 +440,9 @@ typedef struct exp_node {
#define source_line sub.nodep.number
#define param_cnt sub.nodep.number
#define param sub.nodep.l.param_name
-#define parmlist sub.nodep.x.param_list
#define subnode lnode
#define proc sub.nodep.r.pptr
-#define callresult sub.nodep.x.extra
#define re_reg sub.nodep.r.preg
#define re_flags sub.nodep.reflags
@@ -508,8 +467,6 @@ typedef struct exp_node {
#define orig_array sub.nodep.x.extra
-#define printf_count sub.nodep.x.xl
-
#define condpair lnode
#define triggered sub.nodep.r.r_ent
@@ -520,6 +477,14 @@ typedef struct for_loop_header {
NODE *incr;
} FOR_LOOP_HEADER;
+/* for "for(iggy in foo) {" */
+struct search {
+ NODE *sym;
+ size_t idx;
+ NODE *bucket;
+ NODE *retval;
+};
+
/* for faster input, bypass stdio */
typedef struct iobuf {
const char *name;
@@ -534,7 +499,9 @@ typedef struct iobuf {
# define IOP_IS_TTY 1
# define IOP_IS_INTERNAL 2
# define IOP_NO_FREE 4
-# define IOP_NOFREE_OBJ 8
+# define IOP_MMAPPED 8
+# define IOP_NOFREE_OBJ 16
+ int (*getrec)();
} IOBUF;
typedef void (*Func_ptr)();
@@ -550,9 +517,6 @@ struct redirect {
# define RED_NOBUF 32
# define RED_USED 64 /* closed temporarily to reuse fd */
# define RED_EOF 128
-# define RED_TWOWAY 256
-# define RED_SOCKET 512
-# define RED_TCP 1024
char *value;
FILE *fp;
FILE *ifp; /* input fp, needed for PIPES_SIMULATED */
@@ -561,7 +525,6 @@ struct redirect {
int status;
struct redirect *prev;
struct redirect *next;
- char *mode;
};
/* structure for our source, either a command line string or a source file */
@@ -570,12 +533,6 @@ struct src {
char *val;
};
-/* for debugging purposes */
-struct flagtab {
- int val;
- char *name;
-};
-
/* longjmp return codes, must be nonzero */
/* Continue means either for loop/while continue, or next input record */
#define TAG_CONTINUE 1
@@ -600,7 +557,6 @@ struct flagtab {
extern long NF;
extern long NR;
extern long FNR;
-extern int BINMODE;
extern int IGNORECASE;
extern int RS_is_null;
extern char *OFS;
@@ -611,12 +567,10 @@ extern char *OFMT;
extern char *CONVFMT;
extern int CONVFMTidx;
extern int OFMTidx;
-extern char *TEXTDOMAIN;
-extern NODE *BINMODE_node, *CONVFMT_node, *FIELDWIDTHS_node, *FILENAME_node;
+extern NODE *CONVFMT_node, *FIELDWIDTHS_node, *FILENAME_node;
extern NODE *FNR_node, *FS_node, *IGNORECASE_node, *NF_node;
extern NODE *NR_node, *OFMT_node, *OFS_node, *ORS_node, *RLENGTH_node;
-extern NODE *RSTART_node, *RS_node, *RT_node, *SUBSEP_node, *PROCINFO_node;
-extern NODE *LINT_node, *ERRNO_node, *TEXTDOMAIN_node;
+extern NODE *RSTART_node, *RS_node, *RT_node, *SUBSEP_node;
extern NODE **stack_ptr;
extern NODE *Nnull_string;
extern NODE **fields_arr;
@@ -635,10 +589,6 @@ extern int do_posix;
extern int do_lint;
extern int do_lint_old;
extern int do_intervals;
-extern int do_intl;
-extern int do_non_decimal_data;
-extern int do_dump_vars;
-extern int do_tidy_mem;
extern int in_begin_rule;
extern int in_end_rule;
@@ -657,29 +607,21 @@ extern char casetable[]; /* for case-independent regexp matching */
|| (str)[1] == 'x' || (str)[1] == 'X'))
#ifdef MPROF
-#define getnode(n) emalloc((n), NODE *, sizeof(NODE), "getnode"), (n)->flags = UNINITIALIZED, (n)-exec_count = 0;
+#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()
-#ifndef NO_PROFILING
-#define freenode(n) ((n)->flags = UNINITIALIZED,\
- (n)->exec_count = 0, (n)->nextp = nextfree, nextfree = (n))
-#else /* not PROFILING */
-#define freenode(n) ((n)->flags = UNINITIALIZED,\
- (n)->nextp = nextfree, nextfree = (n))
-#endif /* not PROFILING */
+#define freenode(n) ((n)->flags &= ~SCALAR, (n)->nextp = nextfree, nextfree = (n))
#endif /* not MPROF */
-#ifdef MEMDEBUG
+#ifdef DEBUG
#undef freenode
-#define get_lhs(p, a, r) r_get_lhs((p), (a), (r))
+#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, r) ((p)->type == Node_var && \
- ((p)->flags & UNINITIALIZED) == 0 && (r) ? \
- (&(p)->var_value): \
- r_get_lhs((p), (a), (r)))
+#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); \
@@ -688,15 +630,10 @@ extern char casetable[]; /* for case-independent regexp matching */
else { \
switch(_t->type) { \
case Node_val: \
- if (_t->flags&INTLSTR) \
- _t = r_force_string(_t); \
break; \
case Node_var: \
- if ((_t->flags & UNINITIALIZED) == 0) { \
- _t = _t->var_value; \
- break; \
- } \
- /*FALLTHROUGH*/ \
+ _t = _t->var_value; \
+ break; \
default: \
_t = r_tree_eval(_t, iscond);\
break; \
@@ -707,14 +644,11 @@ extern char casetable[]; /* for case-independent regexp matching */
#define m_tree_eval(t, iscond) (_t = (t), _t == NULL ? Nnull_string : \
(_t->type == Node_param_list ? \
r_tree_eval(_t, iscond) : \
- ((_t->type == Node_val && (_t->flags&INTLSTR)) ? \
- r_force_string(_t) : \
(_t->type == Node_val ? _t : \
- (_t->type == Node_var && \
- (_t->flags & UNINITIALIZED) == 0 ? _t->var_value : \
- r_tree_eval(_t, iscond))))))
+ (_t->type == Node_var ? _t->var_value : \
+ r_tree_eval(_t, iscond)))))
#endif /* __GNUC__ */
-#endif /* not MEMDEBUG */
+#endif /* not DEBUG */
#define tree_eval(t) m_tree_eval(t, FALSE)
#define make_number(x) mk_number((x), (unsigned int)(MALLOC|NUM|NUMBER))
@@ -726,7 +660,7 @@ extern char casetable[]; /* for case-independent regexp matching */
#define ALREADY_MALLOCED 2
#define cant_happen() r_fatal("internal error line %d, file: %s", \
- __LINE__, __FILE__)
+ __LINE__, __FILE__);
#ifdef HAVE_STRINGIZE
#define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\
@@ -746,10 +680,10 @@ extern char casetable[]; /* for case-independent regexp matching */
(str), "var", strerror(errno)),0))
#endif /* HAVE_STRINGIZE */
-#ifdef GAWKDEBUG
+#ifdef DEBUG
#define force_number r_force_number
#define force_string r_force_string
-#else /* not GAWKDEBUG */
+#else /* not DEBUG */
#ifdef lint
extern AWKNUM force_number();
#endif
@@ -757,11 +691,9 @@ extern AWKNUM force_number();
#define force_number(n) ({NODE *_tn = (n);\
(_tn->flags & NUM) ?_tn->numbr : r_force_number(_tn);})
#define force_string(s) ({NODE *_ts = (s);\
- ((_ts->flags & INTLSTR) ? \
- r_force_string(_ts) : \
((_ts->flags & STR) && \
(_ts->stfmt == -1 || _ts->stfmt == CONVFMTidx)) ?\
- _ts : r_force_string(_ts));})
+ _ts : r_force_string(_ts);})
#else
#ifdef MSDOS
extern double _msc51bug;
@@ -771,15 +703,12 @@ extern double _msc51bug;
#define force_number(n) (_t = (n),\
(_t->flags & NUM) ? _t->numbr : r_force_number(_t))
#endif /* not MSDOS */
-#define force_string(s) (_t = (s),(_t->flags & INTLSTR) ? \
- r_force_string(_t) :\
- ((_t->flags & STR) && \
- (_t->stfmt == -1 || \
- _t->stfmt == CONVFMTidx))? \
+#define force_string(s) (_t = (s),((_t->flags & STR) && \
+ (_t->stfmt == -1 || \
+ _t->stfmt == CONVFMTidx))? \
_t : r_force_string(_t))
-
#endif /* not __GNUC__ */
-#endif /* not GAWKDEBUG */
+#endif /* not DEBUG */
#define STREQ(a,b) (*(a) == *(b) && strcmp((a), (b)) == 0)
#define STREQN(a,b,n) ((n) && *(a)== *(b) && \
@@ -794,25 +723,21 @@ extern NODE *concat_exp P((NODE *tree));
extern void assoc_clear P((NODE *symbol));
extern unsigned int hash P((const char *s, size_t len, unsigned long hsize));
extern int in_array P((NODE *symbol, NODE *subs));
-extern NODE **assoc_lookup P((NODE *symbol, NODE *subs, int reference));
+extern NODE **assoc_lookup P((NODE *symbol, NODE *subs));
extern void do_delete P((NODE *symbol, NODE *tree));
extern void do_delete_loop P((NODE *symbol, NODE *tree));
+extern void assoc_scan P((NODE *symbol, struct search *lookat));
+extern void assoc_next P((struct search *lookat));
extern NODE *assoc_dump P((NODE *symbol));
extern NODE *do_adump P((NODE *tree));
-extern NODE *do_asort P((NODE *tree));
-/* awkgram.c */
+/* awktab.c */
extern char *tokexpand P((void));
extern NODE *node P((NODE *left, NODETYPE op, NODE *right));
extern NODE *install P((char *name, NODE *value));
extern NODE *lookup P((const char *name));
extern NODE *variable P((char *name, int can_free, NODETYPE type));
extern int yyparse P((void));
-extern void dump_funcs P((void));
-extern void dump_vars P((const char *fname));
-extern void release_all_vars P((void));
-extern const char *getfname P((NODE *(*)()));
extern NODE *stopme P((NODE *tree));
-extern void shadow_funcs();
/* builtin.c */
extern double double_to_int P((double d));
extern NODE *do_exp P((NODE *tree));
@@ -821,7 +746,6 @@ extern NODE *do_index P((NODE *tree));
extern NODE *do_int P((NODE *tree));
extern NODE *do_length P((NODE *tree));
extern NODE *do_log P((NODE *tree));
-extern NODE *do_mktime P((NODE *tree));
extern NODE *do_sprintf P((NODE *tree));
extern void do_printf P((NODE *tree));
extern void print_simple P((NODE *tree, FILE *fp));
@@ -842,7 +766,7 @@ extern NODE *do_match P((NODE *tree));
extern NODE *do_gsub P((NODE *tree));
extern NODE *do_sub P((NODE *tree));
extern NODE *do_gensub P((NODE *tree));
-extern NODE *format_tree P((const char *, int, NODE *, int));
+#ifdef BITOPS
extern NODE *do_lshift P((NODE *tree));
extern NODE *do_rshift P((NODE *tree));
extern NODE *do_and P((NODE *tree));
@@ -850,37 +774,21 @@ 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));
-extern NODE *do_dcgettext P((NODE *tree));
-extern NODE *do_bindtextdomain P((NODE *tree));
+#endif /* defined(BITOPS) || defined(NONDECDATA) */
/* eval.c */
extern int interpret P((NODE *volatile tree));
extern NODE *r_tree_eval P((NODE *tree, int iscond));
extern int cmp_nodes P((NODE *t1, NODE *t2));
-extern NODE **r_get_lhs P((NODE *ptr, Func_ptr *assign, int reference));
+extern NODE **r_get_lhs P((NODE *ptr, Func_ptr *assign));
extern void set_IGNORECASE P((void));
-extern void set_OFS P((void));
-extern void set_ORS P((void));
-extern void set_OFMT P((void));
-extern void set_CONVFMT P((void));
-extern void set_BINMODE P((void));
-extern void set_LINT P((void));
-extern void set_TEXTDOMAIN P((void));
-extern void update_ERRNO P((void));
+void set_OFS P((void));
+void set_ORS P((void));
+void set_OFMT P((void));
+void set_CONVFMT P((void));
extern char *flags2str P((int));
-extern char *genflags2str P((int flagval, struct flagtab *tab));
-extern char *nodetype2str P((NODETYPE type));
-extern NODE *assign_val P((NODE **lhs_p, NODE *rhs));
-#ifdef PROFILING
-extern void dump_fcall_stack P((FILE *fp));
-#endif
-/* ext.c */
-NODE *do_ext P((NODE *));
-#ifdef DYNAMIC
-void make_builtin P((char *, NODE *(*)(NODE *), int));
-NODE *get_argument P((NODE *, int));
-void set_value P((NODE *));
-#endif
/* field.c */
extern void init_fields P((void));
extern void set_record P((char *buf, int cnt, int freeold));
@@ -897,12 +805,6 @@ extern int using_fieldwidths P((void));
extern char *gawk_name P((const char *filespec));
extern void os_arg_fixup P((int *argcp, char ***argvp));
extern int os_devopen P((const char *name, int flag));
-extern void os_close_on_exec P((int fd, const char *name, const char *what,
- const char *dir));
-extern int os_isdir P((int fd));
-extern int os_is_setuid P((void));
-extern int os_setbinmode P((int fd, int mode));
-extern void os_restore_mode P((int fd));
extern int optimal_bufsize P((int fd, struct stat *sbuf));
extern int ispath P((const char *file));
extern int isdirpunct P((int c));
@@ -922,7 +824,6 @@ extern struct redirect *getredirect P((char *str, int len));
/* main.c */
extern int main P((int argc, char **argv));
extern void load_environ P((void));
-extern void load_procinfo P((void));
extern char *arg_assign P((char *arg));
extern RETSIGTYPE catchsig P((int sig, int code));
/* msg.c */
@@ -933,7 +834,6 @@ extern void error P((va_list va_alist, ...));
extern void warning P((va_list va_alist, ...));
extern void set_loc P((char *file, int line));
extern void r_fatal P((va_list va_alist, ...));
-extern void (*lintfunc) P((va_list va_alist, ...));
#else
#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
extern void msg (char *mesg, ...);
@@ -941,35 +841,24 @@ extern void error (char *mesg, ...);
extern void warning (char *mesg, ...);
extern void set_loc (char *file, int line);
extern void r_fatal (char *mesg, ...);
-extern void (*lintfunc) (char *mesg, ...);
#else
extern void msg ();
extern void error ();
extern void warning ();
extern void set_loc ();
extern void r_fatal ();
-extern void (*lintfunc) ();
#endif
#endif
-/* profile.c */
-extern void init_profiling P((int *flag, const char *def_file));
-extern void init_profiling_signals P((void));
-extern void set_prof_file P((const char *filename));
-extern void dump_prog P((NODE *begin, NODE *prog, NODE *end));
-extern void pp_func P((char *name, size_t namelen, NODE *f));
-extern void pp_string_fp P((FILE *fp, char *str, size_t namelen,
- int delim, int breaklines));
/* node.c */
extern AWKNUM r_force_number P((NODE *n));
extern NODE *format_val P((char *format, int index, NODE *s));
extern NODE *r_force_string P((NODE *s));
extern NODE *dupnode P((NODE *n));
-extern NODE *copynode P((NODE *n));
extern NODE *mk_number P((AWKNUM x, unsigned int flags));
extern NODE *make_str_node P((char *s, size_t len, int scan ));
extern NODE *tmp_string P((char *s, size_t len ));
extern NODE *more_nodes P((void));
-#ifdef MEMDEBUG
+#ifdef DEBUG
extern void freenode P((NODE *it));
#endif
extern void unref P((NODE *tmp));
@@ -984,17 +873,13 @@ extern Regexp *re_update P((NODE *t));
extern void resyntax P((int syntax));
extern void resetup P((void));
extern int avoid_dfa P((NODE *re, char *str, size_t len)); /* temporary */
-extern int reisstring P((char *text, size_t len, Regexp *re, char *buf));
/* strncasecmp.c */
-#ifndef BROKEN_STRNCASECMP
-extern int strcasecmp P((const char *s1, const char *s2));
extern int strncasecmp P((const char *s1, const char *s2, register size_t n));
-#endif
#if defined(atarist)
#if defined(PIPES_SIMULATED)
-/* unsupported/atari/tmpnam.c */
+/* atari/tmpnam.c */
extern char *tmpnam P((char *buf));
extern char *tempnam P((const char *path, const char *base));
#else
@@ -1009,3 +894,13 @@ extern char *tempnam P((const char *path, const char *base));
#ifndef STATIC
#define STATIC static
#endif
+
+#ifdef C_ALLOCA
+/* The __hpux check is to avoid conflicts with bison's definition of
+ alloca() in awktab.c.*/
+#if (defined(__STDC__) && __STDC__) || defined (__hpux)
+extern void *alloca P((unsigned));
+#else
+extern char *alloca P((unsigned));
+#endif
+#endif
diff --git a/contrib/awk/builtin.c b/contrib/awk/builtin.c
index 10f8b49..fc9365b 100644
--- a/contrib/awk/builtin.c
+++ b/contrib/awk/builtin.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,29 +21,31 @@
* 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
+ *
+ * $FreeBSD$
*/
#include "awk.h"
-#if defined(HAVE_FCNTL_H)
-#include <fcntl.h>
-#endif
#undef HUGE
#undef CHARBITS
#undef INTBITS
#include <math.h>
+#ifndef __FreeBSD__
#include "random.h"
/* can declare these, since we always use the random shipped with gawk */
-extern char *initstate P((unsigned long seed, char *state, long n));
+extern char *initstate P((unsigned seed, char *state, int n));
extern char *setstate P((char *state));
extern long random P((void));
-extern void srandom P((unsigned long seed));
+extern void srandom P((unsigned int seed));
+#endif
extern NODE **fields_arr;
extern int output_is_tty;
static NODE *sub_common P((NODE *tree, int how_many, int backdigs));
+NODE *format_tree P((const char *, int, NODE *));
#ifdef _CRAY
/* Work around a problem in conversion of doubles to exact integers. */
@@ -83,20 +85,20 @@ static void efwrite P((const void *ptr, size_t size, size_t count, FILE *fp,
/* efwrite --- like fwrite, but with error checking */
static void
-efwrite(const void *ptr,
- size_t size,
- size_t count,
- FILE *fp,
- const char *from,
- struct redirect *rp,
- int flush)
+efwrite(ptr, size, count, fp, from, rp, flush)
+const void *ptr;
+size_t size, count;
+FILE *fp;
+const char *from;
+struct redirect *rp;
+int flush;
{
errno = 0;
if (fwrite(ptr, size, count, fp) != count)
goto wrerror;
if (flush
&& ((fp == stdout && output_is_tty)
- || (rp != NULL && (rp->flag & RED_NOBUF)))) {
+ || (rp && (rp->flag & RED_NOBUF)))) {
fflush(fp);
if (ferror(fp))
goto wrerror;
@@ -104,28 +106,27 @@ efwrite(const void *ptr,
return;
wrerror:
- fatal(_("%s to \"%s\" failed (%s)"), from,
- rp ? rp->value : _("standard output"),
- errno ? strerror(errno) : _("reason unknown"));
+ fatal("%s to \"%s\" failed (%s)", from,
+ rp ? rp->value : "standard output",
+ errno ? strerror(errno) : "reason unknown");
}
/* do_exp --- exponential function */
NODE *
-do_exp(NODE *tree)
+do_exp(tree)
+NODE *tree;
{
NODE *tmp;
double d, res;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("exp: received non-numeric argument"));
d = force_number(tmp);
free_temp(tmp);
errno = 0;
res = exp(d);
if (errno == ERANGE)
- warning(_("exp: argument %g is out of range"), d);
+ warning("exp argument %g is out of range", d);
return tmp_number((AWKNUM) res);
}
@@ -138,7 +139,9 @@ do_exp(NODE *tree)
*/
static FILE *
-stdfile(char *name, size_t len)
+stdfile(name, len)
+char *name;
+size_t len;
{
if (len == 11) {
if (STREQN(name, "/dev/stderr", 11))
@@ -153,7 +156,8 @@ stdfile(char *name, size_t len)
/* do_fflush --- flush output, either named file or pipe or everything */
NODE *
-do_fflush(NODE *tree)
+do_fflush(tree)
+NODE *tree;
{
struct redirect *rp;
NODE *tmp;
@@ -179,15 +183,14 @@ do_fflush(NODE *tree)
}
rp = getredirect(tmp->stptr, tmp->stlen);
- status = -1;
+ status = 1;
if (rp != NULL) {
if ((rp->flag & (RED_WRITE|RED_APPEND)) == 0) {
- if (rp->flag & RED_PIPE)
- warning(_("fflush: cannot flush: pipe `%s' opened for reading, not writing"),
- file);
- else
- warning(_("fflush: cannot flush: file `%s' opened for reading, not writing"),
- file);
+ /* if (do_lint) */
+ warning(
+ "fflush: cannot flush: %s `%s' opened for reading, not writing",
+ (rp->flag & RED_PIPE) ? "pipe" : "file",
+ file);
free_temp(tmp);
return tmp_number((AWKNUM) status);
}
@@ -196,10 +199,8 @@ do_fflush(NODE *tree)
status = fflush(fp);
} else if ((fp = stdfile(tmp->stptr, tmp->stlen)) != NULL) {
status = fflush(fp);
- } else {
- status = -1;
- warning(_("fflush: `%s' is not an open file, pipe or co-process"), file);
- }
+ } else
+ warning("fflush: `%s' is not an open file or pipe", file);
free_temp(tmp);
return tmp_number((AWKNUM) status);
}
@@ -207,7 +208,8 @@ do_fflush(NODE *tree)
/* do_index --- find index of a string */
NODE *
-do_index(NODE *tree)
+do_index(tree)
+NODE *tree;
{
NODE *s1, *s2;
register char *p1, *p2;
@@ -217,12 +219,6 @@ do_index(NODE *tree)
s1 = tree_eval(tree->lnode);
s2 = tree_eval(tree->rnode->lnode);
- if (do_lint) {
- if ((s1->flags & (STRING|STR)) == 0)
- lintwarn(_("index: received non-string first argument"));
- if ((s2->flags & (STRING|STR)) == 0)
- lintwarn(_("index: received non-string second argument"));
- }
force_string(s1);
force_string(s2);
p1 = s1->stptr;
@@ -236,7 +232,7 @@ do_index(NODE *tree)
while (l1 > 0) {
if (l2 > l1)
break;
- if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2]
+ if (casetable[(int)*p1] == casetable[(int)*p2]
&& (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) {
ret = 1 + s1->stlen - l1;
break;
@@ -265,7 +261,8 @@ do_index(NODE *tree)
/* double_to_int --- convert double to int, used several places */
double
-double_to_int(double d)
+double_to_int(d)
+double d;
{
if (d >= 0)
d = Floor(d);
@@ -277,14 +274,13 @@ double_to_int(double d)
/* do_int --- convert double to int for awk */
NODE *
-do_int(NODE *tree)
+do_int(tree)
+NODE *tree;
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("int: received non-numeric argument"));
d = force_number(tmp);
d = double_to_int(d);
free_temp(tmp);
@@ -294,14 +290,13 @@ do_int(NODE *tree)
/* do_length --- length of a string or $0 */
NODE *
-do_length(NODE *tree)
+do_length(tree)
+NODE *tree;
{
NODE *tmp;
size_t len;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (STRING|STR)) == 0)
- lintwarn(_("length: received non-string argument"));
len = force_string(tmp)->stlen;
free_temp(tmp);
return tmp_number((AWKNUM) len);
@@ -310,17 +305,16 @@ do_length(NODE *tree)
/* do_log --- the log function */
NODE *
-do_log(NODE *tree)
+do_log(tree)
+NODE *tree;
{
NODE *tmp;
double d, arg;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("log: received non-numeric argument"));
arg = (double) force_number(tmp);
if (arg < 0.0)
- warning(_("log: received negative argument %g"), arg);
+ warning("log called with negative argument %g", arg);
d = log(arg);
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -337,11 +331,10 @@ do_log(NODE *tree)
*/
NODE *
-format_tree(
- const char *fmt_string,
- int n0,
- register NODE *carg,
- int num_args)
+format_tree(fmt_string, n0, carg)
+const char *fmt_string;
+int n0;
+register NODE *carg;
{
/* copy 'l' bytes from 's' to 'obufout' checking for space in the process */
/* difference of pointers should be of ptrdiff_t type, but let us be kind */
@@ -380,16 +373,21 @@ format_tree(
osiz *= 2; \
}
- static NODE **the_args = 0;
- static size_t args_size = 0;
- size_t cur_arg = 0;
-
- auto NODE **save_args = 0;
- auto size_t save_args_size = 0;
- static int call_level = 0;
+/*
+ * Get the next arg to be formatted. If we've run out of args,
+ * return "" (Null string)
+ */
+#define parse_next_arg() { \
+ if (carg == NULL) { \
+ toofew = TRUE; \
+ break; \
+ } else { \
+ arg = tree_eval(carg->lnode); \
+ carg = carg->rnode; \
+ } \
+}
NODE *r;
- int i;
int toofew = FALSE;
char *obuf, *obufout;
size_t osiz, ofre;
@@ -397,8 +395,7 @@ format_tree(
const char *s0, *s1;
int cs1;
NODE *arg;
- long fw, prec, argnum;
- int used_dollar;
+ long fw, prec;
int lj, alt, big, bigbig, small, have_prec, need_format;
long *cur = NULL;
#ifdef sun386 /* Can't cast unsigned (int/long) from ptr->value */
@@ -426,79 +423,7 @@ format_tree(
osiz = INITIAL_OUT_SIZE;
ofre = osiz - 1;
- /*
- * Icky problem. If the args make a nested call to printf/sprintf,
- * we end up clobbering the static variable `the_args'. Not good.
- * We don't just malloc and free the_args each time, since most of the
- * time there aren't nested calls. But if this is a nested call,
- * save the memory pointed to by the_args and allocate a fresh
- * array. Then free it on end.
- */
- if (++call_level > 1) { /* nested */
- save_args = the_args;
- save_args_size = args_size;
-
- args_size = 0; /* force fresh allocation */
- }
-
- if (args_size == 0) {
- /* allocate array */
- emalloc(the_args, NODE **, (num_args+1) * sizeof(NODE *), "format_tree");
- args_size = num_args + 1;
- } else if (num_args + 1 > args_size) {
- /* grow it */
- erealloc(the_args, NODE **, (num_args+1) * sizeof(NODE *), "format_tree");
- args_size = num_args + 1;
- }
-
-
- /* fill it in */
- /*
- * We ignore the_args[0] since format strings use
- * 1-based numbers to indicate the arguments. It's
- * easiest to just convert to int and index, without
- * having to remember to subtract 1.
- */
- memset(the_args, '\0', num_args * sizeof(NODE *));
- for (i = 1; carg != NULL; i++, carg = carg->rnode) {
- NODE *tmp;
-
- /* Here lies the wumpus's other brother. R.I.P. */
- tmp = tree_eval(carg->lnode);
- the_args[i] = dupnode(tmp);
- free_temp(tmp);
- }
- assert(i == num_args);
- cur_arg = 1;
-
- /*
- * Check first for use of `count$'.
- * If plain argument retrieval was used earlier, choke.
- * Otherwise, return the requested argument.
- * If not `count$' now, but it was used earlier, choke.
- * If this format is more than total number of args, choke.
- * Otherwise, return the current argument.
- */
-#define parse_next_arg() { \
- if (argnum > 0) { \
- if (cur_arg > 1) \
- fatal(_("must use `count$' on all formats or none")); \
- arg = the_args[argnum]; \
- } else if (used_dollar) { \
- fatal(_("must use `count$' on all formats or none")); \
- arg = 0; /* shutup the compiler */ \
- } else if (cur_arg >= num_args) { \
- arg = 0; /* shutup the compiler */ \
- toofew = TRUE; \
- break; \
- } else { \
- arg = the_args[cur_arg]; \
- cur_arg++; \
- } \
-}
-
need_format = FALSE;
- used_dollar = FALSE;
s0 = s1 = fmt_string;
while (n0-- > 0) {
@@ -512,7 +437,6 @@ format_tree(
cur = &fw;
fw = 0;
prec = 0;
- argnum = 0;
have_prec = FALSE;
signchar = FALSE;
zero_flag = FALSE;
@@ -578,42 +502,12 @@ check_pos:
if (n0 == 0) /* badly formatted control string */
continue;
goto retry;
- case '$':
- if (do_traditional)
- fatal(_("`$' is not permitted in awk formats"));
- if (cur == &fw) {
- argnum = fw;
- fw = 0;
- used_dollar = TRUE;
- if (argnum <= 0)
- fatal(_("arg count with `$' must be > 0"));
- if (argnum >= num_args)
- fatal(_("arg count %d greater than total number of supplied arguments"), argnum);
- } else
- fatal(_("`$' not permitted after period in format"));
- goto retry;
case '*':
if (cur == NULL)
break;
- if (! do_traditional && ISDIGIT(*s1)) {
- int val = 0;
-
- for (; n0 > 0 && *s1 && ISDIGIT(*s1); s1++, n0--) {
- val *= 10;
- val += *s1 - '0';
- }
- if (*s1 != '$') {
- fatal(_("no `$' supplied for positional field width or precision"));
- } else {
- s1++;
- n0--;
- }
-
- arg = the_args[val];
- } else {
- parse_next_arg();
- }
+ parse_next_arg();
*cur = force_number(arg);
+ free_temp(arg);
if (*cur < 0 && cur == &fw) {
*cur = -*cur;
lj++;
@@ -661,11 +555,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- lintwarn(_("`l' is meaningless in awk formats; ignored"));
+ warning("`l' is meaningless in awk formats; ignored");
warned = TRUE;
}
if (do_posix)
- fatal(_("`l' is not permitted in POSIX awk formats"));
+ fatal("'l' is not permitted in POSIX awk formats");
}
big = TRUE;
goto retry;
@@ -676,11 +570,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- lintwarn(_("`L' is meaningless in awk formats; ignored"));
+ warning("`L' is meaningless in awk formats; ignored");
warned = TRUE;
}
if (do_posix)
- fatal(_("`L' is not permitted in POSIX awk formats"));
+ fatal("'L' is not permitted in POSIX awk formats");
}
bigbig = TRUE;
goto retry;
@@ -691,11 +585,11 @@ check_pos:
static int warned = FALSE;
if (do_lint && ! warned) {
- lintwarn(_("`h' is meaningless in awk formats; ignored"));
+ warning("`h' is meaningless in awk formats; ignored");
warned = TRUE;
}
if (do_posix)
- fatal(_("`h' is not permitted in POSIX awk formats"));
+ fatal("'h' is not permitted in POSIX awk formats");
}
small = TRUE;
goto retry;
@@ -889,6 +783,7 @@ check_pos:
fw--;
}
s0 = s1;
+ free_temp(arg);
break;
out_of_range:
@@ -905,6 +800,7 @@ check_pos:
parse_next_arg();
tmpval = force_number(arg);
format_float:
+ free_temp(arg);
if (! have_prec)
prec = DEFAULT_G_PRECISION;
chksize(fw + prec + 9); /* 9 == slop */
@@ -944,44 +840,35 @@ check_pos:
}
if (toofew)
fatal("%s\n\t`%s'\n\t%*s%s",
- _("not enough arguments to satisfy format string"),
- fmt_string, s1 - fmt_string - 2, "",
- _("^ ran out for this one"));
+ "not enough arguments to satisfy format string",
+ fmt_string, s1 - fmt_string - 2, "",
+ "^ ran out for this one"
+ );
}
if (do_lint) {
if (need_format)
- lintwarn(
- _("[s]printf: format specifier does not have control letter"));
+ warning(
+ "printf format specifier does not have control letter");
if (carg != NULL)
- lintwarn(
- _("too many arguments supplied for format string"));
+ warning(
+ "too many arguments supplied for format string");
}
bchunk(s0, s1 - s0);
r = make_str_node(obuf, obufout - obuf, ALREADY_MALLOCED);
r->flags |= TEMP;
-
- for (i = 1; i < num_args; i++) {
- unref(the_args[i]);
- }
-
- if (call_level-- > 1) {
- free(the_args);
- the_args = save_args;
- args_size = save_args_size;
- }
-
return r;
}
/* do_sprintf --- perform sprintf */
NODE *
-do_sprintf(NODE *tree)
+do_sprintf(tree)
+NODE *tree;
{
NODE *r;
NODE *sfmt = force_string(tree_eval(tree->lnode));
- r = format_tree(sfmt->stptr, sfmt->stlen, tree->rnode, tree->printf_count);
+ r = format_tree(sfmt->stptr, sfmt->stlen, tree->rnode);
free_temp(sfmt);
return r;
}
@@ -989,7 +876,8 @@ do_sprintf(NODE *tree)
/* do_printf --- perform printf, including redirection */
void
-do_printf(NODE *tree)
+do_printf(tree)
+register NODE *tree;
{
struct redirect *rp = NULL;
register FILE *fp;
@@ -997,10 +885,10 @@ do_printf(NODE *tree)
if (tree->lnode == NULL) {
if (do_traditional) {
if (do_lint)
- lintwarn(_("printf: no arguments"));
+ warning("printf: no arguments");
return; /* bwk accepts it silently */
}
- fatal(_("printf: no arguments"));
+ fatal("printf: no arguments");
}
if (tree->rnode != NULL) {
@@ -1015,36 +903,33 @@ do_printf(NODE *tree)
return;
} else
fp = stdout;
- tree->lnode->printf_count = tree->printf_count;
tree = do_sprintf(tree->lnode);
efwrite(tree->stptr, sizeof(char), tree->stlen, fp, "printf", rp, TRUE);
- if (rp != NULL && (rp->flag & RED_TWOWAY) != 0)
- fflush(rp->fp);
free_temp(tree);
}
/* do_sqrt --- do the sqrt function */
NODE *
-do_sqrt(NODE *tree)
+do_sqrt(tree)
+NODE *tree;
{
NODE *tmp;
double arg;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("sqrt: received non-numeric argument"));
arg = (double) force_number(tmp);
free_temp(tmp);
if (arg < 0.0)
- warning(_("sqrt: called with negative argument %g"), arg);
+ warning("sqrt called with negative argument %g", arg);
return tmp_number((AWKNUM) sqrt(arg));
}
/* do_substr --- do the substr function */
NODE *
-do_substr(NODE *tree)
+do_substr(tree)
+NODE *tree;
{
NODE *t1, *t2, *t3;
NODE *r;
@@ -1059,13 +944,13 @@ do_substr(NODE *tree)
if (d_index < 1.0) {
if (do_lint)
- lintwarn(_("substr: start index %g is invalid, using 1"),
- d_index);
+ warning("substr: start index %g invalid, using 1",
+ d_index);
d_index = 1;
}
if (do_lint && double_to_int(d_index) != d_index)
- lintwarn(_("substr: non-integer start index %g will be truncated"),
- 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 */
@@ -1078,33 +963,33 @@ do_substr(NODE *tree)
free_temp(t3);
if (d_length <= 0.0) {
if (do_lint)
- lintwarn(_("substr: length %g is <= 0"), d_length);
+ warning("substr: length %g is <= 0", d_length);
free_temp(t1);
return Nnull_string;
}
if (do_lint && double_to_int(d_length) != d_length)
- lintwarn(
- _("substr: non-integer length %g will be truncated"),
+ warning(
+ "substr: non-integer length %g will be truncated",
d_length);
length = d_length;
}
if (t1->stlen == 0) {
if (do_lint)
- lintwarn(_("substr: source string is zero length"));
+ warning("substr: source string is zero length");
free_temp(t1);
return Nnull_string;
}
if ((indx + length) > t1->stlen) {
if (do_lint)
- lintwarn(
- _("substr: length %d at start index %d exceeds length of first argument (%d)"),
+ warning(
+ "substr: length %d at position %d exceeds length of first argument (%d)",
length, indx+1, t1->stlen);
length = t1->stlen - indx;
}
if (indx >= t1->stlen) {
if (do_lint)
- lintwarn(_("substr: start index %d is past end of string"),
+ warning("substr: start index %d is past end of string",
indx+1);
free_temp(t1);
return Nnull_string;
@@ -1117,7 +1002,8 @@ do_substr(NODE *tree)
/* do_strftime --- format a time stamp */
NODE *
-do_strftime(NODE *tree)
+do_strftime(tree)
+NODE *tree;
{
NODE *t1, *t2, *ret;
struct tm *tm;
@@ -1125,7 +1011,6 @@ do_strftime(NODE *tree)
char *bufp;
size_t buflen, bufsize;
char buf[BUFSIZ];
- /* FIXME: One day make %d be %e, after C 99 is common. */
static char def_format[] = "%a %b %d %H:%M:%S %Z %Y";
char *format;
int formatlen;
@@ -1138,15 +1023,12 @@ do_strftime(NODE *tree)
t1 = t2 = NULL;
if (tree != NULL) { /* have args */
if (tree->lnode != NULL) {
- NODE *tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (STRING|STR)) == 0)
- lintwarn(_("strftime: recieved non-string first argument"));
- t1 = force_string(tmp);
+ t1 = force_string(tree_eval(tree->lnode));
format = t1->stptr;
formatlen = t1->stlen;
if (formatlen == 0) {
if (do_lint)
- lintwarn(_("strftime: received empty format string"));
+ warning("strftime called with empty format string");
free_temp(t1);
return tmp_string("", 0);
}
@@ -1154,8 +1036,6 @@ do_strftime(NODE *tree)
if (tree->rnode != NULL) {
t2 = tree_eval(tree->rnode->lnode);
- if (do_lint && (t2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("strftime: recieved non-numeric second argument"));
fclock = (time_t) force_number(t2);
free_temp(t2);
}
@@ -1195,7 +1075,8 @@ do_strftime(NODE *tree)
/* do_systime --- get the time of day */
NODE *
-do_systime(NODE *tree)
+do_systime(tree)
+NODE *tree;
{
time_t lclock;
@@ -1203,57 +1084,13 @@ do_systime(NODE *tree)
return tmp_number((AWKNUM) lclock);
}
-/* do_mktime --- turn a time string into a timestamp */
-NODE *
-do_mktime(NODE *tree)
-{
- NODE *t1;
- struct tm then;
- long year;
- int month, day, hour, minute, second, count;
- int dst = -1; /* default is unknown */
- time_t then_stamp;
- char save;
-
- t1 = tree_eval(tree->lnode);
- if (do_lint && (t1->flags & (STRING|STR)) == 0)
- lintwarn(_("mktime: received non-string argument"));
- t1 = force_string(t1);
-
- save = t1->stptr[t1->stlen];
- t1->stptr[t1->stlen] = '\0';
-
- count = sscanf(t1->stptr, "%ld %d %d %d %d %d %d",
- & year, & month, & day,
- & hour, & minute, & second,
- & dst);
-
- t1->stptr[t1->stlen] = save;
- free_temp(t1);
-
- if (count < 6
- || month < month - 1
- || year < year - 1900 || year - 1900 != (int) (year - 1900))
- return tmp_number((AWKNUM) -1);
-
- memset(& then, '\0', sizeof(then));
- then.tm_sec = second;
- then.tm_min = minute;
- then.tm_hour = hour;
- then.tm_mday = day;
- then.tm_mon = month - 1;
- then.tm_year = year - 1900;
- then.tm_isdst = dst;
-
- then_stamp = mktime(& then);
- return tmp_number((AWKNUM) then_stamp);
-}
/* do_system --- run an external command */
NODE *
-do_system(NODE *tree)
+do_system(tree)
+NODE *tree;
{
NODE *tmp;
int ret = 0;
@@ -1262,8 +1099,6 @@ do_system(NODE *tree)
(void) flush_io(); /* so output is synchronous with gawk's */
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (STRING|STR)) == 0)
- lintwarn(_("system: recieved non-string argument"));
cmd = force_string(tmp)->stptr;
if (cmd && *cmd) {
@@ -1286,11 +1121,8 @@ do_system(NODE *tree)
save = cmd[tmp->stlen];
cmd[tmp->stlen] = '\0';
- os_restore_mode(fileno(stdin));
ret = system(cmd);
ret = (ret >> 8) & 0xff;
- if ((BINMODE & 1) != 0)
- os_setbinmode(fileno(stdin), O_BINARY);
cmd[tmp->stlen] = save;
}
@@ -1303,7 +1135,8 @@ extern NODE **fmt_list; /* declared in eval.c */
/* do_print --- print items, separated by OFS, terminated with ORS */
void
-do_print(register NODE *tree)
+do_print(tree)
+register NODE *tree;
{
register NODE **t;
struct redirect *rp = NULL;
@@ -1367,29 +1200,25 @@ do_print(register NODE *tree)
if (ORSlen > 0)
efwrite(ORS, sizeof(char), (size_t) ORSlen, fp, "print", rp, TRUE);
- if (rp != NULL && (rp->flag & RED_TWOWAY) != 0)
- fflush(rp->fp);
-
free(t);
}
/* do_tolower --- lower case a string */
NODE *
-do_tolower(NODE *tree)
+do_tolower(tree)
+NODE *tree;
{
NODE *t1, *t2;
register unsigned char *cp, *cp2;
t1 = tree_eval(tree->lnode);
- if (do_lint && (t1->flags & (STRING|STR)) == 0)
- lintwarn(_("tolower: recieved non-string argument"));
t1 = force_string(t1);
t2 = tmp_string(t1->stptr, t1->stlen);
for (cp = (unsigned char *)t2->stptr,
cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
if (ISUPPER(*cp))
- *cp = TOLOWER(*cp);
+ *cp = tolower(*cp);
free_temp(t1);
return t2;
}
@@ -1397,20 +1226,19 @@ do_tolower(NODE *tree)
/* do_toupper --- upper case a string */
NODE *
-do_toupper(NODE *tree)
+do_toupper(tree)
+NODE *tree;
{
NODE *t1, *t2;
register unsigned char *cp, *cp2;
t1 = tree_eval(tree->lnode);
- if (do_lint && (t1->flags & (STRING|STR)) == 0)
- lintwarn(_("toupper: recieved non-string argument"));
t1 = force_string(t1);
t2 = tmp_string(t1->stptr, t1->stlen);
for (cp = (unsigned char *)t2->stptr,
cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++)
if (ISLOWER(*cp))
- *cp = TOUPPER(*cp);
+ *cp = toupper(*cp);
free_temp(t1);
return t2;
}
@@ -1418,19 +1246,14 @@ do_toupper(NODE *tree)
/* do_atan2 --- do the atan2 function */
NODE *
-do_atan2(NODE *tree)
+do_atan2(tree)
+NODE *tree;
{
NODE *t1, *t2;
double d1, d2;
t1 = tree_eval(tree->lnode);
t2 = tree_eval(tree->rnode->lnode);
- if (do_lint) {
- if ((t1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("atan2: received non-numeric first argument"));
- if ((t2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("atan2: received non-numeric second argument"));
- }
d1 = force_number(t1);
d2 = force_number(t2);
free_temp(t1);
@@ -1441,14 +1264,13 @@ do_atan2(NODE *tree)
/* do_sin --- do the sin function */
NODE *
-do_sin(NODE *tree)
+do_sin(tree)
+NODE *tree;
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("sin: received non-numeric argument"));
d = sin((double) force_number(tmp));
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -1457,14 +1279,13 @@ do_sin(NODE *tree)
/* do_cos --- do the cos function */
NODE *
-do_cos(NODE *tree)
+do_cos(tree)
+NODE *tree;
{
NODE *tmp;
double d;
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("cos: received non-numeric argument"));
d = cos((double) force_number(tmp));
free_temp(tmp);
return tmp_number((AWKNUM) d);
@@ -1477,7 +1298,8 @@ static char state[512];
/* ARGSUSED */
NODE *
-do_rand(NODE *tree)
+do_rand(tree)
+NODE *tree;
{
if (firstrand) {
(void) initstate((unsigned) 1, state, sizeof state);
@@ -1490,7 +1312,8 @@ do_rand(NODE *tree)
/* do_srand --- seed the random number generator */
NODE *
-do_srand(NODE *tree)
+do_srand(tree)
+NODE *tree;
{
NODE *tmp;
static long save_seed = 1;
@@ -1504,65 +1327,37 @@ do_srand(NODE *tree)
(void) setstate(state);
if (tree == NULL)
+#ifdef __FreeBSD__
+ srandom((unsigned int) (save_seed = (long) time((time_t *) 0) ^ getpid()));
+#else
srandom((unsigned int) (save_seed = (long) time((time_t *) 0)));
+#endif
else {
tmp = tree_eval(tree->lnode);
- if (do_lint && (tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("srand: received non-numeric argument"));
srandom((unsigned int) (save_seed = (long) force_number(tmp)));
free_temp(tmp);
}
return tmp_number((AWKNUM) ret);
}
-/* do_match --- match a regexp, set RSTART and RLENGTH,
- * optional third arg is array filled with text of
- * subpatterns enclosed in parens.
- */
+/* do_match --- match a regexp, set RSTART and RLENGTH */
NODE *
-do_match(NODE *tree)
+do_match(tree)
+NODE *tree;
{
- NODE *t1, *dest, *it;
- int rstart, len, ii;
+ NODE *t1;
+ int rstart;
AWKNUM rlength;
Regexp *rp;
- regoff_t s;
- char *start;
t1 = force_string(tree_eval(tree->lnode));
- tree = tree->rnode;
- rp = re_update(tree->lnode);
-
- dest = NULL;
- if (tree->rnode != NULL) { /* 3rd optional arg for the subpatterns */
- dest = tree->rnode->lnode;
- if (dest->type == Node_param_list)
- dest = stack_ptr[dest->param_cnt];
- if (dest->type == Node_array_ref)
- dest = dest->orig_array;
- if (dest->type != Node_var && dest->type != Node_var_array)
- fatal(_("match: third argument is not an array"));
- dest->type = Node_var_array;
- assoc_clear(dest);
- }
-
+ tree = tree->rnode->lnode;
+ rp = re_update(tree);
rstart = research(rp, t1->stptr, 0, t1->stlen, TRUE);
if (rstart >= 0) { /* match succeded */
rstart++; /* 1-based indexing */
rlength = REEND(rp, t1->stptr) - RESTART(rp, t1->stptr);
-
- /* Build the array only if the caller wants the optional subpatterns */
- if (dest != NULL) {
- for (ii = 0; (s = SUBPATSTART(rp, t1->stptr, ii)) != -1; ii++) {
- start = t1->stptr + s;
- len = SUBPATEND(rp, t1->stptr, ii) - s;
-
- it = make_string(start, len);
- it->flags |= MAYBE_NUM;
- *assoc_lookup(dest, tmp_number((AWKNUM) (ii)), FALSE) = it;
- }
- }
} else { /* match failed */
rstart = 0;
rlength = -1.0;
@@ -1637,11 +1432,13 @@ do_match(NODE *tree)
*/
/*
- * NB: `howmany' conflicts with a SunOS 4.x macro in <sys/param.h>.
+ * NB: `howmany' conflicts with a SunOS macro in <sys/param.h>.
*/
static NODE *
-sub_common(NODE *tree, int how_many, int backdigs)
+sub_common(tree, how_many, backdigs)
+NODE *tree;
+int how_many, backdigs;
{
register char *scan;
register char *bp, *cp;
@@ -1690,13 +1487,18 @@ sub_common(NODE *tree, int how_many, int backdigs)
if (tmp->type == Node_val)
lhs = NULL;
else
- lhs = get_lhs(tmp, &after_assign, FALSE);
+ lhs = get_lhs(tmp, &after_assign);
t->flags |= STRING;
/*
* create a private copy of the string
*/
if (t->stref > 1 || (t->flags & (PERM|FIELD)) != 0) {
- tmp = copynode(t);
+ unsigned int saveflags;
+
+ saveflags = t->flags;
+ t->flags &= ~MALLOC;
+ tmp = dupnode(t);
+ t->flags = saveflags;
t = tmp;
priv = TRUE;
}
@@ -1878,7 +1680,8 @@ sub_common(NODE *tree, int how_many, int backdigs)
/* do_gsub --- global substitution */
NODE *
-do_gsub(NODE *tree)
+do_gsub(tree)
+NODE *tree;
{
return sub_common(tree, -1, FALSE);
}
@@ -1886,7 +1689,8 @@ do_gsub(NODE *tree)
/* do_sub --- single substitution */
NODE *
-do_sub(NODE *tree)
+do_sub(tree)
+NODE *tree;
{
return sub_common(tree, 1, FALSE);
}
@@ -1894,7 +1698,8 @@ do_sub(NODE *tree)
/* do_gensub --- fix up the tree for sub_common for the gensub function */
NODE *
-do_gensub(NODE *tree)
+do_gensub(tree)
+NODE *tree;
{
NODE n1, n2, n3, *t, *tmp, *target, *ret;
long how_many = 1; /* default is one substitution */
@@ -1938,8 +1743,6 @@ do_gensub(NODE *tree)
how_many = d;
else
how_many = 1;
- if (d == 0)
- warning(_("gensub: 3rd argument of 0 treated as 1"));
}
free_temp(t);
@@ -1963,12 +1766,13 @@ do_gensub(NODE *tree)
* 'format' string HAS to be of "<flags>*.*g" kind, or we bomb!
*/
static void
-sgfmt(char *buf, /* return buffer; assumed big enough to hold result */
- const char *format,
- int alt, /* use alternate form flag */
- int fwidth, /* field width in a format */
- int prec, /* indicates desired significant digits, not decimal places */
- double g) /* value to format */
+sgfmt(buf, format, alt, fwidth, prec, g)
+char *buf; /* return buffer; assumed big enough to hold result */
+const char *format;
+int alt; /* use alternate form flag */
+int fwidth; /* field width in a format */
+int prec; /* indicates desired significant digits, not decimal places */
+double g; /* value to format */
{
char dform[40];
register char *gpos;
@@ -2032,191 +1836,173 @@ sgfmt(char *buf, /* return buffer; assumed big enough to hold result */
}
#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(NODE *tree)
+do_lshift(tree)
+NODE *tree;
{
NODE *s1, *s2;
- unsigned long uval, ushift, res;
+ 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 ((s1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("lshift: received non-numeric first argument"));
- if ((s2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("lshift: received non-numeric first argument"));
if (val < 0 || shift < 0)
- lintwarn(_("lshift(%lf, %lf): negative values will give strange results"), val, shift);
+ warning("lshift(%lf, %lf): negative values will give strange results", val, shift);
if (double_to_int(val) != val || double_to_int(shift) != shift)
- lintwarn(_("lshift(%lf, %lf): fractional values will be truncated"), val, shift);
+ warning("lshift(%lf, %lf): fractional values will be truncated", val, shift);
if (shift > (sizeof(unsigned long) * BITS_PER_BYTE))
- lintwarn(_("lshift(%lf, %lf): too large shift value will give strange results"), val, shift);
+ warning("lshift(%lf, %lf): too large shift value will give strange results", val, shift);
}
- free_temp(s1);
- free_temp(s2);
-
uval = (unsigned long) val;
ushift = (unsigned long) shift;
- res = uval << ushift;
- return tmp_number((AWKNUM) res);
+ result = uval << ushift;
+ return tmp_number((AWKNUM) result);
}
/* do_rshift --- perform a >> operation */
NODE *
-do_rshift(NODE *tree)
+do_rshift(tree)
+NODE *tree;
{
NODE *s1, *s2;
- unsigned long uval, ushift, res;
+ 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 ((s1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("rshift: received non-numeric first argument"));
- if ((s2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("rshift: received non-numeric first argument"));
if (val < 0 || shift < 0)
- lintwarn(_("rshift(%lf, %lf): negative values will give strange results"), val, shift);
+ warning("rshift(%lf, %lf): negative values will give strange results", val, shift);
if (double_to_int(val) != val || double_to_int(shift) != shift)
- lintwarn(_("rshift(%lf, %lf): fractional values will be truncated"), val, shift);
+ warning("rshift(%lf, %lf): fractional values will be truncated", val, shift);
if (shift > (sizeof(unsigned long) * BITS_PER_BYTE))
- lintwarn(_("rshift(%lf, %lf): too large shift value will give strange results"), val, shift);
+ warning("rshift(%lf, %lf): too large shift value will give strange results", val, shift);
}
- free_temp(s1);
- free_temp(s2);
-
uval = (unsigned long) val;
ushift = (unsigned long) shift;
- res = uval >> ushift;
- return tmp_number((AWKNUM) res);
+ result = uval >> ushift;
+ return tmp_number((AWKNUM) result);
}
/* do_and --- perform an & operation */
NODE *
-do_and(NODE *tree)
+do_and(tree)
+NODE *tree;
{
NODE *s1, *s2;
- unsigned long uleft, uright, res;
+ 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 ((s1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("and: received non-numeric first argument"));
- if ((s2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("and: received non-numeric first argument"));
if (left < 0 || right < 0)
- lintwarn(_("and(%lf, %lf): negative values will give strange results"), left, right);
+ warning("and(%lf, %lf): negative values will give strange results", left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- lintwarn(_("and(%lf, %lf): fractional values will be truncated"), left, right);
+ warning("and(%lf, %lf): fractional values will be truncated", left, right);
}
- free_temp(s1);
- free_temp(s2);
-
uleft = (unsigned long) left;
uright = (unsigned long) right;
- res = uleft & uright;
- return tmp_number((AWKNUM) res);
+ result = uleft & uright;
+ return tmp_number((AWKNUM) result);
}
/* do_or --- perform an | operation */
NODE *
-do_or(NODE *tree)
+do_or(tree)
+NODE *tree;
{
NODE *s1, *s2;
- unsigned long uleft, uright, res;
+ 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 ((s1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("or: received non-numeric first argument"));
- if ((s2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("or: received non-numeric first argument"));
if (left < 0 || right < 0)
- lintwarn(_("or(%lf, %lf): negative values will give strange results"), left, right);
+ warning("or(%lf, %lf): negative values will give strange results", left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- lintwarn(_("or(%lf, %lf): fractional values will be truncated"), left, right);
+ warning("or(%lf, %lf): fractional values will be truncated", left, right);
}
- free_temp(s1);
- free_temp(s2);
-
uleft = (unsigned long) left;
uright = (unsigned long) right;
- res = uleft | uright;
- return tmp_number((AWKNUM) res);
+ result = uleft | uright;
+ return tmp_number((AWKNUM) result);
}
/* do_xor --- perform an ^ operation */
NODE *
-do_xor(NODE *tree)
+do_xor(tree)
+NODE *tree;
{
NODE *s1, *s2;
- unsigned long uleft, uright, res;
+ 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 ((s1->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("xor: received non-numeric first argument"));
- if ((s2->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("xor: received non-numeric first argument"));
if (left < 0 || right < 0)
- lintwarn(_("xor(%lf, %lf): negative values will give strange results"), left, right);
+ warning("xor(%lf, %lf): negative values will give strange results", left, right);
if (double_to_int(left) != left || double_to_int(right) != right)
- lintwarn(_("xor(%lf, %lf): fractional values will be truncated"), left, right);
+ warning("xor(%lf, %lf): fractional values will be truncated", left, right);
}
- free_temp(s1);
- free_temp(s2);
-
uleft = (unsigned long) left;
uright = (unsigned long) right;
- res = uleft ^ uright;
- return tmp_number((AWKNUM) res);
+ result = uleft ^ uright;
+ return tmp_number((AWKNUM) result);
}
/* do_compl --- perform a ~ operation */
NODE *
-do_compl(NODE *tree)
+do_compl(tree)
+NODE *tree;
{
NODE *tmp;
double d;
@@ -2227,12 +2013,10 @@ do_compl(NODE *tree)
free_temp(tmp);
if (do_lint) {
- if ((tmp->flags & (NUM|NUMBER)) == 0)
- lintwarn(_("compl: received non-numeric argument"));
if (d < 0)
- lintwarn(_("compl(%lf): negative value will give strange results"), d);
+ warning("compl(%lf): negative value will give strange results", d);
if (double_to_int(d) != d)
- lintwarn(_("compl(%lf): fractional value will be truncated"), d);
+ warning("compl(%lf): fractional value will be truncated", d);
}
uval = (unsigned long) d;
@@ -2243,10 +2027,11 @@ do_compl(NODE *tree)
/* do_strtonum --- the strtonum function */
NODE *
-do_strtonum(NODE *tree)
+do_strtonum(tree)
+NODE *tree;
{
NODE *tmp;
- double d;
+ double d, arg;
tmp = tree_eval(tree->lnode);
@@ -2260,7 +2045,9 @@ do_strtonum(NODE *tree)
free_temp(tmp);
return tmp_number((AWKNUM) d);
}
+#endif /* BITOPS */
+#if defined(BITOPS) || defined(NONDECDATA)
/* nondec2awknum --- convert octal or hex value to double */
/*
@@ -2270,12 +2057,13 @@ do_strtonum(NODE *tree)
*/
AWKNUM
-nondec2awknum(char *str, size_t len)
+nondec2awknum(str, len)
+char *str;
+size_t len;
{
AWKNUM retval = 0.0;
char save;
short val;
- char *start = str;
if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) {
assert(len > 2);
@@ -2316,173 +2104,21 @@ nondec2awknum(char *str, size_t len)
retval = (retval * 16) + val;
}
} else if (*str == '0') {
+ if (strchr(str, '8') != NULL || strchr(str, '9') != NULL)
+ goto decimal;
for (; len > 0; len--) {
- if (! ISDIGIT(*str))
+ if (! isdigit(*str))
goto done;
- else if (*str == '8' || *str == '9') {
- str = start;
- goto decimal;
- }
retval = (retval * 8) + (*str - '0');
str++;
}
} else {
decimal:
save = str[len];
- retval = strtod(str, NULL);
+ retval = atof(str);
str[len] = save;
}
done:
return retval;
}
-
-/* do_dcgettext --- handle i18n translations */
-
-/*
- * awk usage is
- *
- * str = dcgettext(string [, domain [, category]])
- *
- * Default domain is TEXTDOMAIN, default category is LC_MESSAGES.
- */
-
-NODE *
-do_dcgettext(NODE *tree)
-{
- NODE *tmp, *t1, *t2;
- char *string;
- char *the_result;
-#if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT
- int lc_cat = -1;
- char *category, *domain;
- static struct category_table {
- int val;
- char *name;
- } cat_tab[] = {
-#ifdef LC_ALL
- { LC_ALL, "LC_ALL" },
-#endif /* LC_ALL */
-#ifdef LC_COLLATE
- { LC_COLLATE, "LC_COLLATE" },
-#endif /* LC_COLLATE */
-#ifdef LC_CTYPE
- { LC_CTYPE, "LC_CTYPE" },
-#endif /* LC_CTYPE */
-#ifdef LC_MESSAGES
- { LC_MESSAGES, "LC_MESSAGES" },
-#endif /* LC_MESSAGES */
-#ifdef LC_MONETARY
- { LC_MONETARY, "LC_MONETARY" },
-#endif /* LC_MONETARY */
-#ifdef LC_NUMERIC
- { LC_NUMERIC, "LC_NUMERIC" },
-#endif /* LC_NUMERIC */
-#ifdef LC_RESPONSE
- { LC_RESPONSE, "LC_RESPONSE" },
-#endif /* LC_RESPONSE */
-#ifdef LC_TIME
- { LC_TIME, "LC_TIME" },
-#endif /* LC_TIME */
- };
-#endif /* ENABLE_NLS */
-
- tmp = tree->lnode; /* first argument */
- t1 = force_string(tree_eval(tmp));
- string = t1->stptr;
-
- t2 = NULL;
-#if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT
- tree = tree->rnode; /* second argument */
- if (tree != NULL) {
- tmp = tree->lnode;
- t2 = force_string(tree_eval(tmp));
- domain = t2->stptr;
- } else
- domain = TEXTDOMAIN;
-
- if (tree != NULL && tree->rnode != NULL) { /* third argument */
- int low, high, i, mid;
- NODE *t;
-
- tree = tree->rnode;
- tmp = tree->lnode;
- t = force_string(tree_eval(tmp));
- category = t->stptr;
-
- /* binary search the table */
- low = 0;
- high = (sizeof(cat_tab) / sizeof(cat_tab[0])) - 1;
- while (low <= high) {
- mid = (low + high) / 2;
- i = strcmp(category, cat_tab[mid].name);
-
- if (i < 0) /* category < mid */
- high = mid - 1;
- else if (i > 0) /* category > mid */
- low = mid + 1;
- else {
- lc_cat = cat_tab[mid].val;
- break;
- }
- }
- if (lc_cat == -1) /* not there */
- fatal(_("dcgettext: `%s' is not a valid locale category"), category);
-
- free_temp(t);
- } else
- lc_cat = LC_MESSAGES;
-
- the_result = dcgettext(domain, string, lc_cat);
-#else
- the_result = string;
-#endif
- free_temp(t1);
- if (t2 != NULL)
- free_temp(t2);
-
- return tmp_string(the_result, strlen(the_result));
-}
-
-/* do_bindtextdomain --- set the directory for a text domain */
-
-/*
- * awk usage is
- *
- * binding = bindtextdomain(dir [, domain])
- *
- * If dir is "", pass NULL to C version.
- * Default domain is TEXTDOMAIN.
- */
-
-NODE *
-do_bindtextdomain(NODE *tree)
-{
- NODE *tmp, *t1, *t2;
- char *directory, *domain;
- char *the_result;
-
- t1 = t2 = NULL;
- /* set defaults */
- directory = NULL;
- domain = TEXTDOMAIN;
-
- tmp = tree->lnode; /* first argument */
- t1 = force_string(tree_eval(tmp));
- if (t1->stlen > 0)
- directory = t1->stptr;
-
- tree = tree->rnode; /* second argument */
- if (tree != NULL) {
- tmp = tree->lnode;
- t2 = force_string(tree_eval(tmp));
- domain = t2->stptr;
- }
-
- the_result = bindtextdomain(domain, directory);
-
- free_temp(t1);
- if (t2 != NULL)
- free_temp(t1);
-
- return tmp_string(the_result, strlen(the_result));
-}
+#endif /* defined(BITOPS) || defined(NONDECDATA) */
diff --git a/contrib/awk/config.h b/contrib/awk/config.h
deleted file mode 100644
index c745db1..0000000
--- a/contrib/awk/config.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* config.h. Generated automatically by configure. */
-/* configh.in. Generated automatically from configure.in by autoheader. */
-/*
- * acconfig.h -- configuration definitions for gawk.
- */
-
-/*
- * Copyright (C) 1995-1997 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 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
-#ifndef _ALL_SOURCE
-/* #undef _ALL_SOURCE */
-#endif
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define if type char is unsigned and you are not using gcc. */
-#ifndef __CHAR_UNSIGNED__
-/* #undef __CHAR_UNSIGNED__ */
-#endif
-
-/* Define to empty if the keyword does not work. */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to the type of elements in the array set by `getgroups'.
- Usually this is either `int' or `gid_t'. */
-#define GETGROUPS_T gid_t
-
-/* Define if the `getpgrp' function takes no argument. */
-#define GETPGRP_VOID 1
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you don't have vprintf but do have _doprnt. */
-/* #undef HAVE_DOPRNT */
-
-/* Define if you have a working `mmap' system call. */
-#define HAVE_MMAP 1
-
-/* Define if your struct stat has st_blksize. */
-#define HAVE_ST_BLKSIZE 1
-
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if your struct tm has tm_zone. */
-#define HAVE_TM_ZONE 1
-
-/* Define if you don't have tm_zone but do have the external array
- tzname. */
-/* #undef HAVE_TZNAME */
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define if on MINIX. */
-/* #undef _MINIX */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef pid_t */
-
-/* Define if the system does not provide POSIX.1 features except
- with this defined. */
-/* #undef _POSIX_1_SOURCE */
-
-/* Define if you need to in order for stat and other things to work. */
-/* #undef _POSIX_SOURCE */
-
-/* Define as the return type of signal handlers (int or void). */
-#define RETSIGTYPE void
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if you can safely include both <sys/time.h> and <time.h>. */
-#define TIME_WITH_SYS_TIME 1
-
-/* Define if your <sys/time.h> declares struct tm. */
-/* #undef TM_IN_SYS_TIME */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
-
-#define HAVE_STRINGIZE 1 /* can use ANSI # operator in cpp */
-#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */
-#define SPRINTF_RET int /* 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. */
-#define HAVE_FMOD 1
-
-/* Define if you have the getpagesize function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the madvise function. */
-#define HAVE_MADVISE 1
-
-/* Define if you have the memcmp function. */
-#define HAVE_MEMCMP 1
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the memset function. */
-#define HAVE_MEMSET 1
-
-/* Define if you have the setlocale function. */
-#define HAVE_SETLOCALE 1
-
-/* Define if you have the strchr function. */
-#define HAVE_STRCHR 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strftime function. */
-#define HAVE_STRFTIME 1
-
-/* Define if you have the strncasecmp function. */
-#define HAVE_STRNCASECMP 1
-
-/* Define if you have the strtod function. */
-#define HAVE_STRTOD 1
-
-/* Define if you have the system function. */
-#define HAVE_SYSTEM 1
-
-/* Define if you have the tzset function. */
-#define HAVE_TZSET 1
-
-/* Define if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <locale.h> header file. */
-#define HAVE_LOCALE_H 1
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have the <signum.h> header file. */
-/* #undef HAVE_SIGNUM_H */
-
-/* Define if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <strings.h> header file. */
-/* #undef HAVE_STRINGS_H */
-
-/* Define if you have the <sys/param.h> header file. */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-#include <custom.h> /* overrides for stuff autoconf can't deal with */
diff --git a/contrib/awk/dfa.c b/contrib/awk/dfa.c
index 9716412..c806bea 100644
--- a/contrib/awk/dfa.c
+++ b/contrib/awk/dfa.c
@@ -1,5 +1,5 @@
/* dfa.c - deterministic extended regexp routines for GNU
- Copyright 1988, 1998, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1988 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
@@ -26,14 +26,10 @@
#include <ctype.h>
#include <stdio.h>
-#ifndef VMS
-#include <sys/types.h>
-#else
-#include <stddef.h>
-#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#else
+#include <sys/types.h>
extern char *calloc(), *malloc(), *realloc();
extern void free();
#endif
@@ -81,112 +77,116 @@ extern void free();
#define ISCNTRL(C) (isascii(C) && iscntrl(C))
#endif
-/* ISASCIIDIGIT differs from ISDIGIT, as follows:
- - Its arg may be any int or unsigned int; it need not be an unsigned char.
- - It's guaranteed to evaluate its argument exactly once.
- - It's typically faster.
- Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
- only '0' through '9' are digits. Prefer ISASCIIDIGIT to ISDIGIT unless
- it's important to use the locale's definition of `digit' even when the
- host does not conform to Posix. */
-#define ISASCIIDIGIT(c) ((unsigned) (c) - '0' <= 9)
-
-/* If we (don't) have I18N. */
-/* glibc defines _ */
-#ifndef _
-# ifdef HAVE_LIBINTL_H
-# include <libintl.h>
-# ifndef _
-# define _(Str) gettext (Str)
-# endif
-# else
-# define _(Str) (Str)
-# endif
-#endif
-
+#ifndef __FreeBSD__
#include "regex.h"
+#else
+#include <gnuregex.h>
+#endif
#include "dfa.h"
-/* HPUX, define those as macros in sys/param.h */
-#ifdef setbit
-# undef setbit
+#ifdef __STDC__
+typedef void *ptr_t;
+#else
+typedef char *ptr_t;
+#ifndef const
+#define const
#endif
-#ifdef clrbit
-# undef clrbit
#endif
-static void dfamust PARAMS ((struct dfa *dfa));
+static void dfamust _RE_ARGS((struct dfa *dfa));
-static ptr_t xcalloc PARAMS ((size_t n, size_t s));
-static ptr_t xmalloc PARAMS ((size_t n));
-static ptr_t xrealloc PARAMS ((ptr_t p, size_t n));
+static ptr_t xcalloc _RE_ARGS((size_t n, size_t s));
+static ptr_t xmalloc _RE_ARGS((size_t n));
+static ptr_t xrealloc _RE_ARGS((ptr_t p, size_t n));
#ifdef DEBUG
-static void prtok PARAMS ((token t));
+static void prtok _RE_ARGS((token t));
#endif
-static int tstbit PARAMS ((int b, charclass c));
-static void setbit PARAMS ((int b, charclass c));
-static void clrbit PARAMS ((int b, charclass c));
-static void copyset PARAMS ((charclass src, charclass dst));
-static void zeroset PARAMS ((charclass s));
-static void notset PARAMS ((charclass s));
-static int equal PARAMS ((charclass s1, charclass s2));
-static int charclass_index PARAMS ((charclass s));
-static int looking_at PARAMS ((const char *s));
-static token lex PARAMS ((void));
-static void addtok PARAMS ((token t));
-static void atom PARAMS ((void));
-static int nsubtoks PARAMS ((int tindex));
-static void copytoks PARAMS ((int tindex, int ntokens));
-static void closure PARAMS ((void));
-static void branch PARAMS ((void));
-static void regexp PARAMS ((int toplevel));
-static void copy PARAMS ((position_set *src, position_set *dst));
-static void insert PARAMS ((position p, position_set *s));
-static void merge PARAMS ((position_set *s1, position_set *s2, position_set *m));
-static void delete PARAMS ((position p, position_set *s));
-static int state_index PARAMS ((struct dfa *d, position_set *s,
+static int tstbit _RE_ARGS((int b, charclass c));
+static void setbit _RE_ARGS((int b, charclass c));
+static void clrbit _RE_ARGS((int b, charclass c));
+static void copyset _RE_ARGS((charclass src, charclass dst));
+static void zeroset _RE_ARGS((charclass s));
+static void notset _RE_ARGS((charclass s));
+static int equal _RE_ARGS((charclass s1, charclass s2));
+static int charclass_index _RE_ARGS((charclass s));
+static int looking_at _RE_ARGS((const char *s));
+static token lex _RE_ARGS((void));
+static void addtok _RE_ARGS((token t));
+static void atom _RE_ARGS((void));
+static int nsubtoks _RE_ARGS((int tindex));
+static void copytoks _RE_ARGS((int tindex, int ntokens));
+static void closure _RE_ARGS((void));
+static void branch _RE_ARGS((void));
+static void regexp _RE_ARGS((int toplevel));
+static void copy _RE_ARGS((position_set *src, position_set *dst));
+static void insert _RE_ARGS((position p, position_set *s));
+static void merge _RE_ARGS((position_set *s1, position_set *s2, position_set *m));
+static void delete _RE_ARGS((position p, position_set *s));
+static int state_index _RE_ARGS((struct dfa *d, position_set *s,
int newline, int letter));
-static void build_state PARAMS ((int s, struct dfa *d));
-static void build_state_zero PARAMS ((struct dfa *d));
-static char *icatalloc PARAMS ((char *old, char *new));
-static char *icpyalloc PARAMS ((char *string));
-static char *istrstr PARAMS ((char *lookin, char *lookfor));
-static void ifree PARAMS ((char *cp));
-static void freelist PARAMS ((char **cpp));
-static char **enlist PARAMS ((char **cpp, char *new, size_t len));
-static char **comsubs PARAMS ((char *left, char *right));
-static char **addlists PARAMS ((char **old, char **new));
-static char **inboth PARAMS ((char **left, char **right));
+static void build_state _RE_ARGS((int s, struct dfa *d));
+static void build_state_zero _RE_ARGS((struct dfa *d));
+static char *icatalloc _RE_ARGS((char *old, char *new));
+static char *icpyalloc _RE_ARGS((char *string));
+static char *istrstr _RE_ARGS((char *lookin, char *lookfor));
+static void ifree _RE_ARGS((char *cp));
+static void freelist _RE_ARGS((char **cpp));
+static char **enlist _RE_ARGS((char **cpp, char *new, size_t len));
+static char **comsubs _RE_ARGS((char *left, char *right));
+static char **addlists _RE_ARGS((char **old, char **new));
+static char **inboth _RE_ARGS((char **left, char **right));
+
+#ifdef __FreeBSD__
+static int collate_range_cmp (a, b)
+ int a, b;
+{
+ int r;
+ static char s[2][2];
+
+ if ((unsigned char)a == (unsigned char)b)
+ return 0;
+ s[0][0] = a;
+ s[1][0] = b;
+ if ((r = strcoll(s[0], s[1])) == 0)
+ r = (unsigned char)a - (unsigned char)b;
+ return r;
+}
+#endif
static ptr_t
-xcalloc (size_t n, size_t s)
+xcalloc(n, s)
+ size_t n;
+ size_t s;
{
ptr_t r = calloc(n, s);
if (!r)
- dfaerror(_("Memory exhausted"));
+ dfaerror("Memory exhausted");
return r;
}
static ptr_t
-xmalloc (size_t n)
+xmalloc(n)
+ size_t n;
{
ptr_t r = malloc(n);
assert(n != 0);
if (!r)
- dfaerror(_("Memory exhausted"));
+ dfaerror("Memory exhausted");
return r;
}
static ptr_t
-xrealloc (ptr_t p, size_t n)
+xrealloc(p, n)
+ ptr_t p;
+ size_t n;
{
ptr_t r = realloc(p, n);
assert(n != 0);
if (!r)
- dfaerror(_("Memory exhausted"));
+ dfaerror("Memory exhausted");
return r;
}
@@ -206,7 +206,8 @@ xrealloc (ptr_t p, size_t n)
#ifdef DEBUG
static void
-prtok (token t)
+prtok(t)
+ token t;
{
char *s;
@@ -244,25 +245,33 @@ prtok (token t)
/* Stuff pertaining to charclasses. */
static int
-tstbit (int b, charclass c)
+tstbit(b, c)
+ int b;
+ charclass c;
{
return c[b / INTBITS] & 1 << b % INTBITS;
}
static void
-setbit (int b, charclass c)
+setbit(b, c)
+ int b;
+ charclass c;
{
c[b / INTBITS] |= 1 << b % INTBITS;
}
static void
-clrbit (int b, charclass c)
+clrbit(b, c)
+ int b;
+ charclass c;
{
c[b / INTBITS] &= ~(1 << b % INTBITS);
}
static void
-copyset (charclass src, charclass dst)
+copyset(src, dst)
+ charclass src;
+ charclass dst;
{
int i;
@@ -271,7 +280,8 @@ copyset (charclass src, charclass dst)
}
static void
-zeroset (charclass s)
+zeroset(s)
+ charclass s;
{
int i;
@@ -280,7 +290,8 @@ zeroset (charclass s)
}
static void
-notset (charclass s)
+notset(s)
+ charclass s;
{
int i;
@@ -289,7 +300,9 @@ notset (charclass s)
}
static int
-equal (charclass s1, charclass s2)
+equal(s1, s2)
+ charclass s1;
+ charclass s2;
{
int i;
@@ -304,7 +317,8 @@ static struct dfa *dfa;
/* Find the index of charclass s in dfa->charclasses, or allocate a new charclass. */
static int
-charclass_index (charclass s)
+charclass_index(s)
+ charclass s;
{
int i;
@@ -323,17 +337,15 @@ static reg_syntax_t syntax_bits, syntax_bits_set;
/* Flag for case-folding letters into sets. */
static int case_fold;
-/* End-of-line byte in data. */
-static unsigned char eolbyte;
-
/* Entry point to set syntax options. */
void
-dfasyntax (reg_syntax_t bits, int fold, int eol)
+dfasyntax(bits, fold)
+ reg_syntax_t bits;
+ int fold;
{
syntax_bits_set = 1;
syntax_bits = bits;
case_fold = fold;
- eolbyte = eol;
}
/* Lexical analyzer. All the dross that deals with the obnoxious
@@ -341,6 +353,7 @@ dfasyntax (reg_syntax_t bits, int fold, int eol)
reader is referred to the GNU Regex documentation for the
meaning of the @#%!@#%^!@ syntax bits. */
+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. */
@@ -353,12 +366,10 @@ static int minrep, maxrep; /* Repeat counts for {m,n}. */
#define FETCH(c, eoferr) \
{ \
if (! lexleft) \
- { \
- if (eoferr != 0) \
- dfaerror (eoferr); \
- else \
- return lasttok = END; \
- } \
+ if (eoferr != 0) \
+ dfaerror(eoferr); \
+ else \
+ return lasttok = END; \
(c) = (unsigned char) *lexptr++; \
--lexleft; \
}
@@ -381,8 +392,8 @@ FUNC(is_print, ISPRINT)
FUNC(is_graph, ISGRAPH)
FUNC(is_cntrl, ISCNTRL)
-static int
-is_blank (int c)
+static int is_blank(c)
+int c;
{
return (c == ' ' || c == '\t');
}
@@ -392,7 +403,7 @@ is_blank (int c)
the class. The leading [ has already been eaten by the lexical analyzer. */
static struct {
const char *name;
- int (*pred) PARAMS ((int));
+ int (*pred) _RE_ARGS((int));
} prednames[] = {
{ ":alpha:]", is_alpha },
{ ":upper:]", is_upper },
@@ -409,11 +420,9 @@ static struct {
{ 0 }
};
-/* Return non-zero if C is a `word-constituent' byte; zero otherwise. */
-#define IS_WORD_CONSTITUENT(C) (ISALNUM(C) || (C) == '_')
-
static int
-looking_at (char const *s)
+looking_at(s)
+ const char *s;
{
size_t len;
@@ -424,14 +433,12 @@ looking_at (char const *s)
}
static token
-lex (void)
+lex()
{
token c, c1, c2;
int backslash = 0, invert;
charclass ccl;
int i;
- char lo[2];
- char hi[2];
/* Basic plan: We fetch a character. If it's a backslash,
we set the backslash flag and go through the loop again.
@@ -448,7 +455,7 @@ lex (void)
if (backslash)
goto normal_char;
if (lexleft == 0)
- dfaerror(_("Unfinished \\ escape"));
+ dfaerror("Unfinished \\ escape");
backslash = 1;
break;
@@ -554,76 +561,44 @@ lex (void)
goto normal_char;
if (backslash != ((syntax_bits & RE_NO_BK_BRACES) == 0))
goto normal_char;
- if (!(syntax_bits & RE_CONTEXT_INDEP_OPS) && laststart)
- goto normal_char;
-
- if (syntax_bits & RE_NO_BK_BRACES)
- {
- /* Scan ahead for a valid interval; if it's not valid,
- treat it as a literal '{'. */
- int lo = -1, hi = -1;
- char const *p = lexptr;
- char const *lim = p + lexleft;
- for (; p != lim && ISASCIIDIGIT (*p); p++)
- lo = (lo < 0 ? 0 : lo * 10) + *p - '0';
- if (p != lim && *p == ',')
- while (++p != lim && ISASCIIDIGIT (*p))
- hi = (hi < 0 ? 0 : hi * 10) + *p - '0';
- else
- hi = lo;
- if (p == lim || *p != '}'
- || lo < 0 || RE_DUP_MAX < hi || (0 <= hi && hi < lo))
- goto normal_char;
- }
-
- minrep = 0;
+ minrep = maxrep = 0;
/* Cases:
{M} - exact count
{M,} - minimum count, maximum is infinity
+ {,M} - 0 through M
{M,N} - M through N */
- FETCH(c, _("unfinished repeat count"));
- if (ISASCIIDIGIT (c))
+ FETCH(c, "unfinished repeat count");
+ if (ISDIGIT(c))
{
minrep = c - '0';
for (;;)
{
- FETCH(c, _("unfinished repeat count"));
- if (! ISASCIIDIGIT (c))
+ FETCH(c, "unfinished repeat count");
+ if (!ISDIGIT(c))
break;
minrep = 10 * minrep + c - '0';
}
}
- else
- dfaerror(_("malformed repeat count"));
+ else if (c != ',')
+ dfaerror("malformed repeat count");
if (c == ',')
- {
- FETCH (c, _("unfinished repeat count"));
- if (! ISASCIIDIGIT (c))
- maxrep = -1;
- else
- {
- maxrep = c - '0';
- for (;;)
- {
- FETCH (c, _("unfinished repeat count"));
- if (! ISASCIIDIGIT (c))
- break;
- maxrep = 10 * maxrep + c - '0';
- }
- if (0 <= maxrep && maxrep < minrep)
- dfaerror (_("malformed repeat count"));
- }
- }
+ for (;;)
+ {
+ FETCH(c, "unfinished repeat count");
+ if (!ISDIGIT(c))
+ break;
+ maxrep = 10 * maxrep + c - '0';
+ }
else
maxrep = minrep;
if (!(syntax_bits & RE_NO_BK_BRACES))
{
if (c != '\\')
- dfaerror(_("malformed repeat count"));
- FETCH(c, _("unfinished repeat count"));
+ dfaerror("malformed repeat count");
+ FETCH(c, "unfinished repeat count");
}
if (c != '}')
- dfaerror(_("malformed repeat count"));
+ dfaerror("malformed repeat count");
laststart = 0;
return lasttok = REPMN;
@@ -665,7 +640,7 @@ lex (void)
zeroset(ccl);
notset(ccl);
if (!(syntax_bits & RE_DOT_NEWLINE))
- clrbit(eolbyte, ccl);
+ clrbit('\n', ccl);
if (syntax_bits & RE_DOT_NOT_NULL)
clrbit('\0', ccl);
laststart = 0;
@@ -677,21 +652,22 @@ lex (void)
goto normal_char;
zeroset(ccl);
for (c2 = 0; c2 < NOTCHAR; ++c2)
- if (IS_WORD_CONSTITUENT(c2))
+ if (ISALNUM(c2))
setbit(c2, ccl);
+ setbit('_', ccl);
if (c == 'W')
notset(ccl);
laststart = 0;
return lasttok = CSET + charclass_index(ccl);
-
+
case '[':
if (backslash)
goto normal_char;
zeroset(ccl);
- FETCH(c, _("Unbalanced ["));
+ FETCH(c, "Unbalanced [");
if (c == '^')
{
- FETCH(c, _("Unbalanced ["));
+ FETCH(c, "Unbalanced [");
invert = 1;
}
else
@@ -718,15 +694,15 @@ lex (void)
setbit(c2, ccl);
lexptr += strlen(prednames[c1].name);
lexleft -= strlen(prednames[c1].name);
- FETCH(c1, _("Unbalanced ["));
+ FETCH(c1, "Unbalanced [");
goto skip;
}
if (c == '\\' && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
- FETCH(c, _("Unbalanced ["));
- FETCH(c1, _("Unbalanced ["));
+ FETCH(c, "Unbalanced [");
+ FETCH(c1, "Unbalanced [");
if (c1 == '-')
{
- FETCH(c2, _("Unbalanced ["));
+ FETCH(c2, "Unbalanced [");
if (c2 == ']')
{
/* In the case [x-], the - is an ordinary hyphen,
@@ -739,32 +715,44 @@ lex (void)
{
if (c2 == '\\'
&& (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS))
- FETCH(c2, _("Unbalanced ["));
- FETCH(c1, _("Unbalanced ["));
+ FETCH(c2, "Unbalanced [");
+ FETCH(c1, "Unbalanced [");
}
}
else
c2 = c;
+#ifdef __FreeBSD__
+ { token c3;
- lo[0] = c; lo[1] = '\0';
- hi[0] = c2; hi[1] = '\0';
- for (c = 0; c < NOTCHAR; c++)
- {
- char ch[2];
- ch[0] = c; ch[1] = '\0';
- if (strcoll (lo, ch) <= 0 && strcoll (ch, hi) <= 0)
- {
- setbit (c, ccl);
- if (case_fold)
- {
- if (ISUPPER (c))
- setbit (tolower (c), ccl);
- else if (ISLOWER (c))
- setbit (toupper (c), ccl);
- }
- }
+ if (collate_range_cmp(c, c2) > 0) {
+ FETCH(c2, "Invalid range");
+ goto skip;
}
+ for (c3 = 0; c3 < NOTCHAR; ++c3)
+ if ( collate_range_cmp(c, c3) <= 0
+ && collate_range_cmp(c3, c2) <= 0
+ ) {
+ setbit(c3, ccl);
+ if (case_fold)
+ if (ISUPPER(c3))
+ setbit(tolower(c3), ccl);
+ else if (ISLOWER(c3))
+ setbit(toupper(c3), ccl);
+ }
+ }
+#else
+ while (c <= c2)
+ {
+ setbit(c, ccl);
+ if (case_fold)
+ if (ISUPPER(c))
+ setbit(tolower(c), ccl);
+ else if (ISLOWER(c))
+ setbit(toupper(c), ccl);
+ ++c;
+ }
+#endif
skip:
;
}
@@ -773,7 +761,7 @@ lex (void)
{
notset(ccl);
if (syntax_bits & RE_HAT_LISTS_NOT_NEWLINE)
- clrbit(eolbyte, ccl);
+ clrbit('\n', ccl);
}
laststart = 0;
return lasttok = CSET + charclass_index(ccl);
@@ -813,7 +801,8 @@ static int depth; /* Current depth of a hypothetical stack
/* Add the given token to the parse tree, maintaining the depth count and
updating the maximum depth if necessary. */
static void
-addtok (token t)
+addtok(t)
+ token t;
{
REALLOC_IF_NECESSARY(dfa->tokens, token, dfa->talloc, dfa->tindex);
dfa->tokens[dfa->tindex++] = t;
@@ -872,7 +861,7 @@ addtok (token t)
The parser builds a parse tree in postfix form in an array of tokens. */
static void
-atom (void)
+atom()
{
if ((tok >= 0 && tok < NOTCHAR) || tok >= CSET || tok == BACKREF
|| tok == BEGLINE || tok == ENDLINE || tok == BEGWORD
@@ -886,7 +875,7 @@ atom (void)
tok = lex();
regexp(0);
if (tok != RPAREN)
- dfaerror(_("Unbalanced ("));
+ dfaerror("Unbalanced (");
tok = lex();
}
else
@@ -895,7 +884,8 @@ atom (void)
/* Return the number of tokens in the given subexpression. */
static int
-nsubtoks (int tindex)
+nsubtoks(tindex)
+int tindex;
{
int ntoks1;
@@ -917,7 +907,8 @@ nsubtoks (int tindex)
/* Copy the given subexpression to the top of the tree. */
static void
-copytoks (int tindex, int ntokens)
+copytoks(tindex, ntokens)
+ int tindex, ntokens;
{
int i;
@@ -926,7 +917,7 @@ copytoks (int tindex, int ntokens)
}
static void
-closure (void)
+closure()
{
int tindex, ntokens, i;
@@ -936,7 +927,7 @@ closure (void)
{
ntokens = nsubtoks(dfa->tindex);
tindex = dfa->tindex - ntokens;
- if (maxrep < 0)
+ if (maxrep == 0)
addtok(PLUS);
if (minrep == 0)
addtok(QMARK);
@@ -961,7 +952,7 @@ closure (void)
}
static void
-branch (void)
+branch()
{
closure();
while (tok != RPAREN && tok != OR && tok >= 0)
@@ -972,7 +963,8 @@ branch (void)
}
static void
-regexp (int toplevel)
+regexp(toplevel)
+ int toplevel;
{
branch();
while (tok == OR)
@@ -990,17 +982,21 @@ regexp (int toplevel)
length of the string, so s can include NUL characters. D is a pointer to
the struct dfa to parse into. */
void
-dfaparse (char *s, size_t len, struct dfa *d)
+dfaparse(s, len, d)
+ char *s;
+ size_t len;
+ struct dfa *d;
+
{
dfa = d;
- lexptr = s;
+ lexstart = lexptr = s;
lexleft = len;
lasttok = END;
laststart = 1;
parens = 0;
if (! syntax_bits_set)
- dfaerror(_("No regexp syntax bits specified"));
+ dfaerror("No syntax specified");
tok = lex();
depth = d->depth;
@@ -1008,7 +1004,7 @@ dfaparse (char *s, size_t len, struct dfa *d)
regexp(1);
if (tok != END)
- dfaerror(_("Unbalanced )"));
+ dfaerror("Unbalanced )");
addtok(END - d->nregexps);
addtok(CAT);
@@ -1023,7 +1019,9 @@ dfaparse (char *s, size_t len, struct dfa *d)
/* Copy one set to another; the destination must be large enough. */
static void
-copy (position_set *src, position_set *dst)
+copy(src, dst)
+ position_set *src;
+ position_set *dst;
{
int i;
@@ -1037,7 +1035,9 @@ copy (position_set *src, position_set *dst)
the same index then their constraints are logically or'd together.
S->elems must point to an array large enough to hold the resulting set. */
static void
-insert (position p, position_set *s)
+insert(p, s)
+ position p;
+ position_set *s;
{
int i;
position t1, t2;
@@ -1062,7 +1062,10 @@ insert (position p, position_set *s)
/* Merge two sets of positions into a third. The result is exactly as if
the positions of both sets were inserted into an initially empty set. */
static void
-merge (position_set *s1, position_set *s2, position_set *m)
+merge(s1, s2, m)
+ position_set *s1;
+ position_set *s2;
+ position_set *m;
{
int i = 0, j = 0;
@@ -1085,7 +1088,9 @@ merge (position_set *s1, position_set *s2, position_set *m)
/* Delete a position from a set. */
static void
-delete (position p, position_set *s)
+delete(p, s)
+ position p;
+ position_set *s;
{
int i;
@@ -1102,7 +1107,11 @@ delete (position p, position_set *s)
state. Newline and letter tell whether we got here on a newline or
letter, respectively. */
static int
-state_index (struct dfa *d, position_set *s, int newline, int letter)
+state_index(d, s, newline, letter)
+ struct dfa *d;
+ position_set *s;
+ int newline;
+ int letter;
{
int hash = 0;
int constraint;
@@ -1167,8 +1176,12 @@ state_index (struct dfa *d, position_set *s, int newline, int letter)
that position with the elements of its follow labeled with an appropriate
constraint. Repeat exhaustively until no funny positions are left.
S->elems must be large enough to hold the result. */
+static void epsclosure _RE_ARGS((position_set *s, struct dfa *d));
+
static void
-epsclosure (position_set *s, struct dfa *d)
+epsclosure(s, d)
+ position_set *s;
+ struct dfa *d;
{
int i, j;
int *visited;
@@ -1280,7 +1293,9 @@ epsclosure (position_set *s, struct dfa *d)
scheme; the number of elements in each set deeper in the stack can be
used to determine the address of a particular set's array. */
void
-dfaanalyze (struct dfa *d, int searchflag)
+dfaanalyze(d, searchflag)
+ struct dfa *d;
+ int searchflag;
{
int *nullable; /* Nullable stack. */
int *nfirstpos; /* Element count stack for firstpos sets. */
@@ -1541,7 +1556,10 @@ dfaanalyze (struct dfa *d, int searchflag)
create a new group labeled with the characters of C and insert this
position in that group. */
void
-dfastate (int s, struct dfa *d, int trans[])
+dfastate(s, d, trans)
+ int s;
+ struct dfa *d;
+ int trans[];
{
position_set grps[NOTCHAR]; /* As many as will ever be needed. */
charclass labels[NOTCHAR]; /* Labels corresponding to the groups. */
@@ -1570,9 +1588,9 @@ dfastate (int s, struct dfa *d, int trans[])
{
initialized = 1;
for (i = 0; i < NOTCHAR; ++i)
- if (IS_WORD_CONSTITUENT(i))
+ if (ISALNUM(i))
setbit(i, letters);
- setbit(eolbyte, newline);
+ setbit('\n', newline);
}
zeroset(matches);
@@ -1593,7 +1611,7 @@ dfastate (int s, struct dfa *d, int trans[])
{
if (! MATCHES_NEWLINE_CONTEXT(pos.constraint,
d->states[s].newline, 1))
- clrbit(eolbyte, matches);
+ clrbit('\n', matches);
if (! MATCHES_NEWLINE_CONTEXT(pos.constraint,
d->states[s].newline, 0))
for (j = 0; j < CHARCLASS_INTS; ++j)
@@ -1703,8 +1721,12 @@ dfastate (int s, struct dfa *d, int trans[])
else
state_letter = state;
for (i = 0; i < NOTCHAR; ++i)
- trans[i] = (IS_WORD_CONSTITUENT(i)) ? state_letter : state;
- trans[eolbyte] = state_newline;
+ if (i == '\n')
+ trans[i] = state_newline;
+ else if (ISALNUM(i))
+ trans[i] = state_letter;
+ else
+ trans[i] = state;
}
else
for (i = 0; i < NOTCHAR; ++i)
@@ -1728,7 +1750,7 @@ dfastate (int s, struct dfa *d, int trans[])
/* Find out if the new state will want any context information. */
wants_newline = 0;
- if (tstbit(eolbyte, labels[i]))
+ if (tstbit('\n', labels[i]))
for (j = 0; j < follows.nelem; ++j)
if (PREV_NEWLINE_DEPENDENT(follows.elems[j].constraint))
wants_newline = 1;
@@ -1760,9 +1782,9 @@ dfastate (int s, struct dfa *d, int trans[])
{
int c = j * INTBITS + k;
- if (c == eolbyte)
+ if (c == '\n')
trans[c] = state_newline;
- else if (IS_WORD_CONSTITUENT(c))
+ else if (ISALNUM(c))
trans[c] = state_letter;
else if (c < NOTCHAR)
trans[c] = state;
@@ -1783,7 +1805,9 @@ dfastate (int s, struct dfa *d, int trans[])
TODO: Improve this comment, get rid of the unnecessary redundancy. */
static void
-build_state (int s, struct dfa *d)
+build_state(s, d)
+ int s;
+ struct dfa *d;
{
int *trans; /* The new transition table. */
int i;
@@ -1849,8 +1873,8 @@ build_state (int s, struct dfa *d)
/* Keep the newline transition in a special place so we can use it as
a sentinel. */
- d->newlines[s] = trans[eolbyte];
- trans[eolbyte] = -1;
+ d->newlines[s] = trans['\n'];
+ trans['\n'] = -1;
if (ACCEPTING(s, *d))
d->fails[s] = trans;
@@ -1859,7 +1883,8 @@ build_state (int s, struct dfa *d)
}
static void
-build_state_zero (struct dfa *d)
+build_state_zero(d)
+ struct dfa *d;
{
d->tralloc = 1;
d->trcount = 0;
@@ -1885,14 +1910,18 @@ build_state_zero (struct dfa *d)
match needs to be verified by a backtracking matcher. Otherwise
we store a 0 in *backref. */
char *
-dfaexec (struct dfa *d, char *begin, char *end,
- int newline, int *count, int *backref)
+dfaexec(d, begin, end, newline, count, backref)
+ struct dfa *d;
+ char *begin;
+ char *end;
+ int newline;
+ 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. */
- register unsigned char eol = eolbyte; /* Likewise for eolbyte. */
static int sbit[NOTCHAR]; /* Table for anding with d->success. */
static int sbit_init;
@@ -1902,8 +1931,12 @@ dfaexec (struct dfa *d, char *begin, char *end,
sbit_init = 1;
for (i = 0; i < NOTCHAR; ++i)
- sbit[i] = (IS_WORD_CONSTITUENT(i)) ? 2 : 1;
- sbit[eol] = 4;
+ if (i == '\n')
+ sbit[i] = 4;
+ else if (ISALNUM(i))
+ sbit[i] = 2;
+ else
+ sbit[i] = 1;
}
if (! d->tralloc)
@@ -1912,25 +1945,34 @@ dfaexec (struct dfa *d, char *begin, char *end,
s = s1 = 0;
p = (unsigned char *) begin;
trans = d->trans;
- *end = eol;
+ *end = '\n';
for (;;)
{
- while ((t = trans[s]) != 0) { /* hand-optimized loop */
- s1 = t[*p++];
- if ((t = trans[s1]) == 0) {
- tmp = s ; s = s1 ; s1 = tmp ; /* swap */
- break;
- }
- s = t[*p++];
- }
+ /* The dreaded inner loop. */
+ if ((t = trans[s]) != 0)
+ do
+ {
+ s1 = t[*p++];
+ if (! (t = trans[s1]))
+ goto last_was_s;
+ s = t[*p++];
+ }
+ while ((t = trans[s]) != 0);
+ goto last_was_s1;
+ last_was_s:
+ tmp = s, s = s1, s1 = tmp;
+ last_was_s1:
if (s >= 0 && p <= (unsigned char *) end && d->fails[s])
{
if (d->success[s] & sbit[*p])
{
if (backref)
- *backref = (d->states[s].backref != 0);
+ if (d->states[s].backref)
+ *backref = 1;
+ else
+ *backref = 0;
return (char *) p;
}
@@ -1940,7 +1982,7 @@ dfaexec (struct dfa *d, char *begin, char *end,
}
/* If the previous character was a newline, count it. */
- if (count && (char *) p <= end && p[-1] == eol)
+ if (count && (char *) p <= end && p[-1] == '\n')
++*count;
/* Check if we've run off the end of the buffer. */
@@ -1954,7 +1996,7 @@ dfaexec (struct dfa *d, char *begin, char *end,
continue;
}
- if (p[-1] == eol && newline)
+ if (p[-1] == '\n' && newline)
{
s = d->newlines[s1];
continue;
@@ -1967,7 +2009,8 @@ dfaexec (struct dfa *d, char *begin, char *end,
/* Initialize the components of a dfa that the other routines don't
initialize for themselves. */
void
-dfainit (struct dfa *d)
+dfainit(d)
+ struct dfa *d;
{
d->calloc = 1;
MALLOC(d->charclasses, charclass, d->calloc);
@@ -1981,16 +2024,15 @@ dfainit (struct dfa *d)
d->tralloc = 0;
d->musts = 0;
- d->realtrans = 0;
- d->fails = 0;
- d->newlines = 0;
- d->success = 0;
-
}
/* Parse and analyze a single string of the given length. */
void
-dfacomp (char *s, size_t len, struct dfa *d, int searchflag)
+dfacomp(s, len, d, searchflag)
+ char *s;
+ size_t len;
+ struct dfa *d;
+ int searchflag;
{
if (case_fold) /* dummy folding in service of dfamust() */
{
@@ -1999,13 +2041,13 @@ dfacomp (char *s, size_t len, struct dfa *d, int searchflag)
lcopy = malloc(len);
if (!lcopy)
- dfaerror(_("out of memory"));
-
+ dfaerror("out of memory");
+
/* This is a kludge. */
case_fold = 0;
for (i = 0; i < len; ++i)
- if (ISUPPER ((unsigned char) s[i]))
- lcopy[i] = tolower ((unsigned char) s[i]);
+ if (ISUPPER(s[i]))
+ lcopy[i] = tolower(s[i]);
else
lcopy[i] = s[i];
@@ -2029,7 +2071,8 @@ dfacomp (char *s, size_t len, struct dfa *d, int searchflag)
/* Free the storage held by the components of a dfa. */
void
-dfafree (struct dfa *d)
+dfafree(d)
+ struct dfa *d;
{
int i;
struct dfamust *dm, *ndm;
@@ -2090,9 +2133,9 @@ dfafree (struct dfa *d)
Type left right is in
---- ---- ----- -- --
char c # c # c # c # c
-
+
CSET ZERO ZERO ZERO ZERO
-
+
STAR ZERO ZERO ZERO ZERO
QMARK ZERO ZERO ZERO ZERO
@@ -2103,12 +2146,12 @@ dfafree (struct dfa *d)
p->left : q->right : q->is!=ZERO) ? q->in plus
p->is##q->left p->right##q->is p->is##q->is : p->right##q->left
ZERO
-
+
OR longest common longest common (do p->is and substrings common to
leading trailing q->is have same p->in and q->in
- (sub)sequence (sub)sequence length and
- of p->left of p->right content) ?
- and q->left and q->right p->is : NULL
+ (sub)sequence (sub)sequence length and
+ of p->left of p->right content) ?
+ and q->left and q->right p->is : NULL
If there's anything else we recognize in the tree, all four sequences get set
to zero-length sequences. If there's something we don't recognize in the tree,
@@ -2135,13 +2178,15 @@ dfafree (struct dfa *d)
Does optimization actually accomplish anything,
or is the automaton you get from "psi|epsilon" (for example)
the same as the one you get from "psi" (for example)?
-
+
Are optimizable r.e.'s likely to be used in real-life situations
(something like 'ab*' is probably unlikely; something like is
'psi|epsilon' is likelier)? */
static char *
-icatalloc (char *old, char *new)
+icatalloc(old, new)
+ char *old;
+ char *new;
{
char *result;
size_t oldsize, newsize;
@@ -2162,13 +2207,16 @@ icatalloc (char *old, char *new)
}
static char *
-icpyalloc (char *string)
+icpyalloc(string)
+ char *string;
{
return icatalloc((char *) NULL, string);
}
static char *
-istrstr (char *lookin, char *lookfor)
+istrstr(lookin, lookfor)
+ char *lookin;
+ char *lookfor;
{
char *cp;
size_t len;
@@ -2181,14 +2229,16 @@ istrstr (char *lookin, char *lookfor)
}
static void
-ifree (char *cp)
+ifree(cp)
+ char *cp;
{
if (cp != NULL)
free(cp);
}
static void
-freelist (char **cpp)
+freelist(cpp)
+ char **cpp;
{
int i;
@@ -2202,7 +2252,10 @@ freelist (char **cpp)
}
static char **
-enlist (char **cpp, char *new, size_t len)
+enlist(cpp, new, len)
+ char **cpp;
+ char *new;
+ size_t len;
{
int i, j;
@@ -2247,7 +2300,9 @@ enlist (char **cpp, char *new, size_t len)
list of their distinct common substrings. Return NULL if something
seems wild. */
static char **
-comsubs (char *left, char *right)
+comsubs(left, right)
+ char *left;
+ char *right;
{
char **cpp;
char *lcp;
@@ -2281,7 +2336,9 @@ comsubs (char *left, char *right)
}
static char **
-addlists (char **old, char **new)
+addlists(old, new)
+char **old;
+char **new;
{
int i;
@@ -2299,7 +2356,9 @@ addlists (char **old, char **new)
/* Given two lists of substrings, return a new list giving substrings
common to both. */
static char **
-inboth (char **left, char **right)
+inboth(left, right)
+ char **left;
+ char **right;
{
char **both;
char **temp;
@@ -2340,14 +2399,16 @@ typedef struct
} must;
static void
-resetmust (must *mp)
+resetmust(mp)
+must *mp;
{
mp->left[0] = mp->right[0] = mp->is[0] = '\0';
freelist(mp->in);
}
static void
-dfamust (struct dfa *dfa)
+dfamust(dfa)
+struct dfa *dfa;
{
must *musts;
must *mp;
diff --git a/contrib/awk/doc/awk.1 b/contrib/awk/doc/awk.1
index f15d4f1..807f79f 100644
--- a/contrib/awk/doc/awk.1
+++ b/contrib/awk/doc/awk.1
@@ -1,3 +1,4 @@
+.\" $FreeBSD$
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
.ds AN \s-1ANSI\s+1
@@ -1213,13 +1214,13 @@ For example, the name
might be used to represent all of
``e,'' ``e\`,'' and ``e\`.''
In this case,
-.B [[=e]]
+.B [[=e=]]
is a regexp
that matches any of
- .BR e ,
- .BR e\' ,
+.BR e ,
+.BR e\' ,
or
- .BR e\` .
+.BR e\` .
.PP
These features are very valuable in non-English speaking locales.
The library functions that
@@ -2487,7 +2488,7 @@ statement.
will support this usage if
.B \-\^\-traditional
has been specified.
-.SH ENVIRONMENT VARIABLES
+.SH ENVIRONMENT
If
.B POSIXLY_CORRECT
exists in the environment, then
diff --git a/contrib/awk/eval.c b/contrib/awk/eval.c
index e584afe..3d5e568 100644
--- a/contrib/awk/eval.c
+++ b/contrib/awk/eval.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,6 +21,8 @@
* 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
+ *
+ * $FreeBSD$
*/
#include "awk.h"
@@ -33,14 +35,12 @@ static int eval_condition P((NODE *tree));
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, char **varnames));
+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));
-static int comp_func P((const void *p1, const void *p2));
#if __GNUC__ < 2
NODE *_t; /* used as a temporary in macros */
@@ -54,13 +54,6 @@ int ORSlen;
int OFMTidx;
int CONVFMTidx;
-/* Profiling stuff */
-#ifdef PROFILING
-#define INCREMENT(n) n++
-#else
-#define INCREMENT(n) /* nothing */
-#endif
-
/* Macros and variables to save and restore function and loop bindings */
/*
* the val variable allows return/continue/break-out-of-context to be
@@ -121,8 +114,7 @@ char casetable[] = {
'\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
/* 'x' 'y' 'z' '{' '|' '}' '~' */
'\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
-
- /* Latin 1: */
+#ifndef USE_PURE_ASCII
C('\200'), C('\201'), C('\202'), C('\203'), C('\204'), C('\205'), C('\206'), C('\207'),
C('\210'), C('\211'), C('\212'), C('\213'), C('\214'), C('\215'), C('\216'), C('\217'),
C('\220'), C('\221'), C('\222'), C('\223'), C('\224'), C('\225'), C('\226'), C('\227'),
@@ -139,6 +131,24 @@ char casetable[] = {
C('\350'), C('\351'), C('\352'), C('\353'), C('\354'), C('\355'), C('\356'), C('\357'),
C('\360'), C('\361'), C('\362'), C('\363'), C('\364'), C('\365'), C('\366'), C('\367'),
C('\370'), C('\371'), C('\372'), C('\373'), C('\374'), C('\375'), C('\376'), C('\377'),
+#else
+ C('\200'), C('\201'), C('\202'), C('\203'), C('\204'), C('\205'), C('\206'), C('\207'),
+ C('\210'), C('\211'), C('\212'), C('\213'), C('\214'), C('\215'), C('\216'), C('\217'),
+ C('\220'), C('\221'), C('\222'), C('\223'), C('\224'), C('\225'), C('\226'), C('\227'),
+ C('\230'), C('\231'), C('\232'), C('\233'), C('\234'), C('\235'), C('\236'), C('\237'),
+ C('\240'), C('\241'), C('\242'), C('\243'), C('\244'), C('\245'), C('\246'), C('\247'),
+ C('\250'), C('\251'), C('\252'), C('\253'), C('\254'), C('\255'), C('\256'), C('\257'),
+ C('\260'), C('\261'), C('\262'), C('\263'), C('\264'), C('\265'), C('\266'), C('\267'),
+ C('\270'), C('\271'), C('\272'), C('\273'), C('\274'), C('\275'), C('\276'), C('\277'),
+ C('\300'), C('\301'), C('\302'), C('\303'), C('\304'), C('\305'), C('\306'), C('\307'),
+ C('\310'), C('\311'), C('\312'), C('\313'), C('\314'), C('\315'), C('\316'), C('\317'),
+ C('\320'), C('\321'), C('\322'), C('\323'), C('\324'), C('\325'), C('\326'), C('\327'),
+ C('\330'), C('\331'), C('\332'), C('\333'), C('\334'), C('\335'), C('\336'), C('\337'),
+ C('\340'), C('\341'), C('\342'), C('\343'), C('\344'), C('\345'), C('\346'), C('\347'),
+ C('\350'), C('\351'), C('\352'), C('\353'), C('\354'), C('\355'), C('\356'), C('\357'),
+ C('\360'), C('\361'), C('\362'), C('\363'), C('\364'), C('\365'), C('\366'), C('\367'),
+ C('\370'), C('\371'), C('\372'), C('\373'), C('\374'), C('\375'), C('\376'), C('\377'),
+#endif
};
#else
#include "You lose. You will need a translation table for your character set."
@@ -213,7 +223,6 @@ static char *nodetypes[] = {
"Node_redirect_pipe",
"Node_redirect_pipein",
"Node_redirect_input",
- "Node_redirect_twoway",
"Node_var",
"Node_var_array",
"Node_val",
@@ -227,94 +236,114 @@ static char *nodetypes[] = {
"Node_hashnode",
"Node_ahash",
"Node_array_ref",
- "Node_BINMODE",
- "Node_CONVFMT",
- "Node_FIELDWIDTHS",
+ "Node_NF",
+ "Node_NR",
"Node_FNR",
"Node_FS",
+ "Node_RS",
+ "Node_FIELDWIDTHS",
"Node_IGNORECASE",
- "Node_LINT",
- "Node_NF",
- "Node_NR",
- "Node_OFMT",
"Node_OFS",
"Node_ORS",
- "Node_RS",
- "Node_TEXTDOMAIN",
- "Node_final --- this should never appear",
+ "Node_OFMT",
+ "Node_CONVFMT",
+ "Node_final",
NULL
};
-/* nodetype2str --- convert a node type into a printable value */
-
char *
-nodetype2str(NODETYPE type)
+nodetype2str(type)
+NODETYPE type;
{
static char buf[40];
if (type >= Node_illegal && type <= Node_final)
return nodetypes[(int) type];
- sprintf(buf, _("unknown nodetype %d"), (int) type);
+ sprintf(buf, "unknown nodetype %d", (int) type);
return buf;
}
/* flags2str --- make a flags value readable */
char *
-flags2str(int flagval)
-{
- static struct flagtab values[] = {
- { MALLOC, "MALLOC" },
- { TEMP, "TEMP" },
- { PERM, "PERM" },
- { STRING, "STRING" },
- { STR, "STR" },
- { NUM, "NUM" },
- { NUMBER, "NUMBER" },
- { MAYBE_NUM, "MAYBE_NUM" },
- { ARRAYMAXED, "ARRAYMAXED" },
- { SCALAR, "SCALAR" },
- { FUNC, "FUNC" },
- { FIELD, "FIELD" },
- { INTLSTR, "INTLSTR" },
- { UNINITIALIZED, "UNINITIALIZED" },
- { 0, NULL },
- };
-
- return genflags2str(flagval, values);
-}
-
-/* genflags2str --- general routine to convert a flag value to a string */
-
-char *
-genflags2str(int flagval, struct flagtab *tab)
+flags2str(flagval)
+int flagval;
{
static char buffer[BUFSIZ];
char *sp;
- int i, space_left, space_needed;
sp = buffer;
- space_left = BUFSIZ;
- for (i = 0; tab[i].name != NULL; i++) {
- /*
- * note the trick, we want 1 or 0 for whether we need
- * the '|' character.
- */
- space_needed = (strlen(tab[i].name) + (sp != buffer));
- if (space_left < space_needed)
- fatal(_("buffer overflow in genflags2str"));
-
- if ((flagval & tab[i].val) != 0) {
- if (sp != buffer) {
- *sp++ = '|';
- space_left--;
- }
- strcpy(sp, tab[i].name);
- /* note ordering! */
- space_left -= strlen(sp);
- sp += strlen(sp);
- }
+
+ 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;
@@ -326,7 +355,8 @@ genflags2str(int flagval, struct flagtab *tab)
* statement
*/
int
-interpret(register NODE *volatile tree)
+interpret(tree)
+register NODE *volatile tree;
{
jmp_buf volatile loop_tag_stack; /* shallow binding stack for loop_tag */
static jmp_buf rule_tag; /* tag the rule currently being run, for NEXT
@@ -355,17 +385,12 @@ interpret(register NODE *volatile tree)
tree = t->lnode;
sourceline = tree->source_line;
source = tree->source_file;
- INCREMENT(tree->exec_count);
switch (setjmp(rule_tag)) {
case 0: /* normal non-jump */
/* test pattern, if any */
if (tree->lnode == NULL ||
- eval_condition(tree->lnode)) {
- /* using the lnode exec_count is kludgey */
- if (tree->lnode != NULL)
- INCREMENT(tree->lnode->exec_count);
+ eval_condition(tree->lnode))
(void) interpret(tree->rnode);
- }
break;
case TAG_CONTINUE: /* NEXT statement */
return 1;
@@ -385,13 +410,10 @@ interpret(register NODE *volatile tree)
break;
case Node_K_if:
- INCREMENT(tree->exec_count);
- if (eval_condition(tree->lnode)) {
- INCREMENT(tree->rnode->exec_count);
+ if (eval_condition(tree->lnode))
(void) interpret(tree->rnode->lnode);
- } else {
+ else
(void) interpret(tree->rnode->rnode);
- }
break;
case Node_K_while:
@@ -399,7 +421,6 @@ interpret(register NODE *volatile tree)
stable_tree = tree;
while (eval_condition(stable_tree->lnode)) {
- INCREMENT(stable_tree->exec_count);
switch (setjmp(loop_tag)) {
case 0: /* normal non-jump */
(void) interpret(stable_tree->rnode);
@@ -420,7 +441,6 @@ interpret(register NODE *volatile tree)
PUSH_BINDING(loop_tag_stack, loop_tag, loop_tag_valid);
stable_tree = tree;
do {
- INCREMENT(stable_tree->exec_count);
switch (setjmp(loop_tag)) {
case 0: /* normal non-jump */
(void) interpret(stable_tree->rnode);
@@ -442,7 +462,6 @@ interpret(register NODE *volatile tree)
(void) interpret(tree->forloop->init);
stable_tree = tree;
while (eval_condition(stable_tree->forloop->cond)) {
- INCREMENT(stable_tree->exec_count);
switch (setjmp(loop_tag)) {
case 0: /* normal non-jump */
(void) interpret(stable_tree->lnode);
@@ -462,65 +481,26 @@ interpret(register NODE *volatile tree)
case Node_K_arrayfor:
{
+ volatile struct search l; /* For array_for */
Func_ptr after_assign = NULL;
- NODE **list = 0;
- NODE *volatile array;
- volatile size_t i;
- size_t j, num_elems;
- volatile int retval = 0;
- static int first = TRUE;
- static int sort_indices = FALSE;
#define hakvar forloop->init
#define arrvar forloop->incr
- /* get the array */
- array = tree->arrvar;
- if (array->type == Node_param_list)
- array = stack_ptr[array->param_cnt];
- if (array->type == Node_array_ref)
- array = array->orig_array;
- if ((array->flags & SCALAR) != 0)
- fatal(_("attempt to use scalar `%s' as array"), array->vname);
-
- /* sanity: do nothing if empty */
- if (array->type == Node_var || array->var_array == NULL
- || array->table_size == 0) {
- break; /* from switch */
- }
-
- /* allocate space for array */
- num_elems = array->table_size;
- emalloc(list, NODE **, num_elems * sizeof(NODE *), "for_loop");
-
- /* populate it */
- for (i = j = 0; i < array->array_size; i++) {
- NODE *t = array->var_array[i];
-
- if (t == NULL)
- continue;
-
- for (; t != NULL; t = t->ahnext) {
- list[j++] = dupnode(t->ahname);
- }
- }
-
- if (first) {
- first = FALSE;
- sort_indices = (getenv("WHINY_USERS") != 0);
- }
-
- if (sort_indices)
- qsort(list, num_elems, sizeof(NODE *), comp_func); /* shazzam! */
-
- /* now we can run the loop */
PUSH_BINDING(loop_tag_stack, loop_tag, loop_tag_valid);
-
- lhs = get_lhs(tree->hakvar, &after_assign, FALSE);
+ lhs = get_lhs(tree->hakvar, &after_assign);
+ t = tree->arrvar;
+ if (t->type == Node_param_list)
+ t = stack_ptr[t->param_cnt];
+ if (t->type == Node_array_ref)
+ t = t->orig_array;
stable_tree = tree;
- for (i = 0; i < num_elems; i++) {
- INCREMENT(stable_tree->exec_count);
+ if ((t->flags & SCALAR) != 0)
+ fatal("attempt to use scalar as array");
+ for (assoc_scan(t, (struct search *)&l);
+ l.retval;
+ assoc_next((struct search *)&l)) {
unref(*((NODE **) lhs));
- *lhs = dupnode(list[i]);
+ *lhs = dupnode(l.retval);
if (after_assign)
(*after_assign)();
switch (setjmp(loop_tag)) {
@@ -530,33 +510,17 @@ interpret(register NODE *volatile tree)
break;
case TAG_BREAK:
- retval = 1;
- goto done;
-
+ RESTORE_BINDING(loop_tag_stack, loop_tag, loop_tag_valid);
+ return 1;
default:
cant_happen();
}
}
-
- done:
RESTORE_BINDING(loop_tag_stack, loop_tag, loop_tag_valid);
-
- if (do_lint && num_elems != array->table_size)
- lintwarn(_("for loop: array `%s' changed size from %d to %d during loop execution"),
- array->vname, num_elems, array->table_size);
-
- for (i = 0; i < num_elems; i++)
- unref(list[i]);
-
- free(list);
-
- if (retval == 1)
- return 1;
break;
}
case Node_K_break:
- INCREMENT(tree->exec_count);
if (! loop_tag_valid) {
/*
* Old AT&T nawk treats break outside of loops like
@@ -566,11 +530,11 @@ interpret(register NODE *volatile tree)
static int warned = FALSE;
if (do_lint && ! warned) {
- lintwarn(_("`break' outside a loop is not portable"));
+ warning("use of `break' outside a loop is not portable");
warned = TRUE;
}
if (! do_traditional || do_posix)
- fatal(_("`break' outside a loop is not allowed"));
+ fatal("use of `break' outside a loop is not allowed");
if (in_function())
pop_fcall_stack();
longjmp(rule_tag, TAG_CONTINUE);
@@ -579,7 +543,6 @@ interpret(register NODE *volatile tree)
break;
case Node_K_continue:
- INCREMENT(tree->exec_count);
if (! loop_tag_valid) {
/*
* Old AT&T nawk treats continue outside of loops like
@@ -589,11 +552,11 @@ interpret(register NODE *volatile tree)
static int warned = FALSE;
if (do_lint && ! warned) {
- lintwarn(_("`continue' outside a loop is not portable"));
+ warning("use of `continue' outside a loop is not portable");
warned = TRUE;
}
if (! do_traditional || do_posix)
- fatal(_("`continue' outside a loop is not allowed"));
+ fatal("use of `continue' outside a loop is not allowed");
if (in_function())
pop_fcall_stack();
longjmp(rule_tag, TAG_CONTINUE);
@@ -602,17 +565,14 @@ interpret(register NODE *volatile tree)
break;
case Node_K_print:
- INCREMENT(tree->exec_count);
do_print(tree);
break;
case Node_K_printf:
- INCREMENT(tree->exec_count);
do_printf(tree);
break;
case Node_K_delete:
- INCREMENT(tree->exec_count);
do_delete(tree->lnode, tree->rnode);
break;
@@ -621,13 +581,11 @@ interpret(register NODE *volatile tree)
break;
case Node_K_next:
- INCREMENT(tree->exec_count);
if (in_begin_rule)
- fatal(_("`next' cannot be called from a BEGIN rule"));
+ fatal("`next' cannot be called from a BEGIN rule");
else if (in_end_rule)
- fatal(_("`next' cannot be called from an END rule"));
+ fatal("`next' cannot be called from an END rule");
- /* could add a lint check here */
if (in_function())
pop_fcall_stack();
@@ -635,13 +593,11 @@ interpret(register NODE *volatile tree)
break;
case Node_K_nextfile:
- INCREMENT(tree->exec_count);
if (in_begin_rule)
- fatal(_("`nextfile' cannot be called from a BEGIN rule"));
+ fatal("`nextfile' cannot be called from a BEGIN rule");
else if (in_end_rule)
- fatal(_("`nextfile' cannot be called from an END rule"));
+ fatal("`nextfile' cannot be called from an END rule");
- /* could add a lint check here */
if (in_function())
pop_fcall_stack();
@@ -649,7 +605,6 @@ interpret(register NODE *volatile tree)
break;
case Node_K_exit:
- INCREMENT(tree->exec_count);
/*
* In A,K,&W, p. 49, it says that an exit statement "...
* causes the program to behave as if the end of input had
@@ -667,7 +622,6 @@ interpret(register NODE *volatile tree)
break;
case Node_K_return:
- INCREMENT(tree->exec_count);
t = tree_eval(tree->lnode);
ret_node = dupnode(t);
free_temp(t);
@@ -680,8 +634,7 @@ interpret(register NODE *volatile tree)
* value.
*/
if (do_lint && tree->type == Node_var)
- lintwarn(_("statement has no effect"));
- INCREMENT(tree->exec_count);
+ warning("statement has no effect");
t = tree_eval(tree);
free_temp(t);
break;
@@ -692,7 +645,9 @@ interpret(register NODE *volatile tree)
/* r_tree_eval --- evaluate a subtree */
NODE *
-r_tree_eval(register NODE *tree, int iscond)
+r_tree_eval(tree, iscond)
+register NODE *tree;
+int iscond;
{
register NODE *r, *t1, *t2; /* return value & temporary subtrees */
register NODE **lhs;
@@ -702,8 +657,9 @@ r_tree_eval(register NODE *tree, int iscond)
#ifdef _CRAY
long lx2;
#endif
+ char namebuf[100];
-#ifdef GAWKDEBUG
+#ifdef DEBUG
if (tree == NULL)
return Nnull_string;
else if (tree->type == Node_val) {
@@ -713,39 +669,28 @@ r_tree_eval(register NODE *tree, int iscond)
} else if (tree->type == Node_var) {
if (tree->var_value->stref <= 0)
cant_happen();
- if ((tree->flags & UNINITIALIZED) != 0)
- warning(_("reference to uninitialized variable `%s'"),
- tree->vname);
return tree->var_value;
}
#endif
if (tree->type == Node_param_list) {
+ int paramnum = tree->param_cnt + 1;
+
if ((tree->flags & FUNC) != 0)
- fatal(_("can't use function name `%s' as variable or array"),
+ fatal("can't use function name `%s' as variable or array",
tree->vname);
tree = stack_ptr[tree->param_cnt];
-
- if (tree == NULL) {
- if (do_lint)
- lintwarn(_("reference to uninitialized argument `%s'"),
- tree->vname);
+ if (tree == NULL)
return Nnull_string;
- }
-
- if (do_lint && (tree->flags & UNINITIALIZED) != 0)
- lintwarn(_("reference to uninitialized argument `%s'"),
- tree->vname);
- }
+ sprintf(namebuf, "parameter #%d", paramnum);
+ tree->vname = namebuf;
+ }
if (tree->type == Node_array_ref)
tree = tree->orig_array;
switch (tree->type) {
case Node_var:
- if (do_lint && (tree->flags & UNINITIALIZED) != 0)
- lintwarn(_("reference to uninitialized variable `%s'"),
- tree->vname);
return tree->var_value;
case Node_and:
@@ -786,14 +731,11 @@ r_tree_eval(register NODE *tree, int iscond)
case Node_ORS:
case Node_OFMT:
case Node_CONVFMT:
- case Node_BINMODE:
- case Node_LINT:
- case Node_TEXTDOMAIN:
- lhs = get_lhs(tree, (Func_ptr *) NULL, TRUE);
+ lhs = get_lhs(tree, (Func_ptr *) NULL);
return *lhs;
case Node_var_array:
- fatal(_("attempt to use array `%s' in a scalar context"),
+ fatal("attempt to use array `%s' in a scalar context",
tree->vname);
case Node_unary_minus:
@@ -813,20 +755,26 @@ r_tree_eval(register NODE *tree, int iscond)
return match_op(tree);
case Node_func:
- fatal(_("function `%s' called with space between name and `(',\n%s"),
+ fatal("function `%s' called with space between name and (,\n%s",
tree->lnode->param,
- _("or used in other expression context"));
+ "or used in other expression context");
/* assignments */
case Node_assign:
{
Func_ptr after_assign = NULL;
- if (do_lint && iscond)
- lintwarn(_("assignment used in conditional context"));
+ if (iscond && do_lint)
+ warning("assignment used in conditional context");
r = tree_eval(tree->rnode);
- lhs = get_lhs(tree->lnode, &after_assign, FALSE);
- assign_val(lhs, r);
+ lhs = get_lhs(tree->lnode, &after_assign);
+ if (r != *lhs) {
+ NODE *save;
+
+ save = *lhs;
+ *lhs = dupnode(r);
+ unref(save);
+ }
free_temp(r);
tree->lnode->flags |= SCALAR;
if (after_assign)
@@ -842,7 +790,6 @@ r_tree_eval(register NODE *tree, int iscond)
register NODE **treep;
register NODE **strp;
register size_t len;
- register size_t supposed_len;
char *str;
register char *dest;
int alloc_count, str_count;
@@ -865,8 +812,7 @@ r_tree_eval(register NODE *tree, int iscond)
* use as a sentinel. Thus, start alloc_count at 2.
*/
save_tree = tree;
- for (alloc_count = 2; tree != NULL && tree->type == Node_concat;
- tree = tree->lnode)
+ for (alloc_count = 2; tree && tree->type == Node_concat; tree = tree->lnode)
alloc_count++;
tree = save_tree;
emalloc(treelist, NODE **, sizeof(NODE *) * alloc_count, "tree_eval");
@@ -874,7 +820,7 @@ r_tree_eval(register NODE *tree, int iscond)
/* Now, here we go. */
treep = treelist;
- while (tree != NULL && tree->type == Node_concat) {
+ while (tree && tree->type == Node_concat) {
*treep++ = tree->rnode;
tree = tree->lnode;
}
@@ -888,21 +834,11 @@ r_tree_eval(register NODE *tree, int iscond)
* lengthes, in case one of the expressions has a
* side effect that changes one of the others.
* See test/nasty.awk.
- *
- * dupnode the results a la do_print, to give us
- * more predicable behavior; compare gawk 3.0.6 to
- * nawk/mawk on test/nasty.awk.
*/
strp = strlist;
- supposed_len = len = 0;
+ len = 0;
while (treep >= treelist) {
- NODE *n;
-
- /* Here lies the wumpus's brother. R.I.P. */
- n = force_string(tree_eval(*treep--));
- *strp = dupnode(n);
- free_temp(n);
- supposed_len += (*strp)->stlen;
+ *strp = force_string(tree_eval(*treep--));
strp++;
}
*strp = NULL;
@@ -913,16 +849,14 @@ r_tree_eval(register NODE *tree, int iscond)
len += (*strp)->stlen;
strp++;
}
- if (do_lint && supposed_len != len)
- lintwarn(_("concatenation: side effects in one expression have changed the length of another!"));
emalloc(str, char *, len+2, "tree_eval");
str[len] = str[len+1] = '\0'; /* for good measure */
dest = str;
strp = strlist;
- while (*strp != NULL) {
+ while (*strp) {
memcpy(dest, (*strp)->stptr, (*strp)->stlen);
dest += (*strp)->stlen;
- unref(*strp);
+ free_temp(*strp);
strp++;
}
r = make_str_node(str, len, ALREADY_MALLOCED);
@@ -1009,7 +943,7 @@ r_tree_eval(register NODE *tree, int iscond)
case Node_quotient:
if (x2 == 0)
- fatal(_("division by zero attempted"));
+ fatal("division by zero attempted");
#ifdef _CRAY
/* special case for integer division, put in for Cray */
lx2 = x2;
@@ -1024,7 +958,7 @@ r_tree_eval(register NODE *tree, int iscond)
case Node_mod:
if (x2 == 0)
- fatal(_("division by zero attempted in `%%'"));
+ fatal("division by zero attempted in mod");
#ifdef HAVE_FMOD
return tmp_number(fmod(x1, x2));
#else /* ! HAVE_FMOD */
@@ -1039,11 +973,11 @@ r_tree_eval(register NODE *tree, int iscond)
return tmp_number(x1 - x2);
case Node_var_array:
- fatal(_("attempt to use array `%s' in a scalar context"),
+ fatal("attempt to use array `%s' in a scalar context",
tree->vname);
default:
- fatal(_("illegal type (%s) in tree_eval"), nodetype2str(tree->type));
+ fatal("illegal type (%s) in tree_eval", nodetype2str(tree->type));
}
return 0;
}
@@ -1051,7 +985,8 @@ r_tree_eval(register NODE *tree, int iscond)
/* eval_condition --- is TREE true or false? Returns 0==false, non-zero==true */
static int
-eval_condition(register NODE *tree)
+eval_condition(tree)
+register NODE *tree;
{
register NODE *t1;
register int ret;
@@ -1103,7 +1038,8 @@ eval_condition(register NODE *tree)
/* cmp_nodes --- compare two nodes, returning negative, 0, positive */
int
-cmp_nodes(register NODE *t1, register NODE *t2)
+cmp_nodes(t1, t2)
+register NODE *t1, *t2;
{
register int ret;
register size_t len1, len2;
@@ -1147,7 +1083,8 @@ cmp_nodes(register NODE *t1, register NODE *t2)
/* op_assign --- do +=, -=, etc. */
static NODE *
-op_assign(register NODE *tree)
+op_assign(tree)
+register NODE *tree;
{
AWKNUM rval, lval;
NODE **lhs;
@@ -1165,7 +1102,7 @@ op_assign(register NODE *tree)
switch(tree->type) {
case Node_preincrement:
case Node_predecrement:
- lhs = get_lhs(tree->lnode, &after_assign, TRUE);
+ lhs = get_lhs(tree->lnode, &after_assign);
lval = force_number(*lhs);
unref(*lhs);
*lhs = make_number(lval +
@@ -1177,7 +1114,7 @@ op_assign(register NODE *tree)
case Node_postincrement:
case Node_postdecrement:
- lhs = get_lhs(tree->lnode, &after_assign, TRUE);
+ lhs = get_lhs(tree->lnode, &after_assign);
lval = force_number(*lhs);
unref(*lhs);
*lhs = make_number(lval +
@@ -1198,7 +1135,7 @@ op_assign(register NODE *tree)
rval = force_number(tmp);
free_temp(tmp);
- lhs = get_lhs(tree->lnode, &after_assign, FALSE);
+ lhs = get_lhs(tree->lnode, &after_assign);
lval = force_number(*lhs);
unref(*lhs);
@@ -1225,7 +1162,7 @@ op_assign(register NODE *tree)
case Node_assign_quotient:
if (rval == (AWKNUM) 0)
- fatal(_("division by zero attempted in `/='"));
+ fatal("division by zero attempted in /=");
#ifdef _CRAY
/* special case for integer division, put in for Cray */
ltemp = rval;
@@ -1243,7 +1180,7 @@ op_assign(register NODE *tree)
case Node_assign_mod:
if (rval == (AWKNUM) 0)
- fatal(_("division by zero attempted in `%%='"));
+ fatal("division by zero attempted in %%=");
#ifdef HAVE_FMOD
*lhs = make_number(fmod(lval, rval));
#else /* ! HAVE_FMOD */
@@ -1315,34 +1252,14 @@ pop_fcall()
if (arg->type == Node_param_list)
arg = stack_ptr[arg->param_cnt];
n = *sp++;
- if (n->type == Node_var_array || n->type == Node_array_ref) {
- NODETYPE old_type; /* for check, below */
-
- old_type = arg->type;
-
- /*
- * subtlety: if arg->type is Node_var but n->type
- * is Node_var_array, then the array routines noticed
- * that a variable name was really an array and
- * changed the type. But when v->name was pushed
- * on the stack, it came out of the varnames array,
- * and was not malloc'ed, so we shouldn't free it.
- * See the corresponding code in push_args().
- * Thanks to Juergen Kahrs for finding a test case
- * that shows this.
- */
- if (old_type == Node_var_array || old_type == Node_array_ref)
- free(n->vname);
-
- if (arg->type == Node_var) {
- /* type changed, copy array back for call by reference */
- /* 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;
- }
+ 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 && n->type != Node_array_ref)
@@ -1378,18 +1295,14 @@ pop_fcall_stack()
/* push_args --- push function arguments onto the stack */
static void
-push_args(int count,
- NODE *arglist,
- NODE **oldstack,
- char *func_name,
- char **varnames)
+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;
- int i;
- int num_args;
-
- num_args = count; /* save for later use */
if (fcall_list_size == 0) { /* first time */
emalloc(fcall_list, struct fcall *, 10 * sizeof(struct fcall),
@@ -1406,7 +1319,7 @@ push_args(int count,
memset(f, '\0', sizeof(struct fcall));
if (count > 0)
- emalloc(f->stack, NODE **, count*sizeof(NODE *), "push_args");
+ 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;
@@ -1415,12 +1328,11 @@ push_args(int count,
sp = f->stack;
/* for each calling arg. add NODE * on stack */
- for (argp = arglist, i = 0; count > 0 && argp != NULL; argp = argp->rnode) {
- static char from[] = N_("%s (from %s)");
+ for (argp = arglist; count > 0 && argp != NULL; argp = argp->rnode) {
arg = argp->lnode;
getnode(r);
r->type = Node_var;
- r->flags = 0;
+
/* call by reference for arrays; see below also */
if (arg->type == Node_param_list) {
/* we must also reassign f here; see below */
@@ -1428,43 +1340,26 @@ push_args(int count,
arg = f->prevstack[arg->param_cnt];
}
if (arg->type == Node_var_array) {
- char *p;
- size_t len;
-
r->type = Node_array_ref;
r->flags &= ~SCALAR;
r->orig_array = arg;
- len = strlen(varnames[i]) + strlen(arg->vname)
- + strlen(gettext(from)) - 4 + 1;
- emalloc(p, char *, len, "push_args");
- sprintf(p, _(from), varnames[i], arg->vname);
- r->vname = p;
+ r->vname = arg->vname;
} else if (arg->type == Node_array_ref) {
- char *p;
- size_t len;
-
- *r = *arg;
- len = strlen(varnames[i]) + strlen(arg->vname)
- + strlen(gettext(from)) - 4 + 1;
- emalloc(p, char *, len, "push_args");
- sprintf(p, _(from), varnames[i], arg->vname);
- r->vname = p;
+ *r = *arg;
} else {
n = tree_eval(arg);
r->lnode = dupnode(n);
r->rnode = (NODE *) NULL;
if ((n->flags & SCALAR) != 0)
r->flags |= SCALAR;
- r->vname = varnames[i];
free_temp(n);
}
*sp++ = r;
- i++;
count--;
}
if (argp != NULL) /* left over calling args. */
warning(
- _("function `%s' called with more arguments than declared"),
+ "function `%s' called with more arguments than declared",
func_name);
/* add remaining params. on stack with null value */
@@ -1474,9 +1369,6 @@ push_args(int count,
r->lnode = Nnull_string;
r->flags &= ~SCALAR;
r->rnode = (NODE *) NULL;
- r->vname = varnames[i++];
- r->flags = UNINITIALIZED;
- r->param_cnt = num_args - count;
*sp++ = r;
}
@@ -1497,8 +1389,9 @@ push_args(int count,
NODE **stack_ptr;
static NODE *
-func_call(NODE *name, /* name is a Node_val giving function name */
- NODE *arg_list) /* Node_expression_list of calling args. */
+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;
@@ -1511,12 +1404,11 @@ func_call(NODE *name, /* name is a Node_val giving function name */
/* retrieve function definition node */
f = lookup(name->stptr);
if (f == NULL || f->type != Node_func)
- fatal(_("function `%s' not defined"), name->stptr);
+ fatal("function `%s' not defined", name->stptr);
#ifdef FUNC_TRACE
- fprintf(stderr, _("function %s called\n"), name->stptr);
+ fprintf(stderr, "function %s called\n", name->stptr);
#endif
- push_args(f->lnode->param_cnt, arg_list, stack_ptr, name->stptr,
- f->parmlist);
+ push_args(f->lnode->param_cnt, arg_list, stack_ptr, name->stptr);
/*
* Execute function body, saving context, as a return statement
@@ -1539,7 +1431,6 @@ func_call(NODE *name, /* name is a Node_val giving function name */
PUSH_BINDING(func_tag_stack, func_tag, func_tag_valid);
save_ret_node = ret_node;
ret_node = Nnull_string; /* default return value */
- INCREMENT(f->exec_count); /* count function calls */
if (setjmp(func_tag) == 0)
(void) interpret(f->rnode);
@@ -1561,24 +1452,6 @@ func_call(NODE *name, /* name is a Node_val giving function name */
return r;
}
-#ifdef PROFILING
-/* dump_fcall_stack --- print a backtrace of the awk function calls */
-
-void
-dump_fcall_stack(FILE *fp)
-{
- int i;
-
- if (curfcall < 0)
- return;
-
- fprintf(fp, _("\n\t# Function Call Stack:\n\n"));
- for (i = curfcall; i >= 0; i--)
- fprintf(fp, "\t# %3d. %s\n", i+1, fcall_list[i].fname);
- fprintf(fp, _("\t# -- main --\n"));
-}
-#endif /* PROFILING */
-
/*
* r_get_lhs:
* This returns a POINTER to a node pointer. get_lhs(ptr) is the current
@@ -1591,7 +1464,9 @@ dump_fcall_stack(FILE *fp)
*/
NODE **
-r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
+r_get_lhs(ptr, assign)
+register NODE *ptr;
+Func_ptr *assign;
{
register NODE **aptr = NULL;
register NODE *n;
@@ -1600,25 +1475,19 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
*assign = NULL; /* for safety */
if (ptr->type == Node_param_list) {
if ((ptr->flags & FUNC) != 0)
- fatal(_("can't use function name `%s' as variable or array"), ptr->vname);
+ fatal("can't use function name `%s' as variable or array", ptr->vname);
ptr = stack_ptr[ptr->param_cnt];
}
switch (ptr->type) {
case Node_array_ref:
case Node_var_array:
- fatal(_("attempt to use array `%s' in a scalar context"),
+ fatal("attempt to use array `%s' in a scalar context",
ptr->vname);
case Node_var:
- if (! reference)
- ptr->flags &= ~UNINITIALIZED;
- else if (do_lint && (ptr->flags & UNINITIALIZED) != 0)
- lintwarn(_("reference to uninitialized variable `%s'"),
- ptr->vname);
-
aptr = &(ptr->var_value);
-#ifdef GAWKDEBUG
+#ifdef DEBUG
if (ptr->var_value->stref <= 0)
cant_happen();
#endif
@@ -1680,18 +1549,6 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
*assign = set_IGNORECASE;
break;
- case Node_BINMODE:
- aptr = &(BINMODE_node->var_value);
- if (assign != NULL)
- *assign = set_BINMODE;
- break;
-
- case Node_LINT:
- aptr = &(LINT_node->var_value);
- if (assign != NULL)
- *assign = set_LINT;
- break;
-
case Node_OFMT:
aptr = &(OFMT_node->var_value);
if (assign != NULL)
@@ -1716,32 +1573,8 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
*assign = set_OFS;
break;
- case Node_TEXTDOMAIN:
- aptr = &(TEXTDOMAIN_node->var_value);
- if (assign != NULL)
- *assign = set_TEXTDOMAIN;
- break;
-
case Node_param_list:
- {
- NODE *n = stack_ptr[ptr->param_cnt];
-
- /*
- * This test should always be true, due to the code
- * above, before the switch, that handles parameters.
- */
- if (n->type != Node_var_array)
- aptr = &n->var_value;
- else
- fatal(_("attempt to use array `%s' in a scalar context"),
- n->vname);
-
- if (! reference)
- n->flags &= ~UNINITIALIZED;
- else if (do_lint && (n->flags & UNINITIALIZED) != 0)
- lintwarn(_("reference to uninitialized argument `%s'"),
- n->vname);
- }
+ aptr = &(stack_ptr[ptr->param_cnt]->var_value);
break;
case Node_field_spec:
@@ -1749,17 +1582,10 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
int field_num;
n = tree_eval(ptr->lnode);
- if (do_lint) {
- if ((n->flags & NUMBER) == 0) {
- lintwarn(_("attempt to field reference from non-numeric value"));
- if (n->stlen == 0)
- lintwarn(_("attempt to reference from null string"));
- }
- }
field_num = (int) force_number(n);
free_temp(n);
if (field_num < 0)
- fatal(_("attempt to access field %d"), field_num);
+ fatal("attempt to access field %d", field_num);
if (field_num == 0 && field0_valid) { /* short circuit */
aptr = &fields_arr[0];
if (assign != NULL)
@@ -1769,45 +1595,32 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
aptr = get_field(field_num, assign);
break;
}
-
case Node_subscript:
n = ptr->lnode;
if (n->type == Node_param_list) {
+ int i = n->param_cnt + 1;
+
n = stack_ptr[n->param_cnt];
if ((n->flags & SCALAR) != 0)
- fatal(_("attempt to use scalar parameter `%s' as an array"), n->vname);
+ fatal("attempt to use scalar parameter %d as an array", i);
}
if (n->type == Node_array_ref) {
n = n->orig_array;
assert(n->type == Node_var_array || n->type == Node_var);
}
if (n->type == Node_func) {
- fatal(_("attempt to use function `%s' as array"),
+ fatal("attempt to use function `%s' as array",
n->lnode->param);
}
- aptr = assoc_lookup(n, concat_exp(ptr->rnode), reference);
+ aptr = assoc_lookup(n, concat_exp(ptr->rnode));
break;
case Node_func:
- fatal(_("`%s' is a function, assignment is not allowed"),
+ fatal("`%s' is a function, assignment is not allowed",
ptr->lnode->param);
case Node_builtin:
-#if 1
- /* in gawk for a while */
- fatal(_("assignment is not allowed to result of builtin function"));
-#else
- /*
- * This is how Christos at Deshaw did it.
- * Does this buy us anything?
- */
- if (ptr->proc == NULL)
- fatal(_("assignment is not allowed to result of builtin function"));
- ptr->callresult = (*ptr->proc)(ptr->subnode);
- aptr = &ptr->callresult;
- break;
-#endif
-
+ fatal("assignment is not allowed to result of builtin function");
default:
fprintf(stderr, "type = %s\n", nodetype2str(ptr->type));
fflush(stderr);
@@ -1819,7 +1632,8 @@ r_get_lhs(register NODE *ptr, Func_ptr *assign, int reference)
/* match_op --- do ~ and !~ */
static NODE *
-match_op(register NODE *tree)
+match_op(tree)
+register NODE *tree;
{
register NODE *t1;
register Regexp *rp;
@@ -1866,7 +1680,7 @@ set_IGNORECASE()
if ((do_lint || do_traditional) && ! warned) {
warned = TRUE;
- lintwarn(_("`IGNORECASE' is a gawk extension"));
+ warning("IGNORECASE not supported in compatibility mode");
}
if (do_traditional)
IGNORECASE = FALSE;
@@ -1882,59 +1696,6 @@ set_IGNORECASE()
set_FS_if_not_FIELDWIDTHS();
}
-/* set_BINMODE --- set translation mode (OS/2, DOS, others) */
-
-void
-set_BINMODE()
-{
- static int warned = FALSE;
- char *p, *cp, save;
- NODE *v;
- int digits = FALSE;
-
- if ((do_lint || do_traditional) && ! warned) {
- warned = TRUE;
- lintwarn(_("`BINMODE' is a gawk extension"));
- }
- if (do_traditional)
- BINMODE = 0;
- else if ((BINMODE_node->var_value->flags & STRING) != 0) {
- v = BINMODE_node->var_value;
- p = v->stptr;
- save = p[v->stlen];
- p[v->stlen] = '\0';
-
- for (cp = p; *cp != '\0'; cp++) {
- if (ISDIGIT(*cp)) {
- digits = TRUE;
- break;
- }
- }
-
- if (! digits || (BINMODE_node->var_value->flags & MAYBE_NUM) == 0) {
- BINMODE = 0;
- if (strcmp(p, "r") == 0)
- BINMODE = 1;
- else if (strcmp(p, "w") == 0)
- BINMODE = 2;
- else if (strcmp(p, "rw") == 0 || strcmp(p, "wr") == 0)
- BINMODE = 3;
-
- if (BINMODE == 0 && v->stlen != 0) {
- /* arbitrary string, assume both */
- BINMODE = 3;
- warning("BINMODE: arbitary string value treated as \"rw\"");
- }
- } else
- BINMODE = (int) force_number(BINMODE_node->var_value);
-
- p[v->stlen] = save;
- } else if ((BINMODE_node->var_value->flags & NUMBER) != 0)
- BINMODE = (int) force_number(BINMODE_node->var_value);
- else
- BINMODE = 0; /* shouldn't happen */
-}
-
/* set_OFS --- update OFS related variables when OFS assigned to */
void
@@ -1962,7 +1723,8 @@ static int fmt_ok P((NODE *n));
static int fmt_index P((NODE *n));
static int
-fmt_ok(NODE *n)
+fmt_ok(n)
+NODE *n;
{
NODE *tmp = force_string(n);
char *p = tmp->stptr;
@@ -1971,13 +1733,13 @@ fmt_ok(NODE *n)
return 0;
while (*p && strchr(" +-#", *p) != NULL) /* flags */
p++;
- while (*p && ISDIGIT(*p)) /* width - %*.*g is NOT allowed */
+ while (*p && isdigit(*p)) /* width - %*.*g is NOT allowed */
p++;
- if (*p == '\0' || (*p != '.' && ! ISDIGIT(*p)))
+ if (*p == '\0' || (*p != '.' && ! isdigit(*p)))
return 0;
if (*p == '.')
p++;
- while (*p && ISDIGIT(*p)) /* precision */
+ while (*p && isdigit(*p)) /* precision */
p++;
if (*p == '\0' || strchr("efgEG", *p) == NULL)
return 0;
@@ -1989,7 +1751,8 @@ fmt_ok(NODE *n)
/* fmt_index --- track values of OFMT and CONVFMT to keep semantics correct */
static int
-fmt_index(NODE *n)
+fmt_index(n)
+NODE *n;
{
register int ix = 0;
static int fmt_num = 4;
@@ -2006,10 +1769,10 @@ fmt_index(NODE *n)
/* not found */
n->stptr[n->stlen] = '\0';
if (do_lint && ! fmt_ok(n))
- lintwarn(_("bad `%sFMT' specification `%s'"),
+ warning("bad %sFMT specification",
n == CONVFMT_node->var_value ? "CONV"
: n == OFMT_node->var_value ? "O"
- : "", n->stptr);
+ : "");
if (fmt_hiwater >= fmt_num) {
fmt_num *= 2;
@@ -2036,117 +1799,3 @@ set_CONVFMT()
CONVFMTidx = fmt_index(CONVFMT_node->var_value);
CONVFMT = fmt_list[CONVFMTidx]->stptr;
}
-
-/* set_LINT --- update LINT as appropriate */
-
-void
-set_LINT()
-{
- int old_lint = do_lint;
-
- if ((LINT_node->var_value->flags & (STRING|STR)) != 0) {
- if ((LINT_node->var_value->flags & MAYBE_NUM) == 0) {
- char *lintval;
- size_t lintlen;
-
- do_lint = (force_string(LINT_node->var_value)->stlen > 0);
- lintval = LINT_node->var_value->stptr;
- lintlen = LINT_node->var_value->stlen;
- if (do_lint) {
- if (lintlen == 5 && strncmp(lintval, "fatal", 5) == 0)
- lintfunc = r_fatal;
- else
- lintfunc = warning;
- } else
- lintfunc = warning;
- } else
- do_lint = (force_number(LINT_node->var_value) != 0.0);
- } else if ((LINT_node->var_value->flags & (NUM|NUMBER)) != 0) {
- do_lint = (force_number(LINT_node->var_value) != 0.0);
- lintfunc = warning;
- } else
- do_lint = FALSE; /* shouldn't happen */
-
- if (! do_lint)
- lintfunc = warning;
-
- /* explicitly use warning() here, in case lintfunc == r_fatal */
- if (old_lint != do_lint && old_lint)
- warning(_("turning off `--lint' due to assignment to `LINT'"));
-}
-
-/* set_TEXTDOMAIN --- update TEXTDOMAIN variable when TEXTDOMAIN assigned to */
-
-void
-set_TEXTDOMAIN()
-{
- int len;
-
- TEXTDOMAIN = force_string(TEXTDOMAIN_node->var_value)->stptr;
- len = TEXTDOMAIN_node->var_value->stlen;
- TEXTDOMAIN[len] = '\0';
- /*
- * Note: don't call textdomain(); this value is for
- * the awk program, not for gawk itself.
- */
-}
-
-/*
- * assign_val --- do mechanics of assignment, for calling from multiple
- * places.
- */
-
-NODE *
-assign_val(NODE **lhs_p, NODE *rhs)
-{
- NODE *save;
-
- if (rhs != *lhs_p) {
- save = *lhs_p;
- *lhs_p = dupnode(rhs);
- unref(save);
- }
- return *lhs_p;
-}
-
-/* update_ERRNO --- update the value of ERRNO */
-
-void
-update_ERRNO()
-{
- char *cp;
-
- cp = strerror(errno);
- cp = gettext(cp);
- unref(ERRNO_node->var_value);
- ERRNO_node->var_value = make_string(cp, strlen(cp));
-}
-
-/* comp_func --- array index comparison function for qsort */
-
-static int
-comp_func(const void *p1, const void *p2)
-{
- size_t len1, len2;
- char *str1, *str2;
- NODE *t1, *t2;
-
- t1 = *((NODE **) p1);
- t2 = *((NODE **) p2);
-
-/*
- t1 = force_string(t1);
- t2 = force_string(t2);
-*/
- len1 = t1->stlen;
- str1 = t1->stptr;
-
- len2 = t2->stlen;
- str2 = t2->stptr;
-
- /* Array indexes are strings, compare as such, always! */
- if (len1 == len2 || len1 < len2)
- return strncmp(str1, str2, len1);
- else
- return strncmp(str1, str2, len2);
-}
diff --git a/contrib/awk/field.c b/contrib/awk/field.c
index 7ce6fd0..097196e 100644
--- a/contrib/awk/field.c
+++ b/contrib/awk/field.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,6 +21,8 @@
* 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
+ *
+ * $FreeBSD$
*/
#include "awk.h"
@@ -45,7 +47,6 @@ static long fw_parse_field P((long, char **, int, NODE *,
static void set_element P((long num, char * str, long len, NODE *arr));
static void grow_fields_arr P((long num));
static void set_field P((long num, char *str, long len, NODE *dummy));
-static void update_PROCINFO P((char *subscript, char *str));
static char *parse_extent; /* marks where to restart parse of record */
@@ -91,7 +92,8 @@ init_fields()
/* grow_fields --- acquire new fields as needed */
static void
-grow_fields_arr(long num)
+grow_fields_arr(num)
+long num;
{
register int t;
register NODE *n;
@@ -109,10 +111,11 @@ grow_fields_arr(long num)
/*ARGSUSED*/
static void
-set_field(long num,
- char *str,
- long len,
- NODE *dummy) /* not used -- just to make interface same as set_element */
+set_field(num, str, len, dummy)
+long num;
+char *str;
+long len;
+NODE *dummy; /* not used -- just to make interface same as set_element */
{
register NODE *n;
@@ -182,13 +185,12 @@ rebuild_record()
/*
* Since we are about to unref fields_arr[0], we want to find
* any fields that still point into it, and have them point
- * into the new field zero. This has to be done intelligently,
- * so that unrefing a field doesn't try to unref into the old $0.
+ * into the new field zero.
*/
for (cops = ops, i = 1; i <= NF; i++) {
if (fields_arr[i]->stlen > 0) {
- NODE *n;
- getnode(n);
+ NODE *n;
+ getnode(n);
if ((fields_arr[i]->flags & FIELD) == 0) {
*n = *Null_field;
@@ -226,9 +228,10 @@ rebuild_record()
* but better correct than fast.
*/
void
-set_record(char *buf, /* ignored if ! freeold */
- int cnt, /* ignored if ! freeold */
- int freeold)
+set_record(buf, cnt, freeold)
+char *buf; /* ignored if ! freeold */
+int cnt; /* ignored if ! freeold */
+int freeold;
{
register int i;
NODE *n;
@@ -260,8 +263,6 @@ set_record(char *buf, /* ignored if ! freeold */
if (databuf_size == 0) { /* first time */
emalloc(databuf, char *, INITIAL_SIZE, "set_record");
databuf_size = INITIAL_SIZE;
- memset(databuf, '\0', INITIAL_SIZE);
-
}
/*
* Make sure there's enough room. Since we sometimes need
@@ -272,7 +273,6 @@ set_record(char *buf, /* ignored if ! freeold */
while (cnt >= databuf_size && databuf_size <= MAX_SIZE)
databuf_size *= 2;
erealloc(databuf, char *, databuf_size, "set_record");
- memset(databuf, '\0', databuf_size);
}
/* copy the data */
memcpy(databuf, buf, cnt);
@@ -344,13 +344,14 @@ set_NF()
* expression -- either user-defined or because RS=="" and FS==" "
*/
static long
-re_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+re_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register long nf = parse_high_water;
@@ -402,13 +403,14 @@ re_parse_field(long up_to, /* parse only up to this field number */
*/
static long
-def_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+def_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register long nf = parse_high_water;
@@ -469,13 +471,14 @@ def_parse_field(long up_to, /* parse only up to this field number */
*/
static long
-posix_def_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+posix_def_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register long nf = parse_high_water;
@@ -533,13 +536,14 @@ posix_def_parse_field(long up_to, /* parse only up to this field number */
* via (*parse_field)(). This variation is for when FS is the null string.
*/
static long
-null_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+null_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register long nf = parse_high_water;
@@ -565,13 +569,14 @@ null_parse_field(long up_to, /* parse only up to this field number */
* other than space.
*/
static long
-sc_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+sc_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register char fschar;
@@ -591,9 +596,9 @@ sc_parse_field(long up_to, /* parse only up to this field number */
else
fschar = fs->stptr[0];
- onecase = (IGNORECASE && ISALPHA(fschar));
+ onecase = (IGNORECASE && isalpha(fschar));
if (onecase)
- fschar = casetable[(unsigned char) fschar];
+ fschar = casetable[(int) fschar];
/* before doing anything save the char at *end */
sav = *end;
@@ -603,7 +608,7 @@ sc_parse_field(long up_to, /* parse only up to this field number */
for (; nf < up_to;) {
field = scan;
if (onecase) {
- while (casetable[(unsigned char) *scan] != fschar)
+ while (casetable[(int) *scan] != fschar)
scan++;
} else {
while (*scan != fschar)
@@ -633,13 +638,14 @@ sc_parse_field(long up_to, /* parse only up to this field number */
* via (*parse_field)(). This variation is for fields are fixed widths.
*/
static long
-fw_parse_field(long up_to, /* parse only up to this field number */
- char **buf, /* on input: string to parse; on output: point to start next */
- int len,
- NODE *fs,
- Regexp *rp,
- Setfunc set, /* routine to set the value of the parsed field */
- NODE *n)
+fw_parse_field(up_to, buf, len, fs, rp, set, n)
+long up_to; /* parse only up to this field number */
+char **buf; /* on input: string to parse; on output: point to start next */
+int len;
+NODE *fs;
+Regexp *rp;
+Setfunc set; /* routine to set the value of the parsed field */
+NODE *n;
{
register char *scan = *buf;
register long nf = parse_high_water;
@@ -664,10 +670,10 @@ fw_parse_field(long up_to, /* parse only up to this field number */
/* get_field --- return a particular $n */
-/* assign is not NULL if this field is on the LHS of an assign */
-
NODE **
-get_field(register long requested, Func_ptr *assign)
+get_field(requested, assign)
+register long requested;
+Func_ptr *assign; /* this field is on the LHS of an assign */
{
/*
* if requesting whole line but some other field has been altered,
@@ -740,19 +746,24 @@ get_field(register long requested, Func_ptr *assign)
/* set_element --- set an array element, used by do_split() */
static void
-set_element(long num, char *s, long len, NODE *n)
+set_element(num, s, len, n)
+long num;
+char *s;
+long len;
+NODE *n;
{
register NODE *it;
it = make_string(s, len);
it->flags |= MAYBE_NUM;
- *assoc_lookup(n, tmp_number((AWKNUM) (num)), FALSE) = it;
+ *assoc_lookup(n, tmp_number((AWKNUM) (num))) = it;
}
/* do_split --- implement split(), semantics are same as for field splitting */
NODE *
-do_split(NODE *tree)
+do_split(tree)
+NODE *tree;
{
NODE *src, *arr, *sep, *tmp;
NODE *fs;
@@ -784,36 +795,19 @@ do_split(NODE *tree)
if (arr->type == Node_array_ref)
arr = arr->orig_array;
if (arr->type != Node_var && arr->type != Node_var_array)
- fatal(_("split: second argument is not an array"));
+ fatal("second argument of split is not an array");
arr->type = Node_var_array;
assoc_clear(arr);
- if (src->stlen == 0) {
- /*
- * Skip the work if first arg is the null string.
- * Check after clearing the array, to preserve
- * correct semantics.
- */
- tmp = tmp_number((AWKNUM) 0);
- goto out;
- }
-
if ((sep->re_flags & FS_DFLT) != 0 && ! using_FIELDWIDTHS()) {
parseit = parse_field;
fs = force_string(FS_node->var_value);
rp = FS_regexp;
} else {
tmp = force_string(tree_eval(sep->re_exp));
- if (tmp->stlen == 0) {
- static short warned = FALSE;
-
+ if (tmp->stlen == 0)
parseit = null_parse_field;
-
- if (do_lint && ! warned) {
- warned = TRUE;
- lintwarn(_("split: null string for third arg is a gawk extension"));
- }
- } else if (tmp->stlen == 1 && (sep->re_flags & CONST) == 0) {
+ else if (tmp->stlen == 1 && (sep->re_flags & CONST) == 0) {
if (tmp->stptr[0] == ' ') {
if (do_posix)
parseit = posix_def_parse_field;
@@ -831,7 +825,6 @@ do_split(NODE *tree)
s = src->stptr;
tmp = tmp_number((AWKNUM) (*parseit)(HUGE, &s, (int) src->stlen,
fs, rp, set_element, arr));
-out:
unref(src);
free_temp(sep);
return tmp;
@@ -851,7 +844,7 @@ set_FIELDWIDTHS()
if (do_lint && ! warned) {
warned = TRUE;
- lintwarn(_("`FIELDWIDTHS' is a gawk extension"));
+ warning("use of FIELDWIDTHS is a gawk extension");
}
if (do_traditional) /* quick and dirty, does the trick */
return;
@@ -877,13 +870,9 @@ set_FIELDWIDTHS()
FIELDWIDTHS[i] = (int) strtod(scan, &end);
if (end == scan)
break;
- if (FIELDWIDTHS[i] <= 0)
- fatal(_("field %d in FIELDWIDTHS, must be > 0"), i);
scan = end;
}
FIELDWIDTHS[i] = -1;
-
- update_PROCINFO("FS", "FIELDWIDTHS");
}
void
@@ -925,16 +914,9 @@ set_FS()
buf[0] = '\0';
default_FS = FALSE;
fs = force_string(FS_node->var_value);
- if (! do_traditional && fs->stlen == 0) {
- static short warned = FALSE;
-
+ if (! do_traditional && fs->stlen == 0)
parse_field = null_parse_field;
-
- if (do_lint && ! warned) {
- warned = TRUE;
- lintwarn(_("null string for `FS' is a gawk extension"));
- }
- } else if (fs->stlen > 1)
+ else if (fs->stlen > 1)
parse_field = re_parse_field;
else if (RS_is_null) {
parse_field = sc_parse_field;
@@ -953,7 +935,7 @@ set_FS()
if (fs->stptr[0] == ' ' && fs->stlen == 1)
default_FS = TRUE;
else if (fs->stptr[0] != ' ' && fs->stlen == 1) {
- if (! ISALPHA(fs->stptr[0]) || ! IGNORECASE)
+ if (! IGNORECASE || ! isalpha(fs->stptr[0]))
parse_field = sc_parse_field;
else if (fs->stptr[0] == '\\')
/* yet another special case */
@@ -969,8 +951,6 @@ set_FS()
FS_regexp = make_regexp(fs->stptr, fs->stlen, IGNORECASE, TRUE);
} else
FS_regexp = NULL;
-
- update_PROCINFO("FS", "FS");
}
/* using_fieldwidths --- is FS or FIELDWIDTHS in use? */
@@ -980,17 +960,3 @@ using_fieldwidths()
{
return using_FIELDWIDTHS();
}
-
-/* update_PROCINFO --- update PROCINFO[sub] when FS or FIELDWIDTHS set */
-
-static void
-update_PROCINFO(char *subscript, char *str)
-{
- NODE **aptr;
-
- if (PROCINFO_node == NULL)
- return;
-
- aptr = assoc_lookup(PROCINFO_node, tmp_string(subscript, strlen(subscript)), FALSE);
- assign_val(aptr, tmp_string(str, strlen(str)));
-}
diff --git a/contrib/awk/io.c b/contrib/awk/io.c
index 7589185..a83fc9d 100644
--- a/contrib/awk/io.c
+++ b/contrib/awk/io.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1976, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1976, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,9 +21,12 @@
* 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
+ *
+ * $FreeBSD$
*/
#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 */
@@ -34,6 +37,13 @@
#include <sys/wait.h>
#endif /* HAVE_SYS_WAIT_H */
+#ifdef HAVE_MMAP
+#include <sys/mman.h>
+#ifndef MAP_FAILED
+#define MAP_FAILED ((caddr_t) -1)
+#endif /* ! defined (MAP_FAILED) */
+#endif /* HAVE_MMAP */
+
#ifndef O_RDONLY
#include <fcntl.h>
#endif
@@ -41,65 +51,32 @@
#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#endif
-#ifdef HAVE_SOCKETS
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#else
-#include <socket.h>
-#endif /* HAVE_SYS_SOCKET_H */
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#else
-#include <in.h>
-#endif /* HAVE_NETINET_IN_H */
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif /* HAVE_NETDB_H */
-#endif /* HAVE_SOCKETS */
-
#if ! defined(S_ISREG) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
-#ifndef ENFILE
-#define ENFILE EMFILE
-#endif
-
-extern int MRL;
-
-#ifdef HAVE_SOCKETS
-enum inet_prot { INET_NONE, INET_TCP, INET_UDP, INET_RAW };
-
-#ifndef SHUT_RD
-#define SHUT_RD 0
+#if ! defined(S_ISDIR) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
-#ifndef SHUT_WR
-#define SHUT_WR 1
-#endif
-
-#ifndef SHUT_RDWR
-#define SHUT_RDWR 2
+#ifndef ENFILE
+#define ENFILE EMFILE
#endif
-#endif /* HAVE_SOCKETS */
-
#ifdef atarist
#include <stddef.h>
#endif
-#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(TANDEM)
+#if defined(MSDOS) || defined(OS2) || defined(WIN32)
#define PIPES_SIMULATED
#endif
-typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type;
-
static IOBUF *nextfile P((int skipping));
static int inrec P((IOBUF *iop));
static int iop_close P((IOBUF *iop));
struct redirect *redirect P((NODE *tree, int *errflg));
static void close_one P((void));
-static int close_redir P((struct redirect *rp, int exitwarn, two_way_close_type how));
+static int close_redir P((struct redirect *rp, int exitwarn));
#ifndef PIPES_SIMULATED
static int wait_any P((int interesting));
#endif
@@ -109,14 +86,16 @@ 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));
+#ifdef HAVE_MMAP
+static int mmap_get_record P((char **out, IOBUF *iop, int rs, Regexp *RSre, int *errcode));
+#endif /* HAVE_MMAP */
static int str2mode P((const char *mode));
static void spec_setup P((IOBUF *iop, int len, int allocate));
static int specfdopen P((IOBUF *iop, const char *name, const char *mode));
static int pidopen P((IOBUF *iop, const char *name, const char *mode));
static int useropen P((IOBUF *iop, const char *name, const char *mode));
-static int two_way_open P((char *str, struct redirect *rp));
-#if defined(HAVE_POPEN_H)
+#if defined (HAVE_POPEN_H)
#include "popen.h"
#endif
@@ -135,27 +114,6 @@ extern NODE **fields_arr;
static jmp_buf filebuf; /* for do_nextfile() */
-#if defined(MSDOS) || defined(OS2)
-static const char *
-binmode(char *mode)
-{
- switch (mode[0]) {
- case 'r':
- if ((BINMODE & 1) != 0)
- mode = "rb";
- break;
- case 'w':
- case 'a':
- if ((BINMODE & 2) != 0)
- mode = (mode[0] == 'w' ? "wb" : "ab");
- break;
- }
- return mode;
-}
-#else
-#define binmode(mode) (mode)
-#endif
-
#ifdef VMS
/* File pointers have an extra level of indirection, and there are cases where
`stdin' can be null. That can crash gawk if fileno() is used as-is. */
@@ -177,7 +135,8 @@ do_nextfile()
/* nextfile --- move to the next input data file */
static IOBUF *
-nextfile(int skipping)
+nextfile(skipping)
+int skipping;
{
static long i = 1;
static int files = 0;
@@ -200,7 +159,7 @@ nextfile(int skipping)
return curfile;
}
for (; i < (long) (ARGC_node->lnode->numbr); i++) {
- arg = *assoc_lookup(ARGV_node, tmp_number((AWKNUM) i), FALSE);
+ arg = *assoc_lookup(ARGV_node, tmp_number((AWKNUM) i));
if (arg->stlen == 0)
continue;
arg->stptr[arg->stlen] = '\0';
@@ -211,7 +170,7 @@ nextfile(int skipping)
if (! arg_assign(arg->stptr)) {
files++;
fname = arg->stptr;
- curfile = iop_open(fname, binmode("r"), &mybuf);
+ curfile = iop_open(fname, "r", &mybuf);
if (curfile == NULL)
goto give_up;
curfile->flag |= IOP_NOFREE_OBJ;
@@ -229,7 +188,7 @@ nextfile(int skipping)
/* FNR is init'ed to 0 */
FILENAME_node->var_value = make_string("-", 1);
fname = "-";
- curfile = iop_open(fname, binmode("r"), &mybuf);
+ curfile = iop_open(fname, "r", &mybuf);
if (curfile == NULL)
goto give_up;
curfile->flag |= IOP_NOFREE_OBJ;
@@ -237,7 +196,7 @@ nextfile(int skipping)
return curfile;
give_up:
- fatal(_("cannot open file `%s' for reading (%s)"),
+ fatal("cannot open file `%s' for reading (%s)",
fname, strerror(errno));
/* NOTREACHED */
return 0;
@@ -262,14 +221,16 @@ set_NR()
/* inrec --- This reads in a record from the input file */
static int
-inrec(IOBUF *iop)
+inrec(iop)
+IOBUF *iop;
{
char *begin;
register int cnt;
int retval = 0;
if ((cnt = iop->cnt) != EOF)
- cnt = get_a_record(&begin, iop, RS->stptr[0], RS_regexp, NULL);
+ cnt = (*(iop->getrec))
+ (&begin, iop, RS->stptr[0], RS_regexp, NULL);
if (cnt == EOF) {
cnt = 0;
retval = 1;
@@ -285,7 +246,8 @@ inrec(IOBUF *iop)
/* iop_close --- close an open IOP */
static int
-iop_close(IOBUF *iop)
+iop_close(iop)
+IOBUF *iop;
{
int ret;
@@ -311,13 +273,14 @@ iop_close(IOBUF *iop)
/* 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->fd == fileno(stderr)
+ || (iop->flag & IOP_MMAPPED) != 0)
ret = 0;
else
ret = close(iop->fd);
if (ret == -1)
- warning(_("close of fd %d (`%s') failed (%s)"), iop->fd,
+ warning("close of fd %d (`%s') failed (%s)", iop->fd,
iop->name, strerror(errno));
if ((iop->flag & IOP_NO_FREE) == 0) {
/*
@@ -336,7 +299,12 @@ iop_close(IOBUF *iop)
fields_arr[0] = t;
reset_record();
}
- free(iop->buf);
+ if ((iop->flag & IOP_MMAPPED) == 0)
+ free(iop->buf);
+#ifdef HAVE_MMAP
+ else
+ (void) munmap(iop->buf, iop->size);
+#endif
}
if ((iop->flag & IOP_NOFREE_OBJ) == 0)
free((char *) iop);
@@ -358,37 +326,21 @@ do_input()
if (inrec(iop) == 0)
while (interpret(expression_value) && inrec(iop) == 0)
continue;
+#ifdef C_ALLOCA
+ /* recover any space from C based alloca */
+ (void) alloca(0);
+#endif
if (exiting)
break;
}
}
-/* redflags2str --- turn redirection flags into a string, for debugging */
-
-char *
-redflags2str(int flags)
-{
- static struct flagtab redtab[] = {
- { RED_FILE, "RED_FILE" },
- { RED_PIPE, "RED_PIPE" },
- { RED_READ, "RED_READ" },
- { RED_WRITE, "RED_WRITE" },
- { RED_APPEND, "RED_APPEND" },
- { RED_NOBUF, "RED_NOBUF" },
- { RED_EOF, "RED_EOF" },
- { RED_TWOWAY, "RED_TWOWAY" },
- { RED_SOCKET, "RED_SOCKET" },
- { RED_TCP, "RED_TCP" },
- { 0, NULL }
- };
-
- return genflags2str(flags, redtab);
-}
-
/* redirect --- Redirection for printf and print commands */
struct redirect *
-redirect(NODE *tree, int *errflg)
+redirect(tree, errflg)
+NODE *tree;
+int *errflg;
{
register NODE *tmp;
register struct redirect *rp;
@@ -424,57 +376,31 @@ redirect(NODE *tree, int *errflg)
tflag = (RED_FILE|RED_READ);
what = "<";
break;
- case Node_redirect_twoway:
- tflag = (RED_READ|RED_WRITE|RED_TWOWAY);
- what = "|&";
- break;
default:
- fatal(_("invalid tree type %s in redirect()"),
- nodetype2str(tree->type));
+ fatal("invalid tree type %d in redirect()", tree->type);
break;
}
tmp = tree_eval(tree->subnode);
if (do_lint && (tmp->flags & STR) == 0)
- lintwarn(_("expression in `%s' redirection only has numeric value"),
+ warning("expression in `%s' redirection only has numeric value",
what);
tmp = force_string(tmp);
str = tmp->stptr;
if (str == NULL || *str == '\0')
- fatal(_("expression for `%s' redirection has null string value"),
+ fatal("expression for `%s' redirection has null string value",
what);
if (do_lint
&& (STREQN(str, "0", tmp->stlen) || STREQN(str, "1", tmp->stlen)))
- lintwarn(_("filename `%s' for `%s' redirection may be result of logical expression"), str, what);
-
-#ifdef HAVE_SOCKETS
- if (STREQN(str, "/inet/", 6)) {
- tflag |= RED_SOCKET;
- if (STREQN(str + 6, "tcp/", 4))
- tflag |= RED_TCP; /* use shutdown when closing */
- }
-#endif /* HAVE_SOCKETS */
-
- for (rp = red_head; rp != NULL; rp = rp->next) {
+ warning("filename `%s' for `%s' redirection may be result of logical expression", str, what);
+ for (rp = red_head; rp != NULL; rp = rp->next)
if (strlen(rp->value) == tmp->stlen
&& STREQN(rp->value, str, tmp->stlen)
&& ((rp->flag & ~(RED_NOBUF|RED_EOF)) == tflag
|| (outflag != 0
- && (rp->flag & (RED_FILE|RED_WRITE)) == outflag))) {
-
- int rpflag = (rp->flag & ~(RED_NOBUF|RED_EOF));
- int newflag = (tflag & ~(RED_NOBUF|RED_EOF));
-
- if (do_lint && rpflag != newflag)
- lintwarn(
- _("unnecessary mixing of `>' and `>>' for file `%.*s'"),
- tmp->stlen, rp->value);
-
+ && (rp->flag & (RED_FILE|RED_WRITE)) == outflag)))
break;
- }
- }
-
if (rp == NULL) {
emalloc(rp, struct redirect *, sizeof(struct redirect),
"redirect");
@@ -495,7 +421,6 @@ redirect(NODE *tree, int *errflg)
red_head = rp;
} else
str = rp->value; /* get \0 terminated string */
-
while (rp->fp == NULL && rp->iop == NULL) {
if (rp->flag & RED_EOF)
/*
@@ -507,48 +432,31 @@ redirect(NODE *tree, int *errflg)
errno = 0;
switch (tree->type) {
case Node_redirect_output:
- mode = binmode("w");
+ mode = "w";
if ((rp->flag & RED_USED) != 0)
- mode = (rp->mode[1] == 'b') ? "ab" : "a";
+ mode = "a";
break;
case Node_redirect_append:
- mode = binmode("a");
+ mode = "a";
break;
case Node_redirect_pipe:
/* synchronize output before new pipe */
(void) flush_io();
- os_restore_mode(fileno(stdin));
- if ((rp->fp = popen(str, binmode("w"))) == NULL)
- fatal(_("can't open pipe `%s' for output (%s)"),
+ if ((rp->fp = popen(str, "w")) == NULL)
+ fatal("can't open pipe (\"%s\") for output (%s)",
str, strerror(errno));
- /* set close-on-exec */
- os_close_on_exec(fileno(rp->fp), str, "pipe", "to");
rp->flag |= RED_NOBUF;
break;
case Node_redirect_pipein:
direction = "from";
if (gawk_popen(str, rp) == NULL)
- fatal(_("can't open pipe `%s' for input (%s)"),
+ fatal("can't open pipe (\"%s\") for input (%s)",
str, strerror(errno));
break;
case Node_redirect_input:
direction = "from";
- rp->iop = iop_open(str, binmode("r"), NULL);
- break;
- case Node_redirect_twoway:
- direction = "to/from";
- if (!two_way_open(str, rp)) {
-#ifdef HAVE_SOCKETS
- /* multiple messages make life easier for translators */
- if (STREQN(str, "/inet/", 6))
- fatal(_("can't open two way socket `%s' for input/output (%s)"),
- str, strerror(errno));
- else
-#endif
- fatal(_("can't open two way pipe `%s' for input/output (%s)"),
- str, strerror(errno));
- }
+ rp->iop = iop_open(str, "r", NULL);
break;
default:
cant_happen();
@@ -564,16 +472,7 @@ redirect(NODE *tree, int *errflg)
else if (fd == fileno(stderr))
rp->fp = stderr;
else {
-#if defined(F_GETFL) && defined(O_APPEND)
- int fd_flags;
-
- fd_flags = fcntl(fd, F_GETFL);
- if (fd_flags != -1 && (fd_flags & O_APPEND) == O_APPEND)
- rp->fp = fdopen(fd, binmode("a"));
- else
-#endif
- rp->fp = fdopen(fd, (char *) mode);
- rp->mode = (char *) mode;
+ rp->fp = fdopen(fd, (char *) mode);
/* don't leak file descriptors */
if (rp->fp == NULL)
close(fd);
@@ -595,7 +494,9 @@ redirect(NODE *tree, int *errflg)
/* too many files open -- close one and try again */
if (errno == EMFILE || errno == ENFILE)
close_one();
-#if defined __MINGW32__ || defined solaris
+#if defined __MINGW32__ || defined HAVE_MMAP
+ /* this works for solaris 2.5, not sunos */
+ /* it is also needed for MINGW32 */
else if (errno == 0) /* HACK! */
close_one();
#endif
@@ -619,15 +520,10 @@ redirect(NODE *tree, int *errflg)
if (errflg != NULL)
*errflg = errno;
if (tree->type == Node_redirect_output
- || tree->type == Node_redirect_append) {
- /* multiple messages make life easier for translators */
- if (*direction == 'f')
- fatal(_("can't redirect from `%s' (%s)"),
- str, strerror(errno));
- else
- fatal(_("can't redirect to `%s' (%s)"),
- str, strerror(errno));
- } else {
+ || tree->type == Node_redirect_append)
+ fatal("can't redirect %s `%s' (%s)",
+ direction, str, strerror(errno));
+ else {
free_temp(tmp);
return NULL;
}
@@ -641,7 +537,9 @@ redirect(NODE *tree, int *errflg)
/* getredirect --- find the struct redirect for this file or pipe */
struct redirect *
-getredirect(char *str, int len)
+getredirect(str, len)
+char *str;
+int len;
{
struct redirect *rp;
@@ -660,13 +558,6 @@ close_one()
register struct redirect *rp;
register struct redirect *rplast = NULL;
- static short warned = FALSE;
-
- if (do_lint && ! warned) {
- warned = TRUE;
- lintwarn(_("reached system limit for open files: starting to multiplex file descriptors"));
- }
-
/* go to end of list first, to pick up least recently used entry */
for (rp = red_head; rp != NULL; rp = rp->next)
rplast = rp;
@@ -676,39 +567,26 @@ close_one()
rp->flag |= RED_USED;
errno = 0;
if (/* do_lint && */ fclose(rp->fp) != 0)
- warning(_("close of `%s' failed (%s)."),
+ warning("close of \"%s\" failed (%s).",
rp->value, strerror(errno));
rp->fp = NULL;
break;
}
if (rp == NULL)
/* surely this is the only reason ??? */
- fatal(_("too many pipes or input files open"));
+ fatal("too many pipes or input files open");
}
/* do_close --- completely close an open file or pipe */
NODE *
-do_close(NODE *tree)
+do_close(tree)
+NODE *tree;
{
- NODE *tmp, *tmp2;
+ NODE *tmp;
register struct redirect *rp;
- two_way_close_type how = CLOSE_ALL; /* default */
-
- tmp = force_string(tree_eval(tree->lnode)); /* 1st arg: redir to close */
-
- if (tree->rnode != NULL) {
- /* 2nd arg if present: "to" or "from" for two-way pipe */
- /* DO NOT use _() on the strings here! */
- tmp2 = force_string(tree->rnode->lnode);
- if (strcasecmp(tmp2->stptr, "to") == 0)
- how = CLOSE_TO;
- else if (strcasecmp(tmp2->stptr, "from") == 0)
- how = CLOSE_FROM;
- else
- fatal(_("close: second argument must be `to' or `from'"));
- free_temp(tmp2);
- }
+
+ tmp = force_string(tree_eval(tree->subnode));
for (rp = red_head; rp != NULL; rp = rp->next) {
if (strlen(rp->value) == tmp->stlen
@@ -716,24 +594,22 @@ do_close(NODE *tree)
break;
}
- if (rp == NULL) { /* no match, return -1 */
- char *cp;
-
- if (do_lint)
- lintwarn(_("close: `%.*s' is not an open file, pipe or co-process"),
+ if (rp == NULL) { /* no match */
+ /* icky special case: close(FILENAME) called. */
+ if (tree->subnode == FILENAME_node
+ || (tmp->stlen == FILENAME_node->var_value->stlen
+ && STREQN(tmp->stptr, FILENAME_node->var_value->stptr, tmp->stlen))) {
+ (void) nextfile(TRUE);
+ } else if (do_lint)
+ warning("close: `%.*s' is not an open file or pipe",
tmp->stlen, tmp->stptr);
- /* update ERRNO manually, using errno = ENOENT is a stretch. */
- cp = _("close of redirection that was never opened");
- unref(ERRNO_node->var_value);
- ERRNO_node->var_value = make_string(cp, strlen(cp));
-
free_temp(tmp);
- return tmp_number((AWKNUM) -1.0);
+ return tmp_number((AWKNUM) 0.0);
}
free_temp(tmp);
fflush(stdout); /* synchronize regular output */
- tmp = tmp_number((AWKNUM) close_redir(rp, FALSE, how));
+ tmp = tmp_number((AWKNUM) close_redir(rp, FALSE));
rp = NULL;
return tmp;
}
@@ -741,63 +617,33 @@ do_close(NODE *tree)
/* close_redir --- close an open file or pipe */
static int
-close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how)
+close_redir(rp, exitwarn)
+register struct redirect *rp;
+int exitwarn;
{
int status = 0;
+ char *what;
if (rp == NULL)
return 0;
if (rp->fp == stdout || rp->fp == stderr)
return 0;
-
- if (do_lint && (rp->flag & RED_TWOWAY) == 0 && how != CLOSE_ALL)
- lintwarn(_("close: redirection `%s' not opened with `|&', second argument ignored"),
- rp->value);
-
errno = 0;
- if ((rp->flag & RED_TWOWAY) != 0) { /* two-way pipe */
- /* write end: */
- if ((how == CLOSE_ALL || how == CLOSE_TO) && rp->fp != NULL) {
-#ifdef HAVE_SOCKETS
- if ((rp->flag & RED_TCP) != 0)
- (void) shutdown(fileno(rp->fp), SHUT_WR);
-#endif /* HAVE_SOCKETS */
- status = fclose(rp->fp);
- rp->fp = NULL;
- }
-
- /* read end: */
- if (how == CLOSE_ALL || how == CLOSE_FROM) {
- if ((rp->flag & RED_SOCKET) != 0 && rp->iop != NULL) {
-#ifdef HAVE_SOCKETS
- if ((rp->flag & RED_TCP) != 0)
- (void) shutdown(rp->iop->fd, SHUT_RD);
-#endif /* HAVE_SOCKETS */
- (void) iop_close(rp->iop);
- } else
- status = gawk_pclose(rp);
-
- rp->iop = NULL;
- }
- } else if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE)) { /* write to pipe */
+ if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE))
status = pclose(rp->fp);
- if ((BINMODE & 1) != 0)
- os_setbinmode(fileno(stdin), O_BINARY);
-
- rp->fp = NULL;
- } else if (rp->fp != NULL) { /* write to file */
+ else if (rp->fp != NULL)
status = fclose(rp->fp);
- rp->fp = NULL;
- } else if (rp->iop != NULL) { /* read from pipe/file */
- if ((rp->flag & RED_PIPE) != 0) /* read from pipe */
+ else if (rp->iop != NULL) {
+ if ((rp->flag & RED_PIPE) != 0)
status = gawk_pclose(rp);
- /* gawk_pclose sets rp->iop to null */
- else { /* read from file */
+ else {
status = iop_close(rp->iop);
rp->iop = NULL;
}
}
+ what = ((rp->flag & RED_PIPE) != 0) ? "pipe" : "file";
+
/* SVR4 awk checks and warns about status of close */
if (status != 0) {
char *s = strerror(errno);
@@ -806,55 +652,29 @@ close_redir(register struct redirect *rp, int exitwarn, two_way_close_type how)
* Too many people have complained about this.
* As of 2.15.6, it is now under lint control.
*/
- if (do_lint) {
- if ((rp->flag & RED_PIPE) != 0)
- lintwarn(_("failure status (%d) on pipe close of `%s' (%s)"),
- status, rp->value, s);
- else
- lintwarn(_("failure status (%d) on file close of `%s' (%s)"),
- status, rp->value, s);
- }
+ if (do_lint)
+ warning("failure status (%d) on %s close of \"%s\" (%s)",
+ status, what, rp->value, s);
if (! do_traditional) {
/* set ERRNO too so that program can get at it */
- update_ERRNO();
+ unref(ERRNO_node->var_value);
+ ERRNO_node->var_value = make_string(s, strlen(s));
}
}
- if (exitwarn) {
- /*
- * Don't use lintwarn() here. If lint warnings are fatal,
- * doing so prevents us from closing other open redirections.
- *
- * Using multiple full messages instead of string parameters
- * for the types makes message translation easier.
- */
- if ((rp->flag & RED_SOCKET) != 0)
- warning(_("no explicit close of socket `%s' provided"),
- rp->value);
- else if ((rp->flag & RED_TWOWAY) != 0)
- warning(_("no explicit close of co-process `%s' provided"),
- rp->value);
- else if ((rp->flag & RED_PIPE) != 0)
- warning(_("no explicit close of pipe `%s' provided"),
- rp->value);
- else
- warning(_("no explicit close of file `%s' provided"),
- rp->value);
- }
-
- /* remove it from the list if closing both or both ends have been closed */
- if (how == CLOSE_ALL || (rp->iop == NULL && rp->fp == NULL)) {
- if (rp->next != NULL)
- rp->next->prev = rp->prev;
- if (rp->prev != NULL)
- rp->prev->next = rp->next;
- else
- red_head = rp->next;
- free(rp->value);
- free((char *) rp);
- }
+ if (exitwarn)
+ warning("no explicit close of %s `%s' provided",
+ what, rp->value);
+ if (rp->next != NULL)
+ rp->next->prev = rp->prev;
+ if (rp->prev != NULL)
+ rp->prev->next = rp->next;
+ else
+ red_head = rp->next;
+ free(rp->value);
+ free((char *) rp);
return status;
}
@@ -868,31 +688,23 @@ flush_io()
errno = 0;
if (fflush(stdout)) {
- warning(_("error writing standard output (%s)"), strerror(errno));
+ warning("error writing standard output (%s)", strerror(errno));
status++;
}
if (fflush(stderr)) {
- warning(_("error writing standard error (%s)"), strerror(errno));
+ warning("error writing standard error (%s)", strerror(errno));
status++;
}
for (rp = red_head; rp != NULL; rp = rp->next)
/* flush both files and pipes, what the heck */
if ((rp->flag & RED_WRITE) && rp->fp != NULL) {
if (fflush(rp->fp)) {
- if (rp->flag & RED_PIPE)
- warning(_("pipe flush of `%s' failed (%s)."),
- rp->value, strerror(errno));
- else if (rp->flag & RED_TWOWAY)
- warning(_("co-process flush of pipe to `%s' failed (%s)."),
- rp->value, strerror(errno));
- else
- warning(_("file flush of `%s' failed (%s)."),
- rp->value, strerror(errno));
+ warning("%s flush of \"%s\" failed (%s).",
+ (rp->flag & RED_PIPE) ? "pipe" :
+ "file", rp->value, strerror(errno));
status++;
}
}
- if (status != 0)
- status = -1; /* canonicalize it */
return status;
}
@@ -912,7 +724,7 @@ close_io()
* close_redir() will print a message if needed
* if do_lint, warn about lack of explicit close
*/
- if (close_redir(rp, do_lint, CLOSE_ALL))
+ if (close_redir(rp, do_lint))
status++;
rp = NULL;
}
@@ -922,11 +734,11 @@ close_io()
* them, we just flush them, and do that across the board.
*/
if (fflush(stdout)) {
- warning(_("error writing standard output (%s)"), strerror(errno));
+ warning("error writing standard output (%s)", strerror(errno));
status++;
}
if (fflush(stderr)) {
- warning(_("error writing standard error (%s)"), strerror(errno));
+ warning("error writing standard error (%s)", strerror(errno));
status++;
}
return status;
@@ -935,167 +747,31 @@ close_io()
/* str2mode --- convert a string mode to an integer mode */
static int
-str2mode(const char *mode)
+str2mode(mode)
+const char *mode;
{
int ret;
- const char *second = & mode[1];
-
- if (*second == 'b')
- second++;
switch(mode[0]) {
case 'r':
ret = O_RDONLY;
- if (*second == '+' || *second == 'w')
- ret = O_RDWR;
break;
case 'w':
ret = O_WRONLY|O_CREAT|O_TRUNC;
- if (*second == '+' || *second == 'r')
- ret = O_RDWR|O_CREAT|O_TRUNC;
break;
case 'a':
ret = O_WRONLY|O_APPEND|O_CREAT;
- if (*second == '+')
- ret = O_RDWR|O_APPEND|O_CREAT;
break;
default:
ret = 0; /* lint */
cant_happen();
}
- if (strchr(mode, 'b') != NULL)
- ret |= O_BINARY;
return ret;
}
-#ifdef HAVE_SOCKETS
-/* socketopen --- open a socket and set it into connected state */
-
-int
-socketopen(enum inet_prot type, int localport, int remoteport, char *remotehostname)
-{
- struct hostent *hp = gethostbyname(remotehostname);
- struct sockaddr_in local_addr, remote_addr;
- int socket_fd;
- int any_remote_host = strcmp(remotehostname, "0");
-
- socket_fd = INVALID_HANDLE;
- switch (type) {
- case INET_TCP:
- if (localport != 0 || remoteport != 0) {
- int on = 1;
-#ifdef SO_LINGER
- struct linger linger;
-
- memset(& linger, '\0', sizeof(linger));
-#endif
- socket_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- setsockopt(socket_fd, SOL_SOCKET, SO_REUSEADDR,
- (char *) & on, sizeof(on));
-#ifdef SO_LINGER
- linger.l_onoff = 1;
- linger.l_linger = 30; /* linger for 30/100 second */
- setsockopt(socket_fd, SOL_SOCKET, SO_LINGER,
- (char *) & linger, sizeof(linger));
-#endif
- }
- break;
- case INET_UDP:
- if (localport != 0 || remoteport != 0)
- socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- break;
- case INET_RAW:
-#ifdef SOCK_RAW
- if (localport == 0 && remoteport == 0)
- socket_fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
-#endif
- break;
- case INET_NONE:
- /* fall through */
- default:
- cant_happen();
- break;
- }
-
- if (socket_fd < 0 || socket_fd == INVALID_HANDLE
- || (hp == NULL && any_remote_host != 0))
- return INVALID_HANDLE;
-
- local_addr.sin_family = remote_addr.sin_family = AF_INET;
- local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- remote_addr.sin_addr.s_addr = htonl(INADDR_ANY);
- local_addr.sin_port = htons(localport);
- remote_addr.sin_port = htons(remoteport);
- if (bind(socket_fd, (struct sockaddr *) &local_addr, sizeof(local_addr)) == 0) {
- if (any_remote_host != 0) { /* not ANY => create a client */
- if (type == INET_TCP || type == INET_UDP) {
- memcpy(&remote_addr.sin_addr, hp->h_addr,
- sizeof(remote_addr.sin_addr));
- if (connect(socket_fd,
- (struct sockaddr *) &remote_addr,
- sizeof(remote_addr)) != 0) {
- close(socket_fd);
- if (localport == 0)
- socket_fd = INVALID_HANDLE;
- else
- socket_fd = socketopen(type, localport, 0, "0");
- }
- } else {
- /* /inet/raw client not ready yet */
- fatal(_("/inet/raw client not ready yet, sorry"));
- if (geteuid() != 0)
- fatal(_("only root may use `/inet/raw'."));
- }
- } else { /* remote host is ANY => create a server */
- if (type == INET_TCP) {
- int clientsocket_fd = INVALID_HANDLE;
- int namelen = sizeof(remote_addr);
-
- if (listen(socket_fd, 1) >= 0
- && (clientsocket_fd = accept(socket_fd,
- (struct sockaddr *) &remote_addr,
- &namelen)) >= 0) {
- close(socket_fd);
- socket_fd = clientsocket_fd;
- } else {
- close(socket_fd);
- socket_fd = INVALID_HANDLE;
- }
- } else if (type == INET_UDP) {
- char buf[10];
- int readle;
-
-#ifdef MSG_PEEK
- if (recvfrom(socket_fd, buf, 1, MSG_PEEK,
- (struct sockaddr *) & remote_addr,
- & readle) < 1
- || readle != sizeof(remote_addr)
- || connect(socket_fd,
- (struct sockaddr *)& remote_addr,
- readle) != 0) {
- close(socket_fd);
- socket_fd = INVALID_HANDLE;
- }
-#endif
- } else {
- /* /inet/raw server not ready yet */
- fatal(_("/inet/raw server not ready yet, sorry"));
- if (geteuid() != 0)
- fatal(_("only root may use `/inet/raw'."));
- }
- }
- } else {
- close(socket_fd);
- socket_fd = INVALID_HANDLE;
- }
-
- return socket_fd;
-}
-#endif /* HAVE_SOCKETS */
-
/* devopen --- handle /dev/std{in,out,err}, /dev/fd/N, regular files */
/*
@@ -1105,38 +781,33 @@ socketopen(enum inet_prot type, int localport, int remoteport, char *remotehostn
* no sense to use them for output.
*/
-/*
- * Strictly speaking, "name" is not a "const char *" because we temporarily
- * change the string.
- */
-
int
-devopen(const char *name, const char *mode)
+devopen(name, mode)
+const char *name, *mode;
{
int openfd;
- char *cp;
+ const char *cp;
char *ptr;
int flag = 0;
+ struct stat buf;
extern double strtod();
flag = str2mode(mode);
if (STREQ(name, "-"))
- return fileno(stdin);
-
- openfd = INVALID_HANDLE;
+ openfd = fileno(stdin);
+ else
+ openfd = INVALID_HANDLE;
if (do_traditional)
goto strictopen;
- if ((openfd = os_devopen(name, flag)) != INVALID_HANDLE) {
- os_close_on_exec(openfd, name, "file", "");
+ if ((openfd = os_devopen(name, flag)) >= 0)
return openfd;
- }
-
- if (STREQN(name, "/dev/", 5)) {
- cp = (char *) name + 5;
+ if (STREQN(name, "/dev/", 5) && stat((char *) name, &buf) == -1) {
+ cp = name + 5;
+
if (STREQ(cp, "stdin") && (flag & O_ACCMODE) == O_RDONLY)
openfd = fileno(stdin);
else if (STREQ(cp, "stdout") && (flag & O_ACCMODE) == O_WRONLY)
@@ -1149,115 +820,14 @@ devopen(const char *name, const char *mode)
if (openfd <= INVALID_HANDLE || ptr == cp)
openfd = INVALID_HANDLE;
}
- /* do not set close-on-exec for inherited fd's */
- if (openfd != INVALID_HANDLE)
- return openfd;
- } else if (STREQN(name, "/inet/", 6)) {
-#ifdef HAVE_SOCKETS
- /* /inet/protocol/localport/hostname/remoteport */
- enum inet_prot protocol = INET_NONE;
- int localport, remoteport;
- char *hostname;
- char *hostnameslastcharp;
- char *localpname;
- char proto[4];
- struct servent *service;
-
- cp = (char *) name + 6;
- /* which protocol? */
- if (STREQN(cp, "tcp/", 4))
- protocol = INET_TCP;
- else if (STREQN(cp, "udp/", 4))
- protocol = INET_UDP;
- else if (STREQN(cp, "raw/", 4))
- protocol = INET_RAW;
- else
- fatal(_("no (known) protocol supplied in special filename `%s'"),
- name);
-
- proto[0] = cp[0];
- proto[1] = cp[1];
- proto[2] = cp[2];
- proto[3] = '\0';
- cp += 4;
-
- /* which localport? */
- localpname = cp;
- while (*cp != '/' && *cp != '\0')
- cp++;
- /*
- * Require a port, let them explicitly put 0 if
- * they don't care.
- */
- if (*cp != '/' || cp == localpname)
- fatal(_("special file name `%s' is incomplete"), name);
- /* We change the special file name temporarily because we
- * need a 0-terminated string here for conversion with atoi().
- * By using atoi() the use of decimal numbers is enforced.
- */
- *cp = '\0';
-
- localport = atoi(localpname);
- if (strcmp(localpname, "0") != 0
- && (localport <= 0 || localport > 65535)) {
- service = getservbyname(localpname, proto);
- if (service == NULL)
- fatal(_("local port invalid in `%s'"), name);
- else
- localport = ntohs(service->s_port);
- }
- *cp = '/';
-
- /* which hostname? */
- cp++;
- hostname = cp;
- while (*cp != '/' && *cp != '\0')
- cp++;
- if (*cp != '/' || cp == hostname)
- fatal(_("must supply a remote hostname to `/inet'"));
- *cp = '\0';
- hostnameslastcharp = cp;
-
- /* which remoteport? */
- cp++;
- /*
- * The remote port ends the special file name.
- * This means there already is a 0 at the end of the string.
- * Therefore no need to patch any string ending.
- *
- * Here too, require a port, let them explicitly put 0 if
- * they don't care.
- */
- if (*cp == '\0')
- fatal(_("must supply a remote port to `/inet'"));
- remoteport = atoi(cp);
- if (strcmp(cp, "0") != 0
- && (remoteport <= 0 || remoteport > 65535)) {
- service = getservbyname(cp, proto);
- if (service == NULL)
- fatal(_("remote port invalid in `%s'"), name);
- else
- remoteport = ntohs(service->s_port);
- }
-
- /* Open Sesame! */
- openfd = socketopen(protocol, localport, remoteport, hostname);
- *hostnameslastcharp = '/';
-
-#else /* ! HAVE_SOCKETS */
- fatal(_("TCP/IP communications are not supported"));
-#endif /* HAVE_SOCKETS */
}
strictopen:
if (openfd == INVALID_HANDLE)
openfd = open(name, flag, 0666);
- if (openfd != INVALID_HANDLE) {
- if (os_isdir(openfd))
- fatal(_("file `%s' is a directory"), name);
-
- os_close_on_exec(openfd, name, "file", "");
- }
+ if (openfd != INVALID_HANDLE && fstat(openfd, &buf) > 0)
+ if (S_ISDIR(buf.st_mode))
+ fatal("file `%s' is a directory", name);
return openfd;
}
@@ -1265,7 +835,10 @@ strictopen:
/* spec_setup --- setup an IOBUF for a special internal file */
static void
-spec_setup(IOBUF *iop, int len, int allocate)
+spec_setup(iop, len, allocate)
+IOBUF *iop;
+int len;
+int allocate;
{
char *cp;
@@ -1284,12 +857,15 @@ spec_setup(IOBUF *iop, int len, int allocate)
iop->end = iop->buf + len;
iop->fd = -1;
iop->flag = IOP_IS_INTERNAL;
+ iop->getrec = get_a_record;
}
/* specfdopen --- open an fd special file */
static int
-specfdopen(IOBUF *iop, const char *name, const char *mode)
+specfdopen(iop, name, mode)
+IOBUF *iop;
+const char *name, *mode;
{
int fd;
IOBUF *tp;
@@ -1318,13 +894,12 @@ specfdopen(IOBUF *iop, const char *name, const char *mode)
/* pidopen --- "open" /dev/pid, /dev/ppid, and /dev/pgrpid */
static int
-pidopen(IOBUF *iop, const char *name, const char *mode)
+pidopen(iop, name, mode)
+IOBUF *iop;
+const char *name, *mode;
{
char tbuf[BUFSIZ];
int i;
- const char *cp = name + 5;
-
- warning(_("use `PROCINFO[\"%s\"]' instead of `%s'"), cp, name);
if (name[6] == 'g')
sprintf(tbuf, "%d\n", (int) getpgrp(getpgrp_arg()));
@@ -1351,7 +926,9 @@ pidopen(IOBUF *iop, const char *name, const char *mode)
*/
static int
-useropen(IOBUF *iop, const char *name, const char *mode)
+useropen(iop, name, mode)
+IOBUF *iop;
+const char *name, *mode;
{
char tbuf[BUFSIZ], *cp;
int i;
@@ -1360,15 +937,13 @@ useropen(IOBUF *iop, const char *name, const char *mode)
int ngroups;
#endif
- warning(_("use `PROCINFO[...]' instead of `/dev/user'"));
-
sprintf(tbuf, "%d %d %d %d", (int) getuid(), (int) geteuid(), (int) getgid(), (int) getegid());
cp = tbuf + strlen(tbuf);
#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0
ngroups = getgroups(NGROUPS_MAX, groupset);
if (ngroups == -1)
- fatal(_("could not find groups: %s"), strerror(errno));
+ fatal("could not find groups: %s", strerror(errno));
for (i = 0; i < ngroups; i++) {
*cp++ = ' ';
@@ -1388,10 +963,13 @@ useropen(IOBUF *iop, const char *name, const char *mode)
/* iop_open --- handle special and regular files for input */
static IOBUF *
-iop_open(const char *name, const char *mode, IOBUF *iop)
+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;
@@ -1402,7 +980,6 @@ iop_open(const char *name, const char *mode, IOBUF *iop)
{ "/dev/stdin", 10, specfdopen },
{ "/dev/stdout", 11, specfdopen },
{ "/dev/stderr", 11, specfdopen },
- { "/inet/", 6, specfdopen },
{ "/dev/pid", 8, pidopen },
{ "/dev/ppid", 9, pidopen },
{ "/dev/pgrpid", 11, pidopen },
@@ -1412,11 +989,15 @@ iop_open(const char *name, const char *mode, IOBUF *iop)
flag = str2mode(mode);
+ /*
+ * FIXME: remove the stat call, and always process these files
+ * internally.
+ */
if (STREQ(name, "-"))
openfd = fileno(stdin);
else if (do_traditional)
goto strictopen;
- else if (STREQN(name, "/dev/", 5) || STREQN(name, "/inet/", 6)) {
+ else if (STREQN(name, "/dev/", 5) && stat((char *) name, &buf) == -1) {
int i;
for (i = 0; i < devcount; i++) {
@@ -1429,185 +1010,30 @@ iop_open(const char *name, const char *mode, IOBUF *iop)
} else if ((*table[i].fp)(iop, name, mode) == 0)
return iop;
else {
- warning(_("could not open `%s', mode `%s'"),
+ warning("could not open %s, mode `%s'",
name, mode);
return NULL;
}
}
}
- /* not in table, fall through to regular code */
}
strictopen:
if (openfd == INVALID_HANDLE)
openfd = open(name, flag, 0666);
- if (openfd != INVALID_HANDLE) {
- if (os_isdir(openfd))
- fatal(_("file `%s' is a directory"), name);
-
- os_close_on_exec(openfd, name, "file", "");
- }
+ if (openfd != INVALID_HANDLE && fstat(openfd, &buf) > 0)
+ if (S_ISDIR(buf.st_mode))
+ fatal("file `%s' is a directory", name);
return iop_alloc(openfd, name, iop);
}
-/* two_way_open --- open a two way communications channel */
-
-static int
-two_way_open(char *str, struct redirect *rp)
-{
-#ifdef HAVE_SOCKETS
- /* case 1: socket */
- if (STREQN(str, "/inet/", 6)) {
- int fd, newfd;
-
- fd = devopen(str, "rw");
- if (fd == INVALID_HANDLE)
- return FALSE;
- rp->fp = fdopen(fd, "w");
- if (rp->fp == NULL) {
- close(fd);
- return FALSE;
- }
- newfd = dup(fd);
- if (newfd < 0) {
- fclose(rp->fp);
- return FALSE;
- }
- os_close_on_exec(newfd, str, "socket", "to/from");
- rp->iop = iop_alloc(newfd, str, NULL);
- if (rp->iop == NULL) {
- fclose(rp->fp);
- return FALSE;
- }
- rp->flag |= RED_SOCKET;
- return TRUE;
- }
-#endif /* HAVE_SOCKETS */
-
-#ifdef HAVE_PORTALS
- /* case 1.5: portal */
- if (STREQN(str, "/p/", 3)) {
- int fd, newfd;
-
- fd = open(str, O_RDWR);
- if (fd == INVALID_HANDLE)
- return FALSE;
- rp->fp = fdopen(fd, "w");
- if (rp->fp == NULL) {
- close(fd);
- return FALSE;
- }
- newfd = dup(fd);
- if (newfd < 0) {
- fclose(rp->fp);
- return FALSE;
- }
- os_close_on_exec(newfd, str, "portal", "to/from");
- rp->iop = iop_alloc(newfd, str, NULL);
- if (rp->iop == NULL) {
- fclose(rp->fp);
- return FALSE;
- }
- rp->flag |= RED_SOCKET;
- return TRUE;
- }
-#endif /* HAVE_PORTALS */
-
-#ifndef PIPES_SIMULATED /* real pipes */
- /* case 2: two way pipe to a child process */
- {
- int ptoc[2], ctop[2];
- int pid;
- int save_errno;
-
- if (pipe(ptoc) < 0)
- return FALSE; /* errno set, diagnostic from caller */
-
- if (pipe(ctop) < 0) {
- save_errno = errno;
- close(ptoc[0]);
- close(ptoc[1]);
- errno = save_errno;
- return FALSE;
- }
-
- if ((pid = fork()) < 0) {
- save_errno = errno;
- close(ptoc[0]); close(ptoc[1]);
- close(ctop[0]); close(ctop[1]);
- errno = save_errno;
- return FALSE;
- }
-
- if (pid == 0) { /* child */
- if (close(1) == -1)
- fatal(_("close of stdout in child failed (%s)"),
- strerror(errno));
- if (dup(ctop[1]) != 1)
- fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno));
- if (close(0) == -1)
- fatal(_("close of stdin in child failed (%s)"),
- strerror(errno));
- if (dup(ptoc[0]) != 0)
- fatal(_("moving pipe to stdin in child failed (dup: %s)"), strerror(errno));
- if ( close(ptoc[0]) == -1 || close(ptoc[1]) == -1
- || close(ctop[0]) == -1 || close(ctop[1]) == -1)
- fatal(_("close of pipe failed (%s)"), strerror(errno));
- /* stderr does NOT get dup'ed onto child's stdout */
- execl("/bin/sh", "sh", "-c", str, NULL);
- _exit(127);
- }
-
- /* parent */
- rp->pid = pid;
- rp->iop = iop_alloc(ctop[0], str, NULL);
- if (rp->iop == NULL) {
- (void) close(ctop[0]);
- (void) close(ctop[1]);
- (void) close(ptoc[0]);
- (void) close(ptoc[1]);
- (void) kill(pid, SIGKILL); /* overkill? (pardon pun) */
- return FALSE;
- }
- rp->fp = fdopen(ptoc[1], "w");
- if (rp->fp == NULL) {
- iop_close(rp->iop);
- rp->iop = NULL;
- (void) close(ctop[0]);
- (void) close(ctop[1]);
- (void) close(ptoc[0]);
- (void) close(ptoc[1]);
- (void) kill(pid, SIGKILL); /* overkill? (pardon pun) */
- return FALSE;
- }
- if (fcntl(ctop[0], F_SETFD, 1) < 0) {
- warning(_("pipe from `%s': could not set close-on-exec (fcntl: %s)"),
- str, strerror(errno));;
- }
- if (fcntl(ptoc[1], F_SETFD, 1) < 0) {
- warning(_("pipe to `%s': could not set close-on-exec (fcntl: %s)"),
- str, strerror(errno));;
- }
- (void) close(ptoc[0]);
- (void) close(ctop[1]);
- return TRUE;
- }
-
-#else /*PIPES_SIMULATED*/
-
- fatal(_("`|&' not supported"));
- /*NOTREACHED*/
- return FALSE;
-
-#endif
-}
-
#ifndef PIPES_SIMULATED /* real pipes */
/* wait_any --- wait for a child process, close associated pipe */
static int
-wait_any(int interesting) /* pid of interest, if any */
+wait_any(interesting)
+int interesting; /* pid of interest, if any */
{
RETSIGTYPE (*hstat)(), (*istat)(), (*qstat)();
int pid;
@@ -1646,7 +1072,9 @@ wait_any(int interesting) /* pid of interest, if any */
/* gawk_popen --- open an IOBUF on a child process */
static IOBUF *
-gawk_popen(char *cmd, struct redirect *rp)
+gawk_popen(cmd, rp)
+char *cmd;
+struct redirect *rp;
{
int p[2];
register int pid;
@@ -1659,24 +1087,23 @@ gawk_popen(char *cmd, struct redirect *rp)
/*(void) wait_any(0);*/ /* wait for outstanding processes */
if (pipe(p) < 0)
- fatal(_("cannot open pipe `%s' (%s)"), cmd, strerror(errno));
+ fatal("cannot open pipe \"%s\" (%s)", cmd, strerror(errno));
if ((pid = fork()) == 0) {
if (close(1) == -1)
- fatal(_("close of stdout in child failed (%s)"),
+ fatal("close of stdout in child failed (%s)",
strerror(errno));
if (dup(p[1]) != 1)
- fatal(_("moving pipe to stdout in child failed (dup: %s)"), strerror(errno));
+ fatal("dup of pipe failed (%s)", strerror(errno));
if (close(p[0]) == -1 || close(p[1]) == -1)
- fatal(_("close of pipe failed (%s)"), strerror(errno));
+ fatal("close of pipe failed (%s)", strerror(errno));
execl("/bin/sh", "sh", "-c", cmd, NULL);
_exit(127);
}
if (pid == -1)
- fatal(_("cannot create child process for `%s' (fork: %s)"), cmd, strerror(errno));
+ fatal("cannot fork for \"%s\" (%s)", cmd, strerror(errno));
rp->pid = pid;
if (close(p[1]) == -1)
- fatal(_("close of pipe failed (%s)"), strerror(errno));
- os_close_on_exec(p[0], cmd, "pipe", "from");
+ fatal("close of pipe failed (%s)", strerror(errno));
rp->iop = iop_alloc(p[0], cmd, NULL);
if (rp->iop == NULL)
(void) close(p[0]);
@@ -1686,18 +1113,18 @@ gawk_popen(char *cmd, struct redirect *rp)
/* gawk_pclose --- close an open child pipe */
static int
-gawk_pclose(struct redirect *rp)
+gawk_pclose(rp)
+struct redirect *rp;
{
- if (rp->iop != NULL)
- (void) iop_close(rp->iop);
+ (void) iop_close(rp->iop);
rp->iop = NULL;
/* process previously found, return stored status */
if (rp->pid == -1)
- return (rp->status >> 8) + ((rp->status &0xFF) ? 128 + (rp->status & 0xF) : 0);
+ return (rp->status >> 8) & 0xFF;
rp->status = wait_any(rp->pid);
rp->pid = -1;
- return (rp->status >> 8) + ((rp->status &0xFF) ? 128 + (rp->status & 0xF) : 0);
+ return (rp->status >> 8) & 0xFF;
}
#else /* PIPES_SIMULATED */
@@ -1707,22 +1134,19 @@ gawk_pclose(struct redirect *rp)
* except if popen() provides real pipes too
*/
-#if defined(VMS) || defined(OS2) || defined (MSDOS) || defined(WIN32) || defined(TANDEM)
+#if defined(VMS) || defined(OS2) || defined (MSDOS) || defined(WIN32)
/* gawk_popen --- open an IOBUF on a child process */
static IOBUF *
-gawk_popen(char *cmd, struct redirect *rp)
+gawk_popen(cmd, rp)
+char *cmd;
+struct redirect *rp;
{
FILE *current;
- os_restore_mode(fileno(stdin));
- current = popen(cmd, binmode("r"));
- if ((BINMODE & 1) != 0)
- os_setbinmode(fileno(stdin), O_BINARY);
- if (current == NULL)
+ if ((current = popen(cmd, "r")) == NULL)
return NULL;
- os_close_on_exec(fileno(current), cmd, "pipe", "from");
rp->iop = iop_alloc(fileno(current), cmd, NULL);
if (rp->iop == NULL) {
(void) pclose(current);
@@ -1735,20 +1159,19 @@ gawk_popen(char *cmd, struct redirect *rp)
/* gawk_pclose --- close an open child pipe */
static int
-gawk_pclose(struct redirect *rp)
+gawk_pclose(rp)
+struct redirect *rp;
{
int rval, aval, fd = rp->iop->fd;
- if (rp->iop != NULL) {
- rp->iop->fd = dup(fd); /* kludge to allow close() + pclose() */
- rval = iop_close(rp->iop);
- }
+ rp->iop->fd = dup(fd); /* kludge to allow close() + pclose() */
+ rval = iop_close(rp->iop);
rp->iop = NULL;
aval = pclose(rp->ifp);
rp->ifp = NULL;
return (rval < 0 ? rval : aval);
}
-#else /* not (VMS || OS2 || MSDOS || TANDEM) */
+#else /* not (VMS || OS2 || MSDOS) */
static struct pipeinfo {
char *command;
@@ -1758,7 +1181,9 @@ static struct pipeinfo {
/* gawk_popen --- open an IOBUF on a child process */
static IOBUF *
-gawk_popen(char *cmd, struct redirect *rp)
+gawk_popen(cmd, rp)
+char *cmd;
+struct redirect *rp;
{
extern char *strdup P((const char *));
int current;
@@ -1774,7 +1199,6 @@ gawk_popen(char *cmd, struct redirect *rp)
return NULL;
pipes[current].name = name;
pipes[current].command = strdup(cmd);
- os_close_on_exec(current, cmd, "pipe", "from");
rp->iop = iop_alloc(current, name, NULL);
if (rp->iop == NULL)
(void) close(current);
@@ -1784,13 +1208,13 @@ gawk_popen(char *cmd, struct redirect *rp)
/* gawk_pclose --- close an open child pipe */
static int
-gawk_pclose(struct redirect *rp)
+gawk_pclose(rp)
+struct redirect *rp;
{
int cur = rp->iop->fd;
- int rval = 0;
+ int rval;
- if (rp->iop != NULL)
- rval = iop_close(rp->iop);
+ rval = iop_close(rp->iop);
rp->iop = NULL;
/* check for an open file */
@@ -1802,14 +1226,15 @@ gawk_pclose(struct redirect *rp)
free(pipes[cur].command);
return rval;
}
-#endif /* not (VMS || OS2 || MSDOS || TANDEM) */
+#endif /* not (VMS || OS2 || MSDOS) */
#endif /* PIPES_SIMULATED */
/* do_getline --- read in a line, into var and with redirection, as needed */
NODE *
-do_getline(NODE *tree)
+do_getline(tree)
+NODE *tree;
{
struct redirect *rp = NULL;
IOBUF *iop;
@@ -1827,9 +1252,13 @@ do_getline(NODE *tree)
rp = redirect(tree->rnode, &redir_error);
if (rp == NULL && redir_error) { /* failed redirect */
- if (! do_traditional)
- update_ERRNO();
+ if (! do_traditional) {
+ s = strerror(redir_error);
+ unref(ERRNO_node->var_value);
+ ERRNO_node->var_value =
+ make_string(s, strlen(s));
+ }
return tmp_number((AWKNUM) -1.0);
}
iop = rp->iop;
@@ -1837,11 +1266,14 @@ do_getline(NODE *tree)
return tmp_number((AWKNUM) 0.0);
}
errcode = 0;
- cnt = get_a_record(&s, iop, RS->stptr[0], RS_regexp, &errcode);
+ cnt = (*(iop->getrec))(&s, iop, RS->stptr[0], RS_regexp, &errcode);
if (errcode != 0) {
- if (! do_traditional)
- update_ERRNO();
+ if (! do_traditional) {
+ s = strerror(errcode);
+ unref(ERRNO_node->var_value);
+ ERRNO_node->var_value = make_string(s, strlen(s));
+ }
return tmp_number((AWKNUM) -1.0);
}
if (cnt == EOF) {
@@ -1851,7 +1283,7 @@ do_getline(NODE *tree)
* reading from a pipe; otherwise
* gawk_pclose will not be called.
*/
- if ((rp->flag & (RED_PIPE|RED_TWOWAY)) == 0) {
+ if ((rp->flag & RED_PIPE) == 0) {
(void) iop_close(iop);
rp->iop = NULL;
}
@@ -1870,7 +1302,7 @@ do_getline(NODE *tree)
Func_ptr after_assign = NULL;
NODE **lhs;
- lhs = get_lhs(tree->lnode, &after_assign, FALSE);
+ lhs = get_lhs(tree->lnode, &after_assign);
unref(*lhs);
*lhs = make_string(s, cnt);
(*lhs)->flags |= MAYBE_NUM;
@@ -1885,7 +1317,8 @@ do_getline(NODE *tree)
/* pathopen --- pathopen with default file extension handling */
int
-pathopen(const char *file)
+pathopen(file)
+const char *file;
{
int fd = do_pathopen(file);
@@ -1918,7 +1351,8 @@ pathopen(const char *file)
/* do_pathopen --- search $AWKPATH for source file */
static int
-do_pathopen(const char *file)
+do_pathopen(file)
+const char *file;
{
static const char *savepath = NULL;
static int first = TRUE;
@@ -1978,7 +1412,8 @@ do_pathopen(const char *file)
int bufsize = 8192;
void
-fatal(char *s)
+fatal(s)
+char *s;
{
printf("%s\n", s);
exit(1);
@@ -1988,7 +1423,10 @@ fatal(char *s)
/* iop_alloc --- allocate an IOBUF structure for an open fd */
static IOBUF *
-iop_alloc(int fd, const char *name, IOBUF *iop)
+iop_alloc(fd, name, iop)
+int fd;
+const char *name;
+IOBUF *iop;
{
struct stat sbuf;
@@ -2001,16 +1439,63 @@ iop_alloc(int fd, const char *name, IOBUF *iop)
iop->flag |= IOP_IS_TTY;
iop->size = optimal_bufsize(fd, & sbuf);
if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0)
- lintwarn(_("data file `%s' is empty"), name);
+ warning("data file `%s' is empty", name);
iop->secsiz = -2;
errno = 0;
iop->fd = fd;
iop->off = iop->buf = NULL;
iop->cnt = 0;
iop->name = name;
+ iop->getrec = get_a_record;
+#ifdef HAVE_MMAP
+ /* Use mmap only for regular files with positive sizes.
+ The size must fit into size_t, so that mmap works correctly.
+ Also, it must fit into int, so that iop->cnt won't overflow. */
+ if (S_ISREG(sbuf.st_mode) && sbuf.st_size > 0
+ && sbuf.st_size == (size_t) sbuf.st_size
+ && sbuf.st_size == (int) sbuf.st_size) {
+ register char *cp;
+
+ iop->buf = iop->off = mmap((caddr_t) 0, sbuf.st_size,
+ PROT_READ|PROT_WRITE, MAP_PRIVATE,
+ fd, 0L);
+ /* cast is for buggy compilers (e.g. DEC OSF/1) */
+ if (iop->buf == (caddr_t)MAP_FAILED) {
+ iop->buf = iop->off = NULL;
+ goto out;
+ }
+
+ 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 */
return iop;
}
+/* These macros used by both record reading routines */
#define set_RT_to_null() \
(void)(! do_traditional && (unref(RT_node->var_value), \
RT_node->var_value = Nnull_string))
@@ -2039,11 +1524,12 @@ iop_alloc(int fd, const char *name, IOBUF *iop)
*/
static int
-get_a_record(char **out, /* pointer to pointer to data */
- IOBUF *iop, /* input IOP */
- register int grRS, /* first char in RS->stptr */
- Regexp *RSre, /* regexp for RS */
- int *errcode) /* pointer to error variable */
+get_a_record(out, iop, grRS, RSre, errcode)
+char **out; /* pointer to pointer to data */
+IOBUF *iop; /* input IOP */
+register int grRS; /* first char in RS->stptr */
+Regexp *RSre; /* regexp for RS */
+int *errcode; /* pointer to error variable */
{
register char *bp = iop->off;
char *bufend;
@@ -2054,21 +1540,11 @@ get_a_record(char **out, /* pointer to pointer to data */
int continuing = FALSE, continued = FALSE; /* used for re matching */
int onecase;
-#ifdef TANDEM
- char *mend;
-#endif
-
-#ifdef TANDEM
-#define not_past_end() (bp < mend)
-#else
-#define not_past_end() (1)
-#endif
-
/* first time through */
if (RS_null_re == NULL) {
RS_null_re = make_regexp("\n\n+", 3, TRUE, TRUE);
if (RS_null_re == NULL)
- fatal(_("internal error: file `%s', line %d\n"),
+ fatal("internal error: file `%s', line %d\n",
__FILE__, __LINE__);
}
@@ -2078,21 +1554,14 @@ get_a_record(char **out, /* pointer to pointer to data */
return EOF;
}
-#ifdef TANDEM
- if (MRL)
- mend = start + MRL;
- else
- mend = (char *) LONG_MAX;
-#endif
-
if (RS_is_null) /* special case: RS == "" */
rs = '\n';
else
rs = (char) grRS;
- onecase = (IGNORECASE && ISALPHA(rs));
+ onecase = (IGNORECASE && isalpha(rs));
if (onecase)
- rs = casetable[(unsigned char) rs];
+ rs = casetable[rs];
/* set up sentinel */
if (iop->buf) {
@@ -2142,10 +1611,6 @@ get_a_record(char **out, /* pointer to pointer to data */
}
bp = iop->end = iop->off = iop->buf + iop->secsiz;
start = bp - len;
-#ifdef TANDEM
- if (MRL)
- mend = start + MRL;
-#endif
if (oldbuf != NULL) {
free(oldbuf);
oldbuf = NULL;
@@ -2170,7 +1635,7 @@ get_a_record(char **out, /* pointer to pointer to data */
iop->cnt = EOF;
break;
} else
- fatal(_("error reading input file `%s': %s"),
+ fatal("error reading input file `%s': %s",
iop->name, strerror(errno));
} else if (iop->cnt == 0) {
/*
@@ -2222,14 +1687,6 @@ get_a_record(char **out, /* pointer to pointer to data */
* that until we try to add more to the buffer. Thus, we
* set a flag to indicate, that if eof really does happen,
* don't break early.
- *
- * Still more subtlety. Suppose RS is a multi-character regexp,
- * but it doesn't have the metacharacters that would let it
- * match an arbitrary number of characters. So it's an exact
- * string match. We need to check for this, in the case where
- * there is an exact match at the end, and NOT read more
- * data. Otherwise, this might bite us for an interactive
- * networking program that uses CR-LF as the line terminator.
*/
continuing = FALSE;
if (rsre != NULL) {
@@ -2258,34 +1715,20 @@ get_a_record(char **out, /* pointer to pointer to data */
/* case 3, regex match at exact end */
if (start + REEND(rsre, start) >= iop->end) {
if (iop->cnt != EOF) {
- /*
- * Only do the test if not at EOF
- */
- int isstring;
-
- isstring = reisstring(RS->stptr,
- RS->stlen, rsre, start);
- if (isstring == FALSE) {
- bp = iop->end;
- continuing = continued = TRUE;
- continue;
- }
+ bp = iop->end;
+ continuing = continued = TRUE;
+ continue;
}
}
/* got a match! */
/*
* Leading newlines at the beginning of the file
* should be ignored. Whew!
+ *
+ * Is this code ever executed?
*/
- if (RS_is_null && *start == '\n') {
- /*
- * have to catch the case of a
- * single newline at the front of
- * the record, which the regex
- * doesn't. gurr.
- */
- while (*start == '\n' && start < iop->end)
- start++;
+ if (RS_is_null && RESTART(rsre, start) == 0) {
+ start += REEND(rsre, start);
goto again;
}
bp = start + RESTART(rsre, start);
@@ -2296,10 +1739,10 @@ get_a_record(char **out, /* pointer to pointer to data */
}
/* search for RS, #2, RS = <single char> */
if (onecase) {
- while (casetable[(unsigned char) *bp++] != rs && not_past_end())
+ while (casetable[(int) *bp++] != rs)
continue;
} else {
- while (*bp++ != rs && not_past_end())
+ while (*bp++ != rs)
continue;
}
set_RT(bp - 1, 1);
@@ -2321,12 +1764,15 @@ get_a_record(char **out, /* pointer to pointer to data */
}
if (do_traditional || rsre == NULL) {
- iop->off = bp;
+ char *bstart;
+
+ bstart = iop->off = bp;
bp--;
- if (onecase ? casetable[(unsigned char) *bp] != rs : *bp != rs)
+ if (onecase ? casetable[(int) *bp] != rs : *bp != rs) {
bp++;
- if (MRL == 0)
- *bp = '\0';
+ bstart = bp;
+ }
+ *bp = '\0';
} else if (RS_is_null && iop->cnt == EOF) {
/*
* special case, delete trailing newlines,
@@ -2343,7 +1789,9 @@ get_a_record(char **out, /* pointer to pointer to data */
#ifdef TEST
int
-main(int argc, char *argv[])
+main(argc, argv)
+int argc;
+char *argv[];
{
IOBUF *iop;
char *out;
@@ -2364,6 +1812,145 @@ main(int argc, char *argv[])
}
#endif
+#ifdef HAVE_MMAP
+/* mmap_get_record --- pull a record out of a memory-mapped file */
+
+static int
+mmap_get_record(out, iop, grRS, RSre, errcode)
+char **out; /* pointer to pointer to data */
+IOBUF *iop; /* input IOP */
+register int grRS; /* first char in RS->stptr */
+Regexp *RSre; /* regexp for RS */
+int *errcode; /* pointer to error variable */
+{
+ register char *bp = iop->off;
+ char *start = iop->off; /* beginning of record */
+ int rs;
+ static Regexp *RS_null_re = NULL;
+ Regexp *rsre = NULL;
+ int onecase;
+ register char *end = iop->end;
+ int cnt;
+
+ /* first time through */
+ if (RS_null_re == NULL) {
+ RS_null_re = make_regexp("\n\n+", 3, TRUE, TRUE);
+ if (RS_null_re == NULL)
+ fatal("internal error: file `%s', line %d\n",
+ __FILE__, __LINE__);
+ }
+
+ if (iop->off >= iop->end) { /* previous record was last */
+ *out = NULL;
+ set_RT_to_null();
+ iop->cnt = EOF; /* tested by higher level code */
+ return EOF;
+ }
+
+ if (RS_is_null) /* special case: RS == "" */
+ rs = '\n';
+ else
+ rs = (char) grRS;
+
+ onecase = (IGNORECASE && isalpha(rs));
+ if (onecase)
+ rs = casetable[rs];
+
+ /* if RS = "", skip leading newlines at the front of the file */
+ if (RS_is_null && iop->off == iop->buf) {
+ for (bp = iop->off; *bp == '\n'; bp++)
+ continue;
+
+ if (bp != iop->off)
+ iop->off = start = bp;
+ }
+
+ /*
+ * Regexp based searching. Either RS = "" or RS = <regex>
+ * See comments in get_a_record.
+ */
+ if (! do_traditional && RSre != NULL) /* regexp */
+ rsre = RSre;
+ else if (RS_is_null) /* RS = "" */
+ rsre = RS_null_re;
+ else
+ rsre = NULL;
+
+ /*
+ * Look for regexp match of RS. Non-match conditions are:
+ * 1. No match at all
+ * 2. Match of a null string
+ * 3. Match ends at exact end of buffer
+ *
+ * #1 means that the record ends the file
+ * and there is no text that actually matched RS.
+ *
+ * #2: is probably like #1.
+ *
+ * #3 is simple; since we have the whole file mapped, it's
+ * the last record in the file.
+ */
+ if (rsre != NULL) {
+ if (research(rsre, start, 0, iop->end - start, TRUE) == -1
+ || RESTART(rsre, start) == REEND(rsre, start)) {
+ /* no matching text, we have the record */
+ *out = start;
+ iop->off = iop->end; /* all done with the record */
+ set_RT_to_null();
+ /* special case, don't allow trailing newlines */
+ if (RS_is_null && *(iop->end - 1) == '\n')
+ return iop->end - start - 1;
+ else
+ return iop->end - start;
+
+ }
+ /* have a match */
+ *out = start;
+ bp = start + RESTART(rsre, start);
+ set_RT(bp, REEND(rsre, start) - RESTART(rsre, start));
+ *bp = '\0';
+ iop->off = start + REEND(rsre, start);
+ return bp - start;
+ }
+
+ /*
+ * RS = "?", i.e., one character based searching.
+ *
+ * Alas, we can't just plug the sentinel character in at
+ * the end of the mmapp'ed file ( *(iop->end) = rs; ). This
+ * works if we're lucky enough to have a file that does not
+ * take up all of its last disk block. But if we end up with
+ * file whose size is an even multiple of the disk block size,
+ * assigning past the end of it delivers a SIGBUS. So, we have to
+ * add the extra test in the while loop at the front that looks
+ * for going past the end of the mapped object. Sigh.
+ */
+ /* search for RS, #2, RS = <single char> */
+ if (onecase) {
+ while (bp < end && casetable[*bp++] != rs)
+ continue;
+ } else {
+ 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 */
+
/* set_RS --- update things as appropriate when RS is set */
void
@@ -2389,7 +1976,7 @@ set_RS()
RS_regexp = make_regexp(RS->stptr, RS->stlen, IGNORECASE, TRUE);
if (do_lint && ! warned) {
- lintwarn(_("multicharacter value of `RS' is a gawk extension"));
+ warning("multicharacter value of `RS' is not portable");
warned = TRUE;
}
}
diff --git a/contrib/awk/main.c b/contrib/awk/main.c
index 35308f8..bbd7d71 100644
--- a/contrib/awk/main.c
+++ b/contrib/awk/main.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,28 +21,13 @@
* 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
+ *
+ * $FreeBSD$
*/
#include "awk.h"
#include "getopt.h"
-#ifdef TANDEM
-#include "ptchlvl.h" /* blech */
-#else
-#include "patchlev.h"
-#endif
-
-#ifndef O_BINARY
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_MCHECK_H
-#include <mcheck.h>
-#endif
-
-#define DEFAULT_PROFILE "awkprof.out" /* where to put profile */
-#define DEFAULT_VARFILE "awkvars.out" /* where to put vars */
-
-static char *varfile = DEFAULT_VARFILE;
+#include "patchlevel.h"
static void usage P((int exitval, FILE *fp));
static void copyleft P((void));
@@ -53,25 +38,20 @@ static void pre_assign P((char *v));
RETSIGTYPE catchsig P((int sig, int code));
static void nostalgia P((void));
static void version P((void));
-static void init_fds P((void));
/* These nodes store all the special variables AWK uses */
-NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
-NODE *ENVIRON_node, *ERRNO_node, *FIELDWIDTHS_node, *FILENAME_node, *FNR_node;
-NODE *FS_node, *IGNORECASE_node, *NF_node, *NR_node, *OFMT_node, *OFS_node;
-NODE *ORS_node, *PROCINFO_node, *RLENGTH_node, *RSTART_node, *RS_node;
-NODE *RT_node, *SUBSEP_node, *LINT_node, *TEXTDOMAIN_node;
-
+NODE *ARGC_node, *ARGIND_node, *ARGV_node, *CONVFMT_node, *ENVIRON_node;
+NODE *ERRNO_node, *FIELDWIDTHS_node, *FILENAME_node, *FNR_node, *FS_node;
+NODE *IGNORECASE_node, *NF_node, *NR_node, *OFMT_node, *OFS_node;
+NODE *ORS_node, *RLENGTH_node, *RSTART_node, *RS_node, *RT_node, *SUBSEP_node;
+
long NF;
long NR;
long FNR;
-int BINMODE;
int IGNORECASE;
char *OFS;
char *ORS;
char *OFMT;
-char *TEXTDOMAIN;
-int MRL; /* See -mr option for use of this variable */
/*
* CONVFMT is a convenience pointer for the current number to string format.
@@ -81,7 +61,6 @@ int MRL; /* See -mr option for use of this variable */
*/
char *CONVFMT = "%.6g";
-
int errcount = 0; /* error counter, used by yyerror() */
NODE *Nnull_string; /* The global null string */
@@ -98,7 +77,7 @@ NODE *end_block = NULL;
int exiting = FALSE; /* Was an "exit" statement executed? */
int exit_val = 0; /* optional exit value */
-#if defined(YYDEBUG) || defined(GAWKDEBUG)
+#if defined(YYDEBUG) || defined(DEBUG)
extern int yydebug;
#endif
@@ -109,13 +88,8 @@ int do_traditional = FALSE; /* no gnu extensions, add traditional weirdnesses */
int do_posix = FALSE; /* turn off gnu and unix extensions */
int do_lint = FALSE; /* provide warnings about questionable stuff */
int do_lint_old = FALSE; /* warn about stuff not in V7 awk */
-int do_intl = FALSE; /* dump locale-izable strings to stdout */
-int do_non_decimal_data = FALSE; /* allow octal/hex C style DATA. Use with caution! */
int do_nostalgia = FALSE; /* provide a blast from the past */
int do_intervals = FALSE; /* allow {...,...} in regexps */
-int do_profiling = FALSE; /* profile and pretty print the program */
-int do_dump_vars = FALSE; /* dump all global variables at end */
-int do_tidy_mem = FALSE; /* release vars when done */
int in_begin_rule = FALSE; /* we're in a BEGIN rule */
int in_end_rule = FALSE; /* we're in a END rule */
@@ -127,34 +101,24 @@ extern char *version_string; /* current version, for printing */
/* The parse tree is stored here. */
NODE *expression_value;
-#if _MSC_VER == 510
-void (*lintfunc) P((va_list va_alist, ...)) = warning;
-#else
-void (*lintfunc) P((char *mesg, ...)) = warning;
-#endif
-
static struct option optab[] = {
{ "compat", no_argument, & do_traditional, 1 },
{ "traditional", no_argument, & do_traditional, 1 },
- { "lint", optional_argument, NULL, 'l' },
+ { "lint", no_argument, & do_lint, 1 },
{ "lint-old", no_argument, & do_lint_old, 1 },
{ "posix", no_argument, & do_posix, 1 },
{ "nostalgia", no_argument, & do_nostalgia, 1 },
- { "gen-po", no_argument, & do_intl, 1 },
- { "non-decimal-data", no_argument, & do_non_decimal_data, 1 },
- { "profile", optional_argument, NULL, 'p' },
{ "copyleft", no_argument, NULL, 'C' },
{ "copyright", no_argument, NULL, 'C' },
{ "field-separator", required_argument, NULL, 'F' },
{ "file", required_argument, NULL, 'f' },
- { "re-interval", no_argument, & do_intervals, 1 },
+ { "re-interval", no_argument, & do_intervals, 1 },
{ "source", required_argument, NULL, 's' },
- { "dump-variables", optional_argument, NULL, 'd' },
{ "assign", required_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
{ "usage", no_argument, NULL, 'u' },
{ "help", no_argument, NULL, 'u' },
-#ifdef GAWKDEBUG
+#ifdef DEBUG
{ "parsedebug", no_argument, NULL, 'D' },
#endif
{ NULL, 0, NULL, '\0' }
@@ -163,7 +127,9 @@ static struct option optab[] = {
/* main --- process args, parse program, run it, clean up */
int
-main(int argc, char **argv)
+main(argc, argv)
+int argc;
+char **argv;
{
int c;
char *scan;
@@ -175,21 +141,8 @@ main(int argc, char **argv)
extern int opterr;
extern char *optarg;
- /* do these checks early */
- if (getenv("TIDYMEM") != NULL)
- do_tidy_mem = TRUE;
-
-#ifdef HAVE_MCHECK_H
- if (do_tidy_mem)
- mtrace();
-#endif /* HAVE_MCHECK_H */
-
-
setlocale(LC_CTYPE, "");
setlocale(LC_COLLATE, "");
- /* setlocale (LC_ALL, ""); */
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
(void) signal(SIGFPE, (RETSIGTYPE (*) P((int))) catchsig);
(void) signal(SIGSEGV, (RETSIGTYPE (*) P((int))) catchsig);
@@ -235,9 +188,6 @@ main(int argc, char **argv)
*/
init_fields();
- /* Robustness: check that 0, 1, 2, exist */
- init_fds();
-
/* worst case */
emalloc(srcfiles, struct src *, argc * sizeof(struct src), "main");
memset(srcfiles, '\0', argc * sizeof(struct src));
@@ -289,26 +239,15 @@ main(int argc, char **argv)
* -mr nnn set record length, ditto
*/
if (do_lint)
- lintwarn(_("`-m[fr]' option irrelevant in gawk"));
+ warning("-m[fr] option irrelevant in gawk");
if (optarg[0] != 'r' && optarg[0] != 'f')
- warning(_("-m option usage: `-m[fr] nnn'"));
- /*
- * Set fixed length records for Tandem,
- * ignored on other platforms (see io.c:get_a_record).
- */
- if (optarg[0] == 'r') {
- if (ISDIGIT(optarg[1]))
- MRL = atoi(optarg+1);
- else {
- MRL = atoi(argv[optind]);
- optind++;
- }
- } else if (optarg[1] == '\0')
+ warning("-m option usage: `-m[fr] nnn'");
+ if (optarg[1] == '\0')
optind++;
break;
case 'W': /* gawk specific options - now in getopt_long */
- fprintf(stderr, _("%s: option `-W %s' unrecognized, ignored\n"),
+ fprintf(stderr, "%s: option `-W %s' unrecognized, ignored\n",
argv[0], optarg);
break;
@@ -317,29 +256,9 @@ main(int argc, char **argv)
copyleft();
break;
- case 'd':
- do_dump_vars = TRUE;
- if (optarg != NULL && optarg[0] != '\0')
- varfile = optarg;
- break;
-
- case 'l':
- do_lint = TRUE;
- if (optarg != NULL && strcmp(optarg, "fatal") == 0)
- lintfunc = r_fatal;
- break;
-
- case 'p':
- do_profiling = TRUE;
- if (optarg != NULL)
- set_prof_file(optarg);
- else
- set_prof_file(DEFAULT_PROFILE);
- break;
-
case 's':
if (optarg[0] == '\0')
- warning(_("empty argument to `--source' ignored"));
+ warning("empty argument to --source ignored");
else {
srcfiles[++numfiles].stype = CMDLINE;
srcfiles[numfiles].val = optarg;
@@ -354,7 +273,7 @@ main(int argc, char **argv)
version();
break;
-#ifdef GAWKDEBUG
+#ifdef DEBUG
case 'D':
yydebug = 2;
break;
@@ -394,7 +313,7 @@ main(int argc, char **argv)
} else if (optopt != '\0')
/* Use 1003.2 required message format */
fprintf(stderr,
- _("%s: option requires an argument -- %c\n"),
+ "%s: option requires an argument -- %c\n",
myname, optopt);
/* else
let getopt print error message for us */
@@ -410,13 +329,13 @@ out:
if (! do_posix && getenv("POSIXLY_CORRECT") != NULL) {
do_posix = TRUE;
if (do_lint)
- lintwarn(
- _("environment variable `POSIXLY_CORRECT' set: turning on `--posix'"));
+ warning(
+ "environment variable `POSIXLY_CORRECT' set: turning on --posix");
}
if (do_posix) {
if (do_traditional) /* both on command line */
- warning(_("`--posix' overrides `--traditional'"));
+ warning("--posix overrides --traditional");
else
do_traditional = TRUE;
/*
@@ -425,14 +344,6 @@ out:
*/
}
- if (do_traditional && do_non_decimal_data) {
- do_non_decimal_data = FALSE;
- warning(_("`--posix'/`--traditional' overrides `--non-decimal-data'"));
- }
-
- if (do_lint && os_is_setuid())
- warning(_("runing %s setuid root may be a security problem"), myname);
-
/*
* Tell the regex routines how they should work.
* Do this again, after argument processing, since do_posix
@@ -450,25 +361,7 @@ out:
set_FS();
}
- /*
- * Initialize profiling info, do after parsing args,
- * in case this is pgawk. Don't bother if the command
- * line already set profling up.
- */
- if (! do_profiling)
- init_profiling(& do_profiling, DEFAULT_PROFILE);
-
- if ((BINMODE & 1) != 0)
- if (os_setbinmode(fileno(stdin), O_BINARY) == -1)
- fatal(_("can't set mode on stdin (%s)"), strerror(errno));
- if ((BINMODE & 2) != 0) {
- if (os_setbinmode(fileno(stdout), O_BINARY) == -1)
- fatal(_("can't set mode on stdout (%s)"), strerror(errno));
- if (os_setbinmode(fileno(stderr), O_BINARY) == -1)
- fatal(_("can't set mode on stderr (%s)"), strerror(errno));
- }
-
-#ifdef GAWKDEBUG
+#ifdef DEBUG
setbuf(stdout, (char *) NULL); /* make debugging easier */
#endif
if (isatty(fileno(stdout)))
@@ -488,18 +381,14 @@ out:
/* Read in the program */
if (yyparse() != 0 || errcount != 0)
exit(1);
-
- if (do_intl)
- exit(0);
+ /* recover any space from C based alloca */
+#ifdef C_ALLOCA
+ (void) alloca(0);
+#endif
if (do_lint && begin_block == NULL && expression_value == NULL
&& end_block == NULL)
- lintwarn(_("no program text at all!"));
-
- if (do_lint)
- shadow_funcs();
-
- init_profiling_signals();
+ warning("no program");
if (begin_block != NULL) {
in_begin_rule = TRUE;
@@ -515,18 +404,6 @@ out:
in_end_rule = FALSE;
if (close_io() != 0 && exit_val == 0)
exit_val = 1;
-
- if (do_profiling) {
- dump_prog(begin_block, expression_value, end_block);
- dump_funcs();
- }
-
- if (do_dump_vars)
- dump_vars(varfile);
-
- if (do_tidy_mem)
- release_all_vars();
-
exit(exit_val); /* more portable */
return exit_val; /* to suppress warnings */
}
@@ -534,46 +411,43 @@ out:
/* usage --- print usage information and exit */
static void
-usage(int exitval, FILE *fp)
+usage(exitval, fp)
+int exitval;
+FILE *fp;
{
- /* Not factoring out common stuff makes it easier to translate. */
-
- fprintf(fp, _("Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n"),
- myname);
- fprintf(fp, _("Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n"),
- myname, quote, quote);
-
- /* GNU long options info. This is too many options. */
-
- fputs(_("POSIX options:\t\tGNU long options:\n"), fp);
- fputs(_("\t-f progfile\t\t--file=progfile\n"), fp);
- fputs(_("\t-F fs\t\t\t--field-separator=fs\n"), fp);
- fputs(_("\t-v var=val\t\t--assign=var=val\n"), fp);
- fputs(_("\t-m[fr] val\n"), fp);
- fputs(_("\t-W compat\t\t--compat\n"), fp);
- fputs(_("\t-W copyleft\t\t--copyleft\n"), fp);
- fputs(_("\t-W copyright\t\t--copyright\n"), fp);
- fputs(_("\t-W dump-variables[=file]\t--dump-variables[=file]\n"), fp);
- fputs(_("\t-W gen-po\t\t--gen-po\n"), fp);
- fputs(_("\t-W help\t\t\t--help\n"), fp);
- fputs(_("\t-W lint[=fatal]\t\t--lint[=fatal]\n"), fp);
- fputs(_("\t-W lint-old\t\t--lint-old\n"), fp);
- fputs(_("\t-W non-decimal-data\t--non-decimal-data\n"), fp);
+ char *opt1 = " -f progfile [--]";
+ char *regops = " [POSIX or GNU style options]";
+
+ fprintf(fp, "Usage: %s%s%s file ...\n\t%s%s [--] %cprogram%c file ...\n",
+ myname, regops, opt1, myname, regops, quote, quote);
+
+ /* GNU long options info. Gack. */
+ fputs("POSIX options:\t\tGNU long options:\n", fp);
+ fputs("\t-f progfile\t\t--file=progfile\n", fp);
+ fputs("\t-F fs\t\t\t--field-separator=fs\n", fp);
+ fputs("\t-v var=val\t\t--assign=var=val\n", fp);
+ fputs("\t-m[fr] val\n", fp);
+ fputs("\t-W compat\t\t--compat\n", fp);
+ fputs("\t-W copyleft\t\t--copyleft\n", fp);
+ fputs("\t-W copyright\t\t--copyright\n", fp);
+ fputs("\t-W help\t\t\t--help\n", fp);
+ fputs("\t-W lint\t\t\t--lint\n", fp);
+ fputs("\t-W lint-old\t\t--lint-old\n", fp);
#ifdef NOSTALGIA
- fputs(_("\t-W nostalgia\t\t--nostalgia\n"), fp);
+ fputs("\t-W nostalgia\t\t--nostalgia\n", fp);
#endif
-#ifdef GAWKDEBUG
- fputs(_("\t-W parsedebug\t\t--parsedebug\n"), fp);
+#ifdef DEBUG
+ fputs("\t-W parsedebug\t\t--parsedebug\n", fp);
#endif
- fputs(_("\t-W profile[=file]\t--profile[=file]\n"), fp);
- fputs(_("\t-W posix\t\t--posix\n"), fp);
- fputs(_("\t-W re-interval\t\t--re-interval\n"), fp);
- fputs(_("\t-W source=program-text\t--source=program-text\n"), fp);
- fputs(_("\t-W traditional\t\t--traditional\n"), fp);
- fputs(_("\t-W usage\t\t--usage\n"), fp);
- fputs(_("\t-W version\t\t--version\n"), fp);
- fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info', which is\n"), fp);
- fputs(_("section `Reporting Problems and Bugs' in the printed version.\n"), fp);
+ fputs("\t-W posix\t\t--posix\n", fp);
+ fputs("\t-W re-interval\t\t--re-interval\n", fp);
+ fputs("\t-W source=program-text\t--source=program-text\n", fp);
+ fputs("\t-W traditional\t\t--traditional\n", fp);
+ fputs("\t-W usage\t\t--usage\n", fp);
+ fputs("\t-W version\t\t--version\n", fp);
+ fputs("\nTo report bugs, see node `Bugs' in `gawk.info', which\n", fp);
+ fputs("is section `Reporting Problems and Bugs' in the\n", fp);
+ fputs("printed version.\n", fp);
exit(exitval);
}
@@ -583,28 +457,28 @@ static void
copyleft()
{
static char blurb_part1[] =
- N_("Copyright (C) 1989, 1991-2001 Free Software Foundation.\n\
+"Copyright (C) 1989, 1991-2000 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\
the Free Software Foundation; either version 2 of the License, or\n\
(at your option) any later version.\n\
-\n");
+\n";
static char blurb_part2[] =
- N_("This program is distributed in the hope that it will be useful,\n\
+"This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\
-\n");
+\n";
static char blurb_part3[] =
- N_("You should have received a copy of the GNU General Public License\n\
+"You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n");
-
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n";
+
/* multiple blurbs are needed for some brain dead compilers. */
- fputs(_(blurb_part1), stdout);
- fputs(_(blurb_part2), stdout);
- fputs(_(blurb_part3), stdout);
+ fputs(blurb_part1, stdout);
+ fputs(blurb_part2, stdout);
+ fputs(blurb_part3, stdout);
fflush(stdout);
exit(0);
}
@@ -612,11 +486,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n");
/* cmdline_fs --- set FS from the command line */
static void
-cmdline_fs(char *str)
+cmdline_fs(str)
+char *str;
{
register NODE **tmp;
- tmp = get_lhs(FS_node, (Func_ptr *) 0, FALSE);
+ tmp = get_lhs(FS_node, (Func_ptr *) 0);
unref(*tmp);
/*
* Only if in full compatibility mode check for the stupid special
@@ -627,7 +502,7 @@ cmdline_fs(char *str)
*/
if (str[0] == 't' && str[1] == '\0') {
if (do_lint)
- lintwarn(_("-Ft does not set FS to tab in POSIX awk"));
+ warning("-Ft does not set FS to tab in POSIX awk");
if (do_traditional && ! do_posix)
str[0] = '\t';
}
@@ -638,25 +513,26 @@ cmdline_fs(char *str)
/* init_args --- set up ARGV from stuff on the command line */
static void
-init_args(int argc0, int argc, char *argv0, char **argv)
+init_args(argc0, argc, argv0, argv)
+int argc0, argc;
+char *argv0;
+char **argv;
{
int i, j;
NODE **aptr;
ARGV_node = install("ARGV", node(Nnull_string, Node_var_array, (NODE *) NULL));
- aptr = assoc_lookup(ARGV_node, tmp_number(0.0), FALSE);
+ aptr = assoc_lookup(ARGV_node, tmp_number(0.0));
*aptr = make_string(argv0, strlen(argv0));
(*aptr)->flags |= MAYBE_NUM;
for (i = argc0, j = 1; i < argc; i++) {
- aptr = assoc_lookup(ARGV_node, tmp_number((AWKNUM) j), FALSE);
+ aptr = assoc_lookup(ARGV_node, tmp_number((AWKNUM) j));
*aptr = make_string(argv[i], strlen(argv[i]));
(*aptr)->flags |= MAYBE_NUM;
- (*aptr)->flags &= ~UNINITIALIZED;
j++;
}
ARGC_node = install("ARGC",
node(make_number((AWKNUM) j), Node_var, (NODE *) NULL));
- ARGC_node->flags &= ~UNINITIALIZED;
}
/*
@@ -693,9 +569,6 @@ static struct varinit varinit[] = {
{&ARGIND_node, "ARGIND", Node_var, NULL, 0, NULL },
{&ERRNO_node, "ERRNO", Node_var, NULL, 0, NULL },
{&RT_node, "RT", Node_var, "", 0, NULL },
-{&BINMODE_node, "BINMODE", Node_BINMODE, NULL, 0, NULL },
-{&LINT_node, "LINT", Node_LINT, NULL, 0, NULL },
-{&TEXTDOMAIN_node, "TEXTDOMAIN", Node_TEXTDOMAIN, "messages", 0, set_TEXTDOMAIN },
{0, NULL, Node_illegal, NULL, 0, NULL },
};
@@ -713,7 +586,6 @@ init_vars()
strlen(vp->strval)),
vp->type, (NODE *) NULL));
(*(vp->spec))->flags |= SCALAR;
- (*(vp->spec))->flags &= ~UNINITIALIZED;
if (vp->assign)
(*(vp->assign))();
}
@@ -724,11 +596,10 @@ init_vars()
void
load_environ()
{
-#if ! defined(TANDEM)
#if ! (defined(MSDOS) && !defined(DJGPP)) && ! defined(OS2) && ! (defined(VMS) && defined(__DECC))
extern char **environ;
#endif
- register char *var, *val;
+ register char *var, *val, *cp;
NODE **aptr;
register int i;
@@ -743,8 +614,7 @@ load_environ()
*val++ = '\0';
else
val = nullstr;
- aptr = assoc_lookup(ENVIRON_node,tmp_string(var, strlen(var)),
- FALSE);
+ aptr = assoc_lookup(ENVIRON_node, tmp_string(var, strlen(var)));
*aptr = make_string(val, strlen(val));
(*aptr)->flags |= (MAYBE_NUM|SCALAR);
@@ -754,94 +624,20 @@ load_environ()
}
/*
* Put AWKPATH into ENVIRON if it's not there.
- * This allows querying it from within awk programs.
+ * This allows querying it from outside gawk.
*/
- if (getenv("AWKPATH") == NULL) {
- aptr = assoc_lookup(ENVIRON_node, tmp_string("AWKPATH", 7), FALSE);
+ if ((cp = getenv("AWKPATH")) == NULL) {
+ aptr = assoc_lookup(ENVIRON_node, tmp_string("AWKPATH", 7));
*aptr = make_string(defpath, strlen(defpath));
(*aptr)->flags |= SCALAR;
}
-#endif /* TANDEM */
-}
-
-/* load_procinfo --- populate the PROCINFO array */
-
-void
-load_procinfo()
-{
- int i;
- NODE **aptr;
- char name[100];
- AWKNUM value;
-#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0
- GETGROUPS_T groupset[NGROUPS_MAX];
- int ngroups;
-#endif
-
- PROCINFO_node = install("PROCINFO",
- node(Nnull_string, Node_var, (NODE *) NULL));
-
-#ifdef GETPGRP_VOID
-#define getpgrp_arg() /* nothing */
-#else
-#define getpgrp_arg() getpid()
-#endif
-
- value = getpgrp(getpgrp_arg());
- aptr = assoc_lookup(PROCINFO_node, tmp_string("pgrpid", 6), FALSE);
- *aptr = make_number(value);
-
- /*
- * could put a lot of this into a table, but then there's
- * portability problems declaring all the functions. so just
- * do it the slow and stupid way. sigh.
- */
-
- value = getpid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("pid", 3), FALSE);
- *aptr = make_number(value);
-
- value = getppid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("ppid", 4), FALSE);
- *aptr = make_number(value);
-
- value = getuid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("uid", 3), FALSE);
- *aptr = make_number(value);
-
- value = geteuid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("euid", 4), FALSE);
- *aptr = make_number(value);
-
- value = getgid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("gid", 3), FALSE);
- *aptr = make_number(value);
-
- value = getegid();
- aptr = assoc_lookup(PROCINFO_node, tmp_string("egid", 4), FALSE);
- *aptr = make_number(value);
-
- aptr = assoc_lookup(PROCINFO_node, tmp_string("FS", 2), FALSE);
- *aptr = make_string("FS", 2);
-
-#if defined(NGROUPS_MAX) && NGROUPS_MAX > 0
- ngroups = getgroups(NGROUPS_MAX, groupset);
- if (ngroups == -1)
- fatal(_("could not find groups: %s"), strerror(errno));
-
- for (i = 0; i < ngroups; i++) {
- sprintf(name, "group%d", i + 1);
- value = groupset[i];
- aptr = assoc_lookup(PROCINFO_node, tmp_string(name, strlen(name)), FALSE);
- *aptr = make_number(value);
- }
-#endif
}
/* arg_assign --- process a command-line assignment */
char *
-arg_assign(char *arg)
+arg_assign(arg)
+char *arg;
{
char *cp, *cp2;
int badvar;
@@ -855,18 +651,18 @@ arg_assign(char *arg)
*cp++ = '\0';
/* first check that the variable name has valid syntax */
badvar = FALSE;
- if (! ISALPHA(arg[0]) && arg[0] != '_')
+ if (! isalpha(arg[0]) && arg[0] != '_')
badvar = TRUE;
else
for (cp2 = arg+1; *cp2; cp2++)
- if (! ISALNUM(*cp2) && *cp2 != '_') {
+ if (! isalnum(*cp2) && *cp2 != '_') {
badvar = TRUE;
break;
}
if (badvar) {
if (do_lint)
- lintwarn(_("invalid syntax in name `%s' for variable assignment"), arg);
+ warning("illegal name `%s' in variable assignment", arg);
*--cp = '='; /* restore original text of ARGV */
return NULL;
}
@@ -878,7 +674,7 @@ arg_assign(char *arg)
it = make_str_node(cp, strlen(cp), SCAN);
it->flags |= (MAYBE_NUM|SCALAR);
var = variable(arg, FALSE, Node_var);
- lhs = get_lhs(var, &after_assign, FALSE);
+ lhs = get_lhs(var, &after_assign);
unref(*lhs);
*lhs = it;
if (after_assign != NULL)
@@ -891,58 +687,35 @@ arg_assign(char *arg)
/* pre_assign --- handle -v, print a message and die if a problem */
static void
-pre_assign(char *v)
+pre_assign(v)
+char *v;
{
- char *cp;
- /*
- * There is a problem when doing profiling. For -v x=y,
- * the variable x gets installed into the symbol table pointing
- * at the value in argv. This is what gets dumped. The string
- * ends up containing the full x=y, leading to stuff in the profile
- * of the form:
- *
- * if (x=y) ...
- *
- * Needless to say, this is gross, ugly and wrong. To fix, we
- * malloc a private copy of the storage that we can tweak to
- * our heart's content.
- *
- * This can't depend upon do_profiling; that variable isn't set up yet.
- * Sigh.
- */
-
- emalloc(cp, char *, strlen(v) + 1, "pre_assign");
- strcpy(cp, v);
-
- if (arg_assign(cp) == NULL) {
+ if (arg_assign(v) == NULL) {
fprintf(stderr,
"%s: `%s' argument to `-v' not in `var=value' form\n",
myname, v);
usage(1, stderr);
}
-
- cp = strchr(cp, '=');
- assert(cp);
- *cp = '\0';
}
/* catchsig --- catch signals */
RETSIGTYPE
-catchsig(int sig, int code)
+catchsig(sig, code)
+int sig, code;
{
#ifdef lint
code = 0; sig = code; code = sig;
#endif
if (sig == SIGFPE) {
- fatal(_("floating point exception"));
+ fatal("floating point exception");
} else if (sig == SIGSEGV
#ifdef SIGBUS
|| sig == SIGBUS
#endif
) {
set_loc(__FILE__, __LINE__);
- msg(_("fatal error: internal error"));
+ msg("fatal error: internal error");
/* fatal won't abort() if not compiled for debugging */
abort();
} else
@@ -955,12 +728,7 @@ catchsig(int sig, int code)
static void
nostalgia()
{
- /*
- * N.B.: This string is not gettextized, on purpose.
- * So there.
- */
fprintf(stderr, "awk: bailing out near line 1\n");
- fflush(stderr);
abort();
}
@@ -977,28 +745,3 @@ version()
copyleft();
exit(0);
}
-
-/* init_fds --- check for 0, 1, 2, open on /dev/null if possible */
-
-static void
-init_fds()
-{
- struct stat sbuf;
- int fd;
- int newfd;
-
- /* maybe no stderr, don't bother with error mesg */
- for (fd = 0; fd <= 2; fd++) {
- if (fstat(fd, &sbuf) < 0) {
-#if MAKE_A_HEROIC_EFFORT
- if (do_lint)
- lintwarn(_("no pre-opened fd %d"), fd);
-#endif
- newfd = devopen("/dev/null", "r+");
-#ifdef MAKE_A_HEROIC_EFFORT
- if (do_lint && newfd < 0)
- lintwarn(_("could not pre-open /dev/null for fd %d"), fd);
-#endif
- }
- }
-}
diff --git a/contrib/awk/missing.c b/contrib/awk/missing.c
deleted file mode 100644
index 7494d76..0000000
--- a/contrib/awk/missing.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Do all necessary includes here, so that we don't have to worry about
- * overlapping includes in the files in missing.d.
- */
-#include "awk.h"
-
-
-#ifdef atarist
-/*
- * this will work with gcc compiler - for other compilers you may
- * have to replace path separators in this file into backslashes
- */
-#include "atari/stack.c"
-#include "atari/tmpnam.c"
-#endif /* atarist */
-
-#ifndef HAVE_SYSTEM
-#ifdef atarist
-#include "atari/system.c"
-#else
-#include "missing/system.c"
-#endif
-#endif /* HAVE_SYSTEM */
-
-#ifndef HAVE_MEMCMP
-#include "missing/memcmp.c"
-#endif /* HAVE_MEMCMP */
-
-#ifndef HAVE_MEMCPY
-#include "missing/memcpy.c"
-#endif /* HAVE_MEMCPY */
-
-#ifndef HAVE_MEMSET
-#include "missing/memset.c"
-#endif /* HAVE_MEMSET */
-
-#ifndef HAVE_STRNCASECMP
-#include "missing/strncasecmp.c"
-#endif /* HAVE_STRCASE */
-
-#ifndef HAVE_STRERROR
-#include "missing/strerror.c"
-#endif /* HAVE_STRERROR */
-
-#ifndef HAVE_STRFTIME
-#include "missing/strftime.c"
-#endif /* HAVE_STRFTIME */
-
-#ifndef HAVE_STRCHR
-#include "missing/strchr.c"
-#endif /* HAVE_STRCHR */
-
-#ifndef HAVE_STRTOD
-#include "missing/strtod.c"
-#endif /* HAVE_STRTOD */
-
-#ifndef HAVE_TZSET
-#include "missing/tzset.c"
-#endif /* HAVE_TZSET */
diff --git a/contrib/awk/node.c b/contrib/awk/node.c
index a814f6e..0f77468 100644
--- a/contrib/awk/node.c
+++ b/contrib/awk/node.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc.
+ * Copyright (C) 1986, 1988, 1989, 1991-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -21,6 +21,8 @@
* 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
+ *
+ * $FreeBSD$
*/
#include "awk.h"
@@ -28,7 +30,8 @@
/* r_force_number --- force a value to be numeric */
AWKNUM
-r_force_number(register NODE *n)
+r_force_number(n)
+register NODE *n;
{
register char *cp;
register char *cpend;
@@ -37,7 +40,7 @@ r_force_number(register NODE *n)
unsigned int newflags;
extern double strtod();
-#ifdef GAWKDEBUG
+#ifdef DEBUG
if (n == NULL)
cant_happen();
if (n->type != Node_val)
@@ -52,29 +55,19 @@ r_force_number(register NODE *n)
n->numbr = 0.0;
n->flags |= NUM;
- n->flags &= ~UNINITIALIZED;
- if (n->stlen == 0) {
- if (0 && do_lint)
- lintwarn(_("can't convert string to float"));
+ if (n->stlen == 0)
return 0.0;
- }
cp = n->stptr;
- if (ISALPHA(*cp)) {
- if (0 && do_lint)
- lintwarn(_("can't convert string to float"));
+ if (ISALPHA(*cp))
return 0.0;
- }
cpend = cp + n->stlen;
- while (cp < cpend && ISSPACE(*cp))
+ while (cp < cpend && isspace(*cp))
cp++;
- if (cp == cpend || ISALPHA(*cp)) {
- if (0 && do_lint)
- lintwarn(_("can't convert string to float"));
+ if (cp == cpend || isalpha(*cp))
return 0.0;
- }
if (n->flags & MAYBE_NUM) {
newflags = NUMBER;
@@ -85,18 +78,17 @@ r_force_number(register NODE *n)
if (ISDIGIT(*cp)) {
n->numbr = (AWKNUM)(*cp - '0');
n->flags |= newflags;
- } else if (0 && do_lint)
- lintwarn(_("can't convert string to float"));
+ }
return n->numbr;
}
- if (do_non_decimal_data) {
- errno = 0;
- if (! do_traditional && isnondecimal(cp)) {
- n->numbr = nondec2awknum(cp, cpend - cp);
- goto finish;
- }
+#ifdef NONDECDATA
+ errno = 0;
+ if (! do_traditional && isnondecimal(cp)) {
+ n->numbr = nondec2awknum(cp, cpend - cp);
+ goto finish;
}
+#endif /* NONDECDATA */
errno = 0;
save = *cpend;
@@ -109,13 +101,10 @@ r_force_number(register NODE *n)
*cpend = save;
finish:
/* the >= should be ==, but for SunOS 3.5 strtod() */
- if (errno == 0 && ptr >= cpend) {
+ if (errno == 0 && ptr >= cpend)
n->flags |= newflags;
- } else {
- if (0 && do_lint && ptr < cpend)
- lintwarn(_("can't convert string to float"));
+ else
errno = 0;
- }
return n->numbr;
}
@@ -142,23 +131,14 @@ static const char *values[] = {
/* format_val --- format a numeric value based on format */
NODE *
-format_val(char *format, int index, register NODE *s)
+format_val(format, index, s)
+char *format;
+int index;
+register NODE *s;
{
- char buf[BUFSIZ];
+ char buf[128];
register char *sp = buf;
double val;
- char *orig, *trans, save;
-
- if (! do_traditional && (s->flags & INTLSTR) != 0) {
- save = s->stptr[s->stlen];
- s->stptr[s->stlen] = '\0';
-
- orig = s->stptr;
- trans = dgettext(TEXTDOMAIN, orig);
-
- s->stptr[s->stlen] = save;
- return tmp_string(trans, strlen(trans));
- }
/* not an integral value, or out of range */
if ((val = double_to_int(s->numbr)) != s->numbr
@@ -175,16 +155,16 @@ format_val(char *format, int index, register NODE *s)
NODE *dummy, *r;
unsigned short oflags;
+ extern NODE *format_tree P((const char *, int, NODE *));
extern NODE **fmt_list; /* declared in eval.c */
/* create dummy node for a sole use of format_tree */
getnode(dummy);
- dummy->type = Node_expression_list;
dummy->lnode = s;
dummy->rnode = NULL;
oflags = s->flags;
s->flags |= PERM; /* prevent from freeing by format_tree() */
- r = format_tree(format, fmt_list[index]->stlen, dummy, 2);
+ r = format_tree(format, fmt_list[index]->stlen, dummy);
s->flags = oflags;
s->stfmt = (char) index;
s->stlen = r->stlen;
@@ -211,21 +191,24 @@ format_val(char *format, int index, register NODE *s)
no_malloc:
s->stref = 1;
s->flags |= STR;
- s->flags &= ~UNINITIALIZED;
return s;
}
/* r_force_string --- force a value to be a string */
NODE *
-r_force_string(register NODE *s)
+r_force_string(s)
+register NODE *s;
{
- NODE *ret;
-#ifdef GAWKDEBUG
+#ifdef DEBUG
if (s == NULL)
cant_happen();
if (s->type != Node_val)
cant_happen();
+/*
+ if ((s->flags & NUM) == 0)
+ cant_happen();
+*/
if (s->stref <= 0)
cant_happen();
if ((s->flags & STR) != 0
@@ -233,8 +216,7 @@ r_force_string(register NODE *s)
return s;
#endif
- ret = format_val(CONVFMT, CONVFMTidx, s);
- return ret;
+ return format_val(CONVFMT, CONVFMTidx, s);
}
/*
@@ -244,7 +226,8 @@ r_force_string(register NODE *s)
*/
NODE *
-dupnode(NODE *n)
+dupnode(n)
+NODE *n;
{
register NODE *r;
@@ -253,8 +236,6 @@ dupnode(NODE *n)
n->flags |= MALLOC;
return n;
}
- if ((n->flags & PERM) != 0)
- return n;
if ((n->flags & (MALLOC|STR)) == (MALLOC|STR)) {
if (n->stref < LONG_MAX)
n->stref++;
@@ -273,26 +254,12 @@ dupnode(NODE *n)
return r;
}
-/* copy_node --- force a brand new copy of a node to be allocated */
-
-NODE *
-copynode(NODE *old)
-{
- NODE *new;
- int saveflags;
-
- assert(old != NULL);
- saveflags = old->flags;
- old->flags &= ~(MALLOC|PERM);
- new = dupnode(old);
- old->flags = saveflags;
- return new;
-}
-
/* mk_number --- allocate a node with defined number */
NODE *
-mk_number(AWKNUM x, unsigned int flags)
+mk_number(x, flags)
+AWKNUM x;
+unsigned int flags;
{
register NODE *r;
@@ -300,7 +267,7 @@ mk_number(AWKNUM x, unsigned int flags)
r->type = Node_val;
r->numbr = x;
r->flags = flags | SCALAR;
-#ifdef GAWKDEBUG
+#ifdef DEBUG
r->stref = 1;
r->stptr = NULL;
r->stlen = 0;
@@ -311,7 +278,10 @@ mk_number(AWKNUM x, unsigned int flags)
/* make_str_node --- make a string node */
NODE *
-make_str_node(char *s, size_t len, int flags)
+make_str_node(s, len, flags)
+char *s;
+size_t len;
+int flags;
{
register NODE *r;
@@ -339,7 +309,7 @@ make_str_node(char *s, size_t len, int flags)
c = parse_escape(&pf);
if (c < 0) {
if (do_lint)
- lintwarn(_("backslash at end of string"));
+ warning("backslash at end of string");
c = '\\';
}
*ptm++ = c;
@@ -361,7 +331,9 @@ make_str_node(char *s, size_t len, int flags)
/* tmp_string --- allocate a temporary string */
NODE *
-tmp_string(char *s, size_t len)
+tmp_string(s, len)
+char *s;
+size_t len;
{
register NODE *r;
@@ -382,13 +354,9 @@ more_nodes()
register NODE *np;
/* get more nodes and initialize list */
- emalloc(nextfree, NODE *, NODECHUNK * sizeof(NODE), "more_nodes");
+ emalloc(nextfree, NODE *, NODECHUNK * sizeof(NODE), "newnode");
for (np = nextfree; np <= &nextfree[NODECHUNK - 1]; np++) {
np->flags = 0;
- np->flags |= UNINITIALIZED;
-#ifndef NO_PROFILING
- np->exec_count = 0;
-#endif
np->nextp = np + 1;
}
--np;
@@ -398,40 +366,37 @@ more_nodes()
return np;
}
-#ifdef MEMDEBUG
-#undef freenode
+#ifdef DEBUG
/* freenode --- release a node back to the pool */
void
-freenode(NODE *it)
+freenode(it)
+NODE *it;
{
it->flags &= ~SCALAR;
- it->flags |= UNINITIALIZED;
#ifdef MPROF
it->stref = 0;
free((char *) it);
#else /* not MPROF */
-#ifndef NO_PROFILING
- it->exec_count = 0;
-#endif
/* add it to head of freelist */
it->nextp = nextfree;
nextfree = it;
#endif /* not MPROF */
}
-#endif /* GAWKDEBUG */
+#endif /* DEBUG */
/* unref --- remove reference to a particular node */
void
-unref(register NODE *tmp)
+unref(tmp)
+register NODE *tmp;
{
if (tmp == NULL)
return;
if ((tmp->flags & PERM) != 0)
return;
- tmp->flags &= ~TEMP;
- if ((tmp->flags & MALLOC) != 0) {
+ if ((tmp->flags & (MALLOC|TEMP)) != 0) {
+ tmp->flags &= ~TEMP;
if ((tmp->flags & STR) != 0) {
if (tmp->stref > 1) {
if (tmp->stref != LONG_MAX)
@@ -469,7 +434,8 @@ unref(register NODE *tmp)
*/
int
-parse_escape(char **string_ptr)
+parse_escape(string_ptr)
+char **string_ptr;
{
register int c = *(*string_ptr)++;
register int i;
@@ -521,13 +487,13 @@ parse_escape(char **string_ptr)
if (! didwarn) {
didwarn = TRUE;
- lintwarn(_("POSIX does not allow `\\x' escapes"));
+ warning("POSIX does not allow \"\\x\" escapes");
}
}
if (do_posix)
return ('x');
- if (! ISXDIGIT((*string_ptr)[0])) {
- warning(_("no hex digits in `\\x' escape sequence"));
+ if (! isxdigit((*string_ptr)[0])) {
+ warning("no hex digits in \\x escape sequence");
return ('x');
}
i = 0;
@@ -548,22 +514,19 @@ parse_escape(char **string_ptr)
}
}
return i;
- case '\\':
- case '"':
- return c;
default:
- {
- static short warned[256];
- unsigned char uc = (unsigned char) c;
+ if (do_lint) {
+ static short warned[256];
+ unsigned char uc = (unsigned char) c;
- /* N.B.: use unsigned char here to avoid Latin-1 problems */
+ /* N.B.: use unsigned char here to avoid Latin-1 problems */
- if (! warned[uc]) {
- warned[uc] = TRUE;
+ if (! warned[uc]) {
+ warned[uc] = TRUE;
- warning(_("escape sequence `\\%c' treated as plain `%c'"), uc, uc);
+ warning("escape sequence `\\%c' treated as plain `%c'", uc, uc);
+ }
}
- }
return c;
}
}
diff --git a/contrib/awk/random.c b/contrib/awk/random.c
deleted file mode 100644
index 74ba7d4..0000000
--- a/contrib/awk/random.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- *
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
-#endif /* LIBC_SCCS and not lint */
-
-#include "random.h" /* gawk addition */
-
-#if !defined (_MSC_VER) && !defined (__MINGW32__) && !defined (VMS)
-#include <sys/time.h> /* for srandomdev() */
-#else
-#include <time.h> /* for clock() */
-#define ssize_t size_t
-#endif /* !defined (_MSC_VER) && !defined (__MINGW32__) && !defined (VMS) */
-
-#include <stdio.h>
-
-/* For gawk, don't this, use the decl of random() in random.h */
-#if 0
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* for srandomdev() */
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h> /* for srandomdev() */
-#endif
-
-/*
- * random.c:
- *
- * An improved random number generation package. In addition to the standard
- * rand()/srand() like interface, this package also has a special state info
- * interface. The initstate() routine is called with a seed, an array of
- * bytes, and a count of how many bytes are being passed in; this array is
- * then initialized to contain information for random number generation with
- * that much state information. Good sizes for the amount of state
- * information are 32, 64, 128, and 256 bytes. The state can be switched by
- * calling the setstate() routine with the same array as was initiallized
- * with initstate(). By default, the package runs with 128 bytes of state
- * information and generates far better random numbers than a linear
- * congruential generator. If the amount of state information is less than
- * 32 bytes, a simple linear congruential R.N.G. is used.
- *
- * Internally, the state information is treated as an array of longs; the
- * zeroeth element of the array is the type of R.N.G. being used (small
- * integer); the remainder of the array is the state information for the
- * R.N.G. Thus, 32 bytes of state information will give 7 longs worth of
- * state information, which will allow a degree seven polynomial. (Note:
- * the zeroeth word of state information also has some other information
- * stored in it -- see setstate() for details).
- *
- * The random number generation technique is a linear feedback shift register
- * approach, employing trinomials (since there are fewer terms to sum up that
- * way). In this approach, the least significant bit of all the numbers in
- * the state table will act as a linear feedback shift register, and will
- * have period 2^deg - 1 (where deg is the degree of the polynomial being
- * used, assuming that the polynomial is irreducible and primitive). The
- * higher order bits will have longer periods, since their values are also
- * influenced by pseudo-random carries out of the lower bits. The total
- * period of the generator is approximately deg*(2**deg - 1); thus doubling
- * the amount of state information has a vast influence on the period of the
- * generator. Note: the deg*(2**deg - 1) is an approximation only good for
- * large deg, when the period of the shift register is the dominant factor.
- * With deg equal to seven, the period is actually much longer than the
- * 7*(2**7 - 1) predicted by this formula.
- *
- * Modified 28 December 1994 by Jacob S. Rosenberg.
- * The following changes have been made:
- * All references to the type u_int have been changed to unsigned long.
- * All references to type int have been changed to type long. Other
- * cleanups have been made as well. A warning for both initstate and
- * setstate has been inserted to the effect that on Sparc platforms
- * the 'arg_state' variable must be forced to begin on word boundaries.
- * This can be easily done by casting a long integer array to char *.
- * The overall logic has been left STRICTLY alone. This software was
- * tested on both a VAX and Sun SpacsStation with exactly the same
- * results. The new version and the original give IDENTICAL results.
- * The new version is somewhat faster than the original. As the
- * documentation says: "By default, the package runs with 128 bytes of
- * state information and generates far better random numbers than a linear
- * congruential generator. If the amount of state information is less than
- * 32 bytes, a simple linear congruential R.N.G. is used." For a buffer of
- * 128 bytes, this new version runs about 19 percent faster and for a 16
- * byte buffer it is about 5 percent faster.
- */
-
-/*
- * For each of the currently supported random number generators, we have a
- * break value on the amount of state information (you need at least this
- * many bytes of state info to support this random number generator), a degree
- * for the polynomial (actually a trinomial) that the R.N.G. is based on, and
- * the separation between the two lower order coefficients of the trinomial.
- */
-#define TYPE_0 0 /* linear congruential */
-#define BREAK_0 8
-#define DEG_0 0
-#define SEP_0 0
-
-#define TYPE_1 1 /* x**7 + x**3 + 1 */
-#define BREAK_1 32
-#define DEG_1 7
-#define SEP_1 3
-
-#define TYPE_2 2 /* x**15 + x + 1 */
-#define BREAK_2 64
-#define DEG_2 15
-#define SEP_2 1
-
-#define TYPE_3 3 /* x**31 + x**3 + 1 */
-#define BREAK_3 128
-#define DEG_3 31
-#define SEP_3 3
-
-#define TYPE_4 4 /* x**63 + x + 1 */
-#define BREAK_4 256
-#define DEG_4 63
-#define SEP_4 1
-
-/*
- * Array versions of the above information to make code run faster --
- * relies on fact that TYPE_i == i.
- */
-#define MAX_TYPES 5 /* max number of types above */
-
-static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
-static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
-
-/*
- * Initially, everything is set up as if from:
- *
- * initstate(1, randtbl, 128);
- *
- * Note that this initialization takes advantage of the fact that srandom()
- * advances the front and rear pointers 10*rand_deg times, and hence the
- * rear pointer which starts at 0 will also end up at zero; thus the zeroeth
- * element of the state information, which contains info about the current
- * position of the rear pointer is just
- *
- * MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3.
- */
-
-static long randtbl[DEG_3 + 1] = {
- TYPE_3,
-#ifdef USE_WEAK_SEEDING
-/* Historic implementation compatibility */
-/* The random sequences do not vary much with the seed */
- 0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5,
- 0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
- 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88,
- 0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
- 0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b,
- 0x27fb47b9,
-#else /* !USE_WEAK_SEEDING */
- 0x991539b1, 0x16a5bce3, 0x6774a4cd, 0x3e01511e, 0x4e508aaa, 0x61048c05,
- 0xf5500617, 0x846b7115, 0x6a19892c, 0x896a97af, 0xdb48f936, 0x14898454,
- 0x37ffd106, 0xb58bff9c, 0x59e17104, 0xcf918a49, 0x09378c83, 0x52c7a471,
- 0x8d293ea9, 0x1f4fc301, 0xc3db71be, 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1,
- 0x19edc328, 0x87bf4bdd, 0xc9b240e5, 0xe9ee4b1b, 0x4382aee7, 0x535b6b41,
- 0xf3bec5da
-#endif /* !USE_WEAK_SEEDING */
-};
-
-/*
- * fptr and rptr are two pointers into the state info, a front and a rear
- * pointer. These two pointers are always rand_sep places aparts, as they
- * cycle cyclically through the state information. (Yes, this does mean we
- * could get away with just one pointer, but the code for random() is more
- * efficient this way). The pointers are left positioned as they would be
- * from the call
- *
- * initstate(1, randtbl, 128);
- *
- * (The position of the rear pointer, rptr, is really 0 (as explained above
- * in the initialization of randtbl) because the state table pointer is set
- * to point to randtbl[1] (as explained below).
- */
-static long *fptr = &randtbl[SEP_3 + 1];
-static long *rptr = &randtbl[1];
-
-/*
- * The following things are the pointer to the state information table, the
- * type of the current generator, the degree of the current polynomial being
- * used, and the separation between the two pointers. Note that for efficiency
- * of random(), we remember the first location of the state information, not
- * the zeroeth. Hence it is valid to access state[-1], which is used to
- * store the type of the R.N.G. Also, we remember the last location, since
- * this is more efficient than indexing every time to find the address of
- * the last element to see if the front and rear pointers have wrapped.
- */
-static long *state = &randtbl[1];
-static long rand_type = TYPE_3;
-static long rand_deg = DEG_3;
-static long rand_sep = SEP_3;
-static long *end_ptr = &randtbl[DEG_3 + 1];
-
-static long good_rand __P((long));
-
-static long good_rand (x)
- register long x;
-{
-#ifdef USE_WEAK_SEEDING
-/*
- * Historic implementation compatibility.
- * The random sequences do not vary much with the seed,
- * even with overflowing.
- */
- return (1103515245 * x + 12345);
-#else /* !USE_WEAK_SEEDING */
-/*
- * Compute x = (7^5 * x) mod (2^31 - 1)
- * wihout overflowing 31 bits:
- * (2^31 - 1) = 127773 * (7^5) + 2836
- * From "Random number generators: good ones are hard to find",
- * Park and Miller, Communications of the ACM, vol. 31, no. 10,
- * October 1988, p. 1195.
- */
- register long hi, lo;
-
- hi = x / 127773;
- lo = x % 127773;
- x = 16807 * lo - 2836 * hi;
- if (x <= 0)
- x += 0x7fffffff;
- return (x);
-#endif /* !USE_WEAK_SEEDING */
-}
-
-/*
- * srandom:
- *
- * Initialize the random number generator based on the given seed. If the
- * type is the trivial no-state-information type, just remember the seed.
- * Otherwise, initializes state[] based on the given "seed" via a linear
- * congruential generator. Then, the pointers are set to known locations
- * that are exactly rand_sep places apart. Lastly, it cycles the state
- * information a given number of times to get rid of any initial dependencies
- * introduced by the L.C.R.N.G. Note that the initialization of randtbl[]
- * for default usage relies on values produced by this routine.
- */
-void
-srandom(x)
- unsigned long x;
-{
- register long i;
-
- if (rand_type == TYPE_0)
- state[0] = x;
- else {
- state[0] = x;
- for (i = 1; i < rand_deg; i++)
- state[i] = good_rand(state[i - 1]);
- fptr = &state[rand_sep];
- rptr = &state[0];
- for (i = 0; i < 10 * rand_deg; i++)
- (void)random();
- }
-}
-
-/*
- * srandomdev:
- *
- * Many programs choose the seed value in a totally predictable manner.
- * This often causes problems. We seed the generator using the much more
- * secure urandom(4) interface. Note that this particular seeding
- * procedure can generate states which are impossible to reproduce by
- * calling srandom() with any value, since the succeeding terms in the
- * state buffer are no longer derived from the LC algorithm applied to
- * a fixed seed.
- */
-void
-srandomdev()
-{
- int fd, done;
- size_t len;
-
- if (rand_type == TYPE_0)
- len = sizeof state[0];
- else
- len = rand_deg * sizeof state[0];
-
- done = 0;
-#ifdef O_RDONLY
- fd = open("/dev/urandom", O_RDONLY, 0);
- if (fd >= 0) {
- if (read(fd, (void *) state, len) == (ssize_t) len)
- done = 1;
- close(fd);
- }
-#endif /*O_RDONLY*/
-
- if (!done) {
- unsigned long junk;
-#if !defined (_MSC_VER) && !defined (__MINGW32__)
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- srandom(getpid() ^ tv.tv_sec ^ tv.tv_usec ^ junk);
-#else
- clock_t ret_clock_t = clock();
- /*
- * I don't like the idea of reading uninitialized memory
- * even to generate a random number, but we do it anyway.
- * SD.
- */
- srandom(getpid() ^ ret_clock_t ^ junk);
-#endif
-
- return;
- }
-
- if (rand_type != TYPE_0) {
- fptr = &state[rand_sep];
- rptr = &state[0];
- }
-}
-
-/*
- * initstate:
- *
- * Initialize the state information in the given array of n bytes for future
- * random number generation. Based on the number of bytes we are given, and
- * the break values for the different R.N.G.'s, we choose the best (largest)
- * one we can and set things up for it. srandom() is then called to
- * initialize the state information.
- *
- * Note that on return from srandom(), we set state[-1] to be the type
- * multiplexed with the current value of the rear pointer; this is so
- * successive calls to initstate() won't lose this information and will be
- * able to restart with setstate().
- *
- * Note: the first thing we do is save the current state, if any, just like
- * setstate() so that it doesn't matter when initstate is called.
- *
- * Returns a pointer to the old state.
- *
- * Note: The Sparc platform requires that arg_state begin on a long
- * word boundary; otherwise a bus error will occur. Even so, lint will
- * complain about mis-alignment, but you should disregard these messages.
- */
-char *
-initstate(seed, arg_state, n)
- unsigned long seed; /* seed for R.N.G. */
- char *arg_state; /* pointer to state array */
- long n; /* # bytes of state info */
-{
- register char *ostate = (char *)(&state[-1]);
- register long *long_arg_state = (long *) arg_state;
-
- if (rand_type == TYPE_0)
- state[-1] = rand_type;
- else
- state[-1] = MAX_TYPES * (rptr - state) + rand_type;
- if (n < BREAK_0) {
- (void)fprintf(stderr,
- "random: not enough state (%ld bytes); ignored.\n", n);
- return(0);
- }
- if (n < BREAK_1) {
- rand_type = TYPE_0;
- rand_deg = DEG_0;
- rand_sep = SEP_0;
- } else if (n < BREAK_2) {
- rand_type = TYPE_1;
- rand_deg = DEG_1;
- rand_sep = SEP_1;
- } else if (n < BREAK_3) {
- rand_type = TYPE_2;
- rand_deg = DEG_2;
- rand_sep = SEP_2;
- } else if (n < BREAK_4) {
- rand_type = TYPE_3;
- rand_deg = DEG_3;
- rand_sep = SEP_3;
- } else {
- rand_type = TYPE_4;
- rand_deg = DEG_4;
- rand_sep = SEP_4;
- }
- state = (long *) (long_arg_state + 1); /* first location */
- end_ptr = &state[rand_deg]; /* must set end_ptr before srandom */
- srandom(seed);
- if (rand_type == TYPE_0)
- long_arg_state[0] = rand_type;
- else
- long_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type;
- return(ostate);
-}
-
-/*
- * setstate:
- *
- * Restore the state from the given state array.
- *
- * Note: it is important that we also remember the locations of the pointers
- * in the current state information, and restore the locations of the pointers
- * from the old state information. This is done by multiplexing the pointer
- * location into the zeroeth word of the state information.
- *
- * Note that due to the order in which things are done, it is OK to call
- * setstate() with the same state as the current state.
- *
- * Returns a pointer to the old state information.
- *
- * Note: The Sparc platform requires that arg_state begin on a long
- * word boundary; otherwise a bus error will occur. Even so, lint will
- * complain about mis-alignment, but you should disregard these messages.
- */
-char *
-setstate(arg_state)
- char *arg_state; /* pointer to state array */
-{
- register long *new_state = (long *) arg_state;
- register long type = new_state[0] % MAX_TYPES;
- register long rear = new_state[0] / MAX_TYPES;
- char *ostate = (char *)(&state[-1]);
-
- if (rand_type == TYPE_0)
- state[-1] = rand_type;
- else
- state[-1] = MAX_TYPES * (rptr - state) + rand_type;
- switch(type) {
- case TYPE_0:
- case TYPE_1:
- case TYPE_2:
- case TYPE_3:
- case TYPE_4:
- rand_type = type;
- rand_deg = degrees[type];
- rand_sep = seps[type];
- break;
- default:
- (void)fprintf(stderr,
- "random: state info corrupted; not changed.\n");
- }
- state = (long *) (new_state + 1);
- if (rand_type != TYPE_0) {
- rptr = &state[rear];
- fptr = &state[(rear + rand_sep) % rand_deg];
- }
- end_ptr = &state[rand_deg]; /* set end_ptr too */
- return(ostate);
-}
-
-/*
- * random:
- *
- * If we are using the trivial TYPE_0 R.N.G., just do the old linear
- * congruential bit. Otherwise, we do our fancy trinomial stuff, which is
- * the same in all the other cases due to all the global variables that have
- * been set up. The basic operation is to add the number at the rear pointer
- * into the one at the front pointer. Then both pointers are advanced to
- * the next location cyclically in the table. The value returned is the sum
- * generated, reduced to 31 bits by throwing away the "least random" low bit.
- *
- * Note: the code takes advantage of the fact that both the front and
- * rear pointers can't wrap on the same call by not testing the rear
- * pointer if the front one has wrapped.
- *
- * Returns a 31-bit random number.
- */
-long
-random()
-{
- register long i;
- register long *f, *r;
-
- if (rand_type == TYPE_0) {
- i = state[0];
- state[0] = i = (good_rand(i)) & 0x7fffffff;
- } else {
- /*
- * Use local variables rather than static variables for speed.
- */
- f = fptr; r = rptr;
- *f += *r;
- i = (*f >> 1) & 0x7fffffff; /* chucking least random bit */
- if (++f >= end_ptr) {
- f = state;
- ++r;
- }
- else if (++r >= end_ptr) {
- r = state;
- }
-
- fptr = f; rptr = r;
- }
- return(i);
-}
diff --git a/contrib/awk/random.h b/contrib/awk/random.h
deleted file mode 100644
index fe329a2..0000000
--- a/contrib/awk/random.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * random.h - redefine name of random lib routines to avoid conflicts
- */
-
-/*
- * Copyright (C) 1996, 2001 the Free Software Foundation, Inc.
- *
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- *
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define initstate gawk_initstate
-#define setstate gawk_setstate
-#define random gawk_random
-#define srandom gawk_srandom
-
-#ifdef __STDC__
-#undef __P
-#define __P(s) s
-#else
-#define __P(s) ()
-#endif
-
-extern long random();
diff --git a/contrib/awk/regex.h b/contrib/awk/regex.h
deleted file mode 100644
index 5771995..0000000
--- a/contrib/awk/regex.h
+++ /dev/null
@@ -1,538 +0,0 @@
-/* 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,98 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 _REGEX_H
-#define _REGEX_H 1
-
-/* Allow the use in C++ code. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* POSIX says that <sys/types.h> must be included (by the caller) before
- <regex.h>. */
-
-#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
-/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
- should be there. */
-# include <stddef.h>
-#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)
-
-/* If this bit is set, then character classes are supported. They are:
- [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- If not set, then character classes are not supported. */
-#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
-
-/* If this bit is set, then ^ and $ are always anchors (outside bracket
- expressions, of course).
- If this bit is not set, then it depends:
- ^ 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.
- We already implemented a previous draft which made those constructs
- invalid, though, so we haven't changed the code back. */
-#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
-
-/* 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)
-
-/* If this bit is set, then *, +, ?, and { cannot be first in an re or
- immediately after an alternation or begin-group operator. */
-#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
-
-/* If this bit is set, then . matches newline.
- If not set, then it doesn't. */
-#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
-
-/* If this bit is set, then . doesn't match NUL.
- If not set, then it does. */
-#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
-
-/* If this bit is set, nonmatching lists [^...] do not match newline.
- If not set, they do. */
-#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)
-
-/* If this bit is set, +, ? and | aren't recognized as operators.
- If not set, they are. */
-#define RE_LIMITED_OPS (RE_INTERVALS << 1)
-
-/* If this bit is set, newline is an alternation operator.
- If not set, newline is literal. */
-#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
-
-/* If this bit is set, then `{...}' defines an interval, and \{ and \}
- are literals.
- If not set, then `\{...\}' defines an interval. */
-#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
-
-/* If this bit is set, (...) defines a group, and \( and \) are literals.
- If not set, \(...\) defines a group, and ( and ) are literals. */
-#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
-
-/* If this bit is set, then \<digit> matches <digit>.
- If not set, then \<digit> 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)
-
-/* If this bit is set, then an ending range point collating higher
- than the starting range point, as in [z-a], is invalid.
- If not set, then when ending range point collates higher than the
- starting range point, the range is ignored. */
-#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
-
-/* If this bit is set, then an unmatched ) is ordinary.
- 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.
- This only works if regex.c is compiled -DDEBUG.
- 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
- stored in the pattern buffer, so changing this does not affect
- already-compiled regexps. */
-extern reg_syntax_t re_syntax_options;
-
-/* 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 \
- | RE_INTERVALS | RE_NO_GNU_OPS)
-
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
- | RE_NEWLINE_ALT)
-
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
- | RE_NO_BK_VBAR)
-
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
-
-/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
-#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
-
-#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
-
-/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
- | RE_INTERVALS | RE_NO_EMPTY_RANGES)
-
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
-
-/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
- RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
- isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- | RE_UNMATCHED_RIGHT_PAREN_ORD)
-
-/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS
- replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
-/* [[[end syntaxes]]] */
-
-/* Maximum number of duplicates an interval can allow. Some systems
- (erroneously) define this in other header files, but we want our
- value, so remove any previous define. */
-#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'). */
-
-/* If this bit is set, then use extended regular expression syntax.
- If not set, then use basic regular expression syntax. */
-#define REG_EXTENDED 1
-
-/* 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. */
-#define REG_NEWLINE (REG_ICASE << 1)
-
-/* If this bit is set, then report only success or fail in regexec.
- If not set, then returns differ between not matching and errors. */
-#define REG_NOSUB (REG_NEWLINE << 1)
-
-
-/* POSIX `eflags' bits (i.e., information for regexec). */
-
-/* If this bit is set, then the beginning-of-line operator doesn't match
- the beginning of the string (presumably because it's not the
- beginning of a line).
- If not set, then the beginning-of-line operator does match the
- beginning of the string. */
-#define REG_NOTBOL 1
-
-/* Like REG_NOTBOL, except for the end-of-line. */
-#define REG_NOTEOL (1 << 1)
-
-
-/* If any error codes are removed, changed, or added, update the
- `re_error_msg' table in regex.c. */
-typedef enum
-{
-#ifdef _XOPEN_SOURCE
- REG_ENOSYS = -1, /* This will never happen for this implementation. */
-#endif
-
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
-
- /* POSIX regcomp return error codes. (In the order listed in the
- standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- 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. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
-
- /* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
-} reg_errcode_t;
-
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields `buffer', `allocated', `fastmap',
- `translate', and `no_sub' can be set. After the pattern has been
- 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
-
-struct re_pattern_buffer
-{
-/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
- `unsigned char *' because its elements are
- sometimes used as array indexes. */
- 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;
-
- /* Pointer to a fastmap, if any, otherwise zero. re_search uses
- the fastmap, if there is one, to skip over impossible
- starting points for matches. */
- char *fastmap;
-
- /* Either a translate table to apply to all characters before
- comparing them, or zero for no translation. The translation
- is applied to a pattern when it is compiled and to a string
- when it is matched. */
- RE_TRANSLATE_TYPE translate;
-
- /* Number of subexpressions found by the compiler. */
- size_t re_nsub;
-
- /* Zero if this pattern cannot match the empty string, one else.
- Well, in truth it's used only in `re_search_2', to see
- whether or not we should use the fastmap, so we don't set
- this absolutely perfectly; see `re_compile_fastmap' (the
- `duplicate' case). */
- unsigned can_be_null : 1;
-
- /* If REGS_UNALLOCATED, allocate space in the `regs' structure
- for `max (RE_NREGS, re_nsub + 1)' groups.
- If REGS_REALLOCATE, reallocate space if necessary.
- If REGS_FIXED, use what's there. */
-#define REGS_UNALLOCATED 0
-#define REGS_REALLOCATE 1
-#define REGS_FIXED 2
- unsigned regs_allocated : 2;
-
- /* Set to zero when `regex_compile' compiles a pattern; set to one
- by `re_compile_fastmap' if it updates the fastmap. */
- unsigned fastmap_accurate : 1;
-
- /* If set, `re_match_2' does not return information about
- subexpressions. */
- 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. */
- unsigned not_eol : 1;
-
- /* If true, an anchor at a newline matches. */
- unsigned newline_anchor : 1;
-
-/* [[[end pattern_buffer]]] */
-};
-
-typedef struct re_pattern_buffer regex_t;
-
-/* Type for byte offsets within the string. POSIX mandates this. */
-typedef int regoff_t;
-
-
-/* This is the structure we store register match data in. See
- regex.texinfo for a full description of what registers match. */
-struct re_registers
-{
- unsigned num_regs;
- regoff_t *start;
- regoff_t *end;
-};
-
-
-/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
- `re_match_2' returns information about at least this many registers
- the first time a `regs' structure is passed. */
-#ifndef RE_NREGS
-# define RE_NREGS 30
-#endif
-
-
-/* POSIX specification for registers. Aside from the different names than
- `re_registers', POSIX uses an array of structures, instead of a
- structure of arrays. */
-typedef struct
-{
- regoff_t rm_so; /* Byte offset from string's start to substring's start. */
- regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
-} regmatch_t;
-
-/* Declarations for routines. */
-
-/* To avoid duplicating every routine declaration -- once with a
- prototype (if we are ANSI), and once without (if we aren't) -- we
- use the following macro to declare argument types. This
- unfortunately clutters up the declarations a bit, but I think it's
- worth it. */
-
-#if __STDC__
-
-# define _RE_ARGS(args) args
-
-#else /* not __STDC__ */
-
-# define _RE_ARGS(args) ()
-
-#endif /* not __STDC__ */
-
-/* Sets the current default syntax to SYNTAX, and return the old syntax.
- You can also simply assign to the `re_syntax_options' variable. */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
-
-/* Compile the regular expression PATTERN, with length LENGTH
- and syntax given by the global `re_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
-extern const char *re_compile_pattern
- _RE_ARGS ((const char *pattern, size_t length,
- struct re_pattern_buffer *buffer));
-
-
-/* Compile a fastmap for the compiled pattern in BUFFER; used to
- accelerate searches. Return 0 if successful and -2 if was an
- internal error. */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
-
-
-/* Search in the string STRING (with length LENGTH) for the pattern
- compiled into BUFFER. Start searching at position START, for RANGE
- characters. Return the starting position of the match, -1 for no
- match, or -2 for an internal error. Also return register
- information in REGS (if REGS and BUFFER->no_sub are nonzero). */
-extern int re_search
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, int range, struct re_registers *regs));
-
-
-/* Like `re_search', but search in the concatenation of STRING1 and
- STRING2. Also, stop searching at index START + STOP. */
-extern int re_search_2
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
- int length1, const char *string2, int length2,
- int start, int range, struct re_registers *regs, int stop));
-
-
-/* Like `re_search', but return how many characters in STRING the regexp
- in BUFFER matched, starting at position START. */
-extern int re_match
- _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
- int length, int start, struct re_registers *regs));
-
-
-/* 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));
-
-
-/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
- ENDS. Subsequent matches using BUFFER and REGS will use this memory
- for recording register information. STARTS and ENDS must be
- allocated with malloc, and must each be at least `NUM_REGS * sizeof
- (regoff_t)' bytes long.
-
- If NUM_REGS == 0, then subsequent matches should allocate their own
- register data.
-
- Unless this function is called, the first search or match using
- PATTERN_BUFFER will allocate its own register data, without
- freeing the old data. */
-extern void re_set_registers
- _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
- unsigned num_regs, regoff_t *starts, regoff_t *ends));
-
-#if defined _REGEX_RE_COMP || defined _LIBC
-# ifndef _CRAY
-/* 4.2 bsd compatibility. */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
-# endif
-#endif
-
-/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
- int __cflags));
-
-extern int regexec _RE_ARGS ((const regex_t *__preg,
- const char *__string, size_t __nmatch,
- regmatch_t __pmatch[], int __eflags));
-
-extern size_t regerror _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 /* regex.h */
-
-/*
-Local variables:
-make-backup-files: t
-version-control: t
-trim-versions-without-asking: nil
-End:
-*/
diff --git a/contrib/awk/test/ChangeLog b/contrib/awk/test/ChangeLog
deleted file mode 100644
index aa3b664..0000000
--- a/contrib/awk/test/ChangeLog
+++ /dev/null
@@ -1,585 +0,0 @@
-Sun Jun 3 13:04:44 2001 Arnold D. Robbins <arnold@skeeve.com>
-
- * Release 3.1.0: Release tar file made. And there was
- rejoicing.
-
-Sun May 6 13:30:20 2001 Arnold Robbins <arnold@skeeve.com>
-
- * inftest.awk: Changed test to use < so that it will
- work for MSC and DJGPP combination, per Scott Deifik.
-
-Tue Mar 20 11:09:51 2001 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (funsemnl): new test case.
- * funsemnl.awk, funsemnl.ok: new files.
-
-Wed Mar 7 11:31:41 2001 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (leadnl): new test case.
- * leadnl.awk, leadnl.in, leadnl.ok: new files.
-
-Tue Feb 6 18:08:15 2001 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (rebt8b1, rebt8b2): new test case.
- * rebt8b1.awk, rebt8b1.ok: new files.
- * rebt8b2.awk, rebt8b2.ok: new files.
-
-Sun Dec 3 15:36:41 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (gnuops2): New test case.
- * gnuops2.awk, gnuops2.ok: New files, based on bug report from
- Servatius.Brandt@fujitsu-siemens.com.
-
-Mon Nov 27 15:52:46 2000 Arnold Robbins <arnold@skeeve.com>
-
- * regx8bit.awk, regx8bit.ok: Updated to what should
- work on all systems.
-
-Wed Nov 22 13:27:59 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (poundbang): Added some smarts for /tmp mounted
- noexec. Hopefully it'll even work.
-
-Tue Nov 14 17:45:02 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am: Added - to all cmp calls for consistency.
-
-Sun Nov 12 17:50:18 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (addcomma): new test case.
- * addcomma.awk, addcomma.in, addcomma.ok: new files.
-
-Tue Nov 7 16:03:06 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (regx8bit, psx96sub): new test cases.
- * regx8bit.awk, regx8bit.ok, psx96sub.awk, psx96sub.ok: new files.
-
-Sun Oct 22 12:09:43 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (shadow): new test case.
- * shadow.awk, shadow.ok: new files.
-
-Tue Oct 17 10:51:09 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (arynasty): new test case.
- * arynasty.awk, arynasty.ok: new files.
-
-Mon Oct 2 10:17:13 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (clsflnam): Add redirect of stderr.
- * clsflnam.awk, clsflnam.ok: modified to reflect changed
- semantics of close() for a non-open file. See ../ChangeLog.
-
-Sun Sep 24 16:46:29 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (nasty2): new test case.
- * nasty2.awk, nasty2.ok: new files.
-
-Wed Sep 13 11:09:49 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (check): Added calls to new targets that
- print messages.
- (clos1way, basic-msg-start, basic-msg-end, unix-msg-start,
- unix-msg-end, extend-msg-start, extend-msg-end): new targets.
- * clos1way.awk, clos1way.ok: new files.
-
-Tue Sep 12 16:29:54 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (leaddig): new test case.
- * leaddig.awk, leaddig.ok: new files.
-
-Wed Sep 6 14:09:15 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (strtod): new test case.
- * strtod.awk, strtod.in, strtod.ok: new files.
-
-Mon Sep 4 09:33:28 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (octsub): new test case.
- * octsub.awk, octsub.ok: new files.
-
-Sun Aug 13 12:37:16 2000 Arnold Robbins <arnold@skeeve.com>
-
- * Makefile.am (sort1, diffout): new test cases.
- * sort1.awk, sort1.ok: new files.
-
-2000-02-15 Arnold Robbins <arnold@skeeve.com>
-
- * MOVED TO AUTOMAKE AND GETTEXT.
- Just about every file touched. Work done by Arno Peters.
-
-Wed May 19 15:41:41 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (datanonl,regeq,redfilnm): new test cases.
- * datanonl.awk, datanonl.in, datanonl.ok: new files.
- * regeq.awk, regeq.in, regeq.ok: new files.
- * redfilnm.awk, redfilnm.in, redfilnm.ok: new files.
-
-Mon May 10 17:11:30 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (rsnul1nl): new test case.
- * rsnul1nl.awk, rsnul1nl.in, rsnul1nl.ok: new files.
-
-Sun Apr 25 13:02:35 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (inetechu,inetecht,inetdayu,inetdayt,inet): new
- tests, courtesy of Juergen Khars.
- (paramtyp): new test for bug from Juergen.
- * paramtyp.awk, paramtyp.in: new files.
-
-Sun Oct 25 23:11:46 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (ofmtbig,procinfs): new test cases.
- * procinfs.awk, procinfs.ok: new files.
- * ofmtbig.awk, ofmtbig.in, ofmtbig.ok: new files.
-
-Tue Oct 20 22:07:10 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (lint): new test case.
- * lint.awk, lint.ok: new files.
- * badargs.ok: updated output corresponding to change made to
- main.c (see main ChangeLog).
-
-Tue May 26 20:39:07 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * pipeio2.awk: change "\'" to "'" to avoid new warning.
-
-Mon Mar 23 21:53:36 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (fnasgnm): new test case.
- * fnasgnm.awk, fnasgnm.in, fnasgnm.ok: new files.
-
-Fri Mar 20 11:01:38 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (fnaryscl): new test case.
- * fnaryscl.awk, fnaryscl.ok: new files.
-
-Mon Mar 16 15:23:22 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (splitdef): new test case.
- * splitdef.awk, splitdef.ok: new files.
-
-Fri Sep 26 01:10:14 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (parseme): new test case.
- * parseme.awk, parseme.ok: new files.
-
-Sun Sep 14 23:25:10 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (ofmts): new test case.
- * ofmts.awk, ofmts.in, ofmts.ok: new files.
-
-Sun Aug 17 07:17:35 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (fsfwfs): new test case.
- * fsfwfs.awk, fsfwfs.in, fsfwfs.ok: new files.
-
-Sun Jul 27 23:08:53 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (hsprint): new test case.
- * hsprint.awk, hsprint.ok, printfloat.awk: new files.
-
-Thu Jul 17 20:07:31 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (ofmt): new test case.
- * ofmt.awk, ofmt.in, ofmt.ok: new files.
-
-Sun Jun 22 16:17:35 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (nlinstr): new test case.
- * nlinstr.awk, nlinstr.in, nlinstr.ok: new files.
-
-Wed Jun 4 13:18:21 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * pid.sh: send errors to /dev/null to toss warning about
- using PROCINFO["pid"] etc. This test explicitly tests
- the special files. It'll need changing in 3.2.
-
-Thu Apr 24 23:24:59 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (messages): remove special case if /dev/fd exists.
- Finally.
-
-Mon Aug 7 15:23:00 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Release 3.0.6: Release tar file made.
-
-Thu Aug 3 17:51:56 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (nlstrina): new test case.
- * nlstrina.awk, nlstrina.ok: new files.
-
-Tue Jul 11 14:22:55 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (fnparydl): new test case.
- * fnparydl.awk, fnparydl.ok: new files.
-
-Fri Jun 30 22:00:03 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (arysubnm): new test case.
- * arysubnm.awk, arysubnm.ok: new files.
-
-Sun Jun 25 15:08:19 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Release 3.0.5: Release tar file made.
-
-Wed Jun 14 13:17:59 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (getlnbuf): new test case.
- * getlnbuf.awk, gtlnbufv.awk, getlnbuf.in, getlnbuf.ok: new files.
-
-Mon Jun 5 15:51:39 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * pipeio2.awk: Change use of tr to sed, fixes problems
- on SCO OS5.
- * pipeio2.ok: Updated to reflect use of sed.
-
-Tue May 2 13:28:04 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (strftime): moved test code into a separate
- file for the PC guys.
- * strftime.awk: new file.
-
-Mon Apr 10 15:58:13 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (longwrds): Add setting LC_ALL=C to sort
- call to preserve traditional output. (Theme from the
- Twilight Zone plays eerily in the background...)
-
-Sun Apr 2 17:51:40 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (igncdym): new test case.
- * igncdym.awk, igncdym.in, igncdym.ok: new files.
-
-Wed Mar 8 13:43:44 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (arynocls): new test case.
- * arynocls.awk, arynocls.in, arynocls.ok: new files.
-
-Sun Feb 6 11:45:15 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (opasnidx): new test case.
- * opasnidx.awk, opasnidx.ok: new files.
-
-Tue Feb 1 18:40:45 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (opasnslf): new test case.
- * opasnslf.awk, opasnslf.ok: new files.
-
-Thu Jan 27 18:09:18 2000 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (subslash): new test case.
- * subslash.awk, subslash.ok: new files.
-
-Fri Nov 26 11:03:07 1999 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (numindex): new test case.
- * numindex.awk, numindex.in, numindex.ok: new files.
-
-Sun Oct 24 08:46:16 1999 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (strftime): Add tweak for $NF that should
- hopefully avoid cygwin problems with lack of timezone.
-
-Thu Jul 29 19:25:02 1999 Arnold D. Robbins <arnold@skeeve.com>
-
- * Makefile.in (fsmnam, fnamedat): new test cases.
- * fsmnam.awk, fsmnam.ok: new files.
- * fnamedat.awk, fnamedat.in, fnamedat.ok: new files.
-
-Wed Jun 30 16:14:36 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Release 3.0.4: Release tar file made. This time for sure.
-
-Tue May 25 16:37:50 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (printf1): new test case.
- * printf1.awk, printf1.ok: new files.
-
-Wed May 19 15:32:09 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * reg/*: moved exp and log tests to new `Obsolete' directory; they
- would only succeed under SunOS 4.x.
-
-Mon May 3 11:53:33 1999 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (gawk.extensions): removed `nondec' until the
- associated features get documented in 3.1.
-
-Tue Nov 3 16:46:39 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (getnr2tm, getnr2tb): new test cases.
- * getnr2tm.awk, getnr2tm.in, getnr2tm.ok: new files.
- * getnr2tb.awk, getnr2tb.in, getnr2tb.ok: new files.
-
-Sun Nov 1 13:20:08 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (zeroflag): new test case.
- * zeroflag.awk, zeroflag.ok: new files
-
-Wed Oct 28 18:44:19 1998 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (nasty): new test case.
- * nasty.awk, nasty.ok: new files
-
-Sun Nov 16 20:08:59 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * gsubtest.awk, gsubtest.ok: fix for count of matches in gsub
- from Geert.Debyser@esat.kuleuven.ac.be.
-
-Sun Nov 16 19:54:50 1997 Arnold D. Robbins <arnold@gnu.org>
-
- * Makefile.in (strftime): fix a typo (LANC -> LANG).
-
-Thu May 15 12:49:08 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Release 3.0.3: Release tar file made.
-
-Tue May 13 12:53:46 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (messages): more testing for OK failure on Linux.
-
-Sun May 11 14:57:11 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (nondec): new test case.
- * nondec.awk, nondec.ok: new files.
-
-Sun May 11 07:07:05 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (prdupval): new test case.
- * prdupval.awk, prdupval.in, prdupval.ok: new files.
-
-Wed May 7 21:54:34 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (delarprm): new test case.
- * delarprm.awk, delarprm.ok: new files.
-
-Wed May 7 17:54:00 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (pid): several fixes from ghazi@caip.rutgers.edu.
-
-Tue May 6 20:28:30 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * 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 <arnold@skeeve.atl.ga.us>
-
- * 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 <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (pipeio2): new test case.
- * pipeio2.awk, pipeio2.ok, pipeio2.in: new files.
-
-Sun Apr 20 12:22:52 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (clobber): new test case.
- * clobber.awk, clobber.ok: new files.
-
-Fri Apr 18 07:55:47 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * BETA Release 3.0.34: Release tar file made.
-
-Tue Apr 15 05:57:29 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * 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 <arnold@skeeve.atl.ga.us>
-
- * 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 <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (pipeio1): new test case.
- * pipeio1.awk, pipeio1.ok: new files.
-
-Tue Mar 18 06:38:36 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (noparm): new test case.
- * noparm.awk, noparm.ok: new files.
-
-Fri Feb 21 06:30:18 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (reint): new test case.
- * reint.awk, reint.in, reint.ok: new files.
-
-Wed Feb 5 18:17:51 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (fnarydel): new test case.
- * fnarydel.awk, fnarydel.ok: new files.
-
-Sun Jan 19 17:06:18 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (nors): new test case.
- * nors.ok: new file.
-
-Sun Jan 19 17:06:18 1997 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * 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 <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (intest): new test case.
- * intest.awk, intest.ok: new files.
-
-Wed Dec 25 11:25:22 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Release 3.0.2: Release tar file made.
-
-Tue Dec 10 23:09:26 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Release 3.0.1: Release tar file made.
-
-Thu Nov 7 09:12:20 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (splitvar): new test case.
- * splitvar.awk, splitvar.in, splitvar.ok: new files.
-
-Sun Nov 3 10:55:50 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (nlfldsep): new test case.
- * nlfldsep.sh, nlfldsep.ok: new files.
-
-Fri Oct 25 10:29:56 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * rand.awk: call srand with fixed seed.
- * rand.ok: new file.
- * Makefile.in (rand): changed to compare output with rand.ok.
-
-Sat Oct 19 21:52:04 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (tradanch): new test case.
- * tradanch.awk, tradanch.in, tradanch.ok: new files.
-
-Thu Oct 17 21:22:05 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * tweakfld.awk: move `rm' out into Makefile.in.
- * eofsplit.awk: fixed buggy code so won't loop forever.
- * Makefile.in (all): add unix-tests.
- (unix-tests): new target, has pound-bang, fflush, getlnhd.
- (basic): removed fflush, getlnhd.
- (tweakfld): added rm from tweakfld.awk.
-
-Sun Oct 6 22:00:35 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (back89): new test case.
- * back89.in, back89.ok: new files.
-
-Sun Oct 6 20:45:54 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (splitwht): new test case.
- * splitwht.awk, splitwht.ok: new files.
-
-Sun Sep 29 23:14:20 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (gsubtest): new test case.
- * gsubtest.awk, gsubtest.ok: new files.
-
-Fri Sep 20 11:58:40 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (prtoeval): new test case.
- * prtoeval.awk, prtoeval.ok: new files.
-
-Tue Sep 10 06:26:44 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (gsubasgn): new test case.
- * gsubasgn.awk, gsubasgn.ok: new files.
-
-Wed Aug 28 22:06:33 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * badargs.ok: updated output corresponding to change made to
- main.c (see main ChangeLog).
-
-Thu Aug 1 07:20:28 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (clean): remove out[123] files from `messages' test.
- Thanks to Pat Rankin (rankin@eql.caltech.edu).
-
-Sat Jul 27 23:56:57 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (prt1eval): new test case.
- * prt1eval.awk, prt1eval.ok: new files.
-
-Mon Jul 22 22:06:10 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (eofsplit): new test case.
- * eofsplit.awk, eofsplit.ok: new files.
-
-Sun Jul 14 07:07:45 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (fldchgnf): new test case.
- * fldchgnf.awk, fldchgnf.ok: new files.
-
-Tue May 21 23:23:22 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (substr): new test case.
- * substr.awk, substr.ok: new files.
-
-Tue May 14 15:05:23 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (dynlj): new test case.
- * dynlj.awk, dynlj.ok: new files.
-
-Sun May 12 20:45:34 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (fnarray): new test case.
- * fnarray.awk, fnarray.ok: new files.
-
-Fri Mar 15 06:46:48 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (clean): added `*~' to list of files to be removed.
- * tweakfld.awk (END): added to do clean up action.
-
-Thu Mar 14 16:41:32 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (mmap8k): new test case.
- * mmap8k.in, mmap8k.ok: new files.
-
-Sun Mar 10 22:58:35 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (clsflnam): new test case.
- * clsflnam.in, clsflnam.awk, clsflnam.ok: new files.
- * tweakfld.awk: changed to have a fixed date.
-
-Thu Mar 7 09:56:09 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (tweakfld): new test case.
- * tweakfld.in, tweakfld.awk, tweakfld.ok: new files.
-
-Sun Mar 3 06:51:26 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (getlnhd, backgsub) : new test cases.
- * getlnhd.awk, getlnhd.ok: new files.
- * backgsub.in, backgsub.awk, backgsub.ok: new files.
-
-Mon Feb 26 22:30:02 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (sprintfc): new test case.
- * sprintfc.in, sprintfc.awk, sprintfc.ok: new files.
- * gensub.awk: updated for case of no match of regex.
-
-Wed Jan 24 10:06:16 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * Makefile.in (distclean, maintainer-clean): new targets.
- (reindops): added test from Rick Adams (rick@uunet.uu.net).
- (arrayparm, paramdup, defref, strftime, prmarscl, sclforin,
- sclifin): Fix from Larry Schwimmer (schwim@cyclone.stanford.edu)
- so that tests that are supposed to fail use `... || exit 0' to
- cause a clean `make clean'.
-
-Wed Jan 10 22:58:55 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us>
-
- * ChangeLog created.
diff --git a/contrib/awk/test/Makefile b/contrib/awk/test/Makefile
deleted file mode 100644
index 1a9168e..0000000
--- a/contrib/awk/test/Makefile
+++ /dev/null
@@ -1,451 +0,0 @@
-# Generated automatically from Makefile.in by configure.
-# 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.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-
-SHELL = /bin/sh
-AWK = ../gawk
-CMP = cmp
-
-srcdir = .
-
-bigtest: basic unix-tests gawk.extensions
-
-basic: 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 nofmtch litoct resplit \
- rswhite prmarscl sclforin sclifin intprec childin noeffect \
- 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::
- @echo 'Any output from "cmp" is bad news, although some differences'
- @echo 'in floating point values are probably benign -- in particular,'
- @echo 'some systems may omit a leading zero and the floating point'
- @echo 'precision may lead to slightly different output in a few cases.'
-
-swaplns::
- @$(AWK) -f $(srcdir)/swaplns.awk $(srcdir)/swaplns.in >_$@
- $(CMP) $(srcdir)/swaplns.ok _$@ && rm -f _$@
-
-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 \
- .) : ;; \
- *) cp $(srcdir)/argarray.in . ;; \
- esac
- @TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@
- $(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@
-
-fstabplus::
- @echo '1 2' | $(AWK) -f $(srcdir)/fstabplus.awk >_$@
- $(CMP) $(srcdir)/fstabplus.ok _$@ && rm -f _$@
-
-fsrs::
- @$(AWK) -f $(srcdir)/fsrs.awk $(srcdir)/fsrs.in >_$@
- $(CMP) $(srcdir)/fsrs.ok _$@ && rm -f _$@
-
-igncfs::
- @$(AWK) -f $(srcdir)/igncfs.awk $(srcdir)/igncfs.in >_$@
- $(CMP) $(srcdir)/igncfs.ok _$@ && rm -f _$@
-
-longwrds::
- @$(AWK) -f $(srcdir)/longwrds.awk $(srcdir)/manpage | sort >_$@
- $(CMP) $(srcdir)/longwrds.ok _$@ && rm -f _$@
-
-fieldwdth::
- @echo '123456789' | $(AWK) -v FIELDWIDTHS="2 3 4" '{ print $$2}' >_$@
- $(CMP) $(srcdir)/fieldwdth.ok _$@ && rm -f _$@
-
-ignrcase::
- @echo xYz | $(AWK) -v IGNORECASE=1 '{ sub(/y/, ""); print}' >_$@
- $(CMP) $(srcdir)/ignrcase.ok _$@ && rm -f _$@
-
-regtest::
- @echo 'Some of the output from regtest is very system specific, do not'
- @echo 'be distressed if your output differs from that distributed.'
- @echo 'Manual inspection is called for.'
- AWK=`pwd`/$(AWK) $(srcdir)/regtest
-
-posix::
- @echo '1:2,3 4' | $(AWK) -f $(srcdir)/posix.awk >_$@
- $(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@
-
-manyfiles::
- @rm -rf junk
- @mkdir junk
- @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@
- @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@
- @echo "This number better be 1 ->" | tr -d '\012'
- @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l
- @rm -rf junk _$@
-
-compare::
- @$(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@
- $(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@
-
-arrayref::
- @$(AWK) -f $(srcdir)/arrayref.awk >_$@
- $(CMP) $(srcdir)/arrayref.ok _$@ && rm -f _$@
-
-rs::
- @$(AWK) -v RS="" '{ print $$1, $$2}' $(srcdir)/rs.in >_$@
- $(CMP) $(srcdir)/rs.ok _$@ && rm -f _$@
-
-fsbs::
- @$(AWK) -v FS='\' '{ print $$1, $$2 }' $(srcdir)/fsbs.in >_$@
- $(CMP) $(srcdir)/fsbs.ok _$@ && rm -f _$@
-
-inftest::
- @echo This test is very machine specific...
- @$(AWK) -f $(srcdir)/inftest.awk >_$@
- $(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@
-
-getline::
- @$(AWK) -f $(srcdir)/getline.awk $(srcdir)/getline.awk $(srcdir)/getline.awk >_$@
- $(CMP) $(srcdir)/getline.ok _$@ && rm -f _$@
-
-rand::
- @$(AWK) -f $(srcdir)/rand.awk >_$@
- $(CMP) $(srcdir)/rand.ok _$@ && rm -f _$@
-
-negexp::
- @$(AWK) 'BEGIN { a = -2; print 10^a }' >_$@
- $(CMP) $(srcdir)/negexp.ok _$@ && rm -f _$@
-
-asgext::
- @$(AWK) -f $(srcdir)/asgext.awk $(srcdir)/asgext.in >_$@
- $(CMP) $(srcdir)/asgext.ok _$@ && rm -f _$@
-
-anchgsub::
- @$(AWK) -f $(srcdir)/anchgsub.awk $(srcdir)/anchgsub.in >_$@
- $(CMP) $(srcdir)/anchgsub.ok _$@ && rm -f _$@
-
-splitargv::
- @$(AWK) -f $(srcdir)/splitargv.awk $(srcdir)/splitargv.in >_$@
- $(CMP) $(srcdir)/splitargv.ok _$@ && rm -f _$@
-
-awkpath::
- @AWKPATH="$(srcdir):$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@
- $(CMP) $(srcdir)/awkpath.ok _$@ && rm -f _$@
-
-nfset::
- @$(AWK) -f $(srcdir)/nfset.awk $(srcdir)/nfset.in >_$@
- $(CMP) $(srcdir)/nfset.ok _$@ && rm -f _$@
-
-reparse::
- @$(AWK) -f $(srcdir)/reparse.awk $(srcdir)/reparse.in >_$@
- $(CMP) $(srcdir)/reparse.ok _$@ && rm -f _$@
-
-argtest::
- @$(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@
- $(CMP) $(srcdir)/argtest.ok _$@ && rm -f _$@
-
-badargs::
- @-$(AWK) -f 2>&1 | grep -v patchlevel >_$@
- $(CMP) $(srcdir)/badargs.ok _$@ && rm -f _$@
-
-convfmt::
- @$(AWK) -f $(srcdir)/convfmt.awk >_$@
- $(CMP) $(srcdir)/convfmt.ok _$@ && rm -f _$@
-
-arrayparm::
- @-AWKPATH=$(srcdir) $(AWK) -f arrayparm.awk >_$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/arrayparm.ok _$@ && rm -f _$@
-
-paramdup::
- @-AWKPATH=$(srcdir) $(AWK) -f paramdup.awk >_$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/paramdup.ok _$@ && rm -f _$@
-
-nonl::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk /dev/null >_$@ 2>&1
- $(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@
-
-defref::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f defref.awk >_$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/defref.ok _$@ && rm -f _$@
-
-nofmtch::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f nofmtch.awk >_$@ 2>&1
- $(CMP) $(srcdir)/nofmtch.ok _$@ && rm -f _$@
-
-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
-
-litoct::
- @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@
- $(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@
-
-gensub::
- @$(AWK) -f $(srcdir)/gensub.awk $(srcdir)/gensub.in >_$@
- $(CMP) $(srcdir)/gensub.ok _$@ && rm -f _$@
-
-resplit::
- @echo a:b:c d:e:f | $(AWK) '{ FS = ":"; $$0 = $$0; print $$2 }' > _$@
- $(CMP) $(srcdir)/resplit.ok _$@ && rm -f _$@
-
-rswhite::
- @$(AWK) -f $(srcdir)/rswhite.awk $(srcdir)/rswhite.in > _$@
- $(CMP) $(srcdir)/rswhite.ok _$@ && rm -f _$@
-
-prmarscl::
- @-AWKPATH=$(srcdir) $(AWK) -f prmarscl.awk > _$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/prmarscl.ok _$@ && rm -f _$@
-
-sclforin::
- @-AWKPATH=$(srcdir) $(AWK) -f sclforin.awk > _$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/sclforin.ok _$@ && rm -f _$@
-
-sclifin::
- @-AWKPATH=$(srcdir) $(AWK) -f sclifin.awk > _$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/sclifin.ok _$@ && rm -f _$@
-
-intprec::
- @-$(AWK) -f $(srcdir)/intprec.awk > _$@ 2>&1
- $(CMP) $(srcdir)/intprec.ok _$@ && rm -f _$@
-
-childin::
- @echo hi | $(AWK) 'BEGIN { "cat" | getline; print; close("cat") }' > _$@
- $(CMP) $(srcdir)/childin.ok _$@ && rm -f _$@
-
-noeffect::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f noeffect.awk > _$@ 2>&1
- $(CMP) $(srcdir)/noeffect.ok _$@ && rm -f _$@
-
-numsubstr::
- @-AWKPATH=$(srcdir) $(AWK) -f numsubstr.awk $(srcdir)/numsubstr.in >_$@
- $(CMP) $(srcdir)/numsubstr.ok _$@ && rm -f _$@
-
-gnureops::
- @$(AWK) -f $(srcdir)/gnureops.awk >_$@
- $(CMP) $(srcdir)/gnureops.ok _$@ && rm -f _$@
-
-pcntplus::
- @$(AWK) -f $(srcdir)/pcntplus.awk >_$@
- $(CMP) $(srcdir)/pcntplus.ok _$@ && rm -f _$@
-
-prmreuse::
- @$(AWK) -f $(srcdir)/prmreuse.awk >_$@
- $(CMP) $(srcdir)/prmreuse.ok _$@ && rm -f _$@
-
-math::
- @$(AWK) -f $(srcdir)/math.awk >_$@
- $(CMP) $(srcdir)/math.ok _$@ && rm -f _$@
-
-fflush::
- @$(srcdir)/fflush.sh >_$@
- $(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@
-
-fldchg::
- @$(AWK) -f $(srcdir)/fldchg.awk $(srcdir)/fldchg.in >_$@
- $(CMP) $(srcdir)/fldchg.ok _$@ && rm -f _$@
-
-fldchgnf::
- @$(AWK) -f $(srcdir)/fldchgnf.awk $(srcdir)/fldchgnf.in >_$@
- $(CMP) $(srcdir)/fldchgnf.ok _$@ && rm -f _$@
-
-reindops::
- @$(AWK) -f $(srcdir)/reindops.awk $(srcdir)/reindops.in >_$@
- $(CMP) $(srcdir)/reindops.ok _$@ && rm -f _$@
-
-sprintfc::
- @$(AWK) -f $(srcdir)/sprintfc.awk $(srcdir)/sprintfc.in >_$@
- $(CMP) $(srcdir)/sprintfc.ok _$@ && rm -f _$@
-
-getlnhd::
- @$(AWK) -f $(srcdir)/getlnhd.awk >_$@
- $(CMP) $(srcdir)/getlnhd.ok _$@ && rm -f _$@
-
-backgsub::
- @$(AWK) -f $(srcdir)/backgsub.awk $(srcdir)/backgsub.in >_$@
- $(CMP) $(srcdir)/backgsub.ok _$@ && rm -f _$@
-
-tweakfld::
- @$(AWK) -f $(srcdir)/tweakfld.awk $(srcdir)/tweakfld.in >_$@
- @rm -f errors.cleanup
- $(CMP) $(srcdir)/tweakfld.ok _$@ && rm -f _$@
-
-clsflnam::
- @$(AWK) -f $(srcdir)/clsflnam.awk $(srcdir)/clsflnam.in >_$@
- $(CMP) $(srcdir)/clsflnam.ok _$@ && rm -f _$@
-
-mmap8k::
- @$(AWK) '{ print }' $(srcdir)/mmap8k.in >_$@
- $(CMP) $(srcdir)/mmap8k.in _$@ && rm -f _$@
-
-fnarray::
- @-AWKPATH=$(srcdir) $(AWK) -f fnarray.awk >_$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/fnarray.ok _$@ && rm -f _$@
-
-dynlj::
- @$(AWK) -f $(srcdir)/dynlj.awk >_$@
- $(CMP) $(srcdir)/dynlj.ok _$@ && rm -f _$@
-
-substr::
- @$(AWK) -f $(srcdir)/substr.awk >_$@
- $(CMP) $(srcdir)/substr.ok _$@ && rm -f _$@
-
-eofsplit::
- @$(AWK) -f $(srcdir)/eofsplit.awk >_$@
- $(CMP) $(srcdir)/eofsplit.ok _$@ && rm -f _$@
-
-prt1eval::
- @$(AWK) -f $(srcdir)/prt1eval.awk >_$@
- $(CMP) $(srcdir)/prt1eval.ok _$@ && rm -f _$@
-
-gsubasgn::
- @-AWKPATH=$(srcdir) $(AWK) -f gsubasgn.awk >_$@ 2>&1 || exit 0
- $(CMP) $(srcdir)/gsubasgn.ok _$@ && rm -f _$@
-
-prtoeval::
- @$(AWK) -f $(srcdir)/prtoeval.awk >_$@
- $(CMP) $(srcdir)/prtoeval.ok _$@ && rm -f _$@
-
-gsubtest::
- @$(AWK) -f $(srcdir)/gsubtest.awk >_$@
- $(CMP) $(srcdir)/gsubtest.ok _$@ && rm -f _$@
-
-splitwht::
- @$(AWK) -f $(srcdir)/splitwht.awk >_$@
- $(CMP) $(srcdir)/splitwht.ok _$@ && rm -f _$@
-
-back89::
- @$(AWK) '/a\8b/' $(srcdir)/back89.in >_$@
- $(CMP) $(srcdir)/back89.ok _$@ && rm -f _$@
-
-tradanch::
- @$(AWK) --traditional -f $(srcdir)/tradanch.awk $(srcdir)/tradanch.in >_$@
- $(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
-
-maintainer-clean: distclean
diff --git a/contrib/awk/test/Makefile.in b/contrib/awk/test/Makefile.in
deleted file mode 100644
index a02467e..0000000
--- a/contrib/awk/test/Makefile.in
+++ /dev/null
@@ -1,1236 +0,0 @@
-# Makefile.in generated automatically by automake 1.4a from Makefile.am
-
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
-# Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_FLAG =
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-
-@SET_MAKE@
-AMDEP = @AMDEP@
-AMTAR = @AMTAR@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-DATADIRNAME = @DATADIRNAME@
-DEPDIR = @DEPDIR@
-GENCAT = @GENCAT@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-GT_NO = @GT_NO@
-GT_YES = @GT_YES@
-INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
-INSTOBJEXT = @INSTOBJEXT@
-INTLDEPS = @INTLDEPS@
-INTLLIBS = @INTLLIBS@
-INTLOBJS = @INTLOBJS@
-LN_S = @LN_S@
-MAKEINFO = @MAKEINFO@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-PACKAGE = @PACKAGE@
-POFILES = @POFILES@
-POSUB = @POSUB@
-RANLIB = @RANLIB@
-SOCKET_LIBS = @SOCKET_LIBS@
-U = @U@
-USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-YACC = @YACC@
-install_sh = @install_sh@
-l = @l@
-
-#
-# test/Makefile.am --- automake input file for gawk
-#
-# Copyright (C) 1988-2001 the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
-#
-
-
-EXTRA_DIST = \
- reg \
- lib \
- README \
- addcomma.awk \
- addcomma.in \
- addcomma.ok \
- anchgsub.awk \
- anchgsub.in \
- anchgsub.ok \
- argarray.awk \
- argarray.in \
- argarray.ok \
- argtest.awk \
- argtest.ok \
- arrayparm.awk \
- arrayparm.ok \
- arrayref.awk \
- arrayref.ok \
- arynasty.awk \
- arynasty.ok \
- arynocls.awk \
- arynocls.in \
- arynocls.ok \
- arysubnm.awk \
- arysubnm.ok \
- asgext.awk \
- asgext.in \
- asgext.ok \
- awkpath.ok \
- back89.in \
- back89.ok \
- backgsub.awk \
- backgsub.in \
- backgsub.ok \
- badargs.ok \
- childin.ok \
- clobber.awk \
- clobber.ok \
- clos1way.awk \
- clos1way.ok \
- clsflnam.awk \
- clsflnam.in \
- clsflnam.ok \
- compare.awk \
- compare.in \
- compare.ok \
- convfmt.awk \
- convfmt.ok \
- datanonl.awk \
- datanonl.in \
- datanonl.ok \
- defref.awk \
- defref.ok \
- delarprm.awk \
- delarprm.ok \
- dynlj.awk \
- dynlj.ok \
- eofsplit.awk \
- eofsplit.ok \
- fflush.ok \
- fflush.sh \
- fieldwdth.ok \
- fldchg.awk \
- fldchg.in \
- fldchg.ok \
- fldchgnf.awk \
- fldchgnf.in \
- fldchgnf.ok \
- fnamedat.awk \
- fnamedat.in \
- fnamedat.ok \
- fnarray.awk \
- fnarray.ok \
- fnarydel.awk \
- fnarydel.ok \
- fnaryscl.awk \
- fnaryscl.ok \
- fnasgnm.awk \
- fnasgnm.in \
- fnasgnm.ok \
- fnparydl.awk \
- fnparydl.ok \
- fsbs.in \
- fsbs.ok \
- fsfwfs.awk \
- fsfwfs.in \
- fsfwfs.ok \
- fsrs.awk \
- fsrs.in \
- fsrs.ok \
- fstabplus.awk \
- fstabplus.ok \
- funsemnl.awk \
- funsemnl.ok \
- funsmnam.awk \
- funsmnam.ok \
- funstack.awk \
- funstack.in \
- funstack.ok \
- gensub.awk \
- gensub.in \
- gensub.ok \
- getline.awk \
- getline.ok \
- getlnbuf.awk \
- getlnbuf.in \
- getlnbuf.ok \
- getlnhd.awk \
- getlnhd.ok \
- getnr2tb.awk \
- getnr2tb.in \
- getnr2tb.ok \
- getnr2tm.awk \
- getnr2tm.in \
- getnr2tm.ok \
- gnuops2.awk \
- gnuops2.ok \
- gnureops.awk \
- gnureops.ok \
- gsubasgn.awk \
- gsubasgn.ok \
- gsubtest.awk \
- gsubtest.ok \
- gtlnbufv.awk \
- hsprint.awk \
- hsprint.ok \
- igncdym.awk \
- igncdym.in \
- igncdym.ok \
- igncfs.awk \
- igncfs.in \
- igncfs.ok \
- ignrcase.ok \
- inftest.awk \
- inftest.ok \
- intest.awk \
- intest.ok \
- intprec.awk \
- intprec.ok \
- leaddig.awk \
- leaddig.ok \
- leadnl.awk \
- leadnl.in \
- leadnl.ok \
- lint.awk \
- lint.ok \
- litoct.awk \
- litoct.ok \
- longwrds.awk \
- longwrds.ok \
- manpage \
- manyfiles.awk \
- math.awk \
- math.ok \
- messages.awk \
- mmap8k.in \
- nasty.awk \
- nasty.ok \
- nasty2.awk \
- nasty2.ok \
- negexp.ok \
- nfldstr.ok \
- nfset.awk \
- nfset.in \
- nfset.ok \
- nlfldsep.awk \
- nlfldsep.in \
- nlfldsep.ok \
- nlinstr.awk \
- nlinstr.in \
- nlinstr.ok \
- nlstrina.awk \
- nlstrina.ok \
- noeffect.awk \
- noeffect.ok \
- nofmtch.awk \
- nofmtch.ok \
- nondec.awk \
- nondec.ok \
- nonl.awk \
- nonl.ok \
- noparms.awk \
- noparms.ok \
- nors.in \
- nors.ok \
- numindex.awk \
- numindex.in \
- numindex.ok \
- numsubstr.awk \
- numsubstr.in \
- numsubstr.ok \
- octsub.awk \
- octsub.ok \
- ofmt.awk \
- ofmt.in \
- ofmt.ok \
- ofmtbig.awk \
- ofmtbig.in \
- ofmtbig.ok \
- ofmts.awk \
- ofmts.in \
- ofmts.ok \
- opasnidx.awk \
- opasnidx.ok \
- opasnslf.awk \
- opasnslf.ok \
- out1.ok \
- out2.ok \
- out3.ok \
- paramdup.awk \
- paramdup.ok \
- paramtyp.awk \
- paramtyp.ok \
- parseme.awk \
- parseme.ok \
- pcntplus.awk \
- pcntplus.ok \
- pid.awk \
- pid.ok \
- pid.sh \
- pipeio1.awk \
- pipeio1.ok \
- pipeio2.awk \
- pipeio2.in \
- pipeio2.ok \
- posix.awk \
- posix.ok \
- poundbang.awk \
- poundbang.ok \
- prdupval.awk \
- prdupval.in \
- prdupval.ok \
- printf1.awk \
- printf1.ok \
- printfloat.awk \
- prmarscl.awk \
- prmarscl.ok \
- prmreuse.awk \
- prmreuse.ok \
- procinfs.awk \
- procinfs.ok \
- prt1eval.awk \
- prt1eval.ok \
- prtoeval.awk \
- prtoeval.ok \
- psx96sub.awk \
- psx96sub.ok \
- rand.awk \
- rand.ok \
- rebt8b1.awk \
- rebt8b1.ok \
- rebt8b2.awk \
- rebt8b2.ok \
- redfilnm.awk \
- redfilnm.in \
- redfilnm.ok \
- regeq.awk \
- regeq.in \
- regeq.ok \
- regtest.sh \
- regx8bit.awk \
- regx8bit.ok \
- reindops.awk \
- reindops.in \
- reindops.ok \
- reint.awk \
- reint.in \
- reint.ok \
- reparse.awk \
- reparse.in \
- reparse.ok \
- resplit.ok \
- rs.in \
- rs.ok \
- rsnul1nl.awk \
- rsnul1nl.in \
- rsnul1nl.ok \
- rswhite.awk \
- rswhite.in \
- rswhite.ok \
- sclforin.awk \
- sclforin.ok \
- sclifin.awk \
- sclifin.ok \
- shadow.awk \
- shadow.ok \
- sort1.awk \
- sort1.ok \
- splitargv.awk \
- splitargv.in \
- splitargv.ok \
- splitdef.awk \
- splitdef.ok \
- splitvar.awk \
- splitvar.in \
- splitvar.ok \
- splitwht.awk \
- splitwht.ok \
- sprintfc.awk \
- sprintfc.in \
- sprintfc.ok \
- strtod.awk \
- strtod.in \
- strtod.ok \
- strftime.awk \
- strftlng.awk \
- strftlng.ok \
- subslash.awk \
- subslash.ok \
- substr.awk \
- substr.ok \
- swaplns.awk \
- swaplns.in \
- swaplns.ok \
- tradanch.awk \
- tradanch.in \
- tradanch.ok \
- tweakfld.awk \
- tweakfld.in \
- tweakfld.ok \
- zeroflag.awk \
- zeroflag.ok
-
-
-CMP = cmp
-AWK = ../gawk
-subdir = test
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES =
-DIST_SOURCES =
-DIST_COMMON = README ChangeLog Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-GZIP_ENV = --best
-all: all-redirect
-.SUFFIXES:
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-tags: TAGS
-TAGS:
-
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-distdir: $(DISTFILES)
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- if test -d $$d/$$file; then \
- cp -pR $$d/$$file $(distdir) \
- || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
- -rm -f Makefile.in
-mostlyclean-am: mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-generic clean-am
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-generic distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: tags distdir info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all install-strip installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-# message stuff is to make it a little easier to follow
-check: msg \
- basic-msg-start basic basic-msg-end \
- unix-msg-start unix-tests unix-msg-end \
- extend-msg-start gawk-extensions extend-msg-end
-
-# try to keep these sorted
-basic: addcomma anchgsub argarray arrayparm arrayref arynasty arynocls \
- arysubnm asgext awkpath back89 backgsub childin clobber clsflnam \
- compare convfmt datanonl defref delarprm dynlj eofsplit fldchg \
- fldchgnf fnamedat fnarray fnarydel fnaryscl fnasgnm fnparydl \
- fsbs fsrs fstabplus funsemnl funsmnam funstack getline getlnbuf getnr2tb \
- getnr2tm gsubasgn gsubtest hsprint intest intprec leaddig leadnl litoct \
- longwrds math messages mmap8k nasty nasty2 negexp nfldstr nfset \
- nlfldsep nlinstr nlstrina noeffect nofmtch nonl noparms nors \
- numindex numsubstr octsub ofmt ofmtbig ofmts opasnidx opasnslf \
- paramdup paramtyp parseme pcntplus prdupval printf1 prmarscl \
- prmreuse prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm \
- regeq reindops reparse resplit rs rsnul1nl rswhite sclforin \
- sclifin splitargv splitdef splitvar splitwht sprintfc strtod \
- subslash substr swaplns tradanch tweakfld zeroflag
-
-unix-tests: fflush getlnhd pid pipeio1 pipeio2 poundbang strftlng
-
-gawk-extensions: argtest badargs clos1way fieldwdth fsfwfs gensub \
- gnuops2 gnureops igncdym igncfs ignrcase lint manyfiles nondec \
- posix procinfs regx8bit reint shadow sort1 strftime
-
-extra: regtest inftest inet
-
-inet: inetmesg inetechu inetecht inetdayu inetdayt
-
-msg::
- @echo 'Any output from "cmp" is bad news, although some differences'
- @echo 'in floating point values are probably benign -- in particular,'
- @echo 'some systems may omit a leading zero and the floating point'
- @echo 'precision may lead to slightly different output in a few cases.'
-
-basic-msg-start:
- @echo "======== Starting basic tests ========"
-
-basic-msg-end:
- @echo "======== Done with basic tests ========"
-
-unix-msg-start:
- @echo "======== Starting Unix tests ========"
-
-unix-msg-end:
- @echo "======== Done with Unix tests ========"
-
-extend-msg-start:
- @echo "======== Starting gawk extension tests ========"
-
-extend-msg-end:
- @echo "======== Done with gawk extension tests ========"
-
-# This test is a PITA because increasingly, /tmp is getting
-# mounted noexec. So, we'll test it. Sigh.
-poundbang::
- @cp $(AWK) /tmp/gawk
- @if /tmp/gawk 'BEGIN { print "OK" }' | grep OK > /dev/null ; \
- then \
- $(srcdir)/poundbang.awk $(srcdir)/poundbang.awk >_`basename $@` ; \
- $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` && echo poundbang is ok ; \
- else \
- echo "*** /tmp is apparently mounted noexec, skipping poundbang test." ; \
- fi
- @rm -f /tmp/gawk
-
-swaplns::
- @$(AWK) -f $(srcdir)/swaplns.awk $(srcdir)/swaplns.in >_$@
- -$(CMP) $(srcdir)/swaplns.ok _$@ && rm -f _$@
-
-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
-
-argarray::
- @case $(srcdir) in \
- .) : ;; \
- *) cp $(srcdir)/argarray.in . ;; \
- esac
- @TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@
- -$(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@
-
-fstabplus::
- @echo '1 2' | $(AWK) -f $(srcdir)/fstabplus.awk >_$@
- -$(CMP) $(srcdir)/fstabplus.ok _$@ && rm -f _$@
-
-fsrs::
- @$(AWK) -f $(srcdir)/fsrs.awk $(srcdir)/fsrs.in >_$@
- -$(CMP) $(srcdir)/fsrs.ok _$@ && rm -f _$@
-
-igncfs::
- @$(AWK) -f $(srcdir)/igncfs.awk $(srcdir)/igncfs.in >_$@
- -$(CMP) $(srcdir)/igncfs.ok _$@ && rm -f _$@
-
-longwrds::
- @$(AWK) -f $(srcdir)/longwrds.awk $(srcdir)/manpage | (LC_ALL=C sort) >_$@
- -$(CMP) $(srcdir)/longwrds.ok _$@ && rm -f _$@
-
-fieldwdth::
- @echo '123456789' | $(AWK) -v FIELDWIDTHS="2 3 4" '{ print $$2}' >_$@
- -$(CMP) $(srcdir)/fieldwdth.ok _$@ && rm -f _$@
-
-ignrcase::
- @echo xYz | $(AWK) -v IGNORECASE=1 '{ sub(/y/, ""); print}' >_$@
- -$(CMP) $(srcdir)/ignrcase.ok _$@ && rm -f _$@
-
-regtest::
- @echo 'Some of the output from regtest is very system specific, do not'
- @echo 'be distressed if your output differs from that distributed.'
- @echo 'Manual inspection is called for.'
- AWK=`pwd`/$(AWK) $(srcdir)/regtest.awk
-
-posix::
- @echo '1:2,3 4' | $(AWK) -f $(srcdir)/posix.awk >_$@
- -$(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@
-
-manyfiles::
- @rm -rf junk
- @mkdir junk
- @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@
- @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@
- @echo "This number better be 1 ->" | tr -d '\012'
- @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l
- @rm -rf junk _$@
-
-compare::
- @$(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@
- -$(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@
-
-arrayref::
- @$(AWK) -f $(srcdir)/arrayref.awk >_$@
- -$(CMP) $(srcdir)/arrayref.ok _$@ && rm -f _$@
-
-rs::
- @$(AWK) -v RS="" '{ print $$1, $$2}' $(srcdir)/rs.in >_$@
- -$(CMP) $(srcdir)/rs.ok _$@ && rm -f _$@
-
-fsbs::
- @$(AWK) -v FS='\' '{ print $$1, $$2 }' $(srcdir)/fsbs.in >_$@
- -$(CMP) $(srcdir)/fsbs.ok _$@ && rm -f _$@
-
-inftest::
- @echo This test is very machine specific...
- @$(AWK) -f $(srcdir)/inftest.awk >_$@
- -$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@
-
-getline::
- @$(AWK) -f $(srcdir)/getline.awk $(srcdir)/getline.awk $(srcdir)/getline.awk >_$@
- -$(CMP) $(srcdir)/getline.ok _$@ && rm -f _$@
-
-rand::
- @$(AWK) -f $(srcdir)/rand.awk >_$@
- -$(CMP) $(srcdir)/rand.ok _$@ && rm -f _$@
-
-negexp::
- @$(AWK) 'BEGIN { a = -2; print 10^a }' >_$@
- -$(CMP) $(srcdir)/negexp.ok _$@ && rm -f _$@
-
-asgext::
- @$(AWK) -f $(srcdir)/asgext.awk $(srcdir)/asgext.in >_$@
- -$(CMP) $(srcdir)/asgext.ok _$@ && rm -f _$@
-
-anchgsub::
- @$(AWK) -f $(srcdir)/anchgsub.awk $(srcdir)/anchgsub.in >_$@
- -$(CMP) $(srcdir)/anchgsub.ok _$@ && rm -f _$@
-
-splitargv::
- @$(AWK) -f $(srcdir)/splitargv.awk $(srcdir)/splitargv.in >_$@
- -$(CMP) $(srcdir)/splitargv.ok _$@ && rm -f _$@
-
-awkpath::
- @AWKPATH="$(srcdir):$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@
- -$(CMP) $(srcdir)/awkpath.ok _$@ && rm -f _$@
-
-nfset::
- @$(AWK) -f $(srcdir)/nfset.awk $(srcdir)/nfset.in >_$@
- -$(CMP) $(srcdir)/nfset.ok _$@ && rm -f _$@
-
-reparse::
- @$(AWK) -f $(srcdir)/reparse.awk $(srcdir)/reparse.in >_$@
- -$(CMP) $(srcdir)/reparse.ok _$@ && rm -f _$@
-
-argtest::
- @$(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@
- -$(CMP) $(srcdir)/argtest.ok _$@ && rm -f _$@
-
-badargs::
- @-$(AWK) -f 2>&1 | grep -v patchlevel >_$@
- -$(CMP) $(srcdir)/badargs.ok _$@ && rm -f _$@
-
-convfmt::
- @$(AWK) -f $(srcdir)/convfmt.awk >_$@
- -$(CMP) $(srcdir)/convfmt.ok _$@ && rm -f _$@
-
-arrayparm::
- @-AWKPATH=$(srcdir) $(AWK) -f arrayparm.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/arrayparm.ok _$@ && rm -f _$@
-
-paramdup::
- @-AWKPATH=$(srcdir) $(AWK) -f paramdup.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/paramdup.ok _$@ && rm -f _$@
-
-nonl::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk /dev/null >_$@ 2>&1
- -$(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@
-
-defref::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f defref.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/defref.ok _$@ && rm -f _$@
-
-nofmtch::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f nofmtch.awk >_$@ 2>&1
- -$(CMP) $(srcdir)/nofmtch.ok _$@ && rm -f _$@
-
-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; LANG=C; export LANG; \
- date | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk
- -$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0
-
-litoct::
- @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@
- -$(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@
-
-gensub::
- @$(AWK) -f $(srcdir)/gensub.awk $(srcdir)/gensub.in >_$@
- -$(CMP) $(srcdir)/gensub.ok _$@ && rm -f _$@
-
-resplit::
- @echo a:b:c d:e:f | $(AWK) '{ FS = ":"; $$0 = $$0; print $$2 }' > _$@
- -$(CMP) $(srcdir)/resplit.ok _$@ && rm -f _$@
-
-rswhite::
- @$(AWK) -f $(srcdir)/rswhite.awk $(srcdir)/rswhite.in > _$@
- -$(CMP) $(srcdir)/rswhite.ok _$@ && rm -f _$@
-
-prmarscl::
- @-AWKPATH=$(srcdir) $(AWK) -f prmarscl.awk > _$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/prmarscl.ok _$@ && rm -f _$@
-
-sclforin::
- @-AWKPATH=$(srcdir) $(AWK) -f sclforin.awk > _$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/sclforin.ok _$@ && rm -f _$@
-
-sclifin::
- @-AWKPATH=$(srcdir) $(AWK) -f sclifin.awk > _$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/sclifin.ok _$@ && rm -f _$@
-
-intprec::
- @-$(AWK) -f $(srcdir)/intprec.awk > _$@ 2>&1
- -$(CMP) $(srcdir)/intprec.ok _$@ && rm -f _$@
-
-childin::
- @echo hi | $(AWK) 'BEGIN { "cat" | getline; print; close("cat") }' > _$@
- -$(CMP) $(srcdir)/childin.ok _$@ && rm -f _$@
-
-noeffect::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f noeffect.awk > _$@ 2>&1
- -$(CMP) $(srcdir)/noeffect.ok _$@ && rm -f _$@
-
-numsubstr::
- @-AWKPATH=$(srcdir) $(AWK) -f numsubstr.awk $(srcdir)/numsubstr.in >_$@
- -$(CMP) $(srcdir)/numsubstr.ok _$@ && rm -f _$@
-
-gnureops::
- @$(AWK) -f $(srcdir)/gnureops.awk >_$@
- -$(CMP) $(srcdir)/gnureops.ok _$@ && rm -f _$@
-
-pcntplus::
- @$(AWK) -f $(srcdir)/pcntplus.awk >_$@
- -$(CMP) $(srcdir)/pcntplus.ok _$@ && rm -f _$@
-
-prmreuse::
- @$(AWK) -f $(srcdir)/prmreuse.awk >_$@
- -$(CMP) $(srcdir)/prmreuse.ok _$@ && rm -f _$@
-
-math::
- @$(AWK) -f $(srcdir)/math.awk >_$@
- -$(CMP) $(srcdir)/math.ok _$@ && rm -f _$@
-
-fflush::
- @$(srcdir)/fflush.sh >_$@
- -$(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@
-
-fldchg::
- @$(AWK) -f $(srcdir)/fldchg.awk $(srcdir)/fldchg.in >_$@
- -$(CMP) $(srcdir)/fldchg.ok _$@ && rm -f _$@
-
-fldchgnf::
- @$(AWK) -f $(srcdir)/fldchgnf.awk $(srcdir)/fldchgnf.in >_$@
- -$(CMP) $(srcdir)/fldchgnf.ok _$@ && rm -f _$@
-
-reindops::
- @$(AWK) -f $(srcdir)/reindops.awk $(srcdir)/reindops.in >_$@
- -$(CMP) $(srcdir)/reindops.ok _$@ && rm -f _$@
-
-sprintfc::
- @$(AWK) -f $(srcdir)/sprintfc.awk $(srcdir)/sprintfc.in >_$@
- -$(CMP) $(srcdir)/sprintfc.ok _$@ && rm -f _$@
-
-getlnhd::
- @$(AWK) -f $(srcdir)/getlnhd.awk >_$@
- -$(CMP) $(srcdir)/getlnhd.ok _$@ && rm -f _$@
-
-backgsub::
- @$(AWK) -f $(srcdir)/backgsub.awk $(srcdir)/backgsub.in >_$@
- -$(CMP) $(srcdir)/backgsub.ok _$@ && rm -f _$@
-
-tweakfld::
- @$(AWK) -f $(srcdir)/tweakfld.awk $(srcdir)/tweakfld.in >_$@
- @rm -f errors.cleanup
- -$(CMP) $(srcdir)/tweakfld.ok _$@ && rm -f _$@
-
-clsflnam::
- @$(AWK) -f $(srcdir)/clsflnam.awk $(srcdir)/clsflnam.in >_$@ 2>&1
- -$(CMP) $(srcdir)/clsflnam.ok _$@ && rm -f _$@
-
-mmap8k::
- @$(AWK) '{ print }' $(srcdir)/mmap8k.in >_$@
- -$(CMP) $(srcdir)/mmap8k.in _$@ && rm -f _$@
-
-fnarray::
- @-AWKPATH=$(srcdir) $(AWK) -f fnarray.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/fnarray.ok _$@ && rm -f _$@
-
-dynlj::
- @$(AWK) -f $(srcdir)/dynlj.awk >_$@
- -$(CMP) $(srcdir)/dynlj.ok _$@ && rm -f _$@
-
-substr::
- @$(AWK) -f $(srcdir)/substr.awk >_$@
- -$(CMP) $(srcdir)/substr.ok _$@ && rm -f _$@
-
-eofsplit::
- @$(AWK) -f $(srcdir)/eofsplit.awk >_$@
- -$(CMP) $(srcdir)/eofsplit.ok _$@ && rm -f _$@
-
-prt1eval::
- @$(AWK) -f $(srcdir)/prt1eval.awk >_$@
- -$(CMP) $(srcdir)/prt1eval.ok _$@ && rm -f _$@
-
-gsubasgn::
- @-AWKPATH=$(srcdir) $(AWK) -f gsubasgn.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/gsubasgn.ok _$@ && rm -f _$@
-
-prtoeval::
- @$(AWK) -f $(srcdir)/prtoeval.awk >_$@
- -$(CMP) $(srcdir)/prtoeval.ok _$@ && rm -f _$@
-
-gsubtest::
- @$(AWK) -f $(srcdir)/gsubtest.awk >_$@
- -$(CMP) $(srcdir)/gsubtest.ok _$@ && rm -f _$@
-
-splitwht::
- @$(AWK) -f $(srcdir)/splitwht.awk >_$@
- -$(CMP) $(srcdir)/splitwht.ok _$@ && rm -f _$@
-
-back89::
- @$(AWK) '/a\8b/' $(srcdir)/back89.in >_$@
- -$(CMP) $(srcdir)/back89.ok _$@ && rm -f _$@
-
-tradanch::
- @$(AWK) --traditional -f $(srcdir)/tradanch.awk $(srcdir)/tradanch.in >_$@
- -$(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 _$@
-
-nasty::
- @$(AWK) -f $(srcdir)/nasty.awk >_$@
- -$(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@
-
-nasty2::
- @$(AWK) -f $(srcdir)/nasty2.awk >_$@
- -$(CMP) $(srcdir)/nasty2.ok _$@ && rm -f _$@
-
-zeroflag::
- @$(AWK) -f $(srcdir)/zeroflag.awk >_$@
- -$(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@
-
-getnr2tm::
- @$(AWK) -f $(srcdir)/getnr2tm.awk $(srcdir)/getnr2tm.in >_$@
- -$(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@
-
-getnr2tb::
- @$(AWK) -f $(srcdir)/getnr2tb.awk $(srcdir)/getnr2tb.in >_$@
- -$(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@
-
-printf1::
- @$(AWK) -f $(srcdir)/printf1.awk >_$@
- -$(CMP) $(srcdir)/printf1.ok _$@ && rm -f _$@
-
-funsmnam::
- @-AWKPATH=$(srcdir) $(AWK) -f funsmnam.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/funsmnam.ok _$@ && rm -f _$@
-
-fnamedat::
- @-AWKPATH=$(srcdir) $(AWK) -f fnamedat.awk < $(srcdir)/fnamedat.in >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/fnamedat.ok _$@ && rm -f _$@
-
-numindex::
- @-AWKPATH=$(srcdir) $(AWK) -f numindex.awk < $(srcdir)/numindex.in >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/numindex.ok _$@ && rm -f _$@
-
-subslash::
- @-AWKPATH=$(srcdir) $(AWK) -f subslash.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/subslash.ok _$@ && rm -f _$@
-
-opasnslf::
- @-AWKPATH=$(srcdir) $(AWK) -f opasnslf.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/opasnslf.ok _$@ && rm -f _$@
-
-opasnidx::
- @-AWKPATH=$(srcdir) $(AWK) -f opasnidx.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/opasnidx.ok _$@ && rm -f _$@
-
-arynocls::
- @-AWKPATH=$(srcdir) $(AWK) -v INPUT=$(srcdir)/arynocls.in -f arynocls.awk >_$@
- -$(CMP) $(srcdir)/arynocls.ok _$@ && rm -f _$@
-
-igncdym::
- @-AWKPATH=$(srcdir) $(AWK) -f igncdym.awk $(srcdir)/igncdym.in >_$@
- -$(CMP) $(srcdir)/igncdym.ok _$@ && rm -f _$@
-
-getlnbuf::
- @-AWKPATH=$(srcdir) $(AWK) -f getlnbuf.awk $(srcdir)/getlnbuf.in > _$@
- @-AWKPATH=$(srcdir) $(AWK) -f gtlnbufv.awk $(srcdir)/getlnbuf.in > _2$@
- -$(CMP) $(srcdir)/getlnbuf.ok _$@ && $(CMP) $(srcdir)/getlnbuf.ok _2$@ && rm -f _$@ _2$@
-
-arysubnm::
- @-AWKPATH=$(srcdir) $(AWK) -f arysubnm.awk >_$@
- -$(CMP) $(srcdir)/arysubnm.ok _$@ && rm -f _$@
-
-fnparydl::
- @-AWKPATH=$(srcdir) $(AWK) -f fnparydl.awk >_$@
- -$(CMP) $(srcdir)/fnparydl.ok _$@ && rm -f _$@
-
-nlstrina::
- @-AWKPATH=$(srcdir) $(AWK) -f nlstrina.awk >_$@
- -$(CMP) $(srcdir)/nlstrina.ok _$@ && rm -f _$@
-
-octsub::
- @-AWKPATH=$(srcdir) $(AWK) -f octsub.awk >_$@
- -$(CMP) $(srcdir)/octsub.ok _$@ && rm -f _$@
-
-nlinstr::
- @$(AWK) -f $(srcdir)/nlinstr.awk $(srcdir)/nlinstr.in >_$@
- -$(CMP) $(srcdir)/nlinstr.ok _$@ && rm -f _$@
-
-ofmt::
- @$(AWK) -f $(srcdir)/ofmt.awk $(srcdir)/ofmt.in >_$@
- -$(CMP) $(srcdir)/ofmt.ok _$@ && rm -f _$@
-
-hsprint::
- @$(AWK) -f $(srcdir)/hsprint.awk >_$@
- -$(CMP) $(srcdir)/hsprint.ok _$@ && rm -f _$@
-
-fsfwfs::
- @$(AWK) -f $(srcdir)/fsfwfs.awk $(srcdir)/fsfwfs.in >_$@
- -$(CMP) $(srcdir)/fsfwfs.ok _$@ && rm -f _$@
-
-ofmts::
- @$(AWK) -f $(srcdir)/ofmts.awk $(srcdir)/ofmts.in >_$@
- -$(CMP) $(srcdir)/ofmts.ok _$@ && rm -f _$@
-
-parseme::
- @-AWKPATH=$(srcdir) $(AWK) -f parseme.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/parseme.ok _$@ && rm -f _$@
-
-splitdef::
- @$(AWK) -f $(srcdir)/splitdef.awk >_$@
- -$(CMP) $(srcdir)/splitdef.ok _$@ && rm -f _$@
-
-fnaryscl::
- @-AWKPATH=$(srcdir) $(AWK) -f fnaryscl.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/fnaryscl.ok _$@ && rm -f _$@
-
-fnasgnm::
- @-AWKPATH=$(srcdir) $(AWK) -f fnasgnm.awk < $(srcdir)/fnasgnm.in >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/fnasgnm.ok _$@ && rm -f _$@
-
-lint::
- @-AWKPATH=$(srcdir) $(AWK) -f lint.awk > _$@ 2>&1
- -$(CMP) $(srcdir)/lint.ok _$@ && rm -f _$@
-
-procinfs::
- @-$(AWK) -f $(srcdir)/procinfs.awk > _$@
- -$(CMP) $(srcdir)/procinfs.ok _$@ && rm -f _$@
-
-sort1::
- @-$(AWK) -f $(srcdir)/sort1.awk > _$@
- -$(CMP) $(srcdir)/sort1.ok _$@ && rm -f _$@
-
-ofmtbig::
- @$(AWK) -f $(srcdir)/ofmtbig.awk $(srcdir)/ofmtbig.in >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/ofmtbig.ok _$@ && rm -f _$@
-
-inetmesg::
- @echo These tests only work if your system supports the services
- @echo "'discard'" at port 9 and "'daytimed" at port 13. Check your
- @echo file /etc/services and do "'netstat -a'".
-
-inetechu::
- @echo This test is for establishing UDP connections
- @$(AWK) 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}'
-
-inetecht::
- @echo This test is for establishing TCP connections
- @$(AWK) 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}'
-
-inetdayu::
- @echo This test is for bidirectional UDP transmission
- @$(AWK) 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \
- "/inet/udp/0/127.0.0.1/13" |& getline; print $0}'
-
-inetdayt::
- @echo This test is for bidirectional TCP transmission
- @$(AWK) 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \
- "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}'
-
-paramtyp::
- @$(AWK) -f $(srcdir)/paramtyp.awk >_$@
- -$(CMP) $(srcdir)/paramtyp.ok _$@ && rm -f _$@
-
-rsnul1nl::
- @$(AWK) -f $(srcdir)/rsnul1nl.awk $(srcdir)/rsnul1nl.in >_$@
- -$(CMP) $(srcdir)/rsnul1nl.ok _$@ && rm -f _$@
-
-datanonl::
- @$(AWK) -f $(srcdir)/datanonl.awk $(srcdir)/datanonl.in >_$@
- -$(CMP) $(srcdir)/datanonl.ok _$@ && rm -f _$@
-
-regeq::
- @$(AWK) -f $(srcdir)/regeq.awk $(srcdir)/regeq.in >_$@
- -$(CMP) $(srcdir)/regeq.ok _$@ && rm -f _$@
-
-redfilnm::
- @$(AWK) -f $(srcdir)/redfilnm.awk srcdir=$(srcdir) $(srcdir)/redfilnm.in >_$@
- -$(CMP) $(srcdir)/redfilnm.ok _$@ && rm -f _$@
-
-strtod::
- @$(AWK) -f $(srcdir)/strtod.awk $(srcdir)/strtod.in >_$@
- -$(CMP) $(srcdir)/strtod.ok _$@ && rm -f _$@
-
-leaddig::
- @$(AWK) -v x=2E -f $(srcdir)/leaddig.awk >_$@
- -$(CMP) $(srcdir)/leaddig.ok _$@ && rm -f _$@
-
-clos1way::
- @$(AWK) -f $(srcdir)/clos1way.awk >_$@
- -$(CMP) $(srcdir)/clos1way.ok _$@ && rm -f _$@
-
-arynasty::
- @$(AWK) -f $(srcdir)/arynasty.awk >_$@
- -$(CMP) $(srcdir)/arynasty.ok _$@ && rm -f _$@
-
-shadow::
- @-AWKPATH=$(srcdir) $(AWK) --lint -f shadow.awk >_$@ 2>&1 || exit 0
- -$(CMP) $(srcdir)/shadow.ok _$@ && rm -f _$@
-
-regx8bit::
- @$(AWK) -f $(srcdir)/regx8bit.awk >_$@
- -$(CMP) $(srcdir)/regx8bit.ok _$@ && rm -f _$@
-
-psx96sub::
- @$(AWK) -f $(srcdir)/psx96sub.awk >_$@
- -$(CMP) $(srcdir)/psx96sub.ok _$@ && rm -f _$@
-
-addcomma::
- @$(AWK) -f $(srcdir)/addcomma.awk $(srcdir)/addcomma.in >_$@
- -$(CMP) $(srcdir)/addcomma.ok _$@ && rm -f _$@
-
-gnuops2::
- @$(AWK) -f $(srcdir)/gnuops2.awk >_$@
- -$(CMP) $(srcdir)/gnuops2.ok _$@ && rm -f _$@
-
-rebt8b1::
- @$(AWK) -f $(srcdir)/rebt8b1.awk >_$@
- -$(CMP) $(srcdir)/rebt8b1.ok _$@ && rm -f _$@
-
-rebt8b2::
- @$(AWK) -f $(srcdir)/rebt8b2.awk >_$@
- -$(CMP) $(srcdir)/rebt8b2.ok _$@ && rm -f _$@
-
-leadnl::
- @$(AWK) -f $(srcdir)/leadnl.awk $(srcdir)/leadnl.in >_$@
- -$(CMP) $(srcdir)/leadnl.ok _$@ && rm -f _$@
-
-funsemnl::
- @$(AWK) -f $(srcdir)/funsemnl.awk >_$@
- -$(CMP) $(srcdir)/funsemnl.ok _$@ && rm -f _$@
-
-clean:
- rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~
-
-# This target for my convenience to look at all the results
-diffout:
- for i in _* ; \
- do \
- echo ============== $$i ============= ; \
- diff -c $${i#_}.ok $$i ; \
- done | more
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/contrib/awk/test/README b/contrib/awk/test/README
deleted file mode 100644
index 2343be2..0000000
--- a/contrib/awk/test/README
+++ /dev/null
@@ -1,18 +0,0 @@
-Mon Jan 22 13:08:58 EST 1996
-
-This directory contains the tests for gawk. The tests use the
-following conventions.
-
-Given some aspect of gawk named `foo', there will be one or more
-of the following files:
-
-foo.awk --- actual code for the test if not inline in the Makefile
-foo.in --- the data for the test, if it needs data
-foo.ok --- the expected results
-_foo --- the actual results; generated at run time
-
-The _foo file will be left around if a test fails, allowing you to
-compare actual and expected results, in case they differ.
-
-If they do differ (other than strftime.ok and _strftime!), send in a
-bug report. See the manual for the bug report procedure.
diff --git a/contrib/awk/test/anchgsub.awk b/contrib/awk/test/anchgsub.awk
deleted file mode 100644
index 52e8aa4..0000000
--- a/contrib/awk/test/anchgsub.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ gsub(/^[ ]*/, "", $0) ; print }
diff --git a/contrib/awk/test/anchgsub.in b/contrib/awk/test/anchgsub.in
deleted file mode 100644
index b829d84..0000000
--- a/contrib/awk/test/anchgsub.in
+++ /dev/null
@@ -1 +0,0 @@
- This is a test, this is only a test.
diff --git a/contrib/awk/test/anchgsub.ok b/contrib/awk/test/anchgsub.ok
deleted file mode 100644
index c33dfb9..0000000
--- a/contrib/awk/test/anchgsub.ok
+++ /dev/null
@@ -1 +0,0 @@
-This is a test, this is only a test.
diff --git a/contrib/awk/test/argarray.awk b/contrib/awk/test/argarray.awk
deleted file mode 100644
index 1960f9bd..0000000
--- a/contrib/awk/test/argarray.awk
+++ /dev/null
@@ -1,14 +0,0 @@
-BEGIN {
- argn = " argument" (ARGC > 1 ? "s" : "")
- are = ARGC > 1 ? "are" : "is"
- print "here we have " ARGC argn
- print "which " are
- for (x = 0; x < ARGC; x++)
- print "\t", ARGV[x]
- print "Environment variable TEST=" ENVIRON["TEST"]
- print "and the current input file is called \"" FILENAME "\""
-}
-
-FNR == 1 {
- print "in main loop, this input file is known as \"" FILENAME "\""
-}
diff --git a/contrib/awk/test/argarray.in b/contrib/awk/test/argarray.in
deleted file mode 100644
index bc93338..0000000
--- a/contrib/awk/test/argarray.in
+++ /dev/null
@@ -1 +0,0 @@
-this is a simple test file
diff --git a/contrib/awk/test/argarray.ok b/contrib/awk/test/argarray.ok
deleted file mode 100644
index 18eb841..0000000
--- a/contrib/awk/test/argarray.ok
+++ /dev/null
@@ -1,9 +0,0 @@
-here we have 3 arguments
-which are
- gawk
- ./argarray.in
- -
-Environment variable TEST=
-and the current input file is called ""
-in main loop, this input file is known as "./argarray.in"
-in main loop, this input file is known as "-"
diff --git a/contrib/awk/test/argtest.awk b/contrib/awk/test/argtest.awk
deleted file mode 100644
index e7a1145..0000000
--- a/contrib/awk/test/argtest.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-BEGIN {
- for (i = 0; i < ARGC; i++)
- printf("ARGV[%d] = %s\n", i, ARGV[i])
-}
diff --git a/contrib/awk/test/argtest.ok b/contrib/awk/test/argtest.ok
deleted file mode 100644
index 591bc64..0000000
--- a/contrib/awk/test/argtest.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-ARGV[0] = gawk
-ARGV[1] = -x
-ARGV[2] = -y
-ARGV[3] = abc
diff --git a/contrib/awk/test/arrayparm.awk b/contrib/awk/test/arrayparm.awk
deleted file mode 100644
index d6f34d9..0000000
--- a/contrib/awk/test/arrayparm.awk
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Test program from:
-#
-# Date: Tue, 21 Feb 95 16:09:29 EST
-# From: emory!blackhawk.com!aaron (Aaron Sosnick)
-#
-BEGIN {
- foo[1]=1;
- foo[2]=2;
- bug1(foo);
-}
-function bug1(i) {
- for (i in foo) {
- bug2(i);
- delete foo[i];
- print i,1,bot[1];
- }
-}
-function bug2(arg) {
- bot[arg]=arg;
-}
diff --git a/contrib/awk/test/arrayparm.ok b/contrib/awk/test/arrayparm.ok
deleted file mode 100644
index 4a775ef..0000000
--- a/contrib/awk/test/arrayparm.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: arrayparm.awk:18: fatal: attempt to use array `i (from foo)' in a scalar context
diff --git a/contrib/awk/test/arrayref.awk b/contrib/awk/test/arrayref.awk
deleted file mode 100644
index 144d41a..0000000
--- a/contrib/awk/test/arrayref.awk
+++ /dev/null
@@ -1,13 +0,0 @@
- BEGIN { # foo[10] = 0 # put this line in and it will work
- test(foo); print foo[1]
- test2(foo2); print foo2[1]
- }
-
- function test(foo)
- {
- test2(foo)
- }
- function test2(bar)
- {
- bar[1] = 1
- }
diff --git a/contrib/awk/test/arrayref.ok b/contrib/awk/test/arrayref.ok
deleted file mode 100644
index 6ed281c..0000000
--- a/contrib/awk/test/arrayref.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-1
-1
diff --git a/contrib/awk/test/asgext.awk b/contrib/awk/test/asgext.awk
deleted file mode 100644
index c7f1775..0000000
--- a/contrib/awk/test/asgext.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print $3; $4 = "a"; print }
diff --git a/contrib/awk/test/asgext.in b/contrib/awk/test/asgext.in
deleted file mode 100644
index 3743b5b..0000000
--- a/contrib/awk/test/asgext.in
+++ /dev/null
@@ -1,3 +0,0 @@
-1 2 3
-1
-1 2 3 4
diff --git a/contrib/awk/test/asgext.ok b/contrib/awk/test/asgext.ok
deleted file mode 100644
index 2c0df70..0000000
--- a/contrib/awk/test/asgext.ok
+++ /dev/null
@@ -1,6 +0,0 @@
-3
-1 2 3 a
-
-1 a
-3
-1 2 3 a
diff --git a/contrib/awk/test/awkpath.ok b/contrib/awk/test/awkpath.ok
deleted file mode 100644
index 6cffe1b..0000000
--- a/contrib/awk/test/awkpath.ok
+++ /dev/null
@@ -1 +0,0 @@
-Found it.
diff --git a/contrib/awk/test/back89.in b/contrib/awk/test/back89.in
deleted file mode 100644
index b0a88f2..0000000
--- a/contrib/awk/test/back89.in
+++ /dev/null
@@ -1,2 +0,0 @@
-a8b
-a\8b
diff --git a/contrib/awk/test/back89.ok b/contrib/awk/test/back89.ok
deleted file mode 100644
index e9ea4d5..0000000
--- a/contrib/awk/test/back89.ok
+++ /dev/null
@@ -1 +0,0 @@
-a8b
diff --git a/contrib/awk/test/backgsub.awk b/contrib/awk/test/backgsub.awk
deleted file mode 100644
index bec7354..0000000
--- a/contrib/awk/test/backgsub.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- gsub( "\\\\", "\\\\")
- print
-}
diff --git a/contrib/awk/test/backgsub.in b/contrib/awk/test/backgsub.in
deleted file mode 100644
index 2d3f17f..0000000
--- a/contrib/awk/test/backgsub.in
+++ /dev/null
@@ -1 +0,0 @@
-\x\y\z
diff --git a/contrib/awk/test/backgsub.ok b/contrib/awk/test/backgsub.ok
deleted file mode 100644
index e2e265f..0000000
--- a/contrib/awk/test/backgsub.ok
+++ /dev/null
@@ -1 +0,0 @@
-\\x\\y\\z
diff --git a/contrib/awk/test/badargs.ok b/contrib/awk/test/badargs.ok
deleted file mode 100644
index b6f9cfe..0000000
--- a/contrib/awk/test/badargs.ok
+++ /dev/null
@@ -1,27 +0,0 @@
-gawk: option requires an argument -- f
-Usage: gawk [POSIX or GNU style options] -f progfile [--] file ...
-Usage: gawk [POSIX or GNU style options] [--] 'program' file ...
-POSIX options: GNU long options:
- -f progfile --file=progfile
- -F fs --field-separator=fs
- -v var=val --assign=var=val
- -m[fr] val
- -W compat --compat
- -W copyleft --copyleft
- -W copyright --copyright
- -W dump-variables[=file] --dump-variables[=file]
- -W gen-po --gen-po
- -W help --help
- -W lint[=fatal] --lint[=fatal]
- -W lint-old --lint-old
- -W non-decimal-data --non-decimal-data
- -W profile[=file] --profile[=file]
- -W posix --posix
- -W re-interval --re-interval
- -W source=program-text --source=program-text
- -W traditional --traditional
- -W usage --usage
- -W version --version
-
-To report bugs, see node `Bugs' in `gawk.info', which is
-section `Reporting Problems and Bugs' in the printed version.
diff --git a/contrib/awk/test/childin.ok b/contrib/awk/test/childin.ok
deleted file mode 100644
index 45b983b..0000000
--- a/contrib/awk/test/childin.ok
+++ /dev/null
@@ -1 +0,0 @@
-hi
diff --git a/contrib/awk/test/clobber.awk b/contrib/awk/test/clobber.awk
deleted file mode 100644
index d6635f2..0000000
--- a/contrib/awk/test/clobber.awk
+++ /dev/null
@@ -1,98 +0,0 @@
-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 <emory!synet.net!imdave>
-# 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 <set_field>, 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 <set_field>, 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 <Error reading address 0x804d006: No such file or directory>
-# (gdb) print buf
-# $2 = (char **) 0x37704
-# (gdb) print *buf
-# $3 = 0x804d000 <Error reading address 0x804d000: No such file or directory>
-# (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 --git a/contrib/awk/test/clobber.ok b/contrib/awk/test/clobber.ok
deleted file mode 100644
index 7105708..0000000
--- a/contrib/awk/test/clobber.ok
+++ /dev/null
@@ -1 +0,0 @@
-000801 \ No newline at end of file
diff --git a/contrib/awk/test/clsflnam.awk b/contrib/awk/test/clsflnam.awk
deleted file mode 100644
index 0ba601f..0000000
--- a/contrib/awk/test/clsflnam.awk
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /usr/bin/awk -f
-BEGIN {
- getline
-# print ("FILENAME =", FILENAME) > "/dev/stderr"
- #Rewind the file
- if (close(FILENAME)) {
- print "Error `" ERRNO "' closing input file" > "/dev/stderr";
- exit;
- }
-}
-{ print "Analysing ", $0 }
-
diff --git a/contrib/awk/test/clsflnam.in b/contrib/awk/test/clsflnam.in
deleted file mode 100644
index a92d664..0000000
--- a/contrib/awk/test/clsflnam.in
+++ /dev/null
@@ -1,3 +0,0 @@
-line 1
-line 2
-line 3
diff --git a/contrib/awk/test/clsflnam.ok b/contrib/awk/test/clsflnam.ok
deleted file mode 100644
index 9addfc7..0000000
--- a/contrib/awk/test/clsflnam.ok
+++ /dev/null
@@ -1 +0,0 @@
-Error `close of redirection that was never opened' closing input file
diff --git a/contrib/awk/test/compare.awk b/contrib/awk/test/compare.awk
deleted file mode 100644
index 39a88f3..0000000
--- a/contrib/awk/test/compare.awk
+++ /dev/null
@@ -1,13 +0,0 @@
-BEGIN {
- if (ARGV[1]) print 1
- ARGV[1] = ""
- if (ARGV[2]) print 2
- ARGV[2] = ""
- if ("0") print "zero"
- if ("") print "null"
- if (0) print 0
-}
-{
- if ($0) print $0
- if ($1) print $1
-}
diff --git a/contrib/awk/test/compare.in b/contrib/awk/test/compare.in
deleted file mode 100644
index 1ab098b..0000000
--- a/contrib/awk/test/compare.in
+++ /dev/null
@@ -1,4 +0,0 @@
-0
-1
-0 1
-
diff --git a/contrib/awk/test/compare.ok b/contrib/awk/test/compare.ok
deleted file mode 100644
index 8241359..0000000
--- a/contrib/awk/test/compare.ok
+++ /dev/null
@@ -1,5 +0,0 @@
-2
-zero
-1
-1
-0 1
diff --git a/contrib/awk/test/convfmt.awk b/contrib/awk/test/convfmt.awk
deleted file mode 100644
index 90fd204..0000000
--- a/contrib/awk/test/convfmt.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN {
- CONVFMT = "%2.2f"
- a = 123.456
- b = a "" # give `a' string value also
- printf "a = %s\n", a
- CONVFMT = "%.6g"
- printf "a = %s\n", a
- a += 0 # make `a' numeric only again
- printf "a = %s\n", a # use `a' as string
-}
diff --git a/contrib/awk/test/convfmt.ok b/contrib/awk/test/convfmt.ok
deleted file mode 100644
index a7b66f7..0000000
--- a/contrib/awk/test/convfmt.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-a = 123.46
-a = 123.456
-a = 123.456
diff --git a/contrib/awk/test/defref.awk b/contrib/awk/test/defref.awk
deleted file mode 100644
index b4e8f10..0000000
--- a/contrib/awk/test/defref.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { foo() }
diff --git a/contrib/awk/test/defref.ok b/contrib/awk/test/defref.ok
deleted file mode 100644
index f833c96..0000000
--- a/contrib/awk/test/defref.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-gawk: defref.awk:2: warning: function `foo' called but never defined
-gawk: defref.awk:1: fatal: function `foo' not defined
diff --git a/contrib/awk/test/delarprm.awk b/contrib/awk/test/delarprm.awk
deleted file mode 100644
index d59de31..0000000
--- a/contrib/awk/test/delarprm.awk
+++ /dev/null
@@ -1,50 +0,0 @@
-# From dragon!unagi.cis.upenn.edu!sjanet Tue Mar 25 17:12:20 1997
-# Return-Path: <dragon!unagi.cis.upenn.edu!sjanet>
-# Received: by skeeve.atl.ga.us (/\==/\ Smail3.1.22.1 #22.1)
-# id <m0w9eS4-000GWyC@skeeve.atl.ga.us>; 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 <bug-gnu-utils@prep.ai.mit.edu>; 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 <sjanet@unagi.cis.upenn.edu>
-# 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 --git a/contrib/awk/test/delarprm.ok b/contrib/awk/test/delarprm.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/delarprm.ok
+++ /dev/null
diff --git a/contrib/awk/test/dynlj.awk b/contrib/awk/test/dynlj.awk
deleted file mode 100644
index ec6851b..0000000
--- a/contrib/awk/test/dynlj.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { printf "%*sworld\n", -20, "hello" }
diff --git a/contrib/awk/test/dynlj.ok b/contrib/awk/test/dynlj.ok
deleted file mode 100644
index c8f3fe9..0000000
--- a/contrib/awk/test/dynlj.ok
+++ /dev/null
@@ -1 +0,0 @@
-hello world
diff --git a/contrib/awk/test/eofsplit.awk b/contrib/awk/test/eofsplit.awk
deleted file mode 100644
index 22042b4..0000000
--- a/contrib/awk/test/eofsplit.awk
+++ /dev/null
@@ -1,68 +0,0 @@
-# Date: Sat, 30 Mar 1996 12:47:17 -0800 (PST)
-# From: Charles Howes <chowes@grid.direct.ca>
-# To: bug-gnu-utils@prep.ai.mit.edu, arnold@gnu.ai.mit.edu
-# Subject: Bug in Gawk 3.0.0, sample code:
-#
-#!/usr/local/bin/gawk -f
-#
-# Hello! This is a bug report from chowes@direct.ca
-#
-# uname -a
-# SunOS hostname 5.5 Generic sun4m
-#
-# Gnu Awk (gawk) 3.0, patchlevel 0:
-BEGIN{
-FS=":"
-while ((getline < "/etc/passwd") > 0) {
- r=$3
- z=0
- n[0]=1
- }
-FS=" "
-}
-#gawk: fp.new:16: fatal error: internal error
-#Abort
-
-# #!/usr/local/bin/gawk -f
-# # Gnu Awk (gawk) 2.15, patchlevel 6
-#
-# BEGIN{
-# f="/etc/passwd"
-# while (getline < f) n[0]=1
-# FS=" "
-# }
-# #gawk: /staff/chowes/bin/fp:7: fatal error: internal error
-# #Abort
-
-# These examples are not perfect coding style because I took a real
-# piece of code and tried to strip away anything that didn't make the error
-# message go away.
-#
-# The interesting part of the 'truss' is:
-#
-# fstat(3, 0xEFFFF278) = 0
-# lseek(3, 0, SEEK_SET) = 0
-# read(3, " r o o t : x : 0 : 1 : S".., 2291) = 2291
-# brk(0x00050020) = 0
-# brk(0x00052020) = 0
-# read(3, 0x0004F4B8, 2291) = 0
-# close(3) = 0
-# Incurred fault #6, FLTBOUNDS %pc = 0x0001B810
-# siginfo: SIGSEGV SEGV_MAPERR addr=0x00053000
-# Received signal #11, SIGSEGV [caught]
-# siginfo: SIGSEGV SEGV_MAPERR addr=0x00053000
-# write(2, " g a w k", 4) = 4
-# write(2, " : ", 2) = 2
-#
-# --
-# Charles Howes -- chowes@direct.ca Voice: (604) 691-1607
-# System Administrator Fax: (604) 691-1605
-# Internet Direct - 1050 - 555 West Hastings St - Vancouver, BC V6B 4N6
-#
-# A sysadmin's life is a sorry one. The only advantage he has over Emergency
-# Room doctors is that malpractice suits are rare. On the other hand, ER
-# doctors never have to deal with patients installing new versions of their
-# own innards! -Michael O'Brien
-#
-# "I think I know what may have gone wrong in the original s/w.
-# It's a bug in the way it was written." - Vagueness**n
diff --git a/contrib/awk/test/eofsplit.ok b/contrib/awk/test/eofsplit.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/eofsplit.ok
+++ /dev/null
diff --git a/contrib/awk/test/fflush.ok b/contrib/awk/test/fflush.ok
deleted file mode 100644
index 4cf0df6..0000000
--- a/contrib/awk/test/fflush.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-1st
-2nd
-1st
-2nd
-1st
-2nd
-1st
-2nd
-1st
-2nd
-1st
-2nd
-1st
-2nd
-1st
-2nd
diff --git a/contrib/awk/test/fflush.sh b/contrib/awk/test/fflush.sh
deleted file mode 100755
index 42d624c..0000000
--- a/contrib/awk/test/fflush.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/sh
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"cat"}'
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"cat"}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");close("/dev/stdout");print "2nd"|"cat"}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"cat";close("cat")}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"cat";close("cat")}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"cat";close("cat")}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"sort"}'|cat
-
-../gawk 'BEGIN{print "1st";fflush("/dev/stdout");print "2nd"|"sort";close("sort")}'|cat
diff --git a/contrib/awk/test/fieldwdth.ok b/contrib/awk/test/fieldwdth.ok
deleted file mode 100644
index 51b4008..0000000
--- a/contrib/awk/test/fieldwdth.ok
+++ /dev/null
@@ -1 +0,0 @@
-345
diff --git a/contrib/awk/test/fldchg.awk b/contrib/awk/test/fldchg.awk
deleted file mode 100644
index a8018f7..0000000
--- a/contrib/awk/test/fldchg.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-# print "0:", $0
- gsub("aa", "+")
- print "1:", $0
- $3 = "<" $3 ">"
- print "2:", $0
- print "2a:" "%" $1 "%" $2 "%" $3 "%" $4 "%" $5
-}
diff --git a/contrib/awk/test/fldchg.in b/contrib/awk/test/fldchg.in
deleted file mode 100644
index f500c36..0000000
--- a/contrib/awk/test/fldchg.in
+++ /dev/null
@@ -1 +0,0 @@
-aa aab c d e f
diff --git a/contrib/awk/test/fldchg.ok b/contrib/awk/test/fldchg.ok
deleted file mode 100644
index cc5032a..0000000
--- a/contrib/awk/test/fldchg.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-1: + +b c d e f
-2: + +b <c> d e f
-2a:%+%+b%<c>%d%e
diff --git a/contrib/awk/test/fldchgnf.awk b/contrib/awk/test/fldchgnf.awk
deleted file mode 100644
index fbb8f11..0000000
--- a/contrib/awk/test/fldchgnf.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ OFS = ":"; $2 = ""; print $0; print NF }
diff --git a/contrib/awk/test/fldchgnf.in b/contrib/awk/test/fldchgnf.in
deleted file mode 100644
index 8e13e46..0000000
--- a/contrib/awk/test/fldchgnf.in
+++ /dev/null
@@ -1 +0,0 @@
-a b c d
diff --git a/contrib/awk/test/fldchgnf.ok b/contrib/awk/test/fldchgnf.ok
deleted file mode 100644
index 10b38ed..0000000
--- a/contrib/awk/test/fldchgnf.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-a::c:d
-4
diff --git a/contrib/awk/test/fnarray.awk b/contrib/awk/test/fnarray.awk
deleted file mode 100644
index 92a18b9..0000000
--- a/contrib/awk/test/fnarray.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-function foo(N) {
- return 0
-}
-BEGIN {
- Num = foo[c]
-}
-
diff --git a/contrib/awk/test/fnarray.ok b/contrib/awk/test/fnarray.ok
deleted file mode 100644
index 94beacd..0000000
--- a/contrib/awk/test/fnarray.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: fnarray.awk:5: fatal: attempt to use function `foo' as array
diff --git a/contrib/awk/test/fnarydel.awk b/contrib/awk/test/fnarydel.awk
deleted file mode 100644
index 8a1264c..0000000
--- a/contrib/awk/test/fnarydel.awk
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/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 --git a/contrib/awk/test/fnarydel.ok b/contrib/awk/test/fnarydel.ok
deleted file mode 100644
index 7f3e453..0000000
--- a/contrib/awk/test/fnarydel.ok
+++ /dev/null
@@ -1,27 +0,0 @@
-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 --git a/contrib/awk/test/fsbs.in b/contrib/awk/test/fsbs.in
deleted file mode 100644
index 0a102c3..0000000
--- a/contrib/awk/test/fsbs.in
+++ /dev/null
@@ -1 +0,0 @@
-1\2
diff --git a/contrib/awk/test/fsbs.ok b/contrib/awk/test/fsbs.ok
deleted file mode 100644
index 8d04f96..0000000
--- a/contrib/awk/test/fsbs.ok
+++ /dev/null
@@ -1 +0,0 @@
-1 2
diff --git a/contrib/awk/test/fsrs.awk b/contrib/awk/test/fsrs.awk
deleted file mode 100644
index a001489..0000000
--- a/contrib/awk/test/fsrs.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN {
- RS=""; FS="\n";
- ORS=""; OFS="\n";
- }
-{
- split ($2,f," ")
- print $0;
-}
diff --git a/contrib/awk/test/fsrs.in b/contrib/awk/test/fsrs.in
deleted file mode 100644
index 4b49d81..0000000
--- a/contrib/awk/test/fsrs.in
+++ /dev/null
@@ -1,7 +0,0 @@
-a b
-c d
-e f
-
-1 2
-3 4
-5 6
diff --git a/contrib/awk/test/fsrs.ok b/contrib/awk/test/fsrs.ok
deleted file mode 100644
index 7dafd65..0000000
--- a/contrib/awk/test/fsrs.ok
+++ /dev/null
@@ -1,5 +0,0 @@
-a b
-c d
-e f1 2
-3 4
-5 6 \ No newline at end of file
diff --git a/contrib/awk/test/fstabplus.awk b/contrib/awk/test/fstabplus.awk
deleted file mode 100644
index 748a44f..0000000
--- a/contrib/awk/test/fstabplus.awk
+++ /dev/null
@@ -1,2 +0,0 @@
-BEGIN { FS = "\t+" }
- { print $1, $2 }
diff --git a/contrib/awk/test/fstabplus.ok b/contrib/awk/test/fstabplus.ok
deleted file mode 100644
index 8d04f96..0000000
--- a/contrib/awk/test/fstabplus.ok
+++ /dev/null
@@ -1 +0,0 @@
-1 2
diff --git a/contrib/awk/test/funstack.awk b/contrib/awk/test/funstack.awk
deleted file mode 100644
index ab85b45..0000000
--- a/contrib/awk/test/funstack.awk
+++ /dev/null
@@ -1,977 +0,0 @@
-### ====================================================================
-### @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
-### <at>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) "<BR>")
- }
- html_end_toc()
- html_begin_issue()
- print_line(prefix(2) Journal "<BR>")
- }
- 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}/, "\\&agrave;", s)
- gsub(/{\\'a}/, "\\&aacute;", s)
- gsub(/{\\[\^]a}/,"\\&acirc;", s)
- gsub(/{\\~a}/, "\\&atilde;", s)
- gsub(/{\\\"a}/, "\\&auml;", s)
- gsub(/{\\aa}/, "\\&aring;", s)
- gsub(/{\\ae}/, "\\&aelig;", s)
-
- gsub(/{\\c{c}}/,"\\&ccedil;", s)
-
- gsub(/{\\\e}/, "\\&egrave;", s)
- gsub(/{\\'e}/, "\\&eacute;", s)
- gsub(/{\\[\^]e}/,"\\&ecirc;", s)
- gsub(/{\\\"e}/, "\\&euml;", s)
-
- gsub(/{\\\i}/, "\\&igrave;", s)
- gsub(/{\\'i}/, "\\&iacute;", s)
- gsub(/{\\[\^]i}/,"\\&icirc;", s)
- gsub(/{\\\"i}/, "\\&iuml;", s)
-
- # ignore eth and thorn
-
- gsub(/{\\~n}/, "\\&ntilde;", s)
-
- gsub(/{\\\o}/, "\\&ograve;", s)
- gsub(/{\\'o}/, "\\&oacute;", s)
- gsub(/{\\[\^]o}/, "\\&ocirc;", s)
- gsub(/{\\~o}/, "\\&otilde;", s)
- gsub(/{\\\"o}/, "\\&ouml;", s)
- gsub(/{\\o}/, "\\&oslash;", s)
-
- gsub(/{\\\u}/, "\\&ugrave;", s)
- gsub(/{\\'u}/, "\\&uacute;", s)
- gsub(/{\\[\^]u}/,"\\&ucirc;", s)
- gsub(/{\\\"u}/, "\\&uuml;", s)
-
- gsub(/{\\'y}/, "\\&yacute;", s)
- gsub(/{\\\"y}/, "\\&yuml;", s)
-
- # Now do the same for upper-case accents
-
- gsub(/{\\\A}/, "\\&Agrave;", s)
- gsub(/{\\'A}/, "\\&Aacute;", s)
- gsub(/{\\[\^]A}/, "\\&Acirc;", s)
- gsub(/{\\~A}/, "\\&Atilde;", s)
- gsub(/{\\\"A}/, "\\&Auml;", s)
- gsub(/{\\AA}/, "\\&Aring;", s)
- gsub(/{\\AE}/, "\\&AElig;", s)
-
- gsub(/{\\c{C}}/,"\\&Ccedil;", s)
-
- gsub(/{\\\e}/, "\\&Egrave;", s)
- gsub(/{\\'E}/, "\\&Eacute;", s)
- gsub(/{\\[\^]E}/, "\\&Ecirc;", s)
- gsub(/{\\\"E}/, "\\&Euml;", s)
-
- gsub(/{\\\I}/, "\\&Igrave;", s)
- gsub(/{\\'I}/, "\\&Iacute;", s)
- gsub(/{\\[\^]I}/, "\\&Icirc;", s)
- gsub(/{\\\"I}/, "\\&Iuml;", s)
-
- # ignore eth and thorn
-
- gsub(/{\\~N}/, "\\&Ntilde;", s)
-
- gsub(/{\\\O}/, "\\&Ograve;", s)
- gsub(/{\\'O}/, "\\&Oacute;", s)
- gsub(/{\\[\^]O}/, "\\&Ocirc;", s)
- gsub(/{\\~O}/, "\\&Otilde;", s)
- gsub(/{\\\"O}/, "\\&Ouml;", s)
- gsub(/{\\O}/, "\\&Oslash;", s)
-
- gsub(/{\\\U}/, "\\&Ugrave;", s)
- gsub(/{\\'U}/, "\\&Uacute;", s)
- gsub(/{\\[\^]U}/, "\\&Ucirc;", s)
- gsub(/{\\\"U}/, "\\&Uuml;", s)
-
- gsub(/{\\'Y}/, "\\&Yacute;", s)
-
- gsub(/{\\ss}/, "\\&szlig;", s)
-
- # Others not mentioned in Flynn's book
- gsub(/{\\'\\i}/,"\\&iacute;", s)
- gsub(/{\\'\\j}/,"j", s)
- }
- return (s)
-}
-
-
-function html_begin_issue()
-{
- print_line("")
- print_line(prefix(2) "<HR>")
- print_line("")
- print_line(prefix(2) "<H1>")
- print_line(prefix(3) "<A NAME=\"" html_label() "\">")
-}
-
-
-function html_begin_pages()
-{
- return ((HTML && (BIBFILEURL != "")) ? ("<A HREF=\"" BIBFILEURL "#" Citation_label "\">") : "")
-}
-
-
-function html_begin_pre()
-{
- In_PRE = 1
- print_line("<PRE>")
-}
-
-
-function html_begin_title()
-{
- return ((HTML && (Url != "")) ? ("<A HREF=\"" 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) "</A>")
- print_line(prefix(2) "</H1>")
-}
-
-
-function html_end_pages()
-{
- return ((HTML && (BIBFILEURL != "")) ? "</A>" : "")
-}
-
-
-function html_end_pre()
-{
- if (In_PRE)
- {
- print_line("</PRE>")
- In_PRE = 0
- }
-}
-
-
-function html_end_title()
-{
- return ((HTML && (Url != "")) ? "</A>" : "")
-}
-
-
-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 -> <TAG>arg</TAG>
- arg = "<" Font_decl_map[control_word] ">" arg "</" Font_decl_map[control_word] ">"
- 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 -> <TAG>arg</TAG>
- arg = "<" Font_cmd_map[control_word] ">" arg "</" Font_cmd_map[control_word] ">"
- 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 "<!-- WARNING: Do NOT edit this file. It was converted from -->"
- print "<!-- BibTeX format to HTML by journal-toc.awk version " VERSION_NUMBER " " VERSION_DATE " -->"
- print "<!-- on " DATE " -->"
- print "<!-- for " PERSONAL_NAME " (" USER "@" HOSTNAME ") -->"
- print ""
- print ""
- print "<!DOCTYPE HTML public \"-//IETF//DTD HTML//EN\">"
- print ""
- print "<HTML>"
- print prefix(1) "<HEAD>"
- print prefix(2) "<TITLE>"
- print prefix(3) Journal
- print prefix(2) "</TITLE>"
- print prefix(2) "<LINK REV=\"made\" HREF=\"mailto:" USER "@" HOSTNAME "\">"
- print prefix(1) "</HEAD>"
- print ""
- print prefix(1) "<BODY>"
-}
-
-
-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) "<H1>"
- print prefix(3) "Table of contents for issues of " Journal
- print prefix(2) "</H1>"
- print HTML_TOC
-}
-
-
-function html_toc_entry()
-{
- HTML_TOC = HTML_TOC " <A HREF=\"#" html_label() "\">"
- HTML_TOC = HTML_TOC vol_no_month_year()
- HTML_TOC = HTML_TOC "</A><BR>" "\n"
-}
-
-
-function html_trailer()
-{
- html_end_pre()
- print prefix(1) "</BODY>"
- print "</HTML>"
-}
-
-
-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(/&/,"\\&amp;",s) # NB: this one MUST be first
- gsub(/</,"\\&lt;",s)
- gsub(/>/,"\\&gt;",s)
- gsub(/\"/,"\\&quot;",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(/>/, "\\&gt;", s)
- gsub(/</, "\\&lt;", s)
- gsub(/"/, "\\&quot;", s)
- }
-
- gsub(/[$][$]/,"$$",s) # change display math to triple dollars for split
- n = split(s,parts,/[$]/)# split into non-math (odd) and math (even) parts
-
- s = ""
- for (k = 1; k <= n; ++k) # unbrace non-math part, leaving math mode intact
- s = s ((k > 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(/\\&/,"\\&amp;",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(/\\&/,"\\&amp;",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 ? ("<STRONG>" value "</STRONG>") : value)
-}
diff --git a/contrib/awk/test/funstack.in b/contrib/awk/test/funstack.in
deleted file mode 100644
index 7a29a25..0000000
--- a/contrib/awk/test/funstack.in
+++ /dev/null
@@ -1,206 +0,0 @@
-%%% ====================================================================
-%%% 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 <at>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 --git a/contrib/awk/test/funstack.ok b/contrib/awk/test/funstack.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/funstack.ok
+++ /dev/null
diff --git a/contrib/awk/test/gensub.awk b/contrib/awk/test/gensub.awk
deleted file mode 100644
index f91d84d..0000000
--- a/contrib/awk/test/gensub.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN { a = "this is a test of gawk"
- b = gensub(/(this).*(test).*(gawk)/, "3 = <\\3>, 2 = <\\2>, 1 = <\\1>", 1, a)
- print b
-}
-NR == 1 { print gensub(/b/, "BB", 2) }
-NR == 2 { print gensub(/c/, "CC", "global") }
-END { print gensub(/foo/, "bar", 1, "DON'T PANIC") }
diff --git a/contrib/awk/test/gensub.in b/contrib/awk/test/gensub.in
deleted file mode 100644
index 96c9faf..0000000
--- a/contrib/awk/test/gensub.in
+++ /dev/null
@@ -1,2 +0,0 @@
-a b c a b c a b c
-a b c a b c a b c
diff --git a/contrib/awk/test/gensub.ok b/contrib/awk/test/gensub.ok
deleted file mode 100644
index b9ea3de..0000000
--- a/contrib/awk/test/gensub.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-3 = <gawk>, 2 = <test>, 1 = <this>
-a b c a BB c a b c
-a b CC a b CC a b CC
-DON'T PANIC
diff --git a/contrib/awk/test/getline.awk b/contrib/awk/test/getline.awk
deleted file mode 100644
index f4e413f..0000000
--- a/contrib/awk/test/getline.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { while( getline > 0) { print } }
diff --git a/contrib/awk/test/getline.ok b/contrib/awk/test/getline.ok
deleted file mode 100644
index 9b7f2b9..0000000
--- a/contrib/awk/test/getline.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-BEGIN { while( getline > 0) { print } }
-BEGIN { while( getline > 0) { print } }
diff --git a/contrib/awk/test/getlnhd.awk b/contrib/awk/test/getlnhd.awk
deleted file mode 100644
index f0f801b..0000000
--- a/contrib/awk/test/getlnhd.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN { pipe = "cat <<EOF\n"
- pipe = pipe "select * from user\n"
- pipe = pipe " where Name = 'O\\'Donell'\n"
- pipe = pipe "EOF\n"
-
- while ((pipe | getline) > 0)
- print
-
- exit 0
-}
diff --git a/contrib/awk/test/getlnhd.ok b/contrib/awk/test/getlnhd.ok
deleted file mode 100644
index d8cb453..0000000
--- a/contrib/awk/test/getlnhd.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-select * from user
- where Name = 'O\'Donell'
diff --git a/contrib/awk/test/gnureops.awk b/contrib/awk/test/gnureops.awk
deleted file mode 100644
index 15b9b84..0000000
--- a/contrib/awk/test/gnureops.awk
+++ /dev/null
@@ -1,45 +0,0 @@
-# test the gnu regexp ops
-
-BEGIN {
- if ("a rat is here" ~ /\yrat/) print "test 1 ok (\\y)"
- else print "test 1 failed (\\y)"
- if ("a rat is here" ~ /rat\y/) print "test 2 ok (\\y)"
- else print "test 2 failed (\\y)"
- if ("what a brat" !~ /\yrat/) print "test 3 ok (\\y)"
- else print "test 3 failed (\\y)"
-
- if ("in the crate" ~ /\Brat/) print "test 4 ok (\\B)"
- else print "test 4 failed (\\B)"
- if ("a rat" !~ /\Brat/) print "test 5 ok (\\B)"
- else print "test 5 failed (\\B)"
-
- if ("a word" ~ /\<word/) print "test 6 ok (\\<)"
- else print "test 6 failed (\\<)"
- if ("foreword" !~ /\<word/) print "test 7 ok (\\<)"
- else print "test 7 failed (\\<)"
-
- if ("a word" ~ /word\>/) print "test 8 ok (\\>)"
- else print "test 8 failed (\\\\>)"
- if ("wordy" !~ /word\>/) print "test 9 ok (\\>)"
- else print "test 9 failed (\\>)"
-
- if ("a" ~ /\w/) print "test 10 ok (\\w)"
- else print "test 10 failed (\\\\w)"
- if ("+" !~ /\w/) print "test 11 ok (\\w)"
- else print "test 11 failed (\\w)"
-
- if ("a" !~ /\W/) print "test 12 ok (\\W)"
- else print "test 12 failed (\\W)"
- if ("+" ~ /\W/) print "test 13 ok (\\W)"
- else print "test 13 failed (\\W)"
-
- if ("a" ~ /\`a/) print "test 14 ok (\\`)"
- else print "test 14 failed (\\`)"
- if ("b" !~ /\`a/) print "test 15 ok (\\`)"
- else print "test 15 failed (\\`)"
-
- if ("a" ~ /a\'/) print "test 16 ok (\\')"
- else print "test 16 failed (\\')"
- if ("b" !~ /a\'/) print "test 17 ok (\\')"
- else print "test 17 failed (\\')"
-}
diff --git a/contrib/awk/test/gnureops.ok b/contrib/awk/test/gnureops.ok
deleted file mode 100644
index 0fb5f50..0000000
--- a/contrib/awk/test/gnureops.ok
+++ /dev/null
@@ -1,17 +0,0 @@
-test 1 ok (\y)
-test 2 ok (\y)
-test 3 ok (\y)
-test 4 ok (\B)
-test 5 ok (\B)
-test 6 ok (\<)
-test 7 ok (\<)
-test 8 ok (\>)
-test 9 ok (\>)
-test 10 ok (\w)
-test 11 ok (\w)
-test 12 ok (\W)
-test 13 ok (\W)
-test 14 ok (\`)
-test 15 ok (\`)
-test 16 ok (\')
-test 17 ok (\')
diff --git a/contrib/awk/test/gsubasgn.awk b/contrib/awk/test/gsubasgn.awk
deleted file mode 100644
index f0b7701..0000000
--- a/contrib/awk/test/gsubasgn.awk
+++ /dev/null
@@ -1,13 +0,0 @@
-# tests for assigning to a function within that function
-
-#1 - should be bad
-function test1 (r) { gsub(r, "x", test1) }
-BEGIN { test1("") }
-
-#2 - should be bad
-function test2 () { gsub(/a/, "x", test2) }
-BEGIN { test2() }
-
-#3 - should be ok
-function test3 (r) { gsub(/a/, "x", r) }
-BEGIN { test3("") }
diff --git a/contrib/awk/test/gsubasgn.ok b/contrib/awk/test/gsubasgn.ok
deleted file mode 100644
index dfa6fbc..0000000
--- a/contrib/awk/test/gsubasgn.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-gawk: gsubasgn.awk:4: function test1 (r) { gsub(r, "x", test1) }
-gawk: gsubasgn.awk:4: ^ gsub third parameter is not a changeable object
-gawk: gsubasgn.awk:8: function test2 () { gsub(/a/, "x", test2) }
-gawk: gsubasgn.awk:8: ^ gsub third parameter is not a changeable object
diff --git a/contrib/awk/test/gsubtest.awk b/contrib/awk/test/gsubtest.awk
deleted file mode 100755
index 5dfefe9..0000000
--- a/contrib/awk/test/gsubtest.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN {
- str = "abc"; print gsub("b+", "FOO", str), str
- str = "abc"; print gsub("x*", "X", str), str
- str = "abc"; print gsub("b*", "X", str), str
- str = "abc"; print gsub("c", "X", str), str
- str = "abc"; print gsub("c+", "X", str), str
- str = "abc"; print gsub("x*$", "X", str), str
-}
diff --git a/contrib/awk/test/gsubtest.ok b/contrib/awk/test/gsubtest.ok
deleted file mode 100644
index 7c18f43..0000000
--- a/contrib/awk/test/gsubtest.ok
+++ /dev/null
@@ -1,6 +0,0 @@
-1 aFOOc
-4 XaXbXcX
-3 XaXcX
-1 abX
-1 abX
-1 abcX
diff --git a/contrib/awk/test/igncfs.awk b/contrib/awk/test/igncfs.awk
deleted file mode 100644
index ebb58b2..0000000
--- a/contrib/awk/test/igncfs.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN {
- IGNORECASE=1
- FS="[^a-z]+"
-}
-{
- for (i=1; i<NF; i++) printf "%s, ", $i
- printf "%s\n", $NF
-}
diff --git a/contrib/awk/test/igncfs.in b/contrib/awk/test/igncfs.in
deleted file mode 100644
index 5598017..0000000
--- a/contrib/awk/test/igncfs.in
+++ /dev/null
@@ -1,2 +0,0 @@
-this is handled ok
-This is Not hanDLed Well
diff --git a/contrib/awk/test/igncfs.ok b/contrib/awk/test/igncfs.ok
deleted file mode 100644
index 41df9a4..0000000
--- a/contrib/awk/test/igncfs.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-this, is, handled, ok
-This, is, Not, hanDLed, Well
diff --git a/contrib/awk/test/ignrcase.ok b/contrib/awk/test/ignrcase.ok
deleted file mode 100644
index d66e95c..0000000
--- a/contrib/awk/test/ignrcase.ok
+++ /dev/null
@@ -1 +0,0 @@
-xz
diff --git a/contrib/awk/test/inftest.awk b/contrib/awk/test/inftest.awk
deleted file mode 100644
index f24bd7e..0000000
--- a/contrib/awk/test/inftest.awk
+++ /dev/null
@@ -1,5 +0,0 @@
-BEGIN {
- x = 100
- do { y = x ; x *= 1000; print x,y } while ( y < x )
- print "loop terminated"
-}
diff --git a/contrib/awk/test/inftest.ok b/contrib/awk/test/inftest.ok
deleted file mode 100644
index 83a93d0..0000000
--- a/contrib/awk/test/inftest.ok
+++ /dev/null
@@ -1,105 +0,0 @@
-100000 100
-100000000 100000
-1e+11 100000000
-1e+14 1e+11
-1e+17 1e+14
-1e+20 1e+17
-1e+23 1e+20
-1e+26 1e+23
-1e+29 1e+26
-1e+32 1e+29
-1e+35 1e+32
-1e+38 1e+35
-1e+41 1e+38
-1e+44 1e+41
-1e+47 1e+44
-1e+50 1e+47
-1e+53 1e+50
-1e+56 1e+53
-1e+59 1e+56
-1e+62 1e+59
-1e+65 1e+62
-1e+68 1e+65
-1e+71 1e+68
-1e+74 1e+71
-1e+77 1e+74
-1e+80 1e+77
-1e+83 1e+80
-1e+86 1e+83
-1e+89 1e+86
-1e+92 1e+89
-1e+95 1e+92
-1e+98 1e+95
-1e+101 1e+98
-1e+104 1e+101
-1e+107 1e+104
-1e+110 1e+107
-1e+113 1e+110
-1e+116 1e+113
-1e+119 1e+116
-1e+122 1e+119
-1e+125 1e+122
-1e+128 1e+125
-1e+131 1e+128
-1e+134 1e+131
-1e+137 1e+134
-1e+140 1e+137
-1e+143 1e+140
-1e+146 1e+143
-1e+149 1e+146
-1e+152 1e+149
-1e+155 1e+152
-1e+158 1e+155
-1e+161 1e+158
-1e+164 1e+161
-1e+167 1e+164
-1e+170 1e+167
-1e+173 1e+170
-1e+176 1e+173
-1e+179 1e+176
-1e+182 1e+179
-1e+185 1e+182
-1e+188 1e+185
-1e+191 1e+188
-1e+194 1e+191
-1e+197 1e+194
-1e+200 1e+197
-1e+203 1e+200
-1e+206 1e+203
-1e+209 1e+206
-1e+212 1e+209
-1e+215 1e+212
-1e+218 1e+215
-1e+221 1e+218
-1e+224 1e+221
-1e+227 1e+224
-1e+230 1e+227
-1e+233 1e+230
-1e+236 1e+233
-1e+239 1e+236
-1e+242 1e+239
-1e+245 1e+242
-1e+248 1e+245
-1e+251 1e+248
-1e+254 1e+251
-1e+257 1e+254
-1e+260 1e+257
-1e+263 1e+260
-1e+266 1e+263
-1e+269 1e+266
-1e+272 1e+269
-1e+275 1e+272
-1e+278 1e+275
-1e+281 1e+278
-1e+284 1e+281
-1e+287 1e+284
-1e+290 1e+287
-1e+293 1e+290
-1e+296 1e+293
-1e+299 1e+296
-1e+302 1e+299
-1e+305 1e+302
-1e+308 1e+305
-Inf 1e+308
-Inf Inf
-loop terminated
diff --git a/contrib/awk/test/intest.awk b/contrib/awk/test/intest.awk
deleted file mode 100644
index f030d07..0000000
--- a/contrib/awk/test/intest.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-BEGIN {
- bool = ((b = 1) in c);
- print bool, b # gawk-3.0.1 prints "0 "; should print "0 1"
-}
diff --git a/contrib/awk/test/intest.ok b/contrib/awk/test/intest.ok
deleted file mode 100644
index 6e8183b..0000000
--- a/contrib/awk/test/intest.ok
+++ /dev/null
@@ -1 +0,0 @@
-0 1
diff --git a/contrib/awk/test/intprec.awk b/contrib/awk/test/intprec.awk
deleted file mode 100644
index 978e9ea..0000000
--- a/contrib/awk/test/intprec.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { printf "%.10d:%.10x\n", 5, 14 }
diff --git a/contrib/awk/test/intprec.ok b/contrib/awk/test/intprec.ok
deleted file mode 100644
index 8783fac..0000000
--- a/contrib/awk/test/intprec.ok
+++ /dev/null
@@ -1 +0,0 @@
-0000000005:000000000e
diff --git a/contrib/awk/test/lib/awkpath.awk b/contrib/awk/test/lib/awkpath.awk
deleted file mode 100644
index 6663ca4..0000000
--- a/contrib/awk/test/lib/awkpath.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { print "Found it." }
diff --git a/contrib/awk/test/litoct.awk b/contrib/awk/test/litoct.awk
deleted file mode 100644
index 5cfc128..0000000
--- a/contrib/awk/test/litoct.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ if (/a\52b/) print "match" ; else print "no match" }
diff --git a/contrib/awk/test/litoct.ok b/contrib/awk/test/litoct.ok
deleted file mode 100644
index 4c0be97..0000000
--- a/contrib/awk/test/litoct.ok
+++ /dev/null
@@ -1 +0,0 @@
-no match
diff --git a/contrib/awk/test/longwrds.awk b/contrib/awk/test/longwrds.awk
deleted file mode 100644
index f6a7816..0000000
--- a/contrib/awk/test/longwrds.awk
+++ /dev/null
@@ -1,20 +0,0 @@
-# From Gawk Manual modified by bug fix and removal of punctuation
-# Record every word which is used at least once
-{
- for (i = 1; i <= NF; i++) {
- tmp = tolower($i)
- if (0 != (pos = match(tmp, /([a-z]|-)+/)))
- used[substr(tmp, pos, RLENGTH)] = 1
- }
-}
-
-#Find a number of distinct words longer than 10 characters
-END {
- num_long_words = 0
- for (x in used)
- if (length(x) > 10) {
- ++num_long_words
- print x
- }
- print num_long_words, "long words"
-}
diff --git a/contrib/awk/test/longwrds.ok b/contrib/awk/test/longwrds.ok
deleted file mode 100644
index 01faa84..0000000
--- a/contrib/awk/test/longwrds.ok
+++ /dev/null
@@ -1,21 +0,0 @@
-20 long words
-compatibility
-concatenated
-consistency
-definitions
-description
-distributing
-fistatements
-gawk-options
-gnu-specific
-identically
-implementation
-implementations
-information
-non-portable
-pattern-action
-pre-defined
-program-file
-program-text
-programming
-restrictions
diff --git a/contrib/awk/test/manpage b/contrib/awk/test/manpage
deleted file mode 100644
index 09c3948..0000000
--- a/contrib/awk/test/manpage
+++ /dev/null
@@ -1,200 +0,0 @@
-.ds PX \s-1POSIX\s+1
-.ds UX \s-1UNIX\s+1
-.ds AN \s-1ANSI\s+1
-.TH GAWK 1 "May 28 1991" "Free Software Foundation" "Utility Commands"
-.SH NAME
-gawk \- pattern scanning and processing language
-.SH SYNOPSIS
-.B gawk
-[
-.B \-W
-.I gawk-options
-] [
-.BI \-F\^ fs
-] [
-.B \-v
-.IR var = val
-]
-.B \-f
-.I program-file
-[
-.B \-\^\-
-] file .\^.\^.
-.br
-.B gawk
-[
-.B \-W
-.I gawk-options
-] [
-.BI \-F\^ fs
-] [
-.B \-v
-.IR var = val
-] [
-.B \-\^\-
-]
-.I program-text
-file .\^.\^.
-.SH DESCRIPTION
-.I Gawk
-is the GNU Project's implementation of the AWK programming language.
-It conforms to the definition of the language in
-the \*(PX 1003.2 Command Language And Utilities Standard
-(draft 11).
-This version in turn is based on the description in
-.IR "The AWK Programming Language" ,
-by Aho, Kernighan, and Weinberger,
-with the additional features defined in the System V Release 4 version
-of \*(UX
-.IR awk .
-.I Gawk
-also provides some GNU-specific extensions.
-.PP
-The command line consists of options to
-.I gawk
-itself, the AWK program text (if not supplied via the
-.B \-f
-option), and values to be made
-available in the
-.B ARGC
-and
-.B ARGV
-pre-defined AWK variables.
-.SH OPTIONS
-.PP
-.I Gawk
-accepts the following options, which should be available on any implementation
-of the AWK language.
-.TP
-.BI \-F fs
-Use
-.I fs
-for the input field separator (the value of the
-.B FS
-predefined
-variable).
-.TP
-\fB\-v\fI var\fR\^=\^\fIval\fR
-Assign the value
-.IR val ,
-to the variable
-.IR var ,
-before execution of the program begins.
-Such variable values are available to the
-.B BEGIN
-block of an AWK program.
-.TP
-.BI \-f " program-file"
-Read the AWK program source from the file
-.IR program-file ,
-instead of from the first command line argument.
-Multiple
-.B \-f
-options may be used.
-.TP
-.B \-\^\-
-Signal the end of options. This is useful to allow further arguments to the
-AWK program itself to start with a ``\-''.
-This is mainly for consistency with the argument parsing convention used
-by most other \*(PX programs.
-.PP
-Following the \*(PX standard,
-.IR gawk -specific
-options are supplied via arguments to the
-.B \-W
-option. Multiple
-.B \-W
-options may be supplied, or multiple arguments may be supplied together
-if they are separated by commas, or enclosed in quotes and separated
-by white space.
-Case is ignored in arguments to the
-.B \-W
-option.
-.PP
-The
-.B \-W
-option accepts the following arguments:
-.TP \w'\fBcopyright\fR'u+1n
-.B compat
-Run in
-.I compatibility
-mode. In compatibility mode,
-.I gawk
-behaves identically to \*(UX
-.IR awk ;
-none of the GNU-specific extensions are recognized.
-.TP
-.PD 0
-.B copyleft
-.TP
-.PD
-.B copyright
-Print the short version of the GNU copyright information message on
-the error output.
-.TP
-.B lint
-Provide warnings about constructs that are
-dubious or non-portable to other AWK implementations.
-.TP
-.B posix
-This turns on
-.I compatibility
-mode, with the following additional restrictions:
-.RS
-.TP \w'\(bu'u+1n
-\(bu
-.B \ex
-escape sequences are not recognized.
-.TP
-\(bu
-The synonym
-.B func
-for the keyword
-.B function
-is not recognized.
-.TP
-\(bu
-The operators
-.B **
-and
-.B **=
-cannot be used in place of
-.B ^
-and
-.BR ^= .
-.RE
-.TP
-.B version
-Print version information for this particular copy of
-.I gawk
-on the error output.
-This is useful mainly for knowing if the current copy of
-.I gawk
-on your system
-is up to date with respect to whatever the Free Software Foundation
-is distributing.
-.PP
-Any other options are flagged as illegal, but are otherwise ignored.
-.SH AWK PROGRAM EXECUTION
-.PP
-An AWK program consists of a sequence of pattern-action statements
-and optional function definitions.
-.RS
-.PP
-\fIpattern\fB { \fIaction statements\fB }\fR
-.br
-\fBfunction \fIname\fB(\fIparameter list\fB) { \fIstatements\fB }\fR
-.RE
-.PP
-.I Gawk
-first reads the program source from the
-.IR program-file (s)
-if specified, or from the first non-option argument on the command line.
-The
-.B \-f
-option may be used multiple times on the command line.
-.I Gawk
-will read the program text as if all the
-.IR program-file s
-had been concatenated together. This is useful for building libraries
-of AWK functions, without having to include them in each new AWK
diff --git a/contrib/awk/test/manyfiles.awk b/contrib/awk/test/manyfiles.awk
deleted file mode 100644
index 8651a3a..0000000
--- a/contrib/awk/test/manyfiles.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print $2 > ("junk/" $1) }
diff --git a/contrib/awk/test/math.awk b/contrib/awk/test/math.awk
deleted file mode 100644
index 90a01dd..0000000
--- a/contrib/awk/test/math.awk
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN {
- pi = 3.1415927
- printf "cos(%f) = %f\n", pi/4, cos(pi/4)
- printf "sin(%f) = %f\n", pi/4, sin(pi/4)
- e = exp(1)
- printf "e = %f\n", e
- printf "log(e) = %f\n", log(e)
- printf "sqrt(pi ^ 2) = %f\n", sqrt(pi ^ 2)
- printf "atan2(1, 1) = %f\n", atan2(1, 1)
-}
diff --git a/contrib/awk/test/math.ok b/contrib/awk/test/math.ok
deleted file mode 100644
index a396a5b..0000000
--- a/contrib/awk/test/math.ok
+++ /dev/null
@@ -1,6 +0,0 @@
-cos(0.785398) = 0.707107
-sin(0.785398) = 0.707107
-e = 2.718282
-log(e) = 1.000000
-sqrt(pi ^ 2) = 3.141593
-atan2(1, 1) = 0.785398
diff --git a/contrib/awk/test/messages.awk b/contrib/awk/test/messages.awk
deleted file mode 100644
index 555f6e3..0000000
--- a/contrib/awk/test/messages.awk
+++ /dev/null
@@ -1,9 +0,0 @@
-# This is a demo of different ways of printing with gawk. Try it
-# with and without -c (compatibility) flag, redirecting output
-# from gawk to a file or not. Some results can be quite unexpected.
-BEGIN {
- print "Goes to a file out1" > "out1"
- print "Normal print statement"
- print "This printed on stdout" > "/dev/stdout"
- print "You blew it!" > "/dev/stderr"
-}
diff --git a/contrib/awk/test/mmap8k.in b/contrib/awk/test/mmap8k.in
deleted file mode 100644
index 0500ddf..0000000
--- a/contrib/awk/test/mmap8k.in
+++ /dev/null
@@ -1,143 +0,0 @@
-XXXXXXXX.com ALTERNET 9305 930528 1500.00 startup
-XXXXXXXX.com ALTERNET 9305 930624 94.38 Line-9305
-XXXXXXXX.com ALTERNET 9306 930624 104.49 Line-9306
-XXXXXXXX.com ALTERNET 9306 930624 649.16 Line-install
-XXXXXXXX.com ALTERNET 9306 930624 166.67 TCP-slip
-XXXXXXXX.com ALTERNET 9307 930624 104.49 Line-9307
-XXXXXXXX.com ALTERNET 9307 930624 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9308 930701 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9308 930701 104.49 line-9308
-XXXXXXXX.com PAYMENT 9307 930731 1500.00 1870
-XXXXXXXX.com ALTERNET 9309 930801 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9309 930801 104.49 line-9309
-XXXXXXXX.com INTEREST 9307 930801 22.50
-XXXXXXXX.com CREDADJ 9308 930805 22.50 waive interest
-XXXXXXXX.com PAYMENT 9308 930820 1723.68 1982
-XXXXXXXX.com ALTERNET 9310 930901 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9310 930901 104.49 line-9310
-XXXXXXXX.com PAYMENT 9310 931001 708.98 2313
-XXXXXXXX.com ALTERNET 9311 931001 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9311 931001 104.49 line-9311
-XXXXXXXX.com INTEREST 9309 931001 5.32
-XXXXXXXX.com CREDADJ 9310 931007 5.32 waive int-9309
-XXXXXXXX.com ALTERNET 9312 931101 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9312 931101 104.49 line-9312
-XXXXXXXX.com PAYMENT 9311 931120 354.49 002701
-XXXXXXXX.com ALTERNET 9401 931201 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9401 931201 104.49 line-9401
-XXXXXXXX.com PAYMENT 9312 931218 354.49 2884
-XXXXXXXX.com ALTERNET 9402 940101 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9402 940101 104.49 line-9402
-XXXXXXXX.com INTEREST 9312 940101 5.32
-XXXXXXXX.com PAYMENT 9401 940122 354.49 3084
-XXXXXXXX.com ALTERNET 9403 940201 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9403 940201 104.49 line-9403
-XXXXXXXX.com INTEREST 9401 940201 5.40
-XXXXXXXX.com PAYMENT 9402 940207 354.49 3140
-XXXXXXXX.com CREDADJ 9402 940211 5.32 interest-9402
-XXXXXXXX.com CREDADJ 9402 940211 5.40 interest-9403
-XXXXXXXX.com ALTERNET 9404 940301 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9404 940301 104.49 line-9404
-XXXXXXXX.com INTEREST 9402 940301 5.32
-XXXXXXXX.com PAYMENT 9403 940310 354.49 003307
-XXXXXXXX.com PAYMENT 9403 940324 354.49 3446
-XXXXXXXX.com ALTERNET 9405 940401 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9405 940401 104.49 line-9405
-XXXXXXXX.com ALTERNET 9406 940501 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9406 940501 104.49 line-9406
-XXXXXXXX.com INTEREST 9404 940501 5.40
-XXXXXXXX.com PAYMENT 9405 940509 359.81 003819
-XXXXXXXX.com ALTERNET 9407 940601 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9407 940601 104.49 line-9407
-XXXXXXXX.com INTEREST 9405 940601 5.40
-XXXXXXXX.com PAYMENT 9406 940603 354.49 004025
-XXXXXXXX.com ALTERNET 9408 940701 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9408 940701 104.49 line-9408
-XXXXXXXX.com INTEREST 9406 940701 5.48
-XXXXXXXX.com PAYMENT 9407 940725 354.49 004350
-XXXXXXXX.com ALTERNET 9409 940801 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9409 940801 104.49 line-9409
-XXXXXXXX.com INTEREST 9407 940801 5.56
-XXXXXXXX.com PAYMENT 9408 940808 354.49 004454
-XXXXXXXX.com ALTERNET 9409 940811 0.00 startup
-XXXXXXXX.com EQUIPMENT 9408 940831 399.00 ATL6402-1
-XXXXXXXX.com EQUIPMENT 9408 940831 2295.00 NBClassicPac-1
-XXXXXXXX.com EQUIPMENT 9408 940831 1060.00 Syn35-1+ship
-XXXXXXXX.com ALTERNET 9410 940901 250.00 TCP-slip
-XXXXXXXX.com ALTERNET 9410 940901 104.49 line-9410
-XXXXXXXX.com INTEREST 9408 940901 5.64
-XXXXXXXX.com PAYMENT 9409 940906 354.49 004677
-XXXXXXXX.com CREDADJ 9409 940921 124.95 TCP-slip-9409
-XXXXXXXX.com CREDADJ 9409 940921 52.20 line-9409
-XXXXXXXX.com CREDADJ 9410 940921 250.00 TCP-slip-9410
-XXXXXXXX.com CREDADJ 9410 940921 104.49 line-9410
-XXXXXXXX.com ALTERNET 9409 940921 397.50 TCP-56k-local recon
-XXXXXXXX.com ALTERNET 9409 940921 87.45 line-9409 recon
-XXXXXXXX.com ALTERNET 9410 940921 795.00 TCP-56k-local recon
-XXXXXXXX.com ALTERNET 9410 940921 174.90 line-9410 recon
-XXXXXXXX.com ALTERNET 9411 941001 795.00 TCP-56k-local
-XXXXXXXX.com ALTERNET 9411 941001 174.90 line-9411
-XXXXXXXX.com INTEREST 9409 941001 54.06
-XXXXXXXX.com PAYMENT 9410 941017 354.49 5026
-XXXXXXXX.com ALTERNET 9412 941101 795.00 TCP-56k-local
-XXXXXXXX.com ALTERNET 9412 941101 174.90 line-9412
-XXXXXXXX.com INTEREST 9410 941101 85.93
-XXXXXXXX.com PAYMENT 9411 941114 969.90 005274
-XXXXXXXX.com ALTERNET 9501 941201 795.00 TCP-56k-local
-XXXXXXXX.com ALTERNET 9501 941201 174.90 line-9501
-XXXXXXXX.com INTEREST 9411 941201 87.22
-XXXXXXXX.com PAYMENT 9412 941219 4723.90 5590
-XXXXXXXX.com ALTERNET 9502 950101 795.00 TCP-56k-local
-XXXXXXXX.com ALTERNET 9502 950101 174.90 line-9502
-XXXXXXXX.com INTEREST 9412 950101 32.22
-XXXXXXXX.com PAYMENT 9501 950103 1893.11 5766
-XXXXXXXX.com ALTERNET 9503 950201 795.00 TCP-56k-local-old
-XXXXXXXX.com ALTERNET 9503 950201 174.90 line-9503
-XXXXXXXX.com INTEREST 9501 950201 18.85
-XXXXXXXX.com PAYMENT 9502 950207 969.90 6044
-XXXXXXXX.com ALTERNET 9504 950301 795.00 TCP-56k-local-old
-XXXXXXXX.com ALTERNET 9504 950301 174.90 line-9504
-XXXXXXXX.com INTEREST 9502 950301 19.13
-XXXXXXXX.com PAYMENT 9503 950307 969.90 6408
-XXXXXXXX.com ALTERNET 9504 950316 3000.00 startup TCP-bt1-128k%5
-XXXXXXXX.com PAYMENT 9503 950327 969.90 6594
-XXXXXXXX.com ALTERNET 9505 950401 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9505 950401 556.60 line-9505
-XXXXXXXX.com EQUIPMENT 9504 950410 1595.00 cisco2501-1
-XXXXXXXX.com CREDADJ 9504 950417 503.50 TCP-56k-local
-XXXXXXXX.com CREDADJ 9504 950417 116.60 line-9504
-XXXXXXXX.com ALTERNET 9504 950417 448.80 line-install
-XXXXXXXX.com ALTERNET 9504 950417 752.02 TCP-bt1-128k%5 recon
-XXXXXXXX.com ALTERNET 9504 950417 371.00 line-9504 recon
-XXXXXXXX.com PAYMENT 9504 950424 3000.00 6841
-XXXXXXXX.com ALTERNET 9506 950501 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9506 950501 556.60 line-9506
-XXXXXXXX.com PAYMENT 9505 950505 2049.86 6985
-XXXXXXXX.com PAYMENT 9505 950531 3924.22 7179
-XXXXXXXX.com ALTERNET 9507 950601 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9507 950601 556.60 line-9507
-XXXXXXXX.com PAYMENT 9506 950607 1744.10 7232
-XXXXXXXX.com ALTERNET 9508 950701 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9508 950701 556.60 line-9508
-XXXXXXXX.com PAYMENT 9507 950705 1744.10 7641
-XXXXXXXX.com ALTERNET 9509 950801 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9509 950801 556.60 line-9509
-XXXXXXXX.com PAYMENT 9508 950803 1744.10 7914
-XXXXXXXX.com ALTERNET 9510 950901 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9510 950901 556.60 line-9510
-XXXXXXXX.com PAYMENT 9509 950905 1744.10 8203
-XXXXXXXX.com ALTERNET 9511 951001 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9511 951001 556.60 line-9511
-XXXXXXXX.com PAYMENT 9510 951003 1744.10 8508
-XXXXXXXX.com ALTERNET 9512 951101 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9512 951101 556.60 line-9512
-XXXXXXXX.com PAYMENT 9511 951103 2129.83 8837
-XXXXXXXX.com ALTERNET 9601 951201 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9601 951201 556.60 line-9601
-XXXXXXXX.com PAYMENT 9512 951204 2129.83 9131
-XXXXXXXX.com ALTERNET 9602 960101 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9602 960101 556.60 line-9602
-XXXXXXXX.com PAYMENT 9601 960103 1744.10 9456
-XXXXXXXX.com ALTERNET 9603 960201 1187.50 TCP-bt1-128k%5.00
-XXXXXXXX.com ALTERNET 9603 960201 556.60 line-9603
-XXXXXXXX.com PAYMENT 9602 960205 1358.37 9834
diff --git a/contrib/awk/test/negexp.ok b/contrib/awk/test/negexp.ok
deleted file mode 100644
index 6e6566c..0000000
--- a/contrib/awk/test/negexp.ok
+++ /dev/null
@@ -1 +0,0 @@
-0.01
diff --git a/contrib/awk/test/nfldstr.ok b/contrib/awk/test/nfldstr.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/nfldstr.ok
+++ /dev/null
diff --git a/contrib/awk/test/nfset.awk b/contrib/awk/test/nfset.awk
deleted file mode 100644
index 09ebd08..0000000
--- a/contrib/awk/test/nfset.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ NF = 5 ; print }
diff --git a/contrib/awk/test/nfset.in b/contrib/awk/test/nfset.in
deleted file mode 100644
index 43329b5..0000000
--- a/contrib/awk/test/nfset.in
+++ /dev/null
@@ -1,5 +0,0 @@
-1 2
-1 2 3 4
-1 2 3 4 5
-1 2 3 4 5 6 7 8
-1
diff --git a/contrib/awk/test/nfset.ok b/contrib/awk/test/nfset.ok
deleted file mode 100644
index 3ba48ae..0000000
--- a/contrib/awk/test/nfset.ok
+++ /dev/null
@@ -1,5 +0,0 @@
-1 2
-1 2 3 4
-1 2 3 4 5
-1 2 3 4 5
-1
diff --git a/contrib/awk/test/nlfldsep.awk b/contrib/awk/test/nlfldsep.awk
deleted file mode 100644
index 4fac81d..0000000
--- a/contrib/awk/test/nlfldsep.awk
+++ /dev/null
@@ -1,2 +0,0 @@
-BEGIN { RS = "A" }
-{print NF; for (i = 1; i <= NF; i++) print $i ; print ""}
diff --git a/contrib/awk/test/nlfldsep.in b/contrib/awk/test/nlfldsep.in
deleted file mode 100644
index 7b2317f..0000000
--- a/contrib/awk/test/nlfldsep.in
+++ /dev/null
@@ -1,5 +0,0 @@
-some stuff
-more stuffA
-junk
-stuffA
-final
diff --git a/contrib/awk/test/nlfldsep.ok b/contrib/awk/test/nlfldsep.ok
deleted file mode 100644
index 6684916..0000000
--- a/contrib/awk/test/nlfldsep.ok
+++ /dev/null
@@ -1,13 +0,0 @@
-4
-some
-stuff
-more
-stuff
-
-2
-junk
-stuff
-
-1
-final
-
diff --git a/contrib/awk/test/noeffect.awk b/contrib/awk/test/noeffect.awk
deleted file mode 100644
index b375a4c..0000000
--- a/contrib/awk/test/noeffect.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-BEGIN {
- s == "hello, world";
- print s
-}
diff --git a/contrib/awk/test/noeffect.ok b/contrib/awk/test/noeffect.ok
deleted file mode 100644
index 792ff66..0000000
--- a/contrib/awk/test/noeffect.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-gawk: noeffect.awk:3: warning: statement may have no effect
-gawk: noeffect.awk:2: warning: reference to uninitialized variable `s'
-gawk: noeffect.awk:4: warning: reference to uninitialized variable `s'
-
diff --git a/contrib/awk/test/nofmtch.awk b/contrib/awk/test/nofmtch.awk
deleted file mode 100644
index 2ea2249..0000000
--- a/contrib/awk/test/nofmtch.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { printf "%3\n" }
diff --git a/contrib/awk/test/nofmtch.ok b/contrib/awk/test/nofmtch.ok
deleted file mode 100644
index 297d1592..0000000
--- a/contrib/awk/test/nofmtch.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-gawk: nofmtch.awk:1: warning: [s]printf: format specifier does not have control letter
-%3
diff --git a/contrib/awk/test/nondec.awk b/contrib/awk/test/nondec.awk
deleted file mode 100644
index a680110..0000000
--- a/contrib/awk/test/nondec.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { print 0x81c3e8, 0x744018 }
diff --git a/contrib/awk/test/nondec.ok b/contrib/awk/test/nondec.ok
deleted file mode 100644
index 560f3d1..0000000
--- a/contrib/awk/test/nondec.ok
+++ /dev/null
@@ -1 +0,0 @@
-8504296 7618584
diff --git a/contrib/awk/test/nonl.awk b/contrib/awk/test/nonl.awk
deleted file mode 100644
index c227083..0000000
--- a/contrib/awk/test/nonl.awk
+++ /dev/null
@@ -1 +0,0 @@
-0 \ No newline at end of file
diff --git a/contrib/awk/test/nonl.ok b/contrib/awk/test/nonl.ok
deleted file mode 100644
index 24bd9b7..0000000
--- a/contrib/awk/test/nonl.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: nonl.awk:1: warning: source file does not end in newline
diff --git a/contrib/awk/test/noparms.awk b/contrib/awk/test/noparms.awk
deleted file mode 100644
index 2c7ccc7..0000000
--- a/contrib/awk/test/noparms.awk
+++ /dev/null
@@ -1 +0,0 @@
-function x(a, b, c , ,) {}
diff --git a/contrib/awk/test/noparms.ok b/contrib/awk/test/noparms.ok
deleted file mode 100644
index 4c934c3..0000000
--- a/contrib/awk/test/noparms.ok
+++ /dev/null
@@ -1,4 +0,0 @@
-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 --git a/contrib/awk/test/nors.in b/contrib/awk/test/nors.in
deleted file mode 100644
index f90d9ec..0000000
--- a/contrib/awk/test/nors.in
+++ /dev/null
@@ -1 +0,0 @@
-A B C D E \ No newline at end of file
diff --git a/contrib/awk/test/nors.ok b/contrib/awk/test/nors.ok
deleted file mode 100644
index 54d5aab..0000000
--- a/contrib/awk/test/nors.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-E
-E
diff --git a/contrib/awk/test/numsubstr.awk b/contrib/awk/test/numsubstr.awk
deleted file mode 100644
index 7a30993..0000000
--- a/contrib/awk/test/numsubstr.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print substr(1000+$1, 2) }
diff --git a/contrib/awk/test/numsubstr.in b/contrib/awk/test/numsubstr.in
deleted file mode 100644
index ac65c36..0000000
--- a/contrib/awk/test/numsubstr.in
+++ /dev/null
@@ -1,3 +0,0 @@
-5000
-10000
-5000
diff --git a/contrib/awk/test/numsubstr.ok b/contrib/awk/test/numsubstr.ok
deleted file mode 100644
index 86ec13c..0000000
--- a/contrib/awk/test/numsubstr.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-000
-1000
-000
diff --git a/contrib/awk/test/out1.ok b/contrib/awk/test/out1.ok
deleted file mode 100644
index f54b2b4..0000000
--- a/contrib/awk/test/out1.ok
+++ /dev/null
@@ -1 +0,0 @@
-Goes to a file out1
diff --git a/contrib/awk/test/out2.ok b/contrib/awk/test/out2.ok
deleted file mode 100644
index 66b7d2f..0000000
--- a/contrib/awk/test/out2.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-Normal print statement
-This printed on stdout
diff --git a/contrib/awk/test/out3.ok b/contrib/awk/test/out3.ok
deleted file mode 100644
index 7eb822f..0000000
--- a/contrib/awk/test/out3.ok
+++ /dev/null
@@ -1 +0,0 @@
-You blew it!
diff --git a/contrib/awk/test/paramdup.awk b/contrib/awk/test/paramdup.awk
deleted file mode 100644
index 1f1cc7a..0000000
--- a/contrib/awk/test/paramdup.awk
+++ /dev/null
@@ -1,8 +0,0 @@
-BEGIN { foo(0, 1, 2) }
-
-function foo(a, b, c, b, a)
-{
- print "a =", a
- print "b =", b
- print "c =", c
-}
diff --git a/contrib/awk/test/paramdup.ok b/contrib/awk/test/paramdup.ok
deleted file mode 100644
index 0308cc8..0000000
--- a/contrib/awk/test/paramdup.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-gawk: paramdup.awk:4: error: function `foo': parameter #4, `b', duplicates parameter #2
-gawk: paramdup.awk:4: error: function `foo': parameter #5, `a', duplicates parameter #1
diff --git a/contrib/awk/test/pcntplus.awk b/contrib/awk/test/pcntplus.awk
deleted file mode 100644
index 13999ac..0000000
--- a/contrib/awk/test/pcntplus.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { printf "%+d %d\n", 3, 4 }
diff --git a/contrib/awk/test/pcntplus.ok b/contrib/awk/test/pcntplus.ok
deleted file mode 100644
index b790269..0000000
--- a/contrib/awk/test/pcntplus.ok
+++ /dev/null
@@ -1 +0,0 @@
-+3 4
diff --git a/contrib/awk/test/pid.awk b/contrib/awk/test/pid.awk
deleted file mode 100644
index 9b47d90..0000000
--- a/contrib/awk/test/pid.awk
+++ /dev/null
@@ -1,44 +0,0 @@
-# From: John C. Oppenheimer <jco@slinky.convex.com>
-# 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 --git a/contrib/awk/test/pid.ok b/contrib/awk/test/pid.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/pid.ok
+++ /dev/null
diff --git a/contrib/awk/test/pid.sh b/contrib/awk/test/pid.sh
deleted file mode 100755
index 901637a..0000000
--- a/contrib/awk/test/pid.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-AWK=${AWK-../gawk}
-echo $$ > _pid.in
-echo $1 >> _pid.in
-exec $AWK -f pid.awk _pid.in 2>/dev/null
diff --git a/contrib/awk/test/pipeio1.awk b/contrib/awk/test/pipeio1.awk
deleted file mode 100644
index 66f50ad..0000000
--- a/contrib/awk/test/pipeio1.awk
+++ /dev/null
@@ -1,31 +0,0 @@
-# From dragon!gamgee.acad.emich.edu!dhw Tue Mar 18 01:12:15 1997
-# Return-Path: <dragon!gamgee.acad.emich.edu!dhw>
-# Message-ID: <m0w6owW-000IDSC@gamgee.acad.emich.edu>
-# 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 --git a/contrib/awk/test/pipeio1.ok b/contrib/awk/test/pipeio1.ok
deleted file mode 100644
index 706b09e..0000000
--- a/contrib/awk/test/pipeio1.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-1 2
- 2
diff --git a/contrib/awk/test/pipeio2.awk b/contrib/awk/test/pipeio2.awk
deleted file mode 100644
index 32d09ee..0000000
--- a/contrib/awk/test/pipeio2.awk
+++ /dev/null
@@ -1,69 +0,0 @@
-# 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 <this_prog> -"
-
- #com = "cal 01 1997"
- com = ("cat " SRCDIR "/pipeio2.in")
-
- while ((com | getline fnam) > 0) {
-
-# com_tr = "echo " fnam " | tr [0-9]. ..........."
- com_tr = "echo " fnam " | sed 's/[0-9]/./g'"
- # print "\'" com_tr "\'"
- 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 --git a/contrib/awk/test/pipeio2.in b/contrib/awk/test/pipeio2.in
deleted file mode 100644
index 2652b0e..0000000
--- a/contrib/awk/test/pipeio2.in
+++ /dev/null
@@ -1,8 +0,0 @@
- 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 --git a/contrib/awk/test/pipeio2.ok b/contrib/awk/test/pipeio2.ok
deleted file mode 100644
index 0bb3324..0000000
--- a/contrib/awk/test/pipeio2.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-'echo January 1997 | sed 's/[0-9]/./g''
-January ....
-'echo S M Tu W Th F S | sed 's/[0-9]/./g''
-S M Tu W Th F S
-'echo 1 2 3 4 | sed 's/[0-9]/./g''
-. . . .
-'echo 5 6 7 8 9 10 11 | sed 's/[0-9]/./g''
-. . . . . .. ..
-'echo 12 13 14 15 16 17 18 | sed 's/[0-9]/./g''
-.. .. .. .. .. .. ..
-'echo 19 20 21 22 23 24 25 | sed 's/[0-9]/./g''
-.. .. .. .. .. .. ..
-'echo 26 27 28 29 30 31 | sed 's/[0-9]/./g''
-.. .. .. .. .. ..
-'echo | sed 's/[0-9]/./g''
-
diff --git a/contrib/awk/test/posix.awk b/contrib/awk/test/posix.awk
deleted file mode 100644
index 79474f3..0000000
--- a/contrib/awk/test/posix.awk
+++ /dev/null
@@ -1,69 +0,0 @@
-BEGIN {
- a = "+2"; b = 2; c = "+2a"; d = "+2 "; e = " 2"
-
- printf "Test #1: "
- if (b == a) print "\"" a "\"" " compares as a number"
- else print "\"" a "\"" " compares as a string"
-
- printf "Test #2: "
- if (b == c) print "\"" c "\"" " compares as a number"
- else print "\"" c "\"" " compares as a string"
-
- printf "Test #3: "
- if (b == d) print "\"" d "\"" " compares as a number"
- else print "\"" d "\"" " compares as a string"
-
- printf "Test #4: "
- if (b == e) print "\"" e "\"" " compares as a number"
- else print "\"" e "\"" " compares as a string"
-
- f = a + b + c + d + e
- print "after addition"
-
- printf "Test #5: "
- if (b == a) print "\"" a "\"" " compares as a number"
- else print "\"" a "\"" " compares as a string"
-
- printf "Test #6: "
- if (b == c) print "\"" c "\"" " compares as a number"
- else print "\"" c "\"" " compares as a string"
-
- printf "Test #7: "
- if (b == d) print "\"" d "\"" " compares as a number"
- else print "\"" d "\"" " compares as a string"
-
- printf "Test #8: "
- if (b == e) print "\"" e "\"" " compares as a number"
- else print "\"" e "\"" " compares as a string"
-
- printf "Test #9: "
- if ("3e5" > "5") print "\"3e5\" > \"5\""
- else print "\"3e5\" <= \"5\""
-
- printf "Test #10: "
- x = 32.14
- y[x] = "test"
- OFMT = "%e"
- print y[x]
-
- printf "Test #11: "
- x = x + 0
- print y[x]
-
- printf "Test #12: "
- OFMT="%f"
- CONVFMT="%e"
- print 1.5, 1.5 ""
-
- printf "Test #13: "
- if ( 1000000 "" == 1000001 "") print "match"
- else print "nomatch"
-}
-{
- printf "Test #14: "
- FS = ":"
- print $1
- FS = ","
- printf "Test #15: "
- print $2
-}
diff --git a/contrib/awk/test/posix.ok b/contrib/awk/test/posix.ok
deleted file mode 100644
index 100b150..0000000
--- a/contrib/awk/test/posix.ok
+++ /dev/null
@@ -1,16 +0,0 @@
-Test #1: "+2" compares as a string
-Test #2: "+2a" compares as a string
-Test #3: "+2 " compares as a string
-Test #4: " 2" compares as a string
-after addition
-Test #5: "+2" compares as a string
-Test #6: "+2a" compares as a string
-Test #7: "+2 " compares as a string
-Test #8: " 2" compares as a string
-Test #9: "3e5" <= "5"
-Test #10: test
-Test #11: test
-Test #12: 1.500000 1.500000e+00
-Test #13: nomatch
-Test #14: 1:2,3
-Test #15: 4
diff --git a/contrib/awk/test/poundbang b/contrib/awk/test/poundbang
deleted file mode 100755
index d60652e..0000000
--- a/contrib/awk/test/poundbang
+++ /dev/null
@@ -1,3 +0,0 @@
-#! /tmp/gawk -f
- { ccount += length($0) }
-END { printf "average line length is %2.4f\n", ccount/NR}
diff --git a/contrib/awk/test/poundbang.ok b/contrib/awk/test/poundbang.ok
deleted file mode 100644
index 143e28d..0000000
--- a/contrib/awk/test/poundbang.ok
+++ /dev/null
@@ -1 +0,0 @@
-average line length is 32.6667
diff --git a/contrib/awk/test/prdupval.awk b/contrib/awk/test/prdupval.awk
deleted file mode 100644
index 32c67dc..0000000
--- a/contrib/awk/test/prdupval.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print NF, $NF, "abc" $NF }
diff --git a/contrib/awk/test/prdupval.in b/contrib/awk/test/prdupval.in
deleted file mode 100644
index 5626abf..0000000
--- a/contrib/awk/test/prdupval.in
+++ /dev/null
@@ -1 +0,0 @@
-one
diff --git a/contrib/awk/test/prdupval.ok b/contrib/awk/test/prdupval.ok
deleted file mode 100644
index 6253616..0000000
--- a/contrib/awk/test/prdupval.ok
+++ /dev/null
@@ -1 +0,0 @@
-1 one abcone
diff --git a/contrib/awk/test/prmarscl.awk b/contrib/awk/test/prmarscl.awk
deleted file mode 100644
index 3caf3d9..0000000
--- a/contrib/awk/test/prmarscl.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-function test(a)
-{
- print a[1]
-}
-
-BEGIN { j = 4; test(j) }
diff --git a/contrib/awk/test/prmarscl.ok b/contrib/awk/test/prmarscl.ok
deleted file mode 100644
index 41784fd..0000000
--- a/contrib/awk/test/prmarscl.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: prmarscl.awk:4: fatal: attempt to use scalar parameter `a' as an array
diff --git a/contrib/awk/test/prmreuse.awk b/contrib/awk/test/prmreuse.awk
deleted file mode 100644
index 37e06f5..0000000
--- a/contrib/awk/test/prmreuse.awk
+++ /dev/null
@@ -1,14 +0,0 @@
-# from Pat Rankin, rankin@eql.caltech.edu
-
-BEGIN { dummy(1); legit(); exit }
-
-function dummy(arg)
-{
- return arg
-}
-
-function legit( scratch)
-{
- split("1 2 3", scratch)
- return ""
-}
diff --git a/contrib/awk/test/prmreuse.ok b/contrib/awk/test/prmreuse.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/prmreuse.ok
+++ /dev/null
diff --git a/contrib/awk/test/prt1eval.awk b/contrib/awk/test/prt1eval.awk
deleted file mode 100644
index 4ecd368..0000000
--- a/contrib/awk/test/prt1eval.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-function tst () {
- sum += 1
- return sum
-}
-
-BEGIN { OFMT = "%.0f" ; print tst() }
diff --git a/contrib/awk/test/prt1eval.ok b/contrib/awk/test/prt1eval.ok
deleted file mode 100644
index d00491f..0000000
--- a/contrib/awk/test/prt1eval.ok
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/contrib/awk/test/prtoeval.awk b/contrib/awk/test/prtoeval.awk
deleted file mode 100644
index 77880d8..0000000
--- a/contrib/awk/test/prtoeval.awk
+++ /dev/null
@@ -1,4 +0,0 @@
-function returns_a_str() { print "<in function>" ; return "'A STRING'" }
-BEGIN {
- print "partial line:", returns_a_str()
-}
diff --git a/contrib/awk/test/prtoeval.ok b/contrib/awk/test/prtoeval.ok
deleted file mode 100644
index 13e122b..0000000
--- a/contrib/awk/test/prtoeval.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-<in function>
-partial line: 'A STRING'
diff --git a/contrib/awk/test/rand.awk b/contrib/awk/test/rand.awk
deleted file mode 100644
index 6378f3d..0000000
--- a/contrib/awk/test/rand.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-BEGIN {
- srand(2)
- for (i = 0; i < 19; i++)
- printf "%3d ", (1 + int(100 * rand()))
- print ""
-}
diff --git a/contrib/awk/test/rand.ok b/contrib/awk/test/rand.ok
deleted file mode 100644
index 60432b9..0000000
--- a/contrib/awk/test/rand.ok
+++ /dev/null
@@ -1 +0,0 @@
- 62 67 88 6 35 77 3 68 30 96 90 26 35 8 88 93 49 53 37
diff --git a/contrib/awk/test/reg/exp-eq.awk b/contrib/awk/test/reg/exp-eq.awk
deleted file mode 100644
index fed6a69..0000000
--- a/contrib/awk/test/reg/exp-eq.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ $0 ^= 3 ; print $1}
diff --git a/contrib/awk/test/reg/exp-eq.good b/contrib/awk/test/reg/exp-eq.good
deleted file mode 100644
index d8d59aa..0000000
--- a/contrib/awk/test/reg/exp-eq.good
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-8
-27
diff --git a/contrib/awk/test/reg/exp-eq.in b/contrib/awk/test/reg/exp-eq.in
deleted file mode 100644
index 01e79c3..0000000
--- a/contrib/awk/test/reg/exp-eq.in
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-2
-3
diff --git a/contrib/awk/test/reg/exp.awk b/contrib/awk/test/reg/exp.awk
deleted file mode 100644
index 4e707f8..0000000
--- a/contrib/awk/test/reg/exp.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { print exp(0), exp(1000000), exp(0.5) }
diff --git a/contrib/awk/test/reg/exp.good b/contrib/awk/test/reg/exp.good
deleted file mode 100644
index 07b8853..0000000
--- a/contrib/awk/test/reg/exp.good
+++ /dev/null
@@ -1,2 +0,0 @@
-1 gawk: reg/exp.awk:1: warning: exp argument 1e+06 is out of range
-Inf 1.64872
diff --git a/contrib/awk/test/reg/exp.in b/contrib/awk/test/reg/exp.in
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/reg/exp.in
+++ /dev/null
diff --git a/contrib/awk/test/reg/func.awk b/contrib/awk/test/reg/func.awk
deleted file mode 100644
index e32cd4e..0000000
--- a/contrib/awk/test/reg/func.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { print dummy(1) }
diff --git a/contrib/awk/test/reg/func.good b/contrib/awk/test/reg/func.good
deleted file mode 100644
index d3c7c71..0000000
--- a/contrib/awk/test/reg/func.good
+++ /dev/null
@@ -1 +0,0 @@
-gawk: reg/func.awk:1: fatal: function `dummy' not defined
diff --git a/contrib/awk/test/reg/func.in b/contrib/awk/test/reg/func.in
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/reg/func.in
+++ /dev/null
diff --git a/contrib/awk/test/reg/func2.awk b/contrib/awk/test/reg/func2.awk
deleted file mode 100644
index 2abf2c1..0000000
--- a/contrib/awk/test/reg/func2.awk
+++ /dev/null
@@ -1,2 +0,0 @@
-function dummy() { ; }
-BEGIN { print dummy (1) }
diff --git a/contrib/awk/test/reg/func2.good b/contrib/awk/test/reg/func2.good
deleted file mode 100644
index ae87bc3..0000000
--- a/contrib/awk/test/reg/func2.good
+++ /dev/null
@@ -1,2 +0,0 @@
-gawk: reg/func2.awk:2: fatal: function `dummy' called with space between name and (,
-or used in other expression context
diff --git a/contrib/awk/test/reg/func2.in b/contrib/awk/test/reg/func2.in
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/reg/func2.in
+++ /dev/null
diff --git a/contrib/awk/test/reg/log.awk b/contrib/awk/test/reg/log.awk
deleted file mode 100644
index bcae90b..0000000
--- a/contrib/awk/test/reg/log.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { print log(0), log(-1), log(100) }
diff --git a/contrib/awk/test/reg/log.good b/contrib/awk/test/reg/log.good
deleted file mode 100644
index 857ab77..0000000
--- a/contrib/awk/test/reg/log.good
+++ /dev/null
@@ -1,4 +0,0 @@
-log: SING error
--Inf gawk: reg/log.awk:1: warning: log called with negative argument -1
-log: DOMAIN error
-NaN 4.60517
diff --git a/contrib/awk/test/reg/log.in b/contrib/awk/test/reg/log.in
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/reg/log.in
+++ /dev/null
diff --git a/contrib/awk/test/regtest b/contrib/awk/test/regtest
deleted file mode 100755
index 72b0dbf..0000000
--- a/contrib/awk/test/regtest
+++ /dev/null
@@ -1,18 +0,0 @@
-#! /bin/sh
-
-case "$AWK" in
-"") AWK=../gawk ;;
-esac
-#AWK=${AWK:-../gawk}
-
-for i in reg/*.awk
-do
- it=`basename $i .awk`
- $AWK -f $i <reg/$it.in >reg/$it.out 2>&1
- if cmp -s reg/$it.out reg/$it.good
- then
- rm -f reg/$it.out
- else
- echo "regtest: $it fails"
- fi
-done
diff --git a/contrib/awk/test/reindops.awk b/contrib/awk/test/reindops.awk
deleted file mode 100644
index 13ae657..0000000
--- a/contrib/awk/test/reindops.awk
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- if ($1 !~ /^+[2-9]/)
- print "gawk is broken"
- else
- print "gawk is ok"
-}
diff --git a/contrib/awk/test/reindops.in b/contrib/awk/test/reindops.in
deleted file mode 100644
index b1e5435..0000000
--- a/contrib/awk/test/reindops.in
+++ /dev/null
@@ -1 +0,0 @@
-+44 123 456
diff --git a/contrib/awk/test/reindops.ok b/contrib/awk/test/reindops.ok
deleted file mode 100644
index f9605fd..0000000
--- a/contrib/awk/test/reindops.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk is ok
diff --git a/contrib/awk/test/reint.awk b/contrib/awk/test/reint.awk
deleted file mode 100644
index add0f2a..0000000
--- a/contrib/awk/test/reint.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print match($0, /a{3}/) }
diff --git a/contrib/awk/test/reint.in b/contrib/awk/test/reint.in
deleted file mode 100644
index 43caa2a..0000000
--- a/contrib/awk/test/reint.in
+++ /dev/null
@@ -1 +0,0 @@
-match this: aaa
diff --git a/contrib/awk/test/reint.ok b/contrib/awk/test/reint.ok
deleted file mode 100644
index b1bd38b..0000000
--- a/contrib/awk/test/reint.ok
+++ /dev/null
@@ -1 +0,0 @@
-13
diff --git a/contrib/awk/test/reparse.awk b/contrib/awk/test/reparse.awk
deleted file mode 100644
index 433ecbb..0000000
--- a/contrib/awk/test/reparse.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- gsub(/x/, " ")
- $0 = $0
- print $1
- print $0
- print $1, $2, $3
-}
diff --git a/contrib/awk/test/reparse.in b/contrib/awk/test/reparse.in
deleted file mode 100644
index 6f31cde..0000000
--- a/contrib/awk/test/reparse.in
+++ /dev/null
@@ -1 +0,0 @@
-1 axbxc 2
diff --git a/contrib/awk/test/reparse.ok b/contrib/awk/test/reparse.ok
deleted file mode 100644
index 6bdfacf..0000000
--- a/contrib/awk/test/reparse.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-1
-1 a b c 2
-1 a b
diff --git a/contrib/awk/test/resplit.ok b/contrib/awk/test/resplit.ok
deleted file mode 100644
index 6178079..0000000
--- a/contrib/awk/test/resplit.ok
+++ /dev/null
@@ -1 +0,0 @@
-b
diff --git a/contrib/awk/test/rs.in b/contrib/awk/test/rs.in
deleted file mode 100644
index edef835..0000000
--- a/contrib/awk/test/rs.in
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-a
-b
-
-
-c d
-
-
-
-e
-
-
-
-
diff --git a/contrib/awk/test/rs.ok b/contrib/awk/test/rs.ok
deleted file mode 100644
index 9dd6bd3..0000000
--- a/contrib/awk/test/rs.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-a b
-c d
-e
diff --git a/contrib/awk/test/rswhite.awk b/contrib/awk/test/rswhite.awk
deleted file mode 100644
index 0048765..0000000
--- a/contrib/awk/test/rswhite.awk
+++ /dev/null
@@ -1,2 +0,0 @@
-BEGIN { RS = "" }
-{ printf("<%s>\n", $0) }
diff --git a/contrib/awk/test/rswhite.in b/contrib/awk/test/rswhite.in
deleted file mode 100644
index 39f7756..0000000
--- a/contrib/awk/test/rswhite.in
+++ /dev/null
@@ -1,2 +0,0 @@
- a b
-c d
diff --git a/contrib/awk/test/rswhite.ok b/contrib/awk/test/rswhite.ok
deleted file mode 100644
index a029e47..0000000
--- a/contrib/awk/test/rswhite.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-< a b
-c d>
diff --git a/contrib/awk/test/sclforin.awk b/contrib/awk/test/sclforin.awk
deleted file mode 100644
index 335e854..0000000
--- a/contrib/awk/test/sclforin.awk
+++ /dev/null
@@ -1 +0,0 @@
-BEGIN { j = 4; for (i in j) print j[i] }
diff --git a/contrib/awk/test/sclforin.ok b/contrib/awk/test/sclforin.ok
deleted file mode 100644
index f41fc77..0000000
--- a/contrib/awk/test/sclforin.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: sclforin.awk:1: fatal: attempt to use scalar `j' as array
diff --git a/contrib/awk/test/sclifin.awk b/contrib/awk/test/sclifin.awk
deleted file mode 100644
index 64f5d0d..0000000
--- a/contrib/awk/test/sclifin.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
- j = 4
- if ("foo" in j)
- print "ouch"
- else
- print "ok"
-}
diff --git a/contrib/awk/test/sclifin.ok b/contrib/awk/test/sclifin.ok
deleted file mode 100644
index dc74623..0000000
--- a/contrib/awk/test/sclifin.ok
+++ /dev/null
@@ -1 +0,0 @@
-gawk: sclifin.awk:7: fatal: attempt to use scalar `j' as array
diff --git a/contrib/awk/test/splitargv.awk b/contrib/awk/test/splitargv.awk
deleted file mode 100644
index 10886ef..0000000
--- a/contrib/awk/test/splitargv.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
- for (idx = 1; idx < ARGC; idx++)
- split(ARGV[idx], temp, ".");
- }
- {
- print $0;
- }
diff --git a/contrib/awk/test/splitargv.in b/contrib/awk/test/splitargv.in
deleted file mode 100644
index 10886ef..0000000
--- a/contrib/awk/test/splitargv.in
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
- for (idx = 1; idx < ARGC; idx++)
- split(ARGV[idx], temp, ".");
- }
- {
- print $0;
- }
diff --git a/contrib/awk/test/splitargv.ok b/contrib/awk/test/splitargv.ok
deleted file mode 100644
index 10886ef..0000000
--- a/contrib/awk/test/splitargv.ok
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
- for (idx = 1; idx < ARGC; idx++)
- split(ARGV[idx], temp, ".");
- }
- {
- print $0;
- }
diff --git a/contrib/awk/test/splitvar.awk b/contrib/awk/test/splitvar.awk
deleted file mode 100644
index 9e1ac79..0000000
--- a/contrib/awk/test/splitvar.awk
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- sep = "=+"
- n = split($0, a, sep)
- print n
-}
diff --git a/contrib/awk/test/splitvar.in b/contrib/awk/test/splitvar.in
deleted file mode 100644
index 85be8ee..0000000
--- a/contrib/awk/test/splitvar.in
+++ /dev/null
@@ -1 +0,0 @@
-Here===Is=Some=====Data
diff --git a/contrib/awk/test/splitvar.ok b/contrib/awk/test/splitvar.ok
deleted file mode 100644
index b8626c4..0000000
--- a/contrib/awk/test/splitvar.ok
+++ /dev/null
@@ -1 +0,0 @@
-4
diff --git a/contrib/awk/test/splitwht.awk b/contrib/awk/test/splitwht.awk
deleted file mode 100644
index 6163d72..0000000
--- a/contrib/awk/test/splitwht.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-BEGIN {
- str = "a b\t\tc d"
- n = split(str, a, " ")
- print n
- m = split(str, b, / /)
- print m
-}
diff --git a/contrib/awk/test/splitwht.ok b/contrib/awk/test/splitwht.ok
deleted file mode 100644
index 61c83cb..0000000
--- a/contrib/awk/test/splitwht.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-4
-5
diff --git a/contrib/awk/test/sprintfc.awk b/contrib/awk/test/sprintfc.awk
deleted file mode 100644
index ee1e5a7..0000000
--- a/contrib/awk/test/sprintfc.awk
+++ /dev/null
@@ -1 +0,0 @@
-{ print sprintf("%c", $1), $1 }
diff --git a/contrib/awk/test/sprintfc.in b/contrib/awk/test/sprintfc.in
deleted file mode 100644
index 4602d28..0000000
--- a/contrib/awk/test/sprintfc.in
+++ /dev/null
@@ -1,3 +0,0 @@
-65
-66
-foo
diff --git a/contrib/awk/test/sprintfc.ok b/contrib/awk/test/sprintfc.ok
deleted file mode 100644
index 33769a8..0000000
--- a/contrib/awk/test/sprintfc.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-A 65
-B 66
-f foo
diff --git a/contrib/awk/test/strftlng.awk b/contrib/awk/test/strftlng.awk
deleted file mode 100644
index 0ef8195..0000000
--- a/contrib/awk/test/strftlng.awk
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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 --git a/contrib/awk/test/strftlng.ok b/contrib/awk/test/strftlng.ok
deleted file mode 100644
index 3008aa2..0000000
--- a/contrib/awk/test/strftlng.ok
+++ /dev/null
@@ -1,58 +0,0 @@
-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 --git a/contrib/awk/test/substr.awk b/contrib/awk/test/substr.awk
deleted file mode 100644
index 6016369..0000000
--- a/contrib/awk/test/substr.awk
+++ /dev/null
@@ -1,14 +0,0 @@
-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 --git a/contrib/awk/test/substr.ok b/contrib/awk/test/substr.ok
deleted file mode 100644
index be6889d..0000000
--- a/contrib/awk/test/substr.ok
+++ /dev/null
@@ -1,10 +0,0 @@
-A
-ab
-bc
-ab
-
-
-ab
-
-ef
-
diff --git a/contrib/awk/test/swaplns.awk b/contrib/awk/test/swaplns.awk
deleted file mode 100644
index 6bf2240..0000000
--- a/contrib/awk/test/swaplns.awk
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- if ((getline tmp) > 0) {
- print tmp
- print
- } else
- print
-}
diff --git a/contrib/awk/test/swaplns.in b/contrib/awk/test/swaplns.in
deleted file mode 100644
index 71fb162..0000000
--- a/contrib/awk/test/swaplns.in
+++ /dev/null
@@ -1,9 +0,0 @@
-This directory contains some examples/test-cases for different
-features of gawk - mostly not present in an old awk. Some are from
-"The GAWK Manual", some are original, and some are mixture of the two.
-Read header comments before attempting to use. Have fun and remember
-that program which consists only of BEGIN block does not need an input
-file.
-
- --mj
-
diff --git a/contrib/awk/test/swaplns.ok b/contrib/awk/test/swaplns.ok
deleted file mode 100644
index d38b7ca..0000000
--- a/contrib/awk/test/swaplns.ok
+++ /dev/null
@@ -1,9 +0,0 @@
-features of gawk - mostly not present in an old awk. Some are from
-This directory contains some examples/test-cases for different
-Read header comments before attempting to use. Have fun and remember
-"The GAWK Manual", some are original, and some are mixture of the two.
-file.
-that program which consists only of BEGIN block does not need an input
- --mj
-
-
diff --git a/contrib/awk/test/tradanch.awk b/contrib/awk/test/tradanch.awk
deleted file mode 100644
index 0cd45d1..0000000
--- a/contrib/awk/test/tradanch.awk
+++ /dev/null
@@ -1,2 +0,0 @@
-/foo^bar/
-/foo$bar/
diff --git a/contrib/awk/test/tradanch.in b/contrib/awk/test/tradanch.in
deleted file mode 100644
index e5c8a09..0000000
--- a/contrib/awk/test/tradanch.in
+++ /dev/null
@@ -1,2 +0,0 @@
-foo^bar
-foo$bar
diff --git a/contrib/awk/test/tradanch.ok b/contrib/awk/test/tradanch.ok
deleted file mode 100644
index e69de29..0000000
--- a/contrib/awk/test/tradanch.ok
+++ /dev/null
diff --git a/contrib/awk/test/tweakfld.awk b/contrib/awk/test/tweakfld.awk
deleted file mode 100644
index e7b538f..0000000
--- a/contrib/awk/test/tweakfld.awk
+++ /dev/null
@@ -1,296 +0,0 @@
-# To: bug-gnu-utils@prep.ai.mit.edu
-# Cc: arnold@gnu.ai.mit.edu
-# Date: Mon, 20 Nov 1995 11:39:29 -0500
-# From: "R. Hank Donnelly" <emory!head-cfa.harvard.edu!donnelly>
-#
-# Operating system: Linux1.2.13 (Slackware distrib)
-# GAWK version: 2.15 (?)
-# compiler: GCC (?)
-#
-# The following enclosed script does not want to fully process the input data
-# file. It correctly executes the operations on the first record, and then dies
-# on the second one. My true data file is much longer but this is
-# representative and it does fail on a file even as short as this one.
-# The failure appears to occur in the declared function add2output. Between the
-# steps of incrementing NF by one and setting $NF to the passed variable
-# the passed variable appears to vanish (i.e. NF does go from 68 to 69
-# and before incrementing it "variable" equals what it should but after
-# "variable" has no value at all.)
-#
-# The scripts have been developed using nawk on a Sun (where they run fine)
-# I have tried gawk there but get a different crash which I have not yet traced
-# down. Ideally I would like to keep the script the same so that it would run
-# on either gawk or nawk (that way I can step back and forth between laptop and
-# workstation.
-#
-# Any ideas why the laptop installation is having problems?
-# Hank
-#
-#
-# #!/usr/bin/gawk -f
-
-BEGIN {
- # set a few values
- FS = "\t"
- OFS = "\t"
- pi = atan2(0, -1)
-# distance from HRMA to focal plane in mm
- fullradius = 10260.54
-
- # set locations of parameters on input line
- nf_nrg = 1
- nf_order = 3
- nf_item = 4
- nf_suite = 5
- nf_grating = 8
- nf_shutter = 9
- nf_type = 13
- nf_src = 14
- nf_target = 15
- nf_voltage = 16
- nf_flux = 17
- nf_filt1 = 20
- nf_filt1_th = 21
- nf_filt2 = 22
- nf_filt2_th = 23
- nf_bnd = 24
- nf_hrma_polar = 27
- nf_hrma_az = 28
- nf_detector = 30
- nf_acis_read = 32
- nf_acis_proc = 33
- nf_acis_frame = 34
- nf_hxda_aplist = 36
- nf_hxda_y_range = 37
- nf_hxda_z_range = 38
- nf_hxda_y_step = 39
- nf_hxda_z_step = 40
- nf_sim_z = 41
- nf_fam_polar = 43
- nf_fam_az = 44
- nf_fam_dither_type = 45
- nf_mono_init = 51
- nf_mono_range = 52
- nf_mono_step = 53
- nf_defocus = 54
- nf_acis_temp = 55
- nf_tight = 59
- nf_offset_y = 64
- nf_offset_z = 65
-
- while( getline < "xrcf_mnemonics.dat" > 0 ) {
- mnemonic[$1] = $2
- }
-
-# "date" | getline date_line
-# ADR: use a fixed date so that testing will work
- date_line = "Sun Mar 10 23:00:27 EST 1996"
- split(date_line, in_date, " ")
- out_date = in_date[2] " " in_date[3] ", " in_date[6]
-}
-
-function add2output( variable ) {
-#print("hi1") >> "debug"
- NF++
-#print("hi2") >> "debug"
- $NF = variable
-#print("hi3") >> "debug"
-}
-
-function error( ekey, message ) {
- print "Error at input line " NR ", anode " ekey >> "errors.cleanup"
- print " " message "." >> "errors.cleanup"
-}
-
-function hxda_na() {
- $nf_hxda_aplist = $nf_hxda_y_range = $nf_hxda_z_range = "N/A"
- $nf_hxda_y_step = $nf_hxda_z_step = "N/A"
-}
-
-function acis_na() {
- $nf_acis_read = $nf_acis_proc = $nf_acis_frame = $nf_acis_temp = "N/A"
-}
-
-function hrc_na() {
-# print ("hi") >> "debug"
-}
-
-function fpsi_na() {
- acis_na()
- hrc_na()
- $nf_sim_z = $nf_fam_polar = $nf_fam_az = $nf_fam_dither_type = "N/A"
-}
-
-function mono_na() {
- $nf_mono_init = $nf_mono_range = $nf_mono_step = "N/A"
-}
-
-# this gives the pitch and yaw of the HRMA and FAM
-# positive pitch is facing the source "looking down"
-# positive yaw is looking left
-# 0 az is north 90 is up
-# this also adds in the FAM X,Y,Z positions
-
-function polaz2yawpitch(polar, az) {
- theta = az * pi / 180
- phi = polar * pi / 180 / 60
-
-
- if( polar == 0 ) {
- add2output( 0 )
- add2output( 0 )
- } else {
- if(az == 0 || az == 180)
- add2output( 0 )
- else
- add2output( - polar * sin(theta) )
-
-
-# x = cos (phi)
-# y = sin (phi) * cos (theta)
-# add2output( atan2(y,x)*180 / pi * 60 )
-
- if(az == 90 || az ==270 )
- add2output( 0 )
- else
- add2output( - polar * cos(theta) )
-
- }
-# x = cos (phi)
-# z= sin (phi) * sin (theta)
-# add2output( atan2(z,x)*180 / pi * 60 )
-
- if(config !~ /HXDA/) {
-# negative values of defocus move us farther from the source thus
-# increasing radius
- radius = fullradius - defocus
-
-# FAM_x; FAM_y; FAM_z
- if((offset_y == 0) && (offset_z == 0)){
- add2output( fullradius - radius * cos (phi) )
-
- if (az == 90 || az ==270)
- add2output( 0 )
- else
- add2output( radius * sin (phi) * cos (theta) )
-
- if (az == 0 || az == 180)
- add2output( 0 )
- else
- add2output( - radius * sin (phi) * sin (theta) )
- } else {
-# ******* THIS SEGMENT OF CODE IS NOT MATHEMATICALLY CORRECT FOR ****
-# OFF AXIS ANGLES AND IS SUPPLIED AS A WORKAROUND SINCE IT WILL
-# PROBABLY ONLY BE USED ON AXIS.
- add2output( defocus )
- add2output( offset_y )
- add2output( offset_z )
- }
-
- } else {
- add2output( "N/A" )
- add2output( "N/A" )
- add2output( "N/A" )
- }
-}
-
-# set TIGHT/LOOSE to N/A if it is not one of the two allowed values
-function tight_na() {
- if( $nf_tight !~ /TIGHT|LOOSE/ ) {
- $nf_tight == "N/A"
- }
-}
-
-# this entry is used to give certain entries names
-{
- type = $nf_type
- item = $nf_item
- suite = $nf_suite
- order = $nf_order
- detector = $nf_detector
- grating = $nf_grating
- offset_y= $nf_offset_y
- offset_z= $nf_offset_z
- bnd = $nf_bnd
- defocus = $nf_defocus
-}
-
-{
- # make configuration parameter
- # as well as setting configuration-dependent N/A values
-
- if( $nf_bnd ~ "SCAN" ) {
- # BND is scanning beam
- config = "BND"
- hxda_na()
- fpsi_na()
- } else {
- if( grating == "NONE" ) {
- config = "HRMA"
- } else {
- if( grating == "HETG" ) {
- if( order != "Both" ) {
- $nf_shutter = order substr($nf_shutter, \
- index($nf_shutter, ",") )
- }
- } else {
- order = "N/A"
- }
- config = "HRMA/" grating
- }
-
- if( detector ~ /ACIS|HRC/ ) {
- detsys = detector
- nsub = sub("-", ",", detsys)
- config = config "/" detsys
- hxda_na()
- } else {
- config = config "/HXDA"
- fpsi_na()
- if( detector == "HSI" ) {
- hxda_na()
- }
- }
- }
-
- add2output( config )
-
- if( $nf_src ~ /EIPS|Penning/ ) mono_na()
-
- if( $nf_src == "Penning" ) $nf_voltage = "N/A"
-
- itm = sprintf("%03d", item)
-
- if(config in mnemonic) {
- if( type in mnemonic ) {
- ID = mnemonic[config] "-" mnemonic[type] "-" suite "." itm
- add2output( ID )
- } else {
- error(type, "measurement type not in list")
- }
- } else {
- error(config, "measurement configuration not in list")
- }
-
- # add date to output line
- add2output( out_date )
-
- # Convert HRMA polar and azimuthal angles to yaw and pitch
- polaz2yawpitch($nf_hrma_polar, $nf_hrma_az)
-
- # set TIGHT/LOOSE to N/A if it is not one of the two allowed values
- tight_na()
-
- # compute number of HXDA apertures
- if( config ~ /HXDA/ && $nf_hxda_aplist != "N/A")
- add2output( split( $nf_hxda_aplist, dummy, "," ) )
- else
- add2output( "N/A" )
-
- # make sure the BND value is properly set
- if($nf_bnd == "FIXED" && detector ~ /ACIS/)
- $nf_bnd =bnd"-SYNC"
- else
- $nf_bnd = bnd"-FREE"
- print
-}
diff --git a/contrib/awk/test/tweakfld.in b/contrib/awk/test/tweakfld.in
deleted file mode 100644
index e27a9dde..0000000
--- a/contrib/awk/test/tweakfld.in
+++ /dev/null
@@ -1,3 +0,0 @@
-0.277 N/A N/A 1 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS C-Ka 1.108 0.13484 N/A N/A C8H8 10.32 C8H8 20.64 FIXED 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 44.7175 44.7175 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate
-1.486 N/A N/A 2 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS Al-Ka 4.458 0.642119 N/A N/A Al 18.38 Al 36.76 FIXED 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 5.55556 5.55556 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate
-4.51 N/A N/A 3 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS Ti-Ka 22.55 3.02894 N/A N/A Ti 40.6 N/A N/A FIXED 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 5.55556 5.55556 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate
diff --git a/contrib/awk/test/tweakfld.ok b/contrib/awk/test/tweakfld.ok
deleted file mode 100644
index 3c4d894..0000000
--- a/contrib/awk/test/tweakfld.ok
+++ /dev/null
@@ -1,3 +0,0 @@
-0.277 N/A N/A 1 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS C-Ka 1.108 0.13484 N/A N/A C8H8 10.32 C8H8 20.64 FIXED-FREE 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 44.7175 44.7175 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate HRMA/HRC,I Mar 10, 1996 0 0 0 0 0 N/A
-1.486 N/A N/A 2 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS Al-Ka 4.458 0.642119 N/A N/A Al 18.38 Al 36.76 FIXED-FREE 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 5.55556 5.55556 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate HRMA/HRC,I Mar 10, 1996 0 0 0 0 0 N/A
-4.51 N/A N/A 3 1 ASC/Hank Donnelly N/A NONE ALL,ALL N/A N/A N/A Count Rate Linearity EIPS Ti-Ka 22.55 3.02894 N/A N/A Ti 40.6 N/A N/A FIXED-FREE 1000 NO 0 0 0 HRC,I 1000 N/A N/A N/A N/A N/A N/A N/A N/A N/A 0 N/A APT APT LISSAJOUS 5.55556 5.55556 1 N/A N/A N/A N/A N/A 0 N/A HRCCTRTLIN 0 N/A N/A N/A 10 N/A 180 0 0 N/A N/A FPSI rate HRMA/HRC,I Mar 10, 1996 0 0 0 0 0 N/A
OpenPOWER on IntegriCloud