[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, print-exp, updated. gawk-4.1.0-1007-g487

From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, print-exp, updated. gawk-4.1.0-1007-g48792ae
Date: Tue, 09 Dec 2014 21:22:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, print-exp has been updated
       via  48792aed6d511205bfdfff6ffc2849f6b5265514 (commit)
       via  f9219546740bc1e97cc3593d9c1de4f082f6c491 (commit)
       via  9b3ff12e83ccc37893556a7c4ba98d2e3cd0c581 (commit)
       via  882d4057221d8a9976003214776edd43d2fbf9c4 (commit)
      from  5d35746cc83255fb01e265b429f0941e4910ac3c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

commit 48792aed6d511205bfdfff6ffc2849f6b5265514
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Dec 9 23:22:01 2014 +0200

    Further progress on print returning value.

diff --git a/ChangeLog b/ChangeLog
index 0e9bf9d..550397a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-12-09         Arnold D. Robbins     <address@hidden>
+       * builtin.c (do_printf): Allow for error return from redirect, pass
+       in the can_fatal value.
+       (do_print_rec, do_print): Ditto.
+       * interpret.h (run_print_command): New function.
+       (r_interpret): Use it in the right places.
+       * io.c (redirect): Add boolean allow_fatal parameter. Use it.
+       * profile.c (pprint): Handle expression versions of print - stack
+       the results if needed.
 2014-12-08         Arnold D. Robbins     <address@hidden>
        * awk.h: Additional codes for the expression versions of print,
diff --git a/awk.h b/awk.h
index 1c01b81..f502fb2 100644
--- a/awk.h
+++ b/awk.h
@@ -1481,7 +1481,8 @@ extern void 
register_two_way_processor(awk_two_way_processor_t *processor);
 extern void set_FNR(void);
 extern void set_NR(void);
-extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg);
+extern struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg,
+               bool allow_fatal);
 extern NODE *do_close(int nargs);
 extern int flush_io(void);
 extern int close_io(bool *stdio_problem);
diff --git a/builtin.c b/builtin.c
index ee86f9e..f4f7d29 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1640,9 +1640,9 @@ do_printf(int nargs, int redirtype, bool can_fatal)
        FILE *fp = NULL;
        NODE *tmp;
        struct redirect *rp = NULL;
-       int errflg;     /* not used, sigh */
+       int errflg = 0;
        NODE *redir_exp = NULL;
-       ssize_t count;
+       ssize_t count = 0;
        if (nargs == 0) {
                if (do_traditional) {
@@ -1652,11 +1652,11 @@ do_printf(int nargs, int redirtype, bool can_fatal)
                                redir_exp = TOP();
                                if (redir_exp->type != Node_val)
                                        fatal(_("attempt to use array `%s' in a 
scalar context"), array_vname(redir_exp));
-                               rp = redirect(redir_exp, redirtype, & errflg);
+                               rp = redirect(redir_exp, redirtype, & errflg, 
-                       return make_number(0.0);        /* bwk accepts it 
silently */
+                       return make_number(errflg ? -1.0 : 0.0);
                fatal(_("printf: no arguments"));
@@ -1665,9 +1665,11 @@ do_printf(int nargs, int redirtype, bool can_fatal)
                redir_exp = PEEK(nargs);
                if (redir_exp->type != Node_val)
                        fatal(_("attempt to use array `%s' in a scalar 
context"), array_vname(redir_exp));
-               rp = redirect(redir_exp, redirtype, & errflg);
+               rp = redirect(redir_exp, redirtype, & errflg, can_fatal);
                if (rp != NULL)
                        fp = rp->output.fp;
+               else if (errflg)
+                       return make_number(-1.0);
        } else if (do_debug)    /* only the debugger can change the default 
output */
                fp = output_fp;
@@ -2082,7 +2084,7 @@ NODE *
 do_print(int nargs, int redirtype, bool can_fatal)
        struct redirect *rp = NULL;
-       int errflg;     /* not used, sigh */
+       int errflg = 0;
        FILE *fp = NULL;
        int i;
        NODE *redir_exp = NULL;
@@ -2095,9 +2097,11 @@ do_print(int nargs, int redirtype, bool can_fatal)
                redir_exp = PEEK(nargs);
                if (redir_exp->type != Node_val)
                        fatal(_("attempt to use array `%s' in a scalar 
context"), array_vname(redir_exp));
-               rp = redirect(redir_exp, redirtype, & errflg);
+               rp = redirect(redir_exp, redirtype, & errflg, can_fatal);
                if (rp != NULL)
                        fp = rp->output.fp;
+               else if (errflg)
+                       return make_number(-1.0);
        } else if (do_debug)    /* only the debugger can change the default 
output */
                fp = output_fp;
@@ -2156,16 +2160,18 @@ do_print_rec(int nargs, int redirtype, bool can_fatal)
        FILE *fp = NULL;
        NODE *f0;
        struct redirect *rp = NULL;
-       int errflg;     /* not used, sigh */
+       int errflg = 0;
        NODE *redir_exp = NULL;
        ssize_t count;
        assert(nargs == 0);
        if (redirtype != 0) {
                redir_exp = TOP();
-               rp = redirect(redir_exp, redirtype, & errflg);
+               rp = redirect(redir_exp, redirtype, & errflg, can_fatal);
                if (rp != NULL)
                        fp = rp->output.fp;
+               else if (errflg)
+                       return make_number(-1.0);
        } else
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 223771f..5563d14 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,6 +1,7 @@
 2014-12-09         Arnold D. Robbins     <address@hidden>
        * More minor fixes.
+       * Start to document print with return value.
 2014-12-07         Arnold D. Robbins     <address@hidden>
diff --git a/doc/ b/doc/
index a5d90f1..32cf0d0 100644
--- a/doc/
+++ b/doc/
@@ -6116,6 +6116,7 @@ function.
                                 `gawk' allows access to inherited file
 * Close Files And Pipes::       Closing Input and Output Files and Pipes.
+* Print Return Values::         Checking for output errors.
 * Output Summary::              Output summary.
 * Output Exercises::            Exercises.
@@ -7029,7 +7030,7 @@ that `gawk' provides:
-File:,  Node: Close Files And Pipes,  Next: Output Summary,  Prev: 
Special Files,  Up: Printing
+File:,  Node: Close Files And Pipes,  Next: Print Return Values,  
Prev: Special Files,  Up: Printing
 5.9 Closing Input and Output Redirections
@@ -7198,9 +7199,24 @@ call. See the system manual pages for information on how 
to decode this
-File:,  Node: Output Summary,  Next: Output Exercises,  Prev: Close 
Files And Pipes,  Up: Printing
+File:,  Node: Print Return Values,  Next: Output Summary,  Prev: 
Close Files And Pipes,  Up: Printing
-5.10 Summary
+5.10 Checking For Output Problems
+This minor node describes a `gawk'-specific feature.
+   In standard `awk', both `print' and `printf' are statements; they do
+not return a value.  I/O errors that occur from `print' and `printf'
+are fatal errors:
+     $ gawk 'BEGIN { print "hi" > "/no/such/file" }'
+     error--> gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No 
such file or directory)
+File:,  Node: Output Summary,  Next: Output Exercises,  Prev: Print 
Return Values,  Up: Printing
+5.11 Summary
    * The `print' statement prints comma-separated expressions. Each
@@ -7226,7 +7242,7 @@ File:,  Node: Output Summary,  Next: Output 
Exercises,  Prev: Close Fi
 File:,  Node: Output Exercises,  Prev: Output Summary,  Up: Printing
-5.11 Exercises
+5.12 Exercises
   1. Rewrite the program:
@@ -34565,446 +34581,447 @@ Node: Command-line directories265092
 Node: Input Summary265997
 Node: Input Exercises269298
 Node: Printing270026
-Node: Print271803
-Node: Print Examples273260
-Node: Output Separators276039
-Node: OFMT278057
-Node: Printf279411
-Node: Basic Printf280196
-Node: Control Letters281766
-Node: Format Modifiers285749
-Node: Printf Examples291750
-Node: Redirection294236
-Node: Special FD301077
-Ref: Special FD-Footnote-1304237
-Node: Special Files304311
-Node: Other Inherited Files304928
-Node: Special Network305928
-Node: Special Caveats306790
-Node: Close Files And Pipes307741
-Ref: Close Files And Pipes-Footnote-1314923
-Ref: Close Files And Pipes-Footnote-2315071
-Node: Output Summary315221
-Node: Output Exercises316219
-Node: Expressions316899
-Node: Values318084
-Node: Constants318762
-Node: Scalar Constants319453
-Ref: Scalar Constants-Footnote-1320312
-Node: Nondecimal-numbers320562
-Node: Regexp Constants323580
-Node: Using Constant Regexps324105
-Node: Variables327248
-Node: Using Variables327903
-Node: Assignment Options329814
-Node: Conversion331689
-Node: Strings And Numbers332213
-Ref: Strings And Numbers-Footnote-1335278
-Node: Locale influences conversions335387
-Ref: table-locale-affects338134
-Node: All Operators338722
-Node: Arithmetic Ops339352
-Node: Concatenation341857
-Ref: Concatenation-Footnote-1344676
-Node: Assignment Ops344782
-Ref: table-assign-ops349761
-Node: Increment Ops351033
-Node: Truth Values and Conditions354471
-Node: Truth Values355556
-Node: Typing and Comparison356605
-Node: Variable Typing357415
-Node: Comparison Operators361068
-Ref: table-relational-ops361478
-Node: POSIX String Comparison364973
-Ref: POSIX String Comparison-Footnote-1366045
-Node: Boolean Ops366183
-Ref: Boolean Ops-Footnote-1370662
-Node: Conditional Exp370753
-Node: Function Calls372480
-Node: Precedence376360
-Node: Locales380021
-Node: Expressions Summary381653
-Node: Patterns and Actions384213
-Node: Pattern Overview385333
-Node: Regexp Patterns387012
-Node: Expression Patterns387555
-Node: Ranges391265
-Node: BEGIN/END394371
-Node: Using BEGIN/END395132
-Ref: Using BEGIN/END-Footnote-1397866
-Node: I/O And BEGIN/END397972
-Node: Empty403187
-Node: Using Shell Variables403504
-Node: Action Overview405777
-Node: Statements408103
-Node: If Statement409951
-Node: While Statement411446
-Node: Do Statement413475
-Node: For Statement414619
-Node: Switch Statement417776
-Node: Break Statement420158
-Node: Continue Statement422199
-Node: Next Statement424026
-Node: Nextfile Statement426407
-Node: Exit Statement429037
-Node: Built-in Variables431440
-Node: User-modified432573
-Ref: User-modified-Footnote-1440254
-Node: Auto-set440316
-Ref: Auto-set-Footnote-1454008
-Ref: Auto-set-Footnote-2454213
-Node: ARGC and ARGV454269
-Node: Pattern Action Summary458487
-Node: Arrays460914
-Node: Array Basics462243
-Node: Array Intro463087
-Ref: figure-array-elements465051
-Ref: Array Intro-Footnote-1467577
-Node: Reference to Elements467705
-Node: Assigning Elements470157
-Node: Array Example470648
-Node: Scanning an Array472406
-Node: Controlling Scanning475422
-Ref: Controlling Scanning-Footnote-1480618
-Node: Numeric Array Subscripts480934
-Node: Uninitialized Subscripts483119
-Node: Delete484736
-Ref: Delete-Footnote-1487479
-Node: Multidimensional487536
-Node: Multiscanning490633
-Node: Arrays of Arrays492222
-Node: Arrays Summary496981
-Node: Functions499073
-Node: Built-in499972
-Node: Calling Built-in501050
-Node: Numeric Functions503041
-Ref: Numeric Functions-Footnote-1507860
-Ref: Numeric Functions-Footnote-2508217
-Ref: Numeric Functions-Footnote-3508265
-Node: String Functions508537
-Ref: String Functions-Footnote-1532012
-Ref: String Functions-Footnote-2532141
-Ref: String Functions-Footnote-3532389
-Node: Gory Details532476
-Ref: table-sub-escapes534257
-Ref: table-sub-proposed535777
-Ref: table-posix-sub537141
-Ref: table-gensub-escapes538677
-Ref: Gory Details-Footnote-1539509
-Node: I/O Functions539660
-Ref: I/O Functions-Footnote-1546878
-Node: Time Functions547025
-Ref: Time Functions-Footnote-1557513
-Ref: Time Functions-Footnote-2557581
-Ref: Time Functions-Footnote-3557739
-Ref: Time Functions-Footnote-4557850
-Ref: Time Functions-Footnote-5557962
-Ref: Time Functions-Footnote-6558189
-Node: Bitwise Functions558455
-Ref: table-bitwise-ops559017
-Ref: Bitwise Functions-Footnote-1563326
-Node: Type Functions563495
-Node: I18N Functions564646
-Node: User-defined566291
-Node: Definition Syntax567096
-Ref: Definition Syntax-Footnote-1572503
-Node: Function Example572574
-Ref: Function Example-Footnote-1575493
-Node: Function Caveats575515
-Node: Calling A Function576033
-Node: Variable Scope576991
-Node: Pass By Value/Reference579979
-Node: Return Statement583474
-Node: Dynamic Typing586455
-Node: Indirect Calls587384
-Ref: Indirect Calls-Footnote-1598686
-Node: Functions Summary598814
-Node: Library Functions601516
-Ref: Library Functions-Footnote-1605125
-Ref: Library Functions-Footnote-2605268
-Node: Library Names605439
-Ref: Library Names-Footnote-1608893
-Ref: Library Names-Footnote-2609116
-Node: General Functions609202
-Node: Strtonum Function610305
-Node: Assert Function613327
-Node: Round Function616651
-Node: Cliff Random Function618192
-Node: Ordinal Functions619208
-Ref: Ordinal Functions-Footnote-1622271
-Ref: Ordinal Functions-Footnote-2622523
-Node: Join Function622734
-Ref: Join Function-Footnote-1624503
-Node: Getlocaltime Function624703
-Node: Readfile Function628447
-Node: Shell Quoting630417
-Node: Data File Management631818
-Node: Filetrans Function632450
-Node: Rewind Function636506
-Node: File Checking637893
-Ref: File Checking-Footnote-1639225
-Node: Empty Files639426
-Node: Ignoring Assigns641405
-Node: Getopt Function642956
-Ref: Getopt Function-Footnote-1654418
-Node: Passwd Functions654618
-Ref: Passwd Functions-Footnote-1663455
-Node: Group Functions663543
-Ref: Group Functions-Footnote-1671437
-Node: Walking Arrays671650
-Node: Library Functions Summary673253
-Node: Library Exercises674654
-Node: Sample Programs675934
-Node: Running Examples676704
-Node: Clones677432
-Node: Cut Program678656
-Node: Egrep Program688375
-Ref: Egrep Program-Footnote-1695873
-Node: Id Program695983
-Node: Split Program699628
-Ref: Split Program-Footnote-1703076
-Node: Tee Program703204
-Node: Uniq Program705993
-Node: Wc Program713412
-Ref: Wc Program-Footnote-1717662
-Node: Miscellaneous Programs717756
-Node: Dupword Program718969
-Node: Alarm Program721000
-Node: Translate Program725804
-Ref: Translate Program-Footnote-1730369
-Node: Labels Program730639
-Ref: Labels Program-Footnote-1733990
-Node: Word Sorting734074
-Node: History Sorting738145
-Node: Extract Program739981
-Node: Simple Sed747506
-Node: Igawk Program750574
-Ref: Igawk Program-Footnote-1764898
-Ref: Igawk Program-Footnote-2765099
-Ref: Igawk Program-Footnote-3765221
-Node: Anagram Program765336
-Node: Signature Program768393
-Node: Programs Summary769640
-Node: Programs Exercises770833
-Ref: Programs Exercises-Footnote-1774964
-Node: Advanced Features775055
-Node: Nondecimal Data777003
-Node: Array Sorting778593
-Node: Controlling Array Traversal779290
-Ref: Controlling Array Traversal-Footnote-1787623
-Node: Array Sorting Functions787741
-Ref: Array Sorting Functions-Footnote-1791630
-Node: Two-way I/O791826
-Ref: Two-way I/O-Footnote-1796771
-Ref: Two-way I/O-Footnote-2796957
-Node: TCP/IP Networking797039
-Node: Profiling799912
-Node: Advanced Features Summary808189
-Node: Internationalization810122
-Node: I18N and L10N811602
-Node: Explaining gettext812288
-Ref: Explaining gettext-Footnote-1817313
-Ref: Explaining gettext-Footnote-2817497
-Node: Programmer i18n817662
-Ref: Programmer i18n-Footnote-1822528
-Node: Translator i18n822577
-Node: String Extraction823371
-Ref: String Extraction-Footnote-1824502
-Node: Printf Ordering824588
-Ref: Printf Ordering-Footnote-1827374
-Node: I18N Portability827438
-Ref: I18N Portability-Footnote-1829893
-Node: I18N Example829956
-Ref: I18N Example-Footnote-1832759
-Node: Gawk I18N832831
-Node: I18N Summary833469
-Node: Debugger834808
-Node: Debugging835830
-Node: Debugging Concepts836271
-Node: Debugging Terms838124
-Node: Awk Debugging840696
-Node: Sample Debugging Session841590
-Node: Debugger Invocation842110
-Node: Finding The Bug843494
-Node: List of Debugger Commands849969
-Node: Breakpoint Control851302
-Node: Debugger Execution Control854998
-Node: Viewing And Changing Data858362
-Node: Execution Stack861740
-Node: Debugger Info863377
-Node: Miscellaneous Debugger Commands867394
-Node: Readline Support872423
-Node: Limitations873315
-Node: Debugging Summary875429
-Node: Arbitrary Precision Arithmetic876597
-Node: Computer Arithmetic878013
-Ref: table-numeric-ranges881611
-Ref: Computer Arithmetic-Footnote-1882470
-Node: Math Definitions882527
-Ref: table-ieee-formats885815
-Ref: Math Definitions-Footnote-1886419
-Node: MPFR features886524
-Node: FP Math Caution888195
-Ref: FP Math Caution-Footnote-1889245
-Node: Inexactness of computations889614
-Node: Inexact representation890573
-Node: Comparing FP Values891930
-Node: Errors accumulate893012
-Node: Getting Accuracy894445
-Node: Try To Round897107
-Node: Setting precision898006
-Ref: table-predefined-precision-strings898690
-Node: Setting the rounding mode900479
-Ref: table-gawk-rounding-modes900843
-Ref: Setting the rounding mode-Footnote-1904298
-Node: Arbitrary Precision Integers904477
-Ref: Arbitrary Precision Integers-Footnote-1909376
-Node: POSIX Floating Point Problems909525
-Ref: POSIX Floating Point Problems-Footnote-1913398
-Node: Floating point summary913436
-Node: Dynamic Extensions915630
-Node: Extension Intro917182
-Node: Plugin License918448
-Node: Extension Mechanism Outline919245
-Ref: figure-load-extension919673
-Ref: figure-register-new-function921153
-Ref: figure-call-new-function922157
-Node: Extension API Description924143
-Node: Extension API Functions Introduction925593
-Node: General Data Types930417
-Ref: General Data Types-Footnote-1936156
-Node: Memory Allocation Functions936455
-Ref: Memory Allocation Functions-Footnote-1939294
-Node: Constructor Functions939390
-Node: Registration Functions941124
-Node: Extension Functions941809
-Node: Exit Callback Functions944106
-Node: Extension Version String945354
-Node: Input Parsers946019
-Node: Output Wrappers955896
-Node: Two-way processors960411
-Node: Printing Messages962615
-Ref: Printing Messages-Footnote-1963691
-Node: Updating `ERRNO'963843
-Node: Requesting Values964583
-Ref: table-value-types-returned965311
-Node: Accessing Parameters966268
-Node: Symbol Table Access967499
-Node: Symbol table by name968013
-Node: Symbol table by cookie969994
-Ref: Symbol table by cookie-Footnote-1974138
-Node: Cached values974201
-Ref: Cached values-Footnote-1977700
-Node: Array Manipulation977791
-Ref: Array Manipulation-Footnote-1978889
-Node: Array Data Types978926
-Ref: Array Data Types-Footnote-1981581
-Node: Array Functions981673
-Node: Flattening Arrays985527
-Node: Creating Arrays992419
-Node: Extension API Variables997188
-Node: Extension Versioning997824
-Node: Extension API Informational Variables999725
-Node: Extension API Boilerplate1000813
-Node: Finding Extensions1004622
-Node: Extension Example1005182
-Node: Internal File Description1005954
-Node: Internal File Ops1010021
-Ref: Internal File Ops-Footnote-11021691
-Node: Using Internal File Ops1021831
-Ref: Using Internal File Ops-Footnote-11024214
-Node: Extension Samples1024487
-Node: Extension Sample File Functions1026013
-Node: Extension Sample Fnmatch1033651
-Node: Extension Sample Fork1035142
-Node: Extension Sample Inplace1036357
-Node: Extension Sample Ord1038032
-Node: Extension Sample Readdir1038868
-Ref: table-readdir-file-types1039744
-Node: Extension Sample Revout1040555
-Node: Extension Sample Rev2way1041145
-Node: Extension Sample Read write array1041885
-Node: Extension Sample Readfile1043825
-Node: Extension Sample Time1044920
-Node: Extension Sample API Tests1046269
-Node: gawkextlib1046760
-Node: Extension summary1049418
-Node: Extension Exercises1053095
-Node: Language History1053817
-Node: V7/SVR3.11055473
-Node: SVR41057654
-Node: POSIX1059099
-Node: BTL1060488
-Node: POSIX/GNU1061222
-Node: Feature History1066846
-Node: Common Extensions1079944
-Node: Ranges and Locales1081268
-Ref: Ranges and Locales-Footnote-11085886
-Ref: Ranges and Locales-Footnote-21085913
-Ref: Ranges and Locales-Footnote-31086147
-Node: Contributors1086368
-Node: History summary1091909
-Node: Installation1093279
-Node: Gawk Distribution1094225
-Node: Getting1094709
-Node: Extracting1095532
-Node: Distribution contents1097167
-Node: Unix Installation1103232
-Node: Quick Installation1103915
-Node: Shell Startup Files1106326
-Node: Additional Configuration Options1107405
-Node: Configuration Philosophy1109144
-Node: Non-Unix Installation1111513
-Node: PC Installation1111971
-Node: PC Binary Installation1113290
-Node: PC Compiling1115138
-Ref: PC Compiling-Footnote-11118159
-Node: PC Testing1118268
-Node: PC Using1119444
-Node: Cygwin1123559
-Node: MSYS1124382
-Node: VMS Installation1124882
-Node: VMS Compilation1125674
-Ref: VMS Compilation-Footnote-11126896
-Node: VMS Dynamic Extensions1126954
-Node: VMS Installation Details1128638
-Node: VMS Running1130890
-Node: VMS GNV1133726
-Node: VMS Old Gawk1134460
-Node: Bugs1134930
-Node: Other Versions1138813
-Node: Installation summary1145235
-Node: Notes1146291
-Node: Compatibility Mode1147156
-Node: Additions1147938
-Node: Accessing The Source1148863
-Node: Adding Code1150299
-Node: New Ports1156464
-Node: Derived Files1160946
-Ref: Derived Files-Footnote-11166421
-Ref: Derived Files-Footnote-21166455
-Ref: Derived Files-Footnote-31167051
-Node: Future Extensions1167165
-Node: Implementation Limitations1167771
-Node: Extension Design1169019
-Node: Old Extension Problems1170173
-Ref: Old Extension Problems-Footnote-11171690
-Node: Extension New Mechanism Goals1171747
-Ref: Extension New Mechanism Goals-Footnote-11175107
-Node: Extension Other Design Decisions1175296
-Node: Extension Future Growth1177404
-Node: Old Extension Mechanism1178240
-Node: Notes summary1180002
-Node: Basic Concepts1181188
-Node: Basic High Level1181869
-Ref: figure-general-flow1182141
-Ref: figure-process-flow1182740
-Ref: Basic High Level-Footnote-11185969
-Node: Basic Data Typing1186154
-Node: Glossary1189482
-Node: Copying1214640
-Node: GNU Free Documentation License1252196
-Node: Index1277332
+Node: Print271863
+Node: Print Examples273320
+Node: Output Separators276099
+Node: OFMT278117
+Node: Printf279471
+Node: Basic Printf280256
+Node: Control Letters281826
+Node: Format Modifiers285809
+Node: Printf Examples291810
+Node: Redirection294296
+Node: Special FD301137
+Ref: Special FD-Footnote-1304297
+Node: Special Files304371
+Node: Other Inherited Files304988
+Node: Special Network305988
+Node: Special Caveats306850
+Node: Close Files And Pipes307801
+Ref: Close Files And Pipes-Footnote-1314988
+Ref: Close Files And Pipes-Footnote-2315136
+Node: Print Return Values315286
+Node: Output Summary315840
+Node: Output Exercises316836
+Node: Expressions317516
+Node: Values318701
+Node: Constants319379
+Node: Scalar Constants320070
+Ref: Scalar Constants-Footnote-1320929
+Node: Nondecimal-numbers321179
+Node: Regexp Constants324197
+Node: Using Constant Regexps324722
+Node: Variables327865
+Node: Using Variables328520
+Node: Assignment Options330431
+Node: Conversion332306
+Node: Strings And Numbers332830
+Ref: Strings And Numbers-Footnote-1335895
+Node: Locale influences conversions336004
+Ref: table-locale-affects338751
+Node: All Operators339339
+Node: Arithmetic Ops339969
+Node: Concatenation342474
+Ref: Concatenation-Footnote-1345293
+Node: Assignment Ops345399
+Ref: table-assign-ops350378
+Node: Increment Ops351650
+Node: Truth Values and Conditions355088
+Node: Truth Values356173
+Node: Typing and Comparison357222
+Node: Variable Typing358032
+Node: Comparison Operators361685
+Ref: table-relational-ops362095
+Node: POSIX String Comparison365590
+Ref: POSIX String Comparison-Footnote-1366662
+Node: Boolean Ops366800
+Ref: Boolean Ops-Footnote-1371279
+Node: Conditional Exp371370
+Node: Function Calls373097
+Node: Precedence376977
+Node: Locales380638
+Node: Expressions Summary382270
+Node: Patterns and Actions384830
+Node: Pattern Overview385950
+Node: Regexp Patterns387629
+Node: Expression Patterns388172
+Node: Ranges391882
+Node: BEGIN/END394988
+Node: Using BEGIN/END395749
+Ref: Using BEGIN/END-Footnote-1398483
+Node: I/O And BEGIN/END398589
+Node: Empty403804
+Node: Using Shell Variables404121
+Node: Action Overview406394
+Node: Statements408720
+Node: If Statement410568
+Node: While Statement412063
+Node: Do Statement414092
+Node: For Statement415236
+Node: Switch Statement418393
+Node: Break Statement420775
+Node: Continue Statement422816
+Node: Next Statement424643
+Node: Nextfile Statement427024
+Node: Exit Statement429654
+Node: Built-in Variables432057
+Node: User-modified433190
+Ref: User-modified-Footnote-1440871
+Node: Auto-set440933
+Ref: Auto-set-Footnote-1454625
+Ref: Auto-set-Footnote-2454830
+Node: ARGC and ARGV454886
+Node: Pattern Action Summary459104
+Node: Arrays461531
+Node: Array Basics462860
+Node: Array Intro463704
+Ref: figure-array-elements465668
+Ref: Array Intro-Footnote-1468194
+Node: Reference to Elements468322
+Node: Assigning Elements470774
+Node: Array Example471265
+Node: Scanning an Array473023
+Node: Controlling Scanning476039
+Ref: Controlling Scanning-Footnote-1481235
+Node: Numeric Array Subscripts481551
+Node: Uninitialized Subscripts483736
+Node: Delete485353
+Ref: Delete-Footnote-1488096
+Node: Multidimensional488153
+Node: Multiscanning491250
+Node: Arrays of Arrays492839
+Node: Arrays Summary497598
+Node: Functions499690
+Node: Built-in500589
+Node: Calling Built-in501667
+Node: Numeric Functions503658
+Ref: Numeric Functions-Footnote-1508477
+Ref: Numeric Functions-Footnote-2508834
+Ref: Numeric Functions-Footnote-3508882
+Node: String Functions509154
+Ref: String Functions-Footnote-1532629
+Ref: String Functions-Footnote-2532758
+Ref: String Functions-Footnote-3533006
+Node: Gory Details533093
+Ref: table-sub-escapes534874
+Ref: table-sub-proposed536394
+Ref: table-posix-sub537758
+Ref: table-gensub-escapes539294
+Ref: Gory Details-Footnote-1540126
+Node: I/O Functions540277
+Ref: I/O Functions-Footnote-1547495
+Node: Time Functions547642
+Ref: Time Functions-Footnote-1558130
+Ref: Time Functions-Footnote-2558198
+Ref: Time Functions-Footnote-3558356
+Ref: Time Functions-Footnote-4558467
+Ref: Time Functions-Footnote-5558579
+Ref: Time Functions-Footnote-6558806
+Node: Bitwise Functions559072
+Ref: table-bitwise-ops559634
+Ref: Bitwise Functions-Footnote-1563943
+Node: Type Functions564112
+Node: I18N Functions565263
+Node: User-defined566908
+Node: Definition Syntax567713
+Ref: Definition Syntax-Footnote-1573120
+Node: Function Example573191
+Ref: Function Example-Footnote-1576110
+Node: Function Caveats576132
+Node: Calling A Function576650
+Node: Variable Scope577608
+Node: Pass By Value/Reference580596
+Node: Return Statement584091
+Node: Dynamic Typing587072
+Node: Indirect Calls588001
+Ref: Indirect Calls-Footnote-1599303
+Node: Functions Summary599431
+Node: Library Functions602133
+Ref: Library Functions-Footnote-1605742
+Ref: Library Functions-Footnote-2605885
+Node: Library Names606056
+Ref: Library Names-Footnote-1609510
+Ref: Library Names-Footnote-2609733
+Node: General Functions609819
+Node: Strtonum Function610922
+Node: Assert Function613944
+Node: Round Function617268
+Node: Cliff Random Function618809
+Node: Ordinal Functions619825
+Ref: Ordinal Functions-Footnote-1622888
+Ref: Ordinal Functions-Footnote-2623140
+Node: Join Function623351
+Ref: Join Function-Footnote-1625120
+Node: Getlocaltime Function625320
+Node: Readfile Function629064
+Node: Shell Quoting631034
+Node: Data File Management632435
+Node: Filetrans Function633067
+Node: Rewind Function637123
+Node: File Checking638510
+Ref: File Checking-Footnote-1639842
+Node: Empty Files640043
+Node: Ignoring Assigns642022
+Node: Getopt Function643573
+Ref: Getopt Function-Footnote-1655035
+Node: Passwd Functions655235
+Ref: Passwd Functions-Footnote-1664072
+Node: Group Functions664160
+Ref: Group Functions-Footnote-1672054
+Node: Walking Arrays672267
+Node: Library Functions Summary673870
+Node: Library Exercises675271
+Node: Sample Programs676551
+Node: Running Examples677321
+Node: Clones678049
+Node: Cut Program679273
+Node: Egrep Program688992
+Ref: Egrep Program-Footnote-1696490
+Node: Id Program696600
+Node: Split Program700245
+Ref: Split Program-Footnote-1703693
+Node: Tee Program703821
+Node: Uniq Program706610
+Node: Wc Program714029
+Ref: Wc Program-Footnote-1718279
+Node: Miscellaneous Programs718373
+Node: Dupword Program719586
+Node: Alarm Program721617
+Node: Translate Program726421
+Ref: Translate Program-Footnote-1730986
+Node: Labels Program731256
+Ref: Labels Program-Footnote-1734607
+Node: Word Sorting734691
+Node: History Sorting738762
+Node: Extract Program740598
+Node: Simple Sed748123
+Node: Igawk Program751191
+Ref: Igawk Program-Footnote-1765515
+Ref: Igawk Program-Footnote-2765716
+Ref: Igawk Program-Footnote-3765838
+Node: Anagram Program765953
+Node: Signature Program769010
+Node: Programs Summary770257
+Node: Programs Exercises771450
+Ref: Programs Exercises-Footnote-1775581
+Node: Advanced Features775672
+Node: Nondecimal Data777620
+Node: Array Sorting779210
+Node: Controlling Array Traversal779907
+Ref: Controlling Array Traversal-Footnote-1788240
+Node: Array Sorting Functions788358
+Ref: Array Sorting Functions-Footnote-1792247
+Node: Two-way I/O792443
+Ref: Two-way I/O-Footnote-1797388
+Ref: Two-way I/O-Footnote-2797574
+Node: TCP/IP Networking797656
+Node: Profiling800529
+Node: Advanced Features Summary808806
+Node: Internationalization810739
+Node: I18N and L10N812219
+Node: Explaining gettext812905
+Ref: Explaining gettext-Footnote-1817930
+Ref: Explaining gettext-Footnote-2818114
+Node: Programmer i18n818279
+Ref: Programmer i18n-Footnote-1823145
+Node: Translator i18n823194
+Node: String Extraction823988
+Ref: String Extraction-Footnote-1825119
+Node: Printf Ordering825205
+Ref: Printf Ordering-Footnote-1827991
+Node: I18N Portability828055
+Ref: I18N Portability-Footnote-1830510
+Node: I18N Example830573
+Ref: I18N Example-Footnote-1833376
+Node: Gawk I18N833448
+Node: I18N Summary834086
+Node: Debugger835425
+Node: Debugging836447
+Node: Debugging Concepts836888
+Node: Debugging Terms838741
+Node: Awk Debugging841313
+Node: Sample Debugging Session842207
+Node: Debugger Invocation842727
+Node: Finding The Bug844111
+Node: List of Debugger Commands850586
+Node: Breakpoint Control851919
+Node: Debugger Execution Control855615
+Node: Viewing And Changing Data858979
+Node: Execution Stack862357
+Node: Debugger Info863994
+Node: Miscellaneous Debugger Commands868011
+Node: Readline Support873040
+Node: Limitations873932
+Node: Debugging Summary876046
+Node: Arbitrary Precision Arithmetic877214
+Node: Computer Arithmetic878630
+Ref: table-numeric-ranges882228
+Ref: Computer Arithmetic-Footnote-1883087
+Node: Math Definitions883144
+Ref: table-ieee-formats886432
+Ref: Math Definitions-Footnote-1887036
+Node: MPFR features887141
+Node: FP Math Caution888812
+Ref: FP Math Caution-Footnote-1889862
+Node: Inexactness of computations890231
+Node: Inexact representation891190
+Node: Comparing FP Values892547
+Node: Errors accumulate893629
+Node: Getting Accuracy895062
+Node: Try To Round897724
+Node: Setting precision898623
+Ref: table-predefined-precision-strings899307
+Node: Setting the rounding mode901096
+Ref: table-gawk-rounding-modes901460
+Ref: Setting the rounding mode-Footnote-1904915
+Node: Arbitrary Precision Integers905094
+Ref: Arbitrary Precision Integers-Footnote-1909993
+Node: POSIX Floating Point Problems910142
+Ref: POSIX Floating Point Problems-Footnote-1914015
+Node: Floating point summary914053
+Node: Dynamic Extensions916247
+Node: Extension Intro917799
+Node: Plugin License919065
+Node: Extension Mechanism Outline919862
+Ref: figure-load-extension920290
+Ref: figure-register-new-function921770
+Ref: figure-call-new-function922774
+Node: Extension API Description924760
+Node: Extension API Functions Introduction926210
+Node: General Data Types931034
+Ref: General Data Types-Footnote-1936773
+Node: Memory Allocation Functions937072
+Ref: Memory Allocation Functions-Footnote-1939911
+Node: Constructor Functions940007
+Node: Registration Functions941741
+Node: Extension Functions942426
+Node: Exit Callback Functions944723
+Node: Extension Version String945971
+Node: Input Parsers946636
+Node: Output Wrappers956513
+Node: Two-way processors961028
+Node: Printing Messages963232
+Ref: Printing Messages-Footnote-1964308
+Node: Updating `ERRNO'964460
+Node: Requesting Values965200
+Ref: table-value-types-returned965928
+Node: Accessing Parameters966885
+Node: Symbol Table Access968116
+Node: Symbol table by name968630
+Node: Symbol table by cookie970611
+Ref: Symbol table by cookie-Footnote-1974755
+Node: Cached values974818
+Ref: Cached values-Footnote-1978317
+Node: Array Manipulation978408
+Ref: Array Manipulation-Footnote-1979506
+Node: Array Data Types979543
+Ref: Array Data Types-Footnote-1982198
+Node: Array Functions982290
+Node: Flattening Arrays986144
+Node: Creating Arrays993036
+Node: Extension API Variables997805
+Node: Extension Versioning998441
+Node: Extension API Informational Variables1000342
+Node: Extension API Boilerplate1001430
+Node: Finding Extensions1005239
+Node: Extension Example1005799
+Node: Internal File Description1006571
+Node: Internal File Ops1010638
+Ref: Internal File Ops-Footnote-11022308
+Node: Using Internal File Ops1022448
+Ref: Using Internal File Ops-Footnote-11024831
+Node: Extension Samples1025104
+Node: Extension Sample File Functions1026630
+Node: Extension Sample Fnmatch1034268
+Node: Extension Sample Fork1035759
+Node: Extension Sample Inplace1036974
+Node: Extension Sample Ord1038649
+Node: Extension Sample Readdir1039485
+Ref: table-readdir-file-types1040361
+Node: Extension Sample Revout1041172
+Node: Extension Sample Rev2way1041762
+Node: Extension Sample Read write array1042502
+Node: Extension Sample Readfile1044442
+Node: Extension Sample Time1045537
+Node: Extension Sample API Tests1046886
+Node: gawkextlib1047377
+Node: Extension summary1050035
+Node: Extension Exercises1053712
+Node: Language History1054434
+Node: V7/SVR3.11056090
+Node: SVR41058271
+Node: POSIX1059716
+Node: BTL1061105
+Node: POSIX/GNU1061839
+Node: Feature History1067463
+Node: Common Extensions1080561
+Node: Ranges and Locales1081885
+Ref: Ranges and Locales-Footnote-11086503
+Ref: Ranges and Locales-Footnote-21086530
+Ref: Ranges and Locales-Footnote-31086764
+Node: Contributors1086985
+Node: History summary1092526
+Node: Installation1093896
+Node: Gawk Distribution1094842
+Node: Getting1095326
+Node: Extracting1096149
+Node: Distribution contents1097784
+Node: Unix Installation1103849
+Node: Quick Installation1104532
+Node: Shell Startup Files1106943
+Node: Additional Configuration Options1108022
+Node: Configuration Philosophy1109761
+Node: Non-Unix Installation1112130
+Node: PC Installation1112588
+Node: PC Binary Installation1113907
+Node: PC Compiling1115755
+Ref: PC Compiling-Footnote-11118776
+Node: PC Testing1118885
+Node: PC Using1120061
+Node: Cygwin1124176
+Node: MSYS1124999
+Node: VMS Installation1125499
+Node: VMS Compilation1126291
+Ref: VMS Compilation-Footnote-11127513
+Node: VMS Dynamic Extensions1127571
+Node: VMS Installation Details1129255
+Node: VMS Running1131507
+Node: VMS GNV1134343
+Node: VMS Old Gawk1135077
+Node: Bugs1135547
+Node: Other Versions1139430
+Node: Installation summary1145852
+Node: Notes1146908
+Node: Compatibility Mode1147773
+Node: Additions1148555
+Node: Accessing The Source1149480
+Node: Adding Code1150916
+Node: New Ports1157081
+Node: Derived Files1161563
+Ref: Derived Files-Footnote-11167038
+Ref: Derived Files-Footnote-21167072
+Ref: Derived Files-Footnote-31167668
+Node: Future Extensions1167782
+Node: Implementation Limitations1168388
+Node: Extension Design1169636
+Node: Old Extension Problems1170790
+Ref: Old Extension Problems-Footnote-11172307
+Node: Extension New Mechanism Goals1172364
+Ref: Extension New Mechanism Goals-Footnote-11175724
+Node: Extension Other Design Decisions1175913
+Node: Extension Future Growth1178021
+Node: Old Extension Mechanism1178857
+Node: Notes summary1180619
+Node: Basic Concepts1181805
+Node: Basic High Level1182486
+Ref: figure-general-flow1182758
+Ref: figure-process-flow1183357
+Ref: Basic High Level-Footnote-11186586
+Node: Basic Data Typing1186771
+Node: Glossary1190099
+Node: Copying1215257
+Node: GNU Free Documentation License1252813
+Node: Index1277949
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 6dea8aa..f59154b 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -8964,6 +8964,7 @@ and discusses the @code{close()} built-in function.
                                 @command{gawk} allows access to inherited file
 * Close Files And Pipes::       Closing Input and Output Files and Pipes.
+* Print Return Values::         Checking for output errors.
 * Output Summary::              Output summary.
 * Output Exercises::            Exercises.
 @end menu
@@ -10481,6 +10482,20 @@ when closing a pipe.
address@hidden Print Return Values
address@hidden Checking For Output Problems
+This @value{SECTION} describes a @command{gawk}-specific feature.
+In standard @command{awk}, both @code{print} and @code{printf}
+are statements; they do not return a value.  I/O errors that occur
+from @code{print} and @code{printf} are fatal errors:
+$ @kbd{gawk 'BEGIN @{ print "hi" > "/no/such/file" @}'}
address@hidden gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No 
such file or directory)
address@hidden example
 @node Output Summary
 @section Summary
diff --git a/doc/ b/doc/
index 8fcb97d..1d9dd74 100644
--- a/doc/
+++ b/doc/
@@ -8565,6 +8565,7 @@ and discusses the @code{close()} built-in function.
                                 @command{gawk} allows access to inherited file
 * Close Files And Pipes::       Closing Input and Output Files and Pipes.
+* Print Return Values::         Checking for output errors.
 * Output Summary::              Output summary.
 * Output Exercises::            Exercises.
 @end menu
@@ -9978,6 +9979,20 @@ when closing a pipe.
address@hidden Print Return Values
address@hidden Checking For Output Problems
+This @value{SECTION} describes a @command{gawk}-specific feature.
+In standard @command{awk}, both @code{print} and @code{printf}
+are statements; they do not return a value.  I/O errors that occur
+from @code{print} and @code{printf} are fatal errors:
+$ @kbd{gawk 'BEGIN @{ print "hi" > "/no/such/file" @}'}
address@hidden gawk: cmd. line:1: fatal: can't redirect to `/no/such/file' (No 
such file or directory)
address@hidden example
 @node Output Summary
 @section Summary
diff --git a/interpret.h b/interpret.h
index 6ef254e..c6b0700 100644
--- a/interpret.h
+++ b/interpret.h
@@ -36,6 +36,38 @@
                DEREF(r); \
        } \
+/* guard this; the header is included twice */
+static void
+run_print_command(OPCODE op, int nargs, int redirtype,
+       NODE* (*printfunc)(int nargs, int redirtype, bool can_fatal))
+       NODE *r;
+       bool can_fatal;
+       switch (op) {
+       case Op_K_print_rec_exp:
+       case Op_K_print_exp:
+       case Op_K_printf_exp:
+               can_fatal = false;
+               break;
+       default:
+               can_fatal = true;
+               break;
+       }
+       r = printfunc(nargs, redirtype, can_fatal);
+       if (can_fatal)
+               DEREF(r);
+       else
+               PUSH(r);
+/* r_interpret --- the interpreter */
 r_interpret(INSTRUCTION *code)
@@ -51,7 +83,6 @@ r_interpret(INSTRUCTION *code)
        Regexp *rp;
        NODE *set_array = NULL; /* array with a post-assignment routine */
        NODE *set_idx = NULL;   /* the index of the array element */
-       bool print_fatal = true;
 /* array subscript */
@@ -969,39 +1000,18 @@ arrayfor:
                case Op_K_print_exp:
-                       print_fatal = false;
-                       /* fall through */
                case Op_K_print:
-                       r = do_print(pc->expr_count, pc->redir_type, 
-                       print_fatal = true;
-                       if (op == Op_K_print_exp)
-                               PUSH(r);
-                       else
-                               DEREF(r);
+                       run_print_command(op, pc->expr_count, pc->redir_type, 
                case Op_K_printf_exp:
-                       print_fatal = false;
-                       /* fall through */
                case Op_K_printf:
-                       r = do_printf(pc->expr_count, pc->redir_type, 
-                       print_fatal = true;
-                       if (op == Op_K_printf_exp)
-                               PUSH(r);
-                       else
-                               DEREF(r);
+                       run_print_command(op, pc->expr_count, pc->redir_type, 
                case Op_K_print_rec_exp:
-                       print_fatal = false;
-                       /* fall through */
                case Op_K_print_rec:
-                       r = do_print_rec(pc->expr_count, pc->redir_type, 
-                       print_fatal = true;
-                       if (op == Op_K_print_rec_exp)
-                               PUSH(r);
-                       else
-                               DEREF(r);
+                       run_print_command(op, pc->expr_count, pc->redir_type, 
                case Op_push_re:
diff --git a/io.c b/io.c
index 1d15d88..aad1fb2 100644
--- a/io.c
+++ b/io.c
@@ -261,7 +261,6 @@ struct recmatch {
 static int iop_close(IOBUF *iop);
-struct redirect *redirect(NODE *redir_exp, int redirtype, int *errflg);
 static void close_one(void);
 static int close_redir(struct redirect *rp, bool exitwarn, two_way_close_type 
@@ -727,7 +726,7 @@ redflags2str(int flags)
 /* redirect --- Redirection for printf and print commands */
 struct redirect *
-redirect(NODE *redir_exp, int redirtype, int *errflg)
+redirect(NODE *redir_exp, int redirtype, int *errflg, bool allow_fatal)
        struct redirect *rp;
        char *str;
@@ -932,6 +931,9 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
                                        *errflg = errno;
                                        /* do not free rp, saving it for reuse 
(save_rp = rp) */
                                        return NULL;
+                               } else if (! allow_fatal) {
+                                       free(rp);
+                                       return NULL;
                                } else
                                        fatal(_("can't open two way pipe `%s' 
for input/output (%s)"),
@@ -1014,6 +1016,11 @@ redirect(NODE *redir_exp, int redirtype, int *errflg)
                                        *errflg = errno;
                                if (   redirtype == redirect_output
                                    || redirtype == redirect_append) {
+                                       if (! allow_fatal) {
+                                               efree(rp);
+                                               return NULL;
+                                       }
                                        /* multiple messages make life easier 
for translators */
                                        if (*direction == 'f')
                                                fatal(_("can't redirect from 
`%s' (%s)"),
@@ -2421,7 +2428,7 @@ do_getline_redir(int into_variable, enum redirval 
        assert(redirtype != redirect_none);
        redir_exp = TOP();
-       rp = redirect(redir_exp, redirtype, & redir_error);
+       rp = redirect(redir_exp, redirtype, & redir_error, false);
        if (rp == NULL) {
diff --git a/profile.c b/profile.c
index 59542ab..549d483 100644
--- a/profile.c
+++ b/profile.c
@@ -182,6 +182,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool 
        int rule;
        long lind;
        static int rule_count[MAXRULE];
+       bool print_exp = false;
        for (pc = startp; pc != endp; pc = pc->nexti) {
                if (pc->source_line > 0)
@@ -564,10 +565,15 @@ cleanup:
+               case Op_K_print_exp:
+               case Op_K_printf_exp:
+               case Op_K_print_rec_exp:
+                       print_exp = true;
+                       /* fall through */
                case Op_K_print:
                case Op_K_printf:
                case Op_K_print_rec:
-                       if (pc->opcode == Op_K_print_rec)
+                       if (pc->opcode == Op_K_print_rec || pc->opcode == 
                                tmp = pp_group3(" ", op2str(Op_field_spec), 
                        else if (pc->redir_type != 0)
                                tmp = pp_list(pc->expr_count, "()", ", ");
@@ -577,17 +583,29 @@ cleanup:
                        if (pc->redir_type != 0) {
+                               char *str2;
                                t1 = pp_pop();
                                if (is_binary(t1->type))
-                               fprintf(prof_fp, "%s%s%s%s", op2str(pc->opcode),
-                                                       tmp, 
redir2str(pc->redir_type), t1->pp_str);
+                               str2 = pp_group3(op2str(pc->opcode),
+                                                       tmp, 
+                               str = pp_group3("", str2, t1->pp_str);
+                               efree(str2);
                        } else
-                               fprintf(prof_fp, "%s%s", op2str(pc->opcode), 
+                               str = pp_group3("", op2str(pc->opcode), tmp);
-                       if (! in_for_header)
-                               fprintf(prof_fp, "\n");
+                       if (print_exp) {
+                               pp_push(pc->opcode, str, CAN_FREE);
+                       } else {
+                               fprintf(prof_fp, "%s", str);
+                               efree(str);
+                               if (! in_for_header)
+                                       fprintf(prof_fp, "\n");
+                       }
+                       print_exp = false;
                case Op_push_re:

commit f9219546740bc1e97cc3593d9c1de4f082f6c491
Merge: 5d35746 9b3ff12
Author: Arnold D. Robbins <address@hidden>
Date:   Tue Dec 9 23:17:23 2014 +0200

    Merge branch 'master' into print-exp


Summary of changes:
 ChangeLog       |   11 +
 awk.h           |    3 +-
 builtin.c       |   24 +-
 doc/ChangeLog   |    5 +
 doc/   |  929 ++++++++++++++++++++++++++++---------------------------
 doc/gawk.texi   |   69 +++--
 doc/ |   69 +++--
 interpret.h     |   60 ++--
 io.c            |   13 +-
 profile.c       |   30 ++-
 10 files changed, 659 insertions(+), 554 deletions(-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]