diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | builtin.c | 12 | ||||
-rw-r--r-- | test/ChangeLog | 5 | ||||
-rw-r--r-- | test/strnum2.ok | 8 |
4 files changed, 21 insertions, 11 deletions
@@ -1,3 +1,10 @@ +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_print): Do not use OFMT to print strnum values. We + accomplish this by calling format_val for a NUMBER only + if there is no string currently available, or if stfmt equals + neither -1 nor OFMTidx. + 2016-06-26 Arnold D. Robbins <arnold@skeeve.com> * awk.h: Edit some comments. Add others. Minor coding style changes. @@ -2202,13 +2202,11 @@ do_print(int nargs, int redirtype) } if (tmp->type == Node_typedregex) - args_array[i] = force_string(tmp); - else if ((fixtype(tmp)->flags & (NUMBER|STRING)) == NUMBER) { - if (OFMTidx == CONVFMTidx) - args_array[i] = force_string(tmp); - else - args_array[i] = format_val(OFMT, OFMTidx, tmp); - } + args_array[i] = force_string(tmp); + else if ((fixtype(tmp)->flags & (NUMBER|STRING)) == NUMBER && + !((tmp->flags & STRCUR) != 0 + && (tmp->stfmt == -1 || tmp->stfmt == OFMTidx))) + args_array[i] = format_val(OFMT, OFMTidx, tmp); } if (redir_exp != NULL) { diff --git a/test/ChangeLog b/test/ChangeLog index f5dbd571..cca91c53 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2016-06-26 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * strnum2.ok: Fix results, since print for a strnum should not be + affected by OFMT or CONVFMT. + 2016-06-22 Andrew J. Schorr <aschorr@telemetry-investments.com> * strnum2.awk, strnum2.ok: Improve test case to show both OFMT and diff --git a/test/strnum2.ok b/test/strnum2.ok index 65cfbde2..63898bd4 100644 --- a/test/strnum2.ok +++ b/test/strnum2.ok @@ -1,4 +1,4 @@ -1.2 -1.23 -1.2 -1.23 + 1.234 + 1.234 + 1.234 + 1.234 |