| 1 |
====================================================================== |
| 2 |
Version 1.6.1, by Aleksey Cheusov, Fri, 15 Feb 2019 21:19:26 +0300 |
| 3 |
|
| 4 |
Fix in regression test (broken Solaris shell) |
| 5 |
Sort .awk files locale-independently to get reproducible build |
| 6 |
|
| 7 |
====================================================================== |
| 8 |
Version 1.6.0, by Aleksey Cheusov, Fri, 26 Dec 2014 12:34:12 +0300 |
| 9 |
|
| 10 |
Environment variable RUNAWK_KEEPTMP was introduced. If it set, |
| 11 |
temporary files are kept. This is useful for debugging. |
| 12 |
|
| 13 |
io.awk:file_size was fixed (its behaviour depended on FS value) |
| 14 |
|
| 15 |
AWK_PROGS used for testing is now settable from environment. |
| 16 |
|
| 17 |
A few typos in runawk_modules.3 were fixed. |
| 18 |
Thanks to Andrew Shadura! |
| 19 |
|
| 20 |
====================================================================== |
| 21 |
Version 1.5.1, by Aleksey Cheusov, Sat, 28 Jun 2014 18:00:25 +0300 |
| 22 |
|
| 23 |
Compilation failure on Hurd was fixed. |
| 24 |
|
| 25 |
mk-configure >= 0.26.0 is required for build. |
| 26 |
|
| 27 |
====================================================================== |
| 28 |
Version 1.5.0, by Aleksey Cheusov, Sun, 8 Sep 2013 12:10:47 +0300 |
| 29 |
|
| 30 |
Options -i, -I and all long options were completely removed. |
| 31 |
|
| 32 |
Option -T was added. For details see the man page. |
| 33 |
|
| 34 |
Option -v is documented in manpage. |
| 35 |
|
| 36 |
Fixes for gcc compilation warnings. |
| 37 |
|
| 38 |
Fixes for compilation with non-empty MAKEOBJDIR. |
| 39 |
|
| 40 |
Typo fixes in NEW, runcmd.awk and man pages. |
| 41 |
|
| 42 |
====================================================================== |
| 43 |
Version 1.4.4, by Aleksey Cheusov, Sat, 10 Nov 2012 13:57:35 +0300 |
| 44 |
|
| 45 |
Fix for bug in removing subdirs in temporary directory. |
| 46 |
|
| 47 |
Improvements and bug fix in runawk_modules.3 |
| 48 |
|
| 49 |
====================================================================== |
| 50 |
Version 1.4.3, by Aleksey Cheusov, Sun, 9 Sep 2012 21:54:21 +0300 |
| 51 |
|
| 52 |
runawk: |
| 53 |
- Clean-ups in usage message |
| 54 |
- system(3) is not used anymore for removing temporary directory |
| 55 |
modules: |
| 56 |
- Function print_help() has been moved |
| 57 |
from power_getopt.awk to init_getopt.awk |
| 58 |
|
| 59 |
====================================================================== |
| 60 |
Version 1.4.2, by Aleksey Cheusov, Sun, 19 Aug 2012 23:00:39 +0300 |
| 61 |
|
| 62 |
runawk_modules.3 was added where all modules are documented |
| 63 |
|
| 64 |
Long options are considered deprecated |
| 65 |
|
| 66 |
-i and -I options were removed |
| 67 |
|
| 68 |
man pages are included to a distribution tarball, |
| 69 |
so pod2man is not needed for building |
| 70 |
|
| 71 |
====================================================================== |
| 72 |
Version 1.4.1, by Aleksey Cheusov, Sun, 22 Jul 2012 14:57:19 +0300 |
| 73 |
|
| 74 |
Minor fixes in documentation |
| 75 |
|
| 76 |
Path to AWK interpreter is detected at build time (not hardcoded |
| 77 |
/usr/bin/awk). This fixes runawk on, for example, Haiku. |
| 78 |
|
| 79 |
Clean-ups in build system. mk-configure-0.23.0 is required. |
| 80 |
|
| 81 |
====================================================================== |
| 82 |
Version 1.4.0, by Aleksey Cheusov, Sun, 27 Nov 2011 21:41:09 +0300 |
| 83 |
|
| 84 |
exitnow.awk: |
| 85 |
- Fix: exitnow(status) finishes the execution of the script |
| 86 |
without running END sections even if status == 0. |
| 87 |
|
| 88 |
New module io.awk that includes the following functions: |
| 89 |
is_{file,dir,exec,socket,fifo,blockdev,chardev,symlink}, |
| 90 |
file_size and file_type. |
| 91 |
|
| 92 |
tokenre.awk: |
| 93 |
- Function splitre0() was added that splits $0 |
| 94 |
|
| 95 |
More regression tests were added. |
| 96 |
|
| 97 |
====================================================================== |
| 98 |
Version 1.3.2, by Aleksey Cheusov, Sun, 9 Oct 2011 14:11:32 +0300 |
| 99 |
|
| 100 |
Internal arrays are relocated automatically. |
| 101 |
This fixes use of runawk(1) in combination with xargs(1), e.g. |
| 102 |
cat files.txt | xargs runawk -e '...' |
| 103 |
|
| 104 |
====================================================================== |
| 105 |
Version 1.3.1, by Aleksey Cheusov, Fri, 7 Jan 2011 16:45:30 +0200 |
| 106 |
|
| 107 |
runawk.1 and alt_getopt.1 are included to tarball, so pod2man is not |
| 108 |
needed for installation. No functional changes in source code. |
| 109 |
|
| 110 |
====================================================================== |
| 111 |
Version 1.3.0, by Aleksey Cheusov, Tue, 4 Jan 2011 20:14:04 +0200 |
| 112 |
|
| 113 |
fix in runawk.c for warning message produced by Intel C compiler. |
| 114 |
|
| 115 |
fix for shquote("") from modules/shquote.awk. |
| 116 |
|
| 117 |
Source code is reorganized and it is easy to install examples, |
| 118 |
modules, alt_getopt, runawk executable and TODO/README/... files |
| 119 |
individually. See doc/INSTALL for details. |
| 120 |
|
| 121 |
mk-configure >= 0.21 is required |
| 122 |
|
| 123 |
====================================================================== |
| 124 |
Version 1.2.0, by Aleksey Cheusov, Sat, 23 Oct 2010 00:35:35 +0300 |
| 125 |
|
| 126 |
Due to incompatibilities between traditional BSD mk files and mk |
| 127 |
files shipped with bmake by Simon J. Gerraty, I've decided to switch |
| 128 |
runawk from BSD mk files to mk-configure software build system. This |
| 129 |
makes Makefile significantly smaller, easier to understand and use |
| 130 |
and gives tons of new capabilities. Obviously this makes development |
| 131 |
even easier than before. Updated installation instruction is in |
| 132 |
README. |
| 133 |
|
| 134 |
New functions in heapsort.awk: "heapsort_fields" and "heapsort0" for |
| 135 |
sorting $1, $2 ... |
| 136 |
|
| 137 |
New function in tokenre.awk: "splitre". |
| 138 |
|
| 139 |
New samples of use (regression tests): |
| 140 |
examples/demo_tokenre4, demo_heapsort4. |
| 141 |
|
| 142 |
====================================================================== |
| 143 |
Version 1.1.0, by Aleksey Cheusov, Wed, 6 Oct 2010 22:51:56 +0300 |
| 144 |
|
| 145 |
Makefile: |
| 146 |
- initialize {BIN,MAN}{OWN,GRP} to `id -{u,g}n`. You don't need |
| 147 |
to set these variables manually for unprivileged installation. |
| 148 |
|
| 149 |
Option -F is added to runawk. It passes field separator to AWK |
| 150 |
interpreter. |
| 151 |
|
| 152 |
New tool alt_getopt(1), an alternative to getopt(1) and POSIX |
| 153 |
shell's getopts. alt_getopt is a command options parser that |
| 154 |
undestands long options. It is implemented in runawk and uses its |
| 155 |
modules. Also alt_getopt.sh shell include file is implemented and |
| 156 |
installed. Examples: examples/demo_alt_getopt*.sh |
| 157 |
|
| 158 |
multisub.awk: ability to skip a matched text is added, see the |
| 159 |
documentation at the top of multisub.awk and examples/demo_multisub |
| 160 |
for the sample. Function multisub now has optional third argument. |
| 161 |
|
| 162 |
New module glob.awk for working with glob patterns. |
| 163 |
See examples/demo_glob* for the samples. |
| 164 |
|
| 165 |
min.awk: new functions min3, min4, min5, min_key, min_value and |
| 166 |
key_of_min_value |
| 167 |
max.awk: new functions max3, max4, max5, max_key, max_value and |
| 168 |
key_of_max_value |
| 169 |
|
| 170 |
New module ord.awk from GNU awk. |
| 171 |
|
| 172 |
New module ftrans_in.awk from GNU awk (fixed and modified by me). |
| 173 |
Example: examples/demo_ftrans. |
| 174 |
|
| 175 |
New example: examples/demo_tokenre3. Thanks to Vlad Shakhov for the |
| 176 |
idea. |
| 177 |
|
| 178 |
New example: examples/demo_minmax. |
| 179 |
|
| 180 |
====================================================================== |
| 181 |
Version 1.0.0, by Aleksey Cheusov, Sun, 5 Sep 2010 16:39:47 +0300 |
| 182 |
|
| 183 |
New functions for sorting indices in hash |
| 184 |
heapsort.awk: heapsort_indices |
| 185 |
quicksort.awk: quicksort_indices |
| 186 |
sort.awk: sort_indices |
| 187 |
|
| 188 |
New module ini.awk for reading .ini files. |
| 189 |
|
| 190 |
====================================================================== |
| 191 |
Version 0.21.0, by Aleksey Cheusov, Sun, 28 Mar 2010 13:43:48 +0300 |
| 192 |
|
| 193 |
fixed: compilation failure on recent Linux-es (warn_unused_result |
| 194 |
attribute of system(3) function in recent glibc). |
| 195 |
|
| 196 |
fixed: compilation failures on FreeBSD ("assignment discards |
| 197 |
qualifiers from pointer target type" warning which is critical with |
| 198 |
-Werror). |
| 199 |
|
| 200 |
fixed: compilation failure with Intel C Compiler |
| 201 |
|
| 202 |
Now one can pass arguments to awk program specified with -e option after --, |
| 203 |
that is like the following |
| 204 |
runawk -e '<awk program>' -- <extra options for your program> |
| 205 |
|
| 206 |
New simple modules: |
| 207 |
|
| 208 |
- trim.awk: this modules provides a set of simple functions for |
| 209 |
trimming spaces from the string. |
| 210 |
|
| 211 |
- backslash_in.awk treats backslash symbol at the end of input line |
| 212 |
as "this line will continue on the next line". |
| 213 |
|
| 214 |
$ cat ~/tmp/9.txt |
| 215 |
Some text here \ |
| 216 |
and here too. \ |
| 217 |
This is still the first line. |
| 218 |
This is the second. |
| 219 |
And this is third one that\ |
| 220 |
continues on the next line \ |
| 221 |
and the next line too. |
| 222 |
Ok, we finally have four lines of text. |
| 223 |
$ runawk -f backslash_in.awk -e '{print}' ~/tmp/9.txt |
| 224 |
Some text here and here too. This is still the first line. |
| 225 |
This is the second. |
| 226 |
And this is third one that continues on the next line and the next line too. |
| 227 |
Ok, we finally have four lines of text. |
| 228 |
$ |
| 229 |
|
| 230 |
- trim_in.awk trims spaces from input lines. |
| 231 |
|
| 232 |
- CR_in.awk removes CR symbols from input lines. |
| 233 |
|
| 234 |
====================================================================== |
| 235 |
Version 0.20.0, by Aleksey Cheusov, Thu, 4 Mar 2010 18:33:03 +0200 |
| 236 |
|
| 237 |
New module: fieldwidths.awk: |
| 238 |
By default AWK interpreter splits input lines into tokens |
| 239 |
according to regular expression that defines "spaces" between them |
| 240 |
using special variable FS. Sometimes it is useful to define a |
| 241 |
fixed-size fields for tokens. This is what this module is for. The |
| 242 |
functionality of fieldwidths.awk is very close to GNU awk's |
| 243 |
FIELDWIDTHS variable but is available for all flavours of AWK ;-) |
| 244 |
|
| 245 |
New module: tmpfile.awk: |
| 246 |
This module provides a function `tmpfile' for generating temporary |
| 247 |
filenames. All these filenames are under temporary directory |
| 248 |
created (if necessary) by runawk(1) which is removed automatically |
| 249 |
during normal exit or when runawk(1) reveives SIGINT, SIGQUIT, |
| 250 |
SIGTERM, SIGHUP or SIGPIPE. Thus, this module provides a safe way |
| 251 |
to work with temporary files. |
| 252 |
|
| 253 |
new runawk directive: #interp-var that specifies an environment |
| 254 |
variable name that keeps a preferred AWK interpreter. See a manual |
| 255 |
page for details. |
| 256 |
|
| 257 |
new runawk directive: #safe-use that #use module if it |
| 258 |
exists. Example is below. For more details see a manual page. |
| 259 |
|
| 260 |
foobar application: |
| 261 |
#!/usr/bin/env runawk |
| 262 |
#safe-use "~/.foobarrc" "/etc/foobar.conf" |
| 263 |
BEGIN { |
| 264 |
print foo, bar, baz |
| 265 |
} |
| 266 |
|
| 267 |
config file ~/.foobarrc for foobar application: |
| 268 |
BEGIN { |
| 269 |
foo = "foo10" |
| 270 |
bar = "bar20" |
| 271 |
baz = 123 |
| 272 |
} |
| 273 |
|
| 274 |
fix in power_getopt.awk: arguments equal to "" (empty string) are |
| 275 |
now processed correctly. |
| 276 |
|
| 277 |
power_getopt.awk: after options processing ARGV [1], ARGV [2], ..., |
| 278 |
ARGV [ARGC-1] are set to non-option arguments. |
| 279 |
|
| 280 |
new in heapsort.awk: functions sift_down and sift_up. |
| 281 |
|
| 282 |
fix in tokenre.awk: There is no need to initialize TRE variable, it |
| 283 |
is already initialized to "" at startup. This fixes a problem with |
| 284 |
'runawk -v TRE=lalala ...' |
| 285 |
|
| 286 |
Minor fixes and rewords in the runawk.1 and README. |
| 287 |
|
| 288 |
====================================================================== |
| 289 |
Version 0.19.0, by Aleksey Cheusov, Sun, 3 Jan 2010 15:23:31 +0200 |
| 290 |
|
| 291 |
fix in runawk.c: \n was missed in "running '%s' failed: %s" error |
| 292 |
message. The problem was seen on ancient (12 years old) HP-UX |
| 293 |
|
| 294 |
fix in teets/test.mk: "diff -u" is not portable (SunOS, HP-UX), |
| 295 |
DIFF_PROG variable is introduced to fix the problem |
| 296 |
|
| 297 |
fix in modules/power_getopt.awk: after printing help message we |
| 298 |
should exit immediately not running END section, s/exit/exitnow/ |
| 299 |
|
| 300 |
new function heapsort_values in heapsort.awk module |
| 301 |
|
| 302 |
new function quicksort_values in quicksort.awk module |
| 303 |
|
| 304 |
new function sort_values in sort.awk module |
| 305 |
|
| 306 |
====================================================================== |
| 307 |
Version 0.18.0, by Aleksey Cheusov, Sat, 7 Nov 2009 17:08:16 +0200 |
| 308 |
|
| 309 |
Makefile: |
| 310 |
!!! "install-dirs" target has been renamed to "installdirs" !!! |
| 311 |
|
| 312 |
- At compile time MODULESDIR can contain a *list* of |
| 313 |
colon-separated directories, |
| 314 |
e.g. /usr/local/share/runawk:/usr/local/share/awk |
| 315 |
|
| 316 |
- power_getopt.awk, alt_getopt.awk and init_getopt.awk: |
| 317 |
- Support for multiply applied options, e.g. -vvv for increasing |
| 318 |
verbosity level. If option without arguments is multiply |
| 319 |
applied, getarg() function returns a number of times it was |
| 320 |
applied, not just 0 or 1. |
| 321 |
|
| 322 |
New modules: |
| 323 |
|
| 324 |
- init_getopt.awk using alt_getopt.awk and used by power_getopt.awk. |
| 325 |
Its goal is to initialize `long_opts' and `long_opts' variables |
| 326 |
but not run `getopt' function. |
| 327 |
|
| 328 |
- heapsort.awk - heapsort :-) |
| 329 |
- quicksort.awk - quicksort :-) |
| 330 |
- sort.awk - either heapsort or quicksort, |
| 331 |
the default is heapsort. |
| 332 |
Unfortunately GAWK's asort() and asorti() functions |
| 333 |
do *not* satisfy my needs. Another (and more important) reason |
| 334 |
is a portability. |
| 335 |
|
| 336 |
Improvements, clean-ups and fixes in regression tests. |
| 337 |
|
| 338 |
runawk-0-18-0 was successfully tested on the following platforms: |
| 339 |
NetBSD-5.0/x86, NetBSD-2.0/alpha, OpenBSD-4.5/x86, |
| 340 |
FreeBSD-7.1/x86, FreeBSD-7.1/spark, Linux/x86 and |
| 341 |
Darwin/ppc. |
| 342 |
|
| 343 |
====================================================================== |
| 344 |
Version 0.17.0, by Aleksey Cheusov, Sat, 12 Sep 2009 01:29:31 +0300 |
| 345 |
|
| 346 |
runawk: |
| 347 |
- ADDED: new option for runawk for #use'ing modules: -f. |
| 348 |
runawk can also be used for oneliners! ;-) |
| 349 |
|
| 350 |
runawk -f abs.awk -e 'BEGIN {print abs(-123); exit}' |
| 351 |
|
| 352 |
- In a multilined code passed to runawk using option -e, spaces |
| 353 |
are allowed before #directives. |
| 354 |
|
| 355 |
- After inventing alt_getopt.awk module there is no reason for |
| 356 |
heuristics that detects whether to add `-' to AWK arguments or |
| 357 |
not. So I've removed this heuristics. Use alt_getopt.awk module |
| 358 |
or other "smart" module for handling options correctly! |
| 359 |
|
| 360 |
alt_getopt.awk and power_getopt.awk: |
| 361 |
- FIX: for "abc:" short options specifier BSD and GNU getopt(3) |
| 362 |
accept "-acb" and understand it as "-a -cb", they also accept |
| 363 |
"-ac b" and also translate it to "-a -cb". Now alt_getopt.awk |
| 364 |
and power_getopt.awk work the same way. |
| 365 |
|
| 366 |
power_getopt.awk: |
| 367 |
- -h option doesn't print usage information, --help (and its short |
| 368 |
synonym) does. |
| 369 |
|
| 370 |
New modules: |
| 371 |
- shquote.awk, implementing shquote() function. |
| 372 |
shquote(str): |
| 373 |
`shquote' transforms the string `str' by adding shell |
| 374 |
escape and quoting characters to include it to the |
| 375 |
system() and popen() functions as an argument, so that |
| 376 |
the arguments will have the correct values after being |
| 377 |
evaluated by the shell. |
| 378 |
Inspired by NetBSD's shquote(3) from libc. |
| 379 |
|
| 380 |
- runcmd.awk, implementing functions runcmd1() and xruncmd1() |
| 381 |
runcmd1(CMD, OPTS, FILE): |
| 382 |
wrapper for function system() that runs a command CMD |
| 383 |
with options OPTS and one filename FILE. Unlike |
| 384 |
system(CMD " " OPTS " " FILE) the function runcmd1() |
| 385 |
handles correctly FILE and CMD containing spaces, single |
| 386 |
quote, double quote, tilde etc. |
| 387 |
|
| 388 |
xruncmd1(FILE): |
| 389 |
safe wrapper for 'runcmd(1)'. |
| 390 |
awk exits with error if running command failed. |
| 391 |
|
| 392 |
- isnum.awk, implementing trivial isnum() function, |
| 393 |
see the source code. |
| 394 |
|
| 395 |
- alt_join.awk, implementing the following functions: |
| 396 |
join_keys(HASH, SEP): |
| 397 |
returns string consisting of all keys from HASH separated |
| 398 |
by SEP. |
| 399 |
|
| 400 |
join_values(HASH, SEP): |
| 401 |
returns string consisting of all values from HASH separated |
| 402 |
by SEP. |
| 403 |
|
| 404 |
join_by_numkeys (ARRAY, SEP [, START [, END]]): |
| 405 |
returns string consisting of all values from ARRAY |
| 406 |
separated by SEP. Indices from START (default: 1) to END |
| 407 |
(default: +inf) are analysed. Collecting values is stopped |
| 408 |
on index absent in ARRAY. |
| 409 |
|
| 410 |
====================================================================== |
| 411 |
Version 0.16.0, by Aleksey Cheusov, Sun, 5 Apr 2009 12:45:44 +0300 |
| 412 |
|
| 413 |
Lots of demo programs for most runawk modules were created and |
| 414 |
they are in examples/ subdirectory now. |
| 415 |
|
| 416 |
New MEGA module ;-) power_getopt.awk |
| 417 |
See the documentation and demo program examples/demo_power_getopt. |
| 418 |
It makes options handling REALLY easy. |
| 419 |
|
| 420 |
New modules: |
| 421 |
embed_str.awk |
| 422 |
has_suffix.awk |
| 423 |
has_prefix.awk |
| 424 |
readfile.awk |
| 425 |
modinfo.awk |
| 426 |
|
| 427 |
Minor fixes and improvements in dirname.awk and basename.awk. |
| 428 |
Now they are fully compatible with dirname(1) and basename(1) |
| 429 |
|
| 430 |
RUNAWK sets the following environment variables for the child awk |
| 431 |
subprocess: |
| 432 |
|
| 433 |
RUNAWK_MODC - A number of modules (-f filename) passed to AWK |
| 434 |
RUNAWK_MODV_<n> - Full path to the module #n, |
| 435 |
where n is in [0..RUNAWK_MODC) range. |
| 436 |
|
| 437 |
RUNAWK sets RUNAWK_ART_STDIN environment variable for the child awk |
| 438 |
subprocess to 1 if additional/artificial `-' was added to the list |
| 439 |
to awk's arguments. |
| 440 |
|
| 441 |
Makefile: |
| 442 |
bmake-ism were removed. Now Makefile is fully compatible with |
| 443 |
FreeBSD make. |
| 444 |
|
| 445 |
CLEANFILES target is used instead of hand-made rules |
| 446 |
|
| 447 |
Minor fix in 'test_all' target |
| 448 |
|
| 449 |
====================================================================== |
| 450 |
Version 0.15.0, by Aleksey Cheusov, Fri, 19 Dec 2008 21:41:00 +0200 |
| 451 |
|
| 452 |
new module alt_getopt.awk that implements 'getopt' function |
| 453 |
compatible with "Utility Syntax Guidelines" described in |
| 454 |
"Single UNIX Specification" |
| 455 |
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02 |
| 456 |
"getopt" function from this module is similar to C function getopt(3) |
| 457 |
(Idiotic GNU getopt(3) must die!) |
| 458 |
|
| 459 |
Better heuristics for adding `-' to the list awk's arguments, |
| 460 |
now it better conforms to "Utility Syntax Guidelines". |
| 461 |
|
| 462 |
Makefile: STDIN_FILENAME defaults to `-', not `/dev/stdin' |
| 463 |
Interix has no /dev/stdin file |
| 464 |
|
| 465 |
Makefile: WARNS=4 ====> WARNS?= 4 |
| 466 |
Makefile: CPPFLAGS -> CFLAGS, FreeBSD make mk scripts |
| 467 |
don't support CPPFLAGS |
| 468 |
|
| 469 |
Lots of regression tests for 'getopt' function |
| 470 |
|
| 471 |
====================================================================== |
| 472 |
Version 0.14.3, by Aleksey Cheusov, Sat, 18 Oct 2008 19:39:47 +0300 |
| 473 |
|
| 474 |
The following code no longer fails with NAWK under NetBSD |
| 475 |
runawk -e ' { print "123" } ' /dev/null |
| 476 |
|
| 477 |
fixed: compilation bug under FreeBSD (WARNS=4 -> warning -> error) |
| 478 |
caused by comparison of signed and unsigned values |
| 479 |
|
| 480 |
More verbose output when stat(filename) failed |
| 481 |
|
| 482 |
modules/str2regexp.awk: adapted to buggy MAWK |
| 483 |
|
| 484 |
====================================================================== |
| 485 |
Version 0.14.2, by Aleksey Cheusov, Fri, 29 Aug 2008 17:28:34 +0300 |
| 486 |
|
| 487 |
Temporary file is removed if runawk is killed by |
| 488 |
SIGINT, SIGQUIT, SIGTERM, SIGHUP or SIGPIPE signals. |
| 489 |
(Temporary file is created by 'runawk -e ...') |
| 490 |
|
| 491 |
====================================================================== |
| 492 |
Version 0.14.1, by Aleksey Cheusov, Sat, 19 Jul 2008 22:53:45 +0300 |
| 493 |
|
| 494 |
FIXED: The following code doesn't work with runawk-0.14.0 |
| 495 |
runawk -e ' |
| 496 |
#use "anymodule.awk" |
| 497 |
|
| 498 |
<ANY_CODE_HERE> |
| 499 |
' |
| 500 |
|
| 501 |
This code requires a creation of the temporary file that was |
| 502 |
removed in runawk-0.14.0. Now temporary file is created using |
| 503 |
mkstemp(3). |
| 504 |
|
| 505 |
Regression tests are created for testing. |
| 506 |
|
| 507 |
====================================================================== |
| 508 |
Version 0.14.0, by Aleksey Cheusov, Sat, 12 Jul 2008 17:29:22 +0300 |
| 509 |
|
| 510 |
Temporary file is not needed anymore for -e option. |
| 511 |
|
| 512 |
FIXED: #env didn't work under Linux/glibc. |
| 513 |
|
| 514 |
FIXED: compilation error under FreeBSD. |
| 515 |
|
| 516 |
Lots of new regression tests. Code clean-ups. |
| 517 |
fgetln is not required anymore. No hacks about it. |
| 518 |
|
| 519 |
If error happens while processing a #directive, |
| 520 |
a correct line number is output |
| 521 |
|
| 522 |
====================================================================== |
| 523 |
Version 0.13.0, by Aleksey Cheusov, Sun, 15 Jun 2008 11:30:06 +0300 |
| 524 |
|
| 525 |
ADDED: option -v|--assign that works like AWK's -v option. |
| 526 |
This is to pass some variables to AWK interpreter. |
| 527 |
Example: runawk -v var=123 -e 'BEGIN {print var }' |
| 528 |
|
| 529 |
modules/xgetline.awk: better error message/clean-ups |
| 530 |
|
| 531 |
modules/abort.awk: NR is also printed to stderr |
| 532 |
|
| 533 |
minor fixes in *.c |
| 534 |
|
| 535 |
clean-ups and fixes in 'make test'. Now it doesn't depend on my |
| 536 |
own system and runawk directory |
| 537 |
|
| 538 |
'make test' exits with non-zero exit status if regression tests |
| 539 |
fail |
| 540 |
|
| 541 |
Makefile: ported to ancient pmake-1.45 found in some Linux distros |
| 542 |
|
| 543 |
====================================================================== |
| 544 |
Version 0.12.a, by Aleksey Cheusov, Mon, Tue, 4 Mar |
| 545 |
|
| 546 |
fix in alt_assert.awk |
| 547 |
|
| 548 |
====================================================================== |
| 549 |
Version 0.12.0, by Aleksey Cheusov, Mon, 3 Mar 2008 23:04:10 +0200 |
| 550 |
|
| 551 |
new directive '#env' is implemented. |
| 552 |
It sets environment for running awk subprocess using setenv(3) |
| 553 |
|
| 554 |
Example: |
| 555 |
|
| 556 |
#!/usr/local/bin/runawk |
| 557 |
|
| 558 |
#env "LC_ALL=C" |
| 559 |
|
| 560 |
$1 ~ /^[A-Z]+$/ { # A-Z is valid if LC_CTYPE=C |
| 561 |
print $1 |
| 562 |
} |
| 563 |
|
| 564 |
New modules |
| 565 |
|
| 566 |
match_br.awk |
| 567 |
|
| 568 |
match_br(STRING, BR_OPEN, BR_CLOSE) |
| 569 |
return start position (or zero if failure) of the substring |
| 570 |
surrounded by balanced (), [], {} or similar characters |
| 571 |
Also sets RSTART and RLENGTH variables just like |
| 572 |
the standard 'match' function does |
| 573 |
|
| 574 |
For example: |
| 575 |
print match_br("A (B (), C(D,C,F (), 123))", "(", ")") |
| 576 |
print RSTART, RLENGTH |
| 577 |
-| 3 |
| 578 |
-| 3 |
| 579 |
-| 24 |
| 580 |
|
| 581 |
braceexpand.awk |
| 582 |
|
| 583 |
braceexp(STRING) |
| 584 |
implement shell-like brace expansion |
| 585 |
|
| 586 |
For example: |
| 587 |
print braceexpand("ab{,22{,7,8}}z{8,9}") |
| 588 |
-| abz8 abz9 ab22z8 ab22z9 ab227z8 ab227z9 ab228z8 ab228z9 |
| 589 |
|
| 590 |
exitnow.awk |
| 591 |
|
| 592 |
see the code. exitnow.awk is used by alt_assert.awk and |
| 593 |
abort.awk |
| 594 |
|
| 595 |
abort.awk |
| 596 |
|
| 597 |
abort(MSG, EXIT_STATUS) -- print MSG to stderr and exits |
| 598 |
program with EXIT_STATUS. if EXIT_STATUS is zero of is not |
| 599 |
specified, 1 is assigned. |
| 600 |
|
| 601 |
dirname.awk |
| 602 |
|
| 603 |
similar to UNIX's dirname(1) |
| 604 |
|
| 605 |
basename.awk |
| 606 |
|
| 607 |
similar to UNIX's basename(1) |
| 608 |
|
| 609 |
xgetline.awk |
| 610 |
|
| 611 |
xgetline0([FILE]) |
| 612 |
|
| 613 |
Safe analog to 'getline < FILE' or 'getline' (if no FILE |
| 614 |
is specified). 0 at the end means that input line is |
| 615 |
assigned to $0. |
| 616 |
|
| 617 |
xgetline([FILE]) |
| 618 |
Safe analog to 'getline __input < FILE' and 'getline __input' |
| 619 |
(if no FILE is specified) |
| 620 |
|
| 621 |
In both cases "safe" means that returned value is analysed |
| 622 |
and if it is less than zero (file reading error happens) |
| 623 |
program will be terminated emmidiately with appropriate error |
| 624 |
message printed to stderr. Both functions return zero if end |
| 625 |
of file is reached or non-zero if reading was sucessfull. |
| 626 |
|
| 627 |
Example: |
| 628 |
while (xgetline("/etc/passwd")){ |
| 629 |
print "user: " __input |
| 630 |
} |
| 631 |
|
| 632 |
xclose.awk |
| 633 |
xsystem.awk -- safe wrappers over 'close' and 'system' functions |
| 634 |
|
| 635 |
====================================================================== |
| 636 |
Version 0.11.0, by Aleksey Cheusov, Sat, 9 Feb 2008 17:35:59 +0200 |
| 637 |
|
| 638 |
New modules |
| 639 |
|
| 640 |
tokenre.awk: |
| 641 |
|
| 642 |
By default AWK splits input strings into tokens according to regular |
| 643 |
expression that defines "space" between tokens using special |
| 644 |
variable FS. In many situations it is more useful to define regular |
| 645 |
expressions for tokens themselves. This is what this module does. |
| 646 |
|
| 647 |
tokenre(STRING, REGEXP) |
| 648 |
`tokenre' extracts substrings from STRING |
| 649 |
according to REGEXP from the left to the right and assigns $1, $2 |
| 650 |
etc. and NF variable. |
| 651 |
|
| 652 |
tokenre0(REGEXP) |
| 653 |
Does the the same as `tokenre' but splits $0 instead |
| 654 |
|
| 655 |
TRE - variable. If it is set to not empty string, splitting is |
| 656 |
made by default for all input strings. |
| 657 |
|
| 658 |
For example: |
| 659 |
tokenre("print \"Hello world!\"", "\"([^\"]|\\\")*\"|[[:alnum:]_]+") |
| 660 |
| NF == 2 |
| 661 |
| $1 == print |
| 662 |
| $2 == "Hello world!" |
| 663 |
|
| 664 |
str2regexp.awk |
| 665 |
|
| 666 |
str2regex(STRING) |
| 667 |
returns a regular expression that matches given STRING |
| 668 |
|
| 669 |
For example: |
| 670 |
print str2regexp("all special symbols: ^$(){}[].*+?|\\") |
| 671 |
-| all special symbols: [^][$][(][)][{][}][[]\][.][*][+][?][|]\\ |
| 672 |
|
| 673 |
multisub.awk |
| 674 |
|
| 675 |
multisub(STRING, SUBST_REPLS) |
| 676 |
`multisub' is a substitution function. It searches for |
| 677 |
a list of substrings, specified in SUBST_REPL |
| 678 |
in a left-most longest order and (if found) replaces |
| 679 |
found fragments with appropriate replacement. |
| 680 |
SUBST_REPL format: "SUBSTRING1:REPLACEMENT1 SUBSTRING2:REPLACEMENT2...". |
| 681 |
Three spaces separate substring:replacement pairs from each other. |
| 682 |
|
| 683 |
For example: |
| 684 |
print multisub("ABBABBBBBBAAB", "ABB:c BBA:d AB:e") |
| 685 |
|- ccBBde |
| 686 |
|
| 687 |
new target 'test_all' runs tests for all available |
| 688 |
awk interpreters |
| 689 |
|
| 690 |
====================================================================== |
| 691 |
Version 0.10.1, by Aleksey Cheusov, Fri, 1 Feb 2008 21:25:48 +0200 |
| 692 |
|
| 693 |
FIXED: If AWK interpreter segfaults or killed by any other signal, |
| 694 |
runawk exits with exit status 0. Affected runawk versions: all. |
| 695 |
Now this is fixed and runawk exits with exit status 128+SIGNAL |
| 696 |
just like many shells. |
| 697 |
|
| 698 |
EXIT STATUS section has been added to the manual page. |
| 699 |
|
| 700 |
====================================================================== |
| 701 |
Version 0.10.0, by Aleksey Cheusov, Wed, 23 Jan 2008 00:38:31 +0200 |
| 702 |
|
| 703 |
ADDED: The environment variable RUNAWK_AWKPROG overrides |
| 704 |
the default awk interpreter which is set at compile time. |
| 705 |
Documentation updated accordingly. |
| 706 |
|
| 707 |
FIXED: unsafe use of strdup(3) |
| 708 |
|
| 709 |
I've copied MIT License text to code from www.opensource.org. |
| 710 |
Do you see any difference? |
| 711 |
|
| 712 |
ADDED: new trivial module pow.awk that implements function "pow" |
| 713 |
|
| 714 |
fix: MKMAN and MKCATPAGES make's standard variables are checked |
| 715 |
during installation |
| 716 |
|
| 717 |
In order to build runawk not in a directory you can either build |
| 718 |
it like this (standard way) |
| 719 |
cd /src/dir; make all install MAKEOBJDIR=/obj/dir |
| 720 |
or like this |
| 721 |
cd /obj/dir; make -f /src/dir/Makefile all install |
| 722 |
|
| 723 |
optional config.h is #included if you need it |
| 724 |
|
| 725 |
other minor fixes and improvements both in code and documentation |
| 726 |
|
| 727 |
====================================================================== |
| 728 |
Version 0.9.0, by Aleksey Cheusov, Sun, 23 Dec 2007 22:20:23 +0200 |
| 729 |
|
| 730 |
I switched to BSD make. I really hate automake and its approach in |
| 731 |
general. I'm not expert in BSD, but their 'make' looks much |
| 732 |
better. But using it makes some changes in building process, see |
| 733 |
README/INSTALLATION section for a brief description. |
| 734 |
|
| 735 |
ADDED: man page for runawk. HTML version runawk.html can also be |
| 736 |
generated from runawk.pod using pod2html, see Makefile. |
| 737 |
|
| 738 |
ADDED: -i/-I options for forcing/disabling adding /dev/stdin to |
| 739 |
the list of awk arguments. See man page for more information. |
| 740 |
|
| 741 |
A few AWK modules are installed to PREFIX/share/runawk: abs.awk, |
| 742 |
min.awk, max.awk and alt_assert.awk. This directory is also checked |
| 743 |
while searching for modules. See man page for more details. |
| 744 |
|
| 745 |
AWK_PROG and STDIN_FILENAME Makefile variables can be passed to make |
| 746 |
program to change a path to an actual AWK interpreter (/usr/bin/awk |
| 747 |
by default) and stdin file (/dev/stdin by default). |
| 748 |
|
| 749 |
Lots of improvements in documentation |
| 750 |
|
| 751 |
ADDED: regression tests. Run them by running 'make test' and let |
| 752 |
me know if somethiung fails. |
| 753 |
|
| 754 |
debugging output is sent stdout, not stderr |
| 755 |
|
| 756 |
ADDED: long synonyms for short options, --help, --version etc. |
| 757 |
|
| 758 |
clean-ups in Makefile |
| 759 |
|
| 760 |
options handling improvements |
| 761 |
|
| 762 |
====================================================================== |
| 763 |
Version 0.8.1, by Aleksey Cheusov, Wed, 24 Oct 2007 14:46:12 +0300 |
| 764 |
|
| 765 |
FIXED: default stdin file should be /std/stdin, not /dev/stderr, |
| 766 |
I've made a typo. |
| 767 |
|
| 768 |
====================================================================== |
| 769 |
Version 0.8.0, by Aleksey Cheusov, Sun, 21 Oct 2007 17:19:46 +0300 |
| 770 |
|
| 771 |
FIXED: return code of execvp is not analysed, i.e. when running |
| 772 |
an interpreter fails, runawk silently exits with zero exit status. |
| 773 |
Now it fails with exit status 1 and print an error to stderr. |
| 774 |
|
| 775 |
stdin filename defaults to "/dev/stdin" |
| 776 |
|
| 777 |
ROOT variable in Makefile has been renamed |
| 778 |
to more commonly used PREFIX |
| 779 |
|
| 780 |
realloc(2) is not used anymore. arrays[ARRAY_SZ] are used now. |
| 781 |
|
| 782 |
AWK and STDIN_FILENAME variables are removed from Makefile. |
| 783 |
Use CPPFLAGS for changing defaults. |
| 784 |
|
| 785 |
====================================================================== |
| 786 |
Version 0.7.0, by Aleksey Cheusov, Sat, 22 Sep 2007 02:30:26 +0300 |
| 787 |
|
| 788 |
First publicly available release. |
| 789 |
|
| 790 |
See README for a documentation |
| 791 |
====================================================================== |