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
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