aboutsummaryrefslogtreecommitdiffstats
path: root/awklib
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-05 11:20:41 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-05 11:20:41 +0300
commit4de12ef40f9ea9a0b715903cfe6da51b97eedb77 (patch)
tree84a0c8d117e9a2a629e186a1fe22ebe185e5d6a4 /awklib
parent14da33f5ac17b4adfd15ddb12c07715741bd1b1f (diff)
parentdbf9d5a4fc4b6d6340912395f020019576ed37f6 (diff)
downloadegawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.tar.gz
egawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.tar.bz2
egawk-4de12ef40f9ea9a0b715903cfe6da51b97eedb77.zip
Merge branch 'master' into cmake
Diffstat (limited to 'awklib')
-rw-r--r--awklib/ChangeLog10
-rw-r--r--awklib/Makefile.am4
-rw-r--r--awklib/Makefile.in33
-rw-r--r--awklib/eg/lib/assert.awk2
-rw-r--r--awklib/eg/lib/bits2str.awk2
-rw-r--r--awklib/eg/lib/ftrans.awk2
-rw-r--r--awklib/eg/lib/inplace.awk9
-rw-r--r--awklib/eg/lib/intdiv.awk (renamed from awklib/eg/lib/div.awk)7
-rw-r--r--awklib/eg/lib/quicksort.awk5
-rw-r--r--awklib/eg/lib/strtonum.awk2
-rw-r--r--awklib/eg/prog/anagram.awk6
-rw-r--r--awklib/eg/prog/extract.awk2
-rw-r--r--awklib/eg/prog/indirectcall.awk2
-rw-r--r--awklib/eg/prog/pi.awk2
-rw-r--r--awklib/eg/prog/split.awk2
-rw-r--r--awklib/eg/prog/translate.awk2
16 files changed, 62 insertions, 30 deletions
diff --git a/awklib/ChangeLog b/awklib/ChangeLog
index 6ef0bbde..bede4234 100644
--- a/awklib/ChangeLog
+++ b/awklib/ChangeLog
@@ -1,3 +1,13 @@
+2014-11-05 Juergen Kahrs <juergen.kahrs@googlemail.com>
+
+ * Makefile.am (AWKPROG): Add quotes around the name in case the
+ build dir has spaces in it.
+
+2014-10-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (stamp-eg): Use explicit ./extract.awk to avoid
+ assumptions about AWKPATH in the environment.
+
2014-04-08 Arnold D. Robbins <arnold@skeeve.com>
* 4.1.1: Release tar ball made.
diff --git a/awklib/Makefile.am b/awklib/Makefile.am
index 87ee96b8..27bb269f 100644
--- a/awklib/Makefile.am
+++ b/awklib/Makefile.am
@@ -30,7 +30,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg
if TEST_CROSS_COMPILE
AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT)
else
-AWKPROG = LC_ALL=C LANG=C $(abs_top_builddir)/gawk$(EXEEXT)
+AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)"
endif
# Get config.h from the build directory and custom.h from the source directory.
@@ -66,7 +66,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
cd $(srcdir) && \
rm -fr eg && \
rm -fr stamp-eg && \
- $(AWKPROG) -f extract.awk ../doc/gawk.texi ../doc/gawkinet.texi
+ $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi
@echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg
@echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg
diff --git a/awklib/Makefile.in b/awklib/Makefile.in
index 38124fad..6dc8ea81 100644
--- a/awklib/Makefile.in
+++ b/awklib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -38,7 +38,17 @@
#
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -101,8 +111,6 @@ build_triplet = @build@
host_triplet = @host@
pkglibexec_PROGRAMS = pwcat$(EXEEXT) grcat$(EXEEXT)
subdir = awklib
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
@@ -117,6 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -183,6 +192,8 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
+ $(top_srcdir)/mkinstalldirs ChangeLog
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgdatadir = $(datadir)/awk
pkglibexecdir = $(libexecdir)/awk
@@ -248,6 +259,7 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
@@ -313,7 +325,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = ChangeLog ChangeLog.0 extract.awk eg $(srcdir)/stamp-eg
-@TEST_CROSS_COMPILE_FALSE@AWKPROG = LC_ALL=C LANG=C $(abs_top_builddir)/gawk$(EXEEXT)
+@TEST_CROSS_COMPILE_FALSE@AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)"
# With some locales, the script extract.awk fails.
# So we fix the locale to some sensible value.
@TEST_CROSS_COMPILE_TRUE@AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT)
@@ -339,7 +351,6 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu awklib/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu awklib/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -414,14 +425,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -630,6 +641,8 @@ uninstall-am: uninstall-local uninstall-pkglibexecPROGRAMS
tags tags-am uninstall uninstall-am uninstall-local \
uninstall-pkglibexecPROGRAMS
+.PRECIOUS: Makefile
+
all: $(srcdir)/stamp-eg $(AUXPROGS) $(AUXAWK)
@@ -653,7 +666,7 @@ $(srcdir)/stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi
cd $(srcdir) && \
rm -fr eg && \
rm -fr stamp-eg && \
- $(AWKPROG) -f extract.awk ../doc/gawk.texi ../doc/gawkinet.texi
+ $(AWKPROG) -f ./extract.awk ../doc/gawk.texi ../doc/gawkinet.texi
@echo 'some makes are stupid and will not check a directory' > $(srcdir)/stamp-eg
@echo 'against a file, so this file is a place holder. gack.' >> $(srcdir)/stamp-eg
diff --git a/awklib/eg/lib/assert.awk b/awklib/eg/lib/assert.awk
index 75fd8853..c8e13490 100644
--- a/awklib/eg/lib/assert.awk
+++ b/awklib/eg/lib/assert.awk
@@ -1,4 +1,4 @@
-# assert --- assert that a condition is true. Otherwise exit.
+# assert --- assert that a condition is true. Otherwise, exit.
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
diff --git a/awklib/eg/lib/bits2str.awk b/awklib/eg/lib/bits2str.awk
index 9725ee8f..a10ffad1 100644
--- a/awklib/eg/lib/bits2str.awk
+++ b/awklib/eg/lib/bits2str.awk
@@ -1,4 +1,4 @@
-# bits2str --- turn a byte into readable 1's and 0's
+# bits2str --- turn a byte into readable ones and zeros
function bits2str(bits, data, mask)
{
diff --git a/awklib/eg/lib/ftrans.awk b/awklib/eg/lib/ftrans.awk
index 2fec27ef..6461efff 100644
--- a/awklib/eg/lib/ftrans.awk
+++ b/awklib/eg/lib/ftrans.awk
@@ -1,4 +1,4 @@
-# ftrans.awk --- handle data file transitions
+# ftrans.awk --- handle datafile transitions
#
# user supplies beginfile() and endfile() functions
#
diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk
index 6403a228..d1574654 100644
--- a/awklib/eg/lib/inplace.awk
+++ b/awklib/eg/lib/inplace.awk
@@ -5,10 +5,15 @@
# Please set INPLACE_SUFFIX to make a backup copy. For example, you may
# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule.
+# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
+# actions in an ENDFILE rule will be redirected as expected.
+
BEGINFILE {
- inplace_begin(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
}
-ENDFILE {
+END {
inplace_end(FILENAME, INPLACE_SUFFIX)
}
diff --git a/awklib/eg/lib/div.awk b/awklib/eg/lib/intdiv.awk
index 5939024d..dbc553b0 100644
--- a/awklib/eg/lib/div.awk
+++ b/awklib/eg/lib/intdiv.awk
@@ -1,10 +1,13 @@
-# div --- do integer division
+# intdiv --- do integer division
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# July, 2014
+#
+# Name changed from div() to intdiv()
+# April, 2015
-function div(numerator, denominator, result)
+function intdiv(numerator, denominator, result)
{
split("", result)
diff --git a/awklib/eg/lib/quicksort.awk b/awklib/eg/lib/quicksort.awk
index 3ba2d6e3..e0ed8bc7 100644
--- a/awklib/eg/lib/quicksort.awk
+++ b/awklib/eg/lib/quicksort.awk
@@ -4,8 +4,9 @@
# Arnold Robbins, arnold@skeeve.com, Public Domain
# January 2009
-# quicksort --- C.A.R. Hoare's quick sort algorithm. See Wikipedia
-# or almost any algorithms or computer science text
+
+# quicksort --- C.A.R. Hoare's quicksort algorithm. See Wikipedia
+# or almost any algorithms or computer science text.
#
# Adapted from K&R-II, page 110
diff --git a/awklib/eg/lib/strtonum.awk b/awklib/eg/lib/strtonum.awk
index cd56a449..783496e4 100644
--- a/awklib/eg/lib/strtonum.awk
+++ b/awklib/eg/lib/strtonum.awk
@@ -52,7 +52,7 @@ function mystrtonum(str, ret, n, i, k, c)
# a[6] = "1.e3"
# a[7] = "1.32"
# a[8] = "1.32E2"
-#
+#
# for (i = 1; i in a; i++)
# print a[i], strtonum(a[i]), mystrtonum(a[i])
# }
diff --git a/awklib/eg/prog/anagram.awk b/awklib/eg/prog/anagram.awk
index 7ca14559..df2768d9 100644
--- a/awklib/eg/prog/anagram.awk
+++ b/awklib/eg/prog/anagram.awk
@@ -1,5 +1,5 @@
-# anagram.awk --- An implementation of the anagram finding algorithm
-# from Jon Bentley's "Programming Pearls", 2nd edition.
+# anagram.awk --- An implementation of the anagram-finding algorithm
+# from Jon Bentley's "Programming Pearls," 2nd edition.
# Addison Wesley, 2000, ISBN 0-201-65788-0.
# Column 2, Problem C, section 2.8, pp 18-20.
#
@@ -21,7 +21,7 @@
key = word2key($1) # Build signature
data[key][$1] = $1 # Store word with signature
}
-# word2key --- split word apart into letters, sort, joining back together
+# word2key --- split word apart into letters, sort, and join back together
function word2key(word, a, i, n, result)
{
diff --git a/awklib/eg/prog/extract.awk b/awklib/eg/prog/extract.awk
index 24f40ce5..f5dfcf40 100644
--- a/awklib/eg/prog/extract.awk
+++ b/awklib/eg/prog/extract.awk
@@ -1,4 +1,4 @@
-# extract.awk --- extract files and run programs from texinfo files
+# extract.awk --- extract files and run programs from Texinfo files
#
# Arnold Robbins, arnold@skeeve.com, Public Domain
# May 1993
diff --git a/awklib/eg/prog/indirectcall.awk b/awklib/eg/prog/indirectcall.awk
index 3ecb2887..165b022a 100644
--- a/awklib/eg/prog/indirectcall.awk
+++ b/awklib/eg/prog/indirectcall.awk
@@ -27,7 +27,7 @@ function do_sort(first, last, compare, data, i, retval)
retval = data[1]
for (i = 2; i in data; i++)
retval = retval " " data[i]
-
+
return retval
}
# sort --- sort the data in ascending order and return it as a string
diff --git a/awklib/eg/prog/pi.awk b/awklib/eg/prog/pi.awk
index 3297beff..e1b5bc4f 100644
--- a/awklib/eg/prog/pi.awk
+++ b/awklib/eg/prog/pi.awk
@@ -10,7 +10,7 @@ BEGIN {
for (m = digits * 4; m > 0; --m) {
d = m * 2 + 1
x = pi * m
- div(x, d, result)
+ intdiv(x, d, result)
pi = result["quotient"]
pi = pi + two
}
diff --git a/awklib/eg/prog/split.awk b/awklib/eg/prog/split.awk
index 6a7198f6..b878fa50 100644
--- a/awklib/eg/prog/split.awk
+++ b/awklib/eg/prog/split.awk
@@ -22,7 +22,7 @@ BEGIN {
}
# test argv in case reading from stdin instead of file
if (i in ARGV)
- i++ # skip data file name
+ i++ # skip datafile name
if (i in ARGV) {
outfile = ARGV[i]
ARGV[i] = ""
diff --git a/awklib/eg/prog/translate.awk b/awklib/eg/prog/translate.awk
index cf7f3897..e7403717 100644
--- a/awklib/eg/prog/translate.awk
+++ b/awklib/eg/prog/translate.awk
@@ -4,7 +4,7 @@
# August 1989
# February 2009 - bug fix
-# Bugs: does not handle things like: tr A-Z a-z, it has
+# Bugs: does not handle things like tr A-Z a-z; it has
# to be spelled out. However, if `to' is shorter than `from',
# the last character in `to' is used for the rest of `from'.