Commit Graph

55 Commits

Author SHA1 Message Date
he
4e9514ecb8 Add an overlooked semicolon to fix the build. 2008-07-14 06:14:44 +00:00
christos
96f87739b6 PR/39002: cheusov at tut dot br: Warn for \x where x is not a valid escaped
char.
2008-07-13 17:08:28 +00:00
christos
e8c53cdebd sprintf -> snprintf 2008-07-12 19:57:59 +00:00
christos
19150c1762 explicitly disallow %L,%l,%h as TOG specifies. 2008-07-12 19:49:30 +00:00
christos
f3e4d308aa PR/39133: cheusov at tut dot by: Don't treat -Ft as -F <tab> 2008-07-12 15:17:37 +00:00
christos
e04577112e and remove debugging. 2008-07-11 23:06:48 +00:00
christos
86201bf107 better fix than before. Instead of copying the constant cells, set DONTFREE
on all non-strings.
2008-07-11 23:05:49 +00:00
christos
2a2697b888 PR/39132: cheusov at tut dot by: When copying an OCELL, make sure you make
a copy of its string and deal with DONTFREE properly, so that we don't try
to free the OCELL pointer later which points to a literal string in the text
segment.
2008-07-11 22:11:24 +00:00
christos
f7e42af424 PR/38737: cheusov at tut dot by: Don't build the character class table
starting at 0, because will always be treated as the empty string DuH!
2008-05-25 16:28:25 +00:00
christos
2699db69d7 remove things we don't use. 2008-05-25 14:54:52 +00:00
christos
4459d9696e update to 20070501 2008-05-25 14:51:49 +00:00
christos
200d206cea from: http://cm.bell-labs.com/cm/cs/awkbook/index.html 2008-05-25 13:51:11 +00:00
christos
0f85ac800d Fix segmentation fault with printf("%*"); from Jukka Salmi 2008-01-21 17:18:06 +00:00
he
555e1d5a74 Remove a superfluous test, wcrtomb() cannot return (size_t)-2.
Pointed out by Aleksey Cheusov.
2007-10-25 22:22:41 +00:00
christos
ba0aca47b0 PR/37205: Aleksey Cheusov: nawk: a number of open files is limited to very
small constant. Make the array of files dynamically allocated.
2007-10-25 15:12:03 +00:00
he
50d663aa6a Add support for multibyte charsets in the "tolower" and "toupper" awk
functions.  Code contributed by Aleksey Cheusov in PR#36394, and slightly
tweaked for closer-to-KNF conventions by me.  Also slightly improved checks
of error returns.
2007-10-25 14:44:49 +00:00
he
c6b19d4d1d Bring back the fix in revision 1.6, apparently accidentally lost
during last merge, to allow escape of a newline in string literals.
2007-10-25 14:40:33 +00:00
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