diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2023-09-17 14:49:45 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2023-09-17 14:49:45 +0000 |
commit | c5246d2718cf85e86ceff0c93e17b160815813c4 (patch) | |
tree | 1010eb43cacfc5d7357890fc5a58a08c324ce8ae /usr.bin/awk/tran.c | |
parent | c749387d621c11d2c961dce4fefb26b736c15bca (diff) |
Update to the One True Awk, 2nd edition (Sep 12, 2023).
This corresponds to the 2nd edition of "The AWK Programming Language"
and adds support for UTF-8 and comma-separated value inputs.
Diffstat (limited to 'usr.bin/awk/tran.c')
-rw-r--r-- | usr.bin/awk/tran.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index 0e4802ecbf9..0456aed983f 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.36 2022/09/21 01:42:59 millert Exp $ */ +/* $OpenBSD: tran.c,v 1.37 2023/09/17 14:49:44 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -309,7 +309,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */ } else if (&vp->fval == NF) { donerec = false; /* mark $0 invalid */ setlastfld(f); - DPRINTF("setting NF to %g\n", f); + DPRINTF("setfval: setting NF to %g\n", f); } else if (isrec(vp)) { donefld = false; /* mark $1... invalid */ donerec = true; @@ -349,6 +349,10 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld); if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "assign to"); + if (CSV && (vp == rsloc)) + WARNING("danger: don't set RS when --csv is in effect"); + if (CSV && (vp == fsloc)) + WARNING("danger: don't set FS when --csv is in effect"); if (isfld(vp)) { donerec = false; /* mark $0 invalid */ fldno = atoi(vp->nval); @@ -376,7 +380,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ donerec = false; /* mark $0 invalid */ f = getfval(vp); setlastfld(f); - DPRINTF("setting NF to %g\n", f); + DPRINTF("setsval: setting NF to %g\n", f); } return(vp->sval); |