It is trivial to fix:
Index: lib.c
===================================================================
RCS file: /cvsroot/src/external/historical/nawk/dist/lib.c,v
retrieving revision 1.16
diff -u -p -u -r1.16 lib.c
--- lib.c 18 Aug 2024 16:51:05 -0000 1.16
+++ lib.c 16 Nov 2025 19:33:24 -0000
@@ -252,13 +252,7 @@ int readrec(char **pbuf, int *pbufsize,
isrec = found != 0 || *buf != '\0';
} else {
- if ((sep = *rs) == 0) {
- sep = '\n';
- while ((c=getc(inf)) == '\n' && c != EOF) /* skip leading \n's */
- ;
- if (c != EOF)
- ungetc(c, inf);
- }
+ sep = *rs;
for (rr = buf; ; ) {
for (; (c=getc(inf)) != sep && c != EOF; ) {
if (rr-buf+1 > bufsize)
@@ -267,7 +261,7 @@ int readrec(char **pbuf, int *pbufsize,
FATAL("input record `%.30s...' too long", buf);
*rr++ = c;
}
- if (*rs == sep || c == EOF)
+ if (c == EOF)
break;
if ((c = getc(inf)) == '\n' || c == EOF) /* 2 in a row */
break;
The question is why special-case it this way? gawk does not do this.
christos
Attachment:
signature.asc
Description: Message signed with OpenPGP