Commit Graph

38 Commits

Author SHA1 Message Date
apb 22d0439909 In setfval(), ensure that arithmetic never yields a negative zero
result.  Now {echo | awk '{print -1 * 0}'} prints "0" instead of "-0".

Fixes PR 36831.  Discussed in tech-userlevel.
2007-08-28 15:23:13 +00:00
christos 407a09df84 strdup/strlcat/snprintf changes from Aleksey Cheusov 2006-07-26 20:46:37 +00:00
christos f45b14fd95 add ytab.[ch] 2006-07-25 21:25:55 +00:00
christos cc3156aaa2 Change the meaning of state count to be the number allocated (like c does)
instead of the highest number allocated (fortran). Fixes off-by-one errors.
Also change the overallocation of n * 5 / 4 + 10 to just n + 10.
2006-07-25 20:52:57 +00:00
christos 295eac6574 make the gototab unsigned int 2006-06-26 17:58:25 +00:00
christos 80f0134faf - widen gototab so NCHARS states fits.
- don't allocate more space than we need.
From Aleksey Cheusov
2006-06-26 13:10:47 +00:00
christos a504bbc8d8 Don't forget to free gototab[i]; pointed out by Aleksey Cheusov 2006-06-25 22:37:45 +00:00
christos ab7ad9579e PR/33392: Aleksey Cheusov: Incorrect matching due to hard-coded limit in
number of states. Adapted from patch supplied.
2006-06-22 21:25:14 +00:00
christos a674b513c2 Coverity CID 2738: When a symbol with a NULL name is passed, convert it to
the empty symbol.
2006-03-21 16:59:09 +00:00
christos 6dccf87632 Avoid overflowing static array which c == HAT. 2006-03-19 17:41:55 +00:00
christos 57e31ffb5c Coverity CID 1867: Fix memory leak. 2006-03-18 22:39:40 +00:00
christos a1f97364cb Coverity CID 862: Avoid NULL deref. 2006-03-18 22:37:16 +00:00
christos 73a77c6016 Coverity CID 1476: Add assertion before index operation. 2006-03-18 22:35:42 +00:00
jdolecek e2ba6dc38f back-off 'use bounded string op' commit of 2003/08/13 - no real problem
has been fixed by it, but it introduced at least one bug

don't do any more of such gratuitous changes here, please
2005-07-03 15:18:11 +00:00
jdolecek e6b9888ace resolve conflicts 2005-07-02 20:10:34 +00:00
jdolecek 5a4553e726 this should not have been committed, sorry 2005-07-02 18:58:15 +00:00
jdolecek e5687f9fff Update to nawk-20050424. Fixes several overflow and RE bugs, as well as
preserving $0 in END block.
2005-07-02 18:56:41 +00:00
he a80853ef7a Make nawk retain the text from the last line of the input as well as
the derived variables (fields & NF) under the END pattern.  This
implicitly complies with the SUSv2 specification at
  http://www.opengroup.org/onlinepubs/007908799/xcu/awk.html
which explicitly says that NF and NR must retain their values from
the last record seen.  Fixes PR#29659.
2005-03-23 17:24:41 +00:00
yamt 83aa569ca0 allow to escape newline in string literals.
(being compatible with solaris /usr/xpg4/bin/awk and GNU awk.)
2005-01-13 12:10:02 +00:00
jdolecek fbac8027bb fix off-by-one use of gensub() index parameter, and treat negative
number to mean 'replace first match'; the index use is now fully
aligned with GNU awk

fixes PR bin/25543 by Richard Rauch
2004-06-05 12:01:28 +00:00
jdolecek eff7cd8291 bump the regular expression cache from 20 expressions to 128 2003-10-26 13:39:38 +00:00
jdolecek 9ce369b7f5 exit with fatal error if backreferences are used in subst string
of gensub(); these are not supported (yet) and better to fail with
error than to end up with silent incorrect substitution
2003-10-26 13:27:26 +00:00
jdolecek a45cfadaff cleanup some (uschar **) to (char **) casts which break
strict aliasing rules, so that this builds with gcc 3.3; this was done
by changing variables & function arguments to uschar where appropriate
2003-10-26 11:34:23 +00:00
itojun e1e0321817 use bounded string op 2003-08-13 02:51:20 +00:00
jdolecek 19de07894e Merge nawk version 20030729 changes, and resolve conflicts. 2003-08-02 22:41:59 +00:00
jdolecek 4ea2a427d1 Import nawk as of 2003/07/29
Changes:
* internationalization improvements
* [:digit:] addition
* some bugfixes
2003-08-02 22:21:23 +00:00
itojun 93851338f2 sscanf overrun 2003-05-17 01:12:28 +00:00
jdolecek e46100bcfd correctly handle 'printf "%c", 0' - previously, it accessed random
memory and segv'd under some circumstances (e.g. when running
sys/arch/walnut/compile/mkimg.sh rev. 1.2 script)
2002-06-27 08:52:27 +00:00
jdolecek a88d50e63a call setlocale(3) on startup 2001-02-09 00:56:51 +00:00
jdolecek 7193677c62 cast the parameter to toupper()/tolower() to unsigned char, so that
this works with *p > 127
2001-02-09 00:56:18 +00:00
jdolecek 7f0ff9b2ee add GNU awk compatible functions systime(), strftime() and gensub()
XXX gensub() doesn't handle backreferences (\0 .... \9) yet
2001-02-08 20:42:39 +00:00
jdolecek 5d05ca039b ytab.[ch] --> awkgram.[ch] 2001-02-05 19:07:57 +00:00
jdolecek 8bd0c1d510 use awkgram.h, generate constified printname[] and tokname() 2001-02-05 19:07:15 +00:00
jdolecek 1286145cd7 change to build/use awkgram.[ch] instead of ytab.[ch] 2001-02-05 19:06:02 +00:00
jdolecek 9f2789de82 regen with correct token numbers (since only in comment, this is cosmetic only) 2001-02-05 18:43:34 +00:00
jdolecek 9a78fc84e2 Import nawk 2000/11/15.
These files are not used for build, but are usable when one want to regenerate
proctab.c
2001-02-05 13:31:17 +00:00
jdolecek e82124d4fa adapt to NetBSD build environment, constify a little 2001-01-23 22:26:02 +00:00
jdolecek adb545a48e Import nawk 2000/11/15, try #2.
This is the original New AWK from AT&T Labs as described in "The
AWK Programming Language", by Al Aho, Brian Kernighan, and Peter
Weinberger.

This would eventually replace gawk in our tree in future.
2001-01-23 22:14:07 +00:00