Commit Graph

84 Commits

Author SHA1 Message Date
uwe 375d892ebc awk(1): Fix incomplete edit. Bump date. 2022-07-05 22:50:43 +00:00
rillig 9f20f1d6fa awk.1: add articles, remove 'shall' 2022-07-05 22:20:55 +00:00
rillig b9b802f2b0 awk.1: fix typo 2022-07-05 22:07:20 +00:00
uwe 5305d6f737 awk(1): consistent Capitalization. 2022-07-05 18:40:03 +00:00
uwe 628a87c5aa awk(1): Empty parens of length() be omitted.
Mark up length[([string])] description accordingly (like POSIX does).
Adjust the length example to demonstrate this.
2022-07-05 18:18:48 +00:00
uwe aa708eb2ec awk(1): Another echo(1) example that demonstrates field assignment 2022-07-05 17:58:47 +00:00
uwe 3fd9f4ec12 awk(1): Use .It Xo Fo trick to format optional arguments correctly 2022-07-05 16:59:41 +00:00
uwe 79c59330dd awk(1): Document /dev/stdin &c magic names (NB: unrelated to fd(4)) 2022-07-05 16:21:35 +00:00
uwe cd08e114e1 awk(1): Factor out output redirection for print and printf.
This makes the description way less cluttered and explicitly shows
"| expr" (that was mentioned, but not written out) and ">> file" (that
was not even mentioned at all).  Adapted from the POSIX wording, but
doesn't bring over all the detailed verbiage.
2022-07-05 15:56:42 +00:00
uwe e92fc1cc7e awk(1): A few more formatting tweaks to inlibe code bits and pieces 2022-07-05 15:35:53 +00:00
uwe 87c13de339 awk(1): Fix editing accident in one of the previous commits. 2022-07-05 15:28:02 +00:00
uwe 1e388e4cea awk(1): Drop whitespace between initials
P.J. requires thin space, for other - V and W has enough natural space
near the bottom (the intervening dot prevents kerning).
2022-07-05 15:27:14 +00:00
uwe 7dbb986ee1 awk(1): more formatting nits 2022-07-05 15:21:39 +00:00
uwe cb70ac6a62 awk(1): drop POSIX prescriptive "shall" from the otherwise descriptive passage 2022-07-05 14:36:33 +00:00
uwe de2b19da7a awk(1): Fix mark up of inline code, the easy cases for now. 2022-07-05 14:10:09 +00:00
uwe b7c8f49c00 awk(1): mark up $<n> properly - '$' is an unary op, not part of the name 2022-07-05 13:48:07 +00:00
uwe 7bf4dc70f9 awk(1): document programs that only has BEGIN and/or END pattern-actions.
Copied from POSIX, except "getline" is a statement, not a function, so
call it that.
2022-07-05 13:29:18 +00:00
uwe fd9ac8923c awk(1): document what assigning to $0 and $<n> does 2022-07-05 13:21:38 +00:00
uwe 81d2993237 awk(1): mark up var=value properly 2022-07-05 13:05:20 +00:00
uwe 8ccdd972f6 awk(1): Fix -width.
"indent" (or misspelings thereof) is not a magic value for -width.
2022-07-05 12:59:01 +00:00
uwe 06fd90beaf awk(1): g/c extraneous space in an example 2022-07-05 12:46:48 +00:00
uwe 196509a057 awk(1): use official echo example from POSIX 2022-07-05 00:47:32 +00:00
rillig 7ec6419d33 awk.1: revert changes to example 'echo' program
I had removed the exit statement in the strong belief that POSIX had
specified that an AWK program consisting of only a BEGIN block would
implicitly exit after the BEGIN block.  This assumption was wrong.
There are several implementations that implement this special case
though.

https://mail-index.netbsd.org/source-changes-d/2022/07/03/msg013718.html
2022-07-04 18:07:41 +00:00
rillig 973649f2bc awk.1: remove trailing space in output of 'echo' example program 2022-07-03 10:56:22 +00:00
christos 358fc34e52 From wajap at github:
- eat whitespace in infnan checks
- set fval to 0 if we are not a floating point number
2020-11-02 22:58:51 +00:00
riastradh dd2199c16d Nix trailing whitespace. 2020-09-02 18:09:04 +00:00
christos 85da8872cb eat the sign, pointed out by uwe@ 2020-09-01 00:35:29 +00:00
christos d21092d46f check explicitly for inf and nan. We can't check if it is a number,
because awk parses 1a as 1...
2020-09-01 00:21:01 +00:00
christos 4b14471916 Add a check_number function that does what is repeated in many places in
the code, but better.
2020-08-31 23:37:55 +00:00
christos 8871000030 Don't try so hard to convert strings into numbers. Results in bogus
conversions like:

% awk 'BEGIN { print "nanotime" + 123 }'
nan
% awk 'BEGIN { print "microtime" + 123 }'
123
% awk 'BEGIN { print "inftime" + 123 }'
inf
2020-08-31 23:36:58 +00:00
ad 74ff427e71 Now that inputFS is dynamically allocated, make sure it's always non-NULL.
Fixes core dumps when building CDE.
2020-04-17 22:35:18 +00:00
christos e9bf148a44 Fix failing unittests (by restoring old changes). 2020-02-20 19:59:12 +00:00
christos ebfc71ebe2 regen 2020-02-18 21:29:39 +00:00
christos b0222858ea use the correct header name. 2020-02-18 21:29:30 +00:00
christos cdabad706d merge conflicts 2020-02-18 21:12:21 +00:00
christos 6f2cbaf607 Last import was 2010 when there was no ChangeLog yet. I've worked
with upstream to merge all our changes and this includes many other
fixes including new operator support etc. The change to pass an
extra "isnew" argument to open was not preserved as none of the
tests supplied with the PR fail.

This also adds the testsuite and all the bugs fixed since then.
2020-02-18 20:50:46 +00:00
wiz cc99a5951f Add license from https://github.com/onetrueawk/awk/blob/master/LICENSE 2019-12-21 09:11:59 +00:00
wiz 28107122fa Remove macros with no effect. 2019-12-18 10:17:48 +00:00
christos 33c14bf659 Sync with upstream. 2019-12-17 18:35:57 +00:00
christos 806ea548cf Add translators for \v and \a per posix. 2019-08-01 13:17:42 +00:00
christos efd65d89e4 remove ### error output accidentally committed. 2019-08-01 06:33:58 +00:00
christos ca889033bb PR/54424: Martijn Dekker: awk: broken character classes in UTF-8 locale:
only the first matches
Pick up some of the fixes from upstream:
	- posix paren matching
	- print \v \a
	- some more fatal handling
	- init all the character range.
2019-08-01 06:22:52 +00:00
christos a533950c00 remove trailing whitespace. 2019-08-01 06:14:45 +00:00
christos d7ebb8dfb4 PR/53885: Martijn Dekker: Add ERE support from
https://opensource.apple.com/tarballs/awk/awk-24.tar.gz
2019-01-19 00:37:41 +00:00
kamil 463be44101 Do not use index out of bounds in nawk
$ awk '{w=$1}' < /dev/null
/public/src.git/external/historical/nawk/bin/../dist/lex.c:476:16: runtime error: index -1 out of bounds for type 'const Keyword [46]'

There used to be documented a bug in the code that index ouf of bounds
can in theory fault (by daniel barrett).

Before assigning the pointer, first check for the index whether it's not
not -1. This was a suggested solution in the comment in the code.

The sanitizer is overcautious as this pointer wasn't dereferenced, but
fix is nonetheless.

Sponsored by <The NetBSD Foundation>
2018-06-12 13:24:28 +00:00
christos 77b64f0a5c PR/52516: Guy Incognito: Fix memory leak; setsymtab already calls tostring()
for the buffer, don't do it twice.
XXX: pullup-8
2017-09-01 07:01:06 +00:00
abhinav f703bc6a87 Use literal for formatting the examples
Based on OpenBSD awk(1) man page.

Ok wiz@
2017-05-23 14:11:08 +00:00
shm 52ccb86d6c PR/50199 - fix for strftime called with empty string.
Patch written by Juho Salminen
2015-11-03 14:15:08 +00:00
wiz 04c27f1642 Fix important typo, from Joachim Henke on netbsd-docs.
Bump date.
2015-04-06 14:36:41 +00:00
dholland f6f4f5e81c Change the argument names in the prototypes and discussion for
sub/gsub to match those in gensub. Noted by Kai-Uwe Eckhardt in
PR 48667.
2014-03-23 01:29:12 +00:00