Makefile:
!!! "install-dirs" target has been renamed to "installdirs" !!!
- At compile time MODULESDIR can contain a *list* of
colon-separated directories,
e.g. /usr/local/share/runawk:/usr/local/share/awk
- power_getopt.awk, alt_getopt.awk and init_getopt.awk:
- Support for multiply applied options, e.g. -vvv for increasing
verbosity level. If option without arguments is multiply
applied, getarg() function returns a number of times it was
applied, not just 0 or 1.
New modules:
- init_getopt.awk using alt_getopt.awk and used by power_getopt.awk.
Its goal is to initialize `long_opts' and `long_opts' variables
but not run `getopt' function.
- heapsort.awk - heapsort :-)
- quicksort.awk - quicksort :-)
- sort.awk - either heapsort or quicksort,
the default is heapsort.
Unfortunately GAWK's asort() and asorti() functions
do *not* satisfy my needs. Another (and more important) reason
is a portability.
Improvements, clean-ups and fixes in regression tests.
runawk-0-18-0 was successfully tested on the following platforms:
NetBSD-5.0/x86, NetBSD-2.0/alpha, OpenBSD-4.5/x86,
FreeBSD-7.1/x86, FreeBSD-7.1/spark, Linux/x86 and
Darwin/ppc.
MAJOR CHANGES
-------------
runawk:
- ADDED: new option for runawk for #use'ing modules: -f.
runawk can also be used for oneliners! ;-)
runawk -f abs.awk -e 'BEGIN {print abs(-123); exit}'
- In a multilined code passed to runawk using option -e, spaces
are allowed before #directives.
- After inventing alt_getopt.awk module there is no reason for
heuristics that detects whether to add `-' to AWK arguments or
not. So I've removed this heuristics. Use alt_getopt.awk module
or other "smart" module for handling options correctly!
alt_getopt.awk and power_getopt.awk:
- FIX: for "abc:" short options specifier BSD and GNU getopt(3)
accept "-acb" and understand it as "-a -cb", they also accept
"-ac b" and also translate it to "-a -cb". Now alt_getopt.awk
and power_getopt.awk work the same way.
power_getopt.awk:
- -h option doesn't print usage information, --help (and its short
synonym) does.
New modules:
- shquote.awk, implementing shquote() function.
shquote(str):
`shquote' transforms the string `str' by adding shell
escape and quoting characters to include it to the
system() and popen() functions as an argument, so that
the arguments will have the correct values after being
evaluated by the shell.
Inspired by NetBSD's shquote(3) from libc.
- runcmd.awk, implementing functions runcmd1() and xruncmd1()
runcmd1(CMD, OPTS, FILE):
wrapper for function system() that runs a command CMD
with options OPTS and one filename FILE. Unlike
system(CMD " " OPTS " " FILE) the function runcmd1()
handles correctly FILE and CMD containing spaces, single
quote, double quote, tilde etc.
xruncmd1(FILE):
safe wrapper for 'runcmd(1)'.
awk exits with error if running command failed.
- isnum.awk, implementing trivial isnum() function,
see the source code.
- alt_join.awk, implementing the following functions:
join_keys(HASH, SEP):
returns string consisting of all keys from HASH separated
by SEP.
join_values(HASH, SEP):
returns string consisting of all values from HASH separated
by SEP.
join_by_numkeys (ARRAY, SEP [, START [, END]]):
returns string consisting of all values from ARRAY
separated by SEP. Indices from START (default: 1) to END
(default: +inf) are analysed. Collecting values is stopped
on index absent in ARRAY.
Lots of demo programs for most runawk modules were created and
they are in examples/ subdirectory now.
New MEGA module ;-) power_getopt.awk
See the documentation and demo program examples/demo_power_getopt.
It makes options handling REALLY easy.
New modules:
embed_str.awk
has_suffix.awk
has_prefix.awk
readfile.awk
modinfo.awk
Minor fixes and improvements in dirname.awk and basename.awk.
Now they are fully compatible with dirname(1) and basename(1)
RUNAWK sets the following environment variables for the child awk
subprocess:
RUNAWK_MODC - A number of modules (-f filename) passed to AWK
RUNAWK_MODV_<n> - Full path to the module #n,
where n is in [0..RUNAWK_MODC) range.
RUNAWK sets RUNAWK_ART_STDIN environment variable for the child awk
subprocess to 1 if additional/artificial `-' was added to the list
to awk's arguments.
Makefile:
bmake-ism were removed. Now Makefile is fully compatible with
FreeBSD make.
CLEANFILES target is used instead of hand-made rules
Minor fix in 'test_all' target
new module alt_getopt.awk that implements 'getopt' function
compatible with "Utility Syntax Guidelines" described in
"Single UNIX Specification"
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02
"getopt" function from this module is similar to C function getopt(3)
(Idiotic GNU getopt(3) must die!)
Better heuristics for adding `-' to the list awk's arguments,
now it better conforms to "Utility Syntax Guidelines".
Makefile: STDIN_FILENAME defaults to `-', not `/dev/stdin'
Interix has no /dev/stdin file
Makefile: WARNS=4 ====> WARNS?= 4
Makefile: CPPFLAGS -> CFLAGS, FreeBSD make mk scripts
don't support CPPFLAGS
Lots of regression tests for 'getopt' function
Major changes:
The following code fails with nawk (seen on NetBSD)
runawk -e ' { print "123" } ' /dev/null
It says
/usr/bin/awk: can't open file --
source line number 7
This happens because nawk treats `--' after program as a generic file.
fixed: compilation bug under FreeBSD (WARNS=4 -> warning -> error)
caused by comparison of signed with unsigned
More verbose output when stat(filename) failed
modules/str2regexp.awk: adapted to buggy MAWK
Major changes:
Temporary file is removed if runawk is killed by
SIGINT, SIGQUIT, SIGTERM, SIGHUP or SIGPIPE signals.
(Temporary file is created by 'runawk -e ...')
======================================================================
Version 0.14.1, by Aleksey Cheusov, Sat, 19 Jul 2008 22:53:45 +0300
FIXED: The following code doesn't work with runawk-0.14.0
runawk -e '
#use "anymodule.awk"
<ANY_CODE_HERE>
'
This code requires a creation of the temporary file that was
removed in runawk-0.14.0. Now temporary file is created using
mkstemp(3).
Regression tests are created for testing.
======================================================================
Version 0.14.0, by Aleksey Cheusov, Sat, 12 Jul 2008 17:29:22 +0300
Temporary file is not needed anymore for -e option.
FIXED: #env didn't work under Linux/glibc.
FIXED: compilation error under FreeBSD.
Lots of new regression tests. Code clean-ups.
fgetln is not required anymore. No hacks about it.
If error happens while processing a #directive,
a correct line number is output
ADDED: option -v|--assign that works like AWK's -v option.
This is to pass some variables to AWK interpreter.
Example: runawk -v var=123 -e 'BEGIN {print var }'
modules/xgetline.awk: better error message/clean-ups
modules/abort.awk: NR is also printed to stderr
minor fixes in *.c
clean-ups and fixes in 'make test'. Now it doesn't depend on my
own system and runawk directory
'make test' exits with non-zero exit status if regression tests
fail
Makefile: ported to ancient pmake-1.45 found in some Linux distros
FIXED: If AWK interpreter segfaults or killed by any other signal,
runawk exits with exit status 0. Affected runawk versions: all.
Now this is fixed and runawk exits with exit status 128+SIGNAL
just like many shells.
EXIT STATUS section has been added to the manual page.
Major changes:
ADDED: The environment variable RUNAWK_AWKPROG overrides
the default awk interpreter which is set at compile time.
Documentation updated accordingly.
FIXED: unsafe use of strdup(3)
I've copied MIT License text to code from www.opensource.org.
Do you see any difference?
ADDED: new trivial module pow.awk that implements function "pow"
fix: MKMAN and MKCATPAGES make's standard variables are checked
during installation
In order to build runawk not in a directory you can either build
it like this (standard way)
cd /src/dir; make all install MAKEOBJDIR=/obj/dir
or like this
cd /obj/dir; make -f /src/dir/Makefile all install
optional config.h is #included if you need it
other minor fixes and improvements both in code and documentation
NEWS:
I switched to BSD make. I really hate automake and its approach in
general. I'm not expert in BSD, but their 'make' looks much
better. But using it makes some changes in building process, see
README/INSTALLATION section for a brief description.
ADDED: man page for runawk. HTML version runawk.html can also be
generated from runawk.pod using pod2html, see Makefile.
ADDED: -i/-I options for forcing/disabling adding /dev/stdin to
the list of awk arguments. See man page for more information.
A few AWK modules are installed to PREFIX/share/runawk: abs.awk,
min.awk, max.awk and alt_assert.awk. This directory is also checked
while searching for modules. See man page for more details.
AWK_PROG and STDIN_FILENAME Makefile variables can be passed to make
program to change a path to an actual AWK interpreter (/usr/bin/awk
by default) and stdin file (/dev/stdin by default).
Lots of improvements in documentation
ADDED: regression tests. Run them by running 'make test' and let
me know if somethiung fails.
debugging output is sent stdout, not stderr
ADDED: long synonyms for short options, --help, --version etc.
clean-ups in Makefile
options handling improvements
NEWS:
FIXED: return code of execvp is not analysed, i.e. when running
an interpreter fails, runawk silently exits with zero exit status.
Now it fails with exit status 1 and print an error to stderr.
stdin filename defaults to "/dev/stdin"
ROOT variable in Makefile has been renamed
to more commonly used PREFIX
realloc(2) is not used anymore. arrays[ARRAY_SZ] are used now.
AWK and STDIN_FILENAME variables are removed from Makefile.
Use CPPFLAGS for changing defaults.