Commit Graph

59 Commits

Author SHA1 Message Date
Warner Losh
d12420d872 Don't display empty error context.
Context extraction didn't handle this case and showed uninitialized memory.

Obtained from: OpenBSD lib.c 1.21
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:04:06 +00:00
Warner Losh
8e537f8ae0 Fix %c for floating values that become 0 when coerced to int.
Obtained from: OpenBSD run.c 1.36 (From Jeremy Devenport)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:04:02 +00:00
Warner Losh
547f34cace Fix uninitialized variable
echo | awk 'BEGIN {i=$1; print i}' prints a boatload of stack
garbage. NUL terminate the memory returned from malloc to prevent it.

Obtained from: OpenBSD run.c 1.40
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12379
2017-09-24 05:03:57 +00:00
Warner Losh
73f7ff91b2 Implement gawk multiple-arg extension to and, or, and xor.
gawk allows multiple arguemnts to bit-wiste and, or and xor
functions. Implement an arbitrary number of arguments for these
functions. Also, use NULL in preference to 0 to match rest of file.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12361
2017-09-14 05:48:23 +00:00
Warner Losh
69679fc10f Bring in bit operation functions, ala gawk.
These are from OpenBSD:
>>> Extend awk with bitwise operations. This is an extension to the awk
>>> spec and documented as such, but comes in handy from time to time.
>>> The prototypes make it compatible with a similar GNU awk extension.
>>>
>>> ok millert@, enthusiasm from deraadt@

Edited to fix cut and paste in error messages, as well as
using tabs instead of spaces after #defines added.

Obtained From: OpenBSD awk.h 1.12, lex.c 1.10, run.c 1.29
Differential Revision: https://reviews.freebsd.org/D12361
Sponsored by: Netflix
2017-09-14 05:47:55 +00:00
Pedro F. Giffuni
6c10e0ba0b MFV r315425:
one-true-awk: have calloc(3) do the multiplication.

MFC after:	3 days
2017-03-16 21:32:05 +00:00
Andrey A. Chernov
cd3912b6be The bug:
$ echo x | awk '/[[:cntrl:]]/'
x

The NUL character in cntrl class truncates the pattern, and an empty
pattern matches anything. The patch skips NUL as a quick fix.

PR:     195792
Submitted by:   kdrakehp@zoho.com
Approved by:    bwk@cs.princeton.edu (the author)
MFC after:      3 days
2016-09-03 23:04:56 +00:00
Andrey A. Chernov
6c2a17d0b5 Back out non-collating [a-z] ranges.
Instead of changing the whole course to another POSIX-permitted way
for consistency and uniformity I decide to completely ignore missing
regex fucntionality and focus on fixing bugs in what we have now,
too many small obstacles we have choicing other way, counting ports.
Corresponding libc changes are backed out in r302824.
2016-07-14 09:31:52 +00:00
Andrey A. Chernov
1d148a7c3f After removing collation for [a-z] ranges in r302512, do it here too.
I'll try to keep the change very minimal to not touch contribed code much.
I'll send it upstream when it will be merged to main branches,
but we need the change right now here.
2016-07-13 10:01:31 +00:00
Pedro F. Giffuni
c8b6d1e472 Revert r301689 - one-true-awk: Avoid a NULL dereference.
I got this wrong and the coverity report doesn't match the NetBSD change,
which was thought for a different version.

The change wouldn't hurt but let's wait until upstream figures this out.
2016-06-08 19:39:44 +00:00
Pedro F. Giffuni
17ce5a9b90 one-true-awk: Avoid a NULL dereference.
CID:		270862
Obtained from:	NetBSD (CVS Rev. 1.8)
MFC after:	2 weeks
2016-06-08 19:24:48 +00:00
Pedro F. Giffuni
9051825205 MFV r300961:
one-true-awk: replace 0 with NULL for pointers

Also remove a redundant semicolon.
2016-06-03 21:23:11 +00:00
Pedro F. Giffuni
a4b2ac79e4 awk: Use random(3) instead of rand(3)
While none of them is considered even near to cryptographic
level, random(3) is a better random generator than rand(3).

Use random(3) for awk as is done in other systems.

Thanks to Chenguang Li for discussing this in the lists
and submitting the patch upstream.

PR:		193147
MFC after:	5 weeks
2014-09-19 18:24:02 +00:00
Xin LI
0840e960f9 MFV: one-true-awk 20121220.
MFC after:	1 month
2013-01-03 07:25:30 +00:00
Ruslan Ermilov
aa0da2e494 - Merged awk upstream that includes a fix for a bug exposed by kmod_syms.mk.
- Provide a build aid for those who already have a buggy awk(1) installed.

Approved by:	re (kib)
2011-08-11 10:29:10 +00:00
Ruslan Ermilov
d86a0988d2 Update to a 7-Aug-2011 release.
Approved by:	re (kib)
2011-08-09 12:54:43 +00:00
Ruslan Ermilov
b40501fb67 Update to a 6-May-2011 release (upstreamed some of our changes). 2011-05-06 14:21:46 +00:00
Ruslan Ermilov
1b11b78377 Update to a 1-May-2011 release (except for the isblank change). 2011-05-03 11:47:19 +00:00
Ruslan Ermilov
d98dd8e5f9 Apply patches directly to sources. Their effect is as follows:
- Make one-true-awk respect locale's collating order in [a-z]
  bracket expressions, until a more complete fix (like handing
  BREs) is ready.

- Don't require a space between -[fv] and its argument.
2010-01-10 08:02:07 +00:00
Ruslan Ermilov
91217c1c70 Update to a 26-Nov-2009 release. 2010-01-09 23:19:01 +00:00
Ruslan Ermilov
829089cc6f Clean up import. 2010-01-09 22:47:40 +00:00
Ruslan Ermilov
6023075d0d Flatten out vendor tree. 2010-01-09 22:31:11 +00:00
David E. O'Brien
168aca5df6 Document the bwk_20071023 import. 2007-10-25 12:38:34 +00:00
David E. O'Brien
d2f6e49220 Vendor import of bwk's 23-Oct-2007 release.
This includes fixes for FreeBSD PR's: bin/104795, bin/100443
2007-10-25 12:38:02 +00:00
David E. O'Brien
4afed873bc This commit was generated by cvs2svn to compensate for changes in r172958,
which included commits to RCS files with non-trunk default branches.
2007-10-25 12:38:02 +00:00
Rong-En Fan
a36454aac4 - Update for 2007/05/01 import.
Approved by:	delphij (mentor)
Nodded by:	ru
2007-06-05 15:34:40 +00:00
Rong-En Fan
addad6af5a Vendor import of bwk's 01-May-2007 release.
Approved by:	delphij (mentor)
Nodded by:	ru
Tested by:	make universe
2007-06-05 15:33:51 +00:00
Rong-En Fan
3aa1b8b946 This commit was generated by cvs2svn to compensate for changes in r170331,
which included commits to RCS files with non-trunk default branches.
2007-06-05 15:33:51 +00:00
Ruslan Ermilov
45c9b8cd6e Update for the 2005/04/24 import. 2005-05-16 19:19:32 +00:00
Ruslan Ermilov
c263f9bff0 Vendor import of bwk's 24-Apr-2005 release. 2005-05-16 19:11:36 +00:00
Ruslan Ermilov
e53d81968a This commit was generated by cvs2svn to compensate for changes in r146299,
which included commits to RCS files with non-trunk default branches.
2005-05-16 19:11:36 +00:00
Ruslan Ermilov
5bb0c94f9d Update for the 2004/02/07 import. 2004-02-08 21:39:18 +00:00
Ruslan Ermilov
62ebc626e6 Vendor import of bwk's 7-Feb-2004 release. 2004-02-08 21:32:21 +00:00
Ruslan Ermilov
43fb8a0b80 This commit was generated by cvs2svn to compensate for changes in r125601,
which included commits to RCS files with non-trunk default branches.
2004-02-08 21:32:21 +00:00
Ruslan Ermilov
63cf1d7ac8 Update for the 2003/07/31 import. 2004-02-07 16:46:05 +00:00
Ruslan Ermilov
2e454f23fa Fixes from 31-Jul-2003; make it 8-bit clean.
Forgotten by:	ru (for far too long)
2004-02-05 23:16:31 +00:00
Ruslan Ermilov
175f0360d3 This commit was generated by cvs2svn to compensate for changes in r125505,
which included commits to RCS files with non-trunk default branches.
2004-02-05 23:16:31 +00:00
Ruslan Ermilov
0560c735b9 Update for the 2003/07/29 import. 2003-07-30 06:50:31 +00:00
Ruslan Ermilov
88b8d48716 Vendor import of bwk's 29-Jul-2003 release. 2003-07-30 06:47:03 +00:00
Ruslan Ermilov
65259669d3 This commit was generated by cvs2svn to compensate for changes in r118194,
which included commits to RCS files with non-trunk default branches.
2003-07-30 06:47:03 +00:00
David E. O'Brien
fc6b1dfe95 Vendor import of bwk's 14-March-2003 release. 2003-03-17 07:59:59 +00:00
David E. O'Brien
3a147e6d81 This commit was generated by cvs2svn to compensate for changes in r112336,
which included commits to RCS files with non-trunk default branches.
2003-03-17 07:59:59 +00:00
David E. O'Brien
edc3fe2db6 Update for the 20021213 version. 2002-12-19 04:34:00 +00:00
David E. O'Brien
72969a2212 Vendor import of bwk's 13-Dec-2002 release. 2002-12-19 04:33:15 +00:00
David E. O'Brien
6825c07db3 This commit was generated by cvs2svn to compensate for changes in r108072,
which included commits to RCS files with non-trunk default branches.
2002-12-19 04:33:15 +00:00
David E. O'Brien
9dc9a9b380 Update for the just-done-import. 2002-12-13 05:03:15 +00:00
David E. O'Brien
813da98d0e Vendor import of bwk's 29-Nov-2002 release.
Most significant update is the inclusion of our port's locale patches.
2002-12-13 04:59:48 +00:00
David E. O'Brien
cf709e0a4f This commit was generated by cvs2svn to compensate for changes in r107806,
which included commits to RCS files with non-trunk default branches.
2002-12-13 04:59:48 +00:00
David E. O'Brien
146a1e500c Vendor import of bwk's 2002-02-10 release. 2002-03-16 16:50:57 +00:00
David E. O'Brien
d6cfbc78d7 This commit was generated by cvs2svn to compensate for changes in r92422,
which included commits to RCS files with non-trunk default branches.
2002-03-16 16:50:57 +00:00