Make RS as regexp work without ifdef. Add doc, bump version.
This commit is contained in:
parent
643a5a3dad
commit
7cae39dfa5
10
ChangeLog
10
ChangeLog
@ -1,3 +1,11 @@
|
||||
2019-10-06 Arnold D. Robbins <arnold@skeeve.com>
|
||||
|
||||
* lib.c (readrec): Allow RS a regular expression. Imported
|
||||
the code from the NetBSD awk.
|
||||
* b.c (fnematch): New function for implementing the feature.
|
||||
* awk.1: Updated.
|
||||
* main.c (version): Updated.
|
||||
|
||||
2019-06-24 Arnold D. Robbins <arnold@skeeve.com>
|
||||
|
||||
* makefile: Revise to take into account there is no more awktest.tar,
|
||||
@ -18,7 +26,7 @@
|
||||
* b.c (relex): Count parentheses and treat umatched right paren
|
||||
as a literal character.
|
||||
* awktest.tar (testdir/T.re): Added a test case.
|
||||
* main.c (version): Upated.
|
||||
* main.c (version): Updated.
|
||||
|
||||
2019-05-29 Arnold D. Robbins <arnold@skeeve.com>
|
||||
|
||||
|
4
FIXES
4
FIXES
@ -25,6 +25,10 @@ THIS SOFTWARE.
|
||||
This file lists all bug fixes, changes, etc., made since the AWK book
|
||||
was sent to the printers in August, 1987.
|
||||
|
||||
October 6, 2019:
|
||||
Import code from NetBSD awk that implements RS as a regular
|
||||
expression.
|
||||
|
||||
September 10, 2019:
|
||||
Fixes for various array / memory overruns found via gcc's
|
||||
-fsanitize=unknown. Thanks to Alexander Richardson (Github
|
||||
|
5
awk.1
5
awk.1
@ -478,6 +478,11 @@ the length of a string matched by
|
||||
.TP
|
||||
.B RS
|
||||
input record separator (default newline).
|
||||
If empty, blank lines separate records.
|
||||
If more than one character long,
|
||||
.B RS
|
||||
is treated as a regular expression, and records are
|
||||
separated by text matching the expression.
|
||||
.TP
|
||||
.B RSTART
|
||||
the start position of a string matched by
|
||||
|
4
lib.c
4
lib.c
@ -209,7 +209,6 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf *
|
||||
int bufsize = *pbufsize;
|
||||
char *rs = getsval(rsloc);
|
||||
|
||||
#ifdef RS_AS_REGEXP
|
||||
if (*rs && rs[1]) {
|
||||
int found;
|
||||
|
||||
@ -218,7 +217,6 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf *
|
||||
if (found)
|
||||
*patbeg = 0;
|
||||
} else {
|
||||
#endif
|
||||
if ((sep = *rs) == 0) {
|
||||
sep = '\n';
|
||||
while ((c=getc(inf)) == '\n' && c != EOF) /* skip leading \n's */
|
||||
@ -247,9 +245,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf *
|
||||
if (!adjbuf(&buf, &bufsize, 1+rr-buf, recsize, &rr, "readrec 3"))
|
||||
FATAL("input record `%.30s...' too long", buf);
|
||||
*rr = 0;
|
||||
#ifdef RS_AS_REGEXP
|
||||
}
|
||||
#endif
|
||||
*pbuf = buf;
|
||||
*pbufsize = bufsize;
|
||||
isrec = *buf || !feof(inf);
|
||||
|
Loading…
Reference in New Issue
Block a user