aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-10-24 22:08:00 +0300
committerArnold D. Robbins <arnold@skeeve.com>2013-10-24 22:08:00 +0300
commit38bd2eff2ea99abb535ee5d2bd14f2b7b2c303de (patch)
tree5d4c774e87954166bc5c8fcfddeaba370f5a5c63
parent0307bffa31f7c7b51531bd74b730c035c8f1dfa1 (diff)
parent29e3ae329c550b884169b7db20775cd74b95b77a (diff)
downloadegawk-38bd2eff2ea99abb535ee5d2bd14f2b7b2c303de.tar.gz
egawk-38bd2eff2ea99abb535ee5d2bd14f2b7b2c303de.tar.bz2
egawk-38bd2eff2ea99abb535ee5d2bd14f2b7b2c303de.zip
Merge branch 'gawk-4.1-stable'
-rw-r--r--ChangeLog18
-rw-r--r--awk.h4
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.info955
-rw-r--r--doc/gawk.texi19
-rw-r--r--doc/gawktexi.in19
-rw-r--r--extension/ChangeLog7
-rw-r--r--extension/inplace.c8
-rw-r--r--io.c18
-rw-r--r--main.c23
-rw-r--r--msg.c17
-rw-r--r--test/ChangeLog11
-rw-r--r--test/Makefile.am6
-rw-r--r--test/Makefile.in11
-rw-r--r--test/Maketests5
15 files changed, 618 insertions, 508 deletions
diff --git a/ChangeLog b/ChangeLog
index 2240218a..f4640979 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2013-10-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ Revise error messages when writing to standard output or standard
+ error to ignore EPIPE. Add the ability based on an environment
+ variable to get the source file and line number.
+
+ * awk.h (r_warning): Renamed from warning.
+ (warning): New macro to set location and call warning.
+ * io.c (flush_io): Print errors only if not EPIPE.
+ (close_io): Ditto.
+ * main.c (lintfunc): Init to r_warning.
+ (main): Enhance explanatory comment.
+ (usage): Print errors only if not EPIPE.
+ (copyleft): Ditto.
+ * msg.c (err): Make printing srcfile and srcline depend upon
+ GAWK_MSG_SRC environment variable.
+ (r_warning): Renamed from warning.
+
2013-10-17 Arnold D. Robbins <arnold@skeeve.com>
* main.c (main): Ignore SIGPIPE. See the comment in the code.
diff --git a/awk.h b/awk.h
index 73ee8d0e..e79d86f8 100644
--- a/awk.h
+++ b/awk.h
@@ -213,6 +213,8 @@ typedef void *stackoverflow_context_t;
/* use this as lintwarn("...")
this is a hack but it gives us the right semantics */
#define lintwarn (*(set_loc(__FILE__, __LINE__),lintfunc))
+/* same thing for warning */
+#define warning (*(set_loc(__FILE__, __LINE__),r_warning))
#ifdef HAVE_MPFR
#include <gmp.h>
@@ -1578,7 +1580,7 @@ extern void final_exit(int status) ATTRIBUTE_NORETURN;
extern void err(bool isfatal, const char *s, const char *emsg, va_list argp) ATTRIBUTE_PRINTF(3, 0);
extern void msg (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
extern void error (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
-extern void warning (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
+extern void r_warning (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
extern void set_loc (const char *file, int line);
extern void r_fatal (const char *mesg, ...) ATTRIBUTE_PRINTF_1;
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 4e801a46..123ae722 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Other Environment Variables): Document GAWK_MSG_SRC
+ variable and fix documentation of *_CHAIN_MAX variables.
+
2013-10-11 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Conversion, Printf Ordering): Better wording for
diff --git a/doc/gawk.info b/doc/gawk.info
index bf131b48..a3b1b1b8 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -2851,10 +2851,6 @@ used by regular users.
the `gawk' developers for testing and tuning. They are subject to
change. The variables are:
-`AVG_CHAIN_MAX'
- The average number of items `gawk' will maintain on a hash chain
- for managing arrays.
-
`AWK_HASH'
If this variable exists with a value of `gst', `gawk' will switch
to using the hash function from GNU Smalltalk for managing arrays.
@@ -2866,6 +2862,13 @@ change. The variables are:
debugging problems on filesystems on non-POSIX operating systems
where I/O is performed in records, not in blocks.
+`GAWK_MSG_SRC'
+ If this variable exists, `gawk' includes the source file name and
+ line number from which warning and/or fatal messages are
+ generated. Its purpose is to help isolate the source of a
+ message, since there can be multiple places which produce the same
+ warning or error message.
+
`GAWK_NO_DFA'
If this variable exists, `gawk' does not use the DFA regexp matcher
for "does it match" kinds of tests. This can cause `gawk' to be
@@ -2878,6 +2881,14 @@ change. The variables are:
This specifies the amount by which `gawk' should grow its internal
evaluation stack, when needed.
+`INT_CHAIN_MAX'
+ The average number of items `gawk' will maintain on a hash chain
+ for managing arrays indexed by integers.
+
+`STR_CHAIN_MAX'
+ The average number of items `gawk' will maintain on a hash chain
+ for managing arrays indexed by strings.
+
`TIDYMEM'
If this variable exists, `gawk' uses the `mtrace()' library calls
from GNU LIBC to help track down possible memory leaks.
@@ -32222,473 +32233,473 @@ Node: AWKPATH Variable130128
Ref: AWKPATH Variable-Footnote-1132886
Node: AWKLIBPATH Variable133146
Node: Other Environment Variables133864
-Node: Exit Status136359
-Node: Include Files137034
-Node: Loading Shared Libraries140603
-Node: Obsolete141967
-Node: Undocumented142664
-Node: Regexp142907
-Node: Regexp Usage144296
-Node: Escape Sequences146322
-Node: Regexp Operators151991
-Ref: Regexp Operators-Footnote-1159371
-Ref: Regexp Operators-Footnote-2159518
-Node: Bracket Expressions159616
-Ref: table-char-classes161506
-Node: GNU Regexp Operators164029
-Node: Case-sensitivity167752
-Ref: Case-sensitivity-Footnote-1170720
-Ref: Case-sensitivity-Footnote-2170955
-Node: Leftmost Longest171063
-Node: Computed Regexps172264
-Node: Reading Files175601
-Node: Records177604
-Ref: Records-Footnote-1186493
-Node: Fields186530
-Ref: Fields-Footnote-1189563
-Node: Nonconstant Fields189649
-Node: Changing Fields191851
-Node: Field Separators197810
-Node: Default Field Splitting200439
-Node: Regexp Field Splitting201556
-Node: Single Character Fields204898
-Node: Command Line Field Separator205957
-Node: Field Splitting Summary209398
-Ref: Field Splitting Summary-Footnote-1212509
-Node: Constant Size212610
-Node: Splitting By Content217194
-Ref: Splitting By Content-Footnote-1220920
-Node: Multiple Line220960
-Ref: Multiple Line-Footnote-1226807
-Node: Getline226986
-Node: Plain Getline229202
-Node: Getline/Variable231297
-Node: Getline/File232444
-Node: Getline/Variable/File233785
-Ref: Getline/Variable/File-Footnote-1235384
-Node: Getline/Pipe235471
-Node: Getline/Variable/Pipe238171
-Node: Getline/Coprocess239278
-Node: Getline/Variable/Coprocess240530
-Node: Getline Notes241267
-Node: Getline Summary244054
-Ref: table-getline-variants244462
-Node: Read Timeout245374
-Ref: Read Timeout-Footnote-1249115
-Node: Command line directories249172
-Node: Printing249802
-Node: Print251433
-Node: Print Examples252770
-Node: Output Separators255554
-Node: OFMT257314
-Node: Printf258672
-Node: Basic Printf259578
-Node: Control Letters261117
-Node: Format Modifiers264929
-Node: Printf Examples270938
-Node: Redirection273653
-Node: Special Files280618
-Node: Special FD281151
-Ref: Special FD-Footnote-1284776
-Node: Special Network284850
-Node: Special Caveats285700
-Node: Close Files And Pipes286496
-Ref: Close Files And Pipes-Footnote-1293479
-Ref: Close Files And Pipes-Footnote-2293627
-Node: Expressions293777
-Node: Values294909
-Node: Constants295585
-Node: Scalar Constants296265
-Ref: Scalar Constants-Footnote-1297124
-Node: Nondecimal-numbers297306
-Node: Regexp Constants300306
-Node: Using Constant Regexps300781
-Node: Variables303836
-Node: Using Variables304491
-Node: Assignment Options306215
-Node: Conversion308087
-Ref: table-locale-affects313588
-Ref: Conversion-Footnote-1314212
-Node: All Operators314321
-Node: Arithmetic Ops314951
-Node: Concatenation317456
-Ref: Concatenation-Footnote-1320249
-Node: Assignment Ops320369
-Ref: table-assign-ops325357
-Node: Increment Ops326688
-Node: Truth Values and Conditions330123
-Node: Truth Values331206
-Node: Typing and Comparison332255
-Node: Variable Typing333044
-Ref: Variable Typing-Footnote-1336941
-Node: Comparison Operators337063
-Ref: table-relational-ops337473
-Node: POSIX String Comparison341022
-Ref: POSIX String Comparison-Footnote-1341978
-Node: Boolean Ops342116
-Ref: Boolean Ops-Footnote-1346194
-Node: Conditional Exp346285
-Node: Function Calls348017
-Node: Precedence351611
-Node: Locales355280
-Node: Patterns and Actions356369
-Node: Pattern Overview357423
-Node: Regexp Patterns359092
-Node: Expression Patterns359635
-Node: Ranges363320
-Node: BEGIN/END366286
-Node: Using BEGIN/END367048
-Ref: Using BEGIN/END-Footnote-1369779
-Node: I/O And BEGIN/END369885
-Node: BEGINFILE/ENDFILE372167
-Node: Empty375081
-Node: Using Shell Variables375397
-Node: Action Overview377682
-Node: Statements380039
-Node: If Statement381893
-Node: While Statement383392
-Node: Do Statement385436
-Node: For Statement386592
-Node: Switch Statement389744
-Node: Break Statement391841
-Node: Continue Statement393831
-Node: Next Statement395624
-Node: Nextfile Statement398014
-Node: Exit Statement400657
-Node: Built-in Variables403073
-Node: User-modified404168
-Ref: User-modified-Footnote-1412528
-Node: Auto-set412590
-Ref: Auto-set-Footnote-1426060
-Ref: Auto-set-Footnote-2426265
-Node: ARGC and ARGV426321
-Node: Arrays430172
-Node: Array Basics431677
-Node: Array Intro432503
-Node: Reference to Elements436821
-Node: Assigning Elements439091
-Node: Array Example439582
-Node: Scanning an Array441314
-Node: Controlling Scanning443628
-Ref: Controlling Scanning-Footnote-1448551
-Node: Delete448867
-Ref: Delete-Footnote-1451632
-Node: Numeric Array Subscripts451689
-Node: Uninitialized Subscripts453872
-Node: Multi-dimensional455500
-Node: Multi-scanning458594
-Node: Arrays of Arrays460185
-Node: Functions464826
-Node: Built-in465645
-Node: Calling Built-in466723
-Node: Numeric Functions468711
-Ref: Numeric Functions-Footnote-1472543
-Ref: Numeric Functions-Footnote-2472900
-Ref: Numeric Functions-Footnote-3472948
-Node: String Functions473217
-Ref: String Functions-Footnote-1496775
-Ref: String Functions-Footnote-2496904
-Ref: String Functions-Footnote-3497152
-Node: Gory Details497239
-Ref: table-sub-escapes498918
-Ref: table-sub-posix-92500272
-Ref: table-sub-proposed501623
-Ref: table-posix-sub502977
-Ref: table-gensub-escapes504522
-Ref: Gory Details-Footnote-1505698
-Ref: Gory Details-Footnote-2505749
-Node: I/O Functions505900
-Ref: I/O Functions-Footnote-1512885
-Node: Time Functions513032
-Ref: Time Functions-Footnote-1523965
-Ref: Time Functions-Footnote-2524033
-Ref: Time Functions-Footnote-3524191
-Ref: Time Functions-Footnote-4524302
-Ref: Time Functions-Footnote-5524414
-Ref: Time Functions-Footnote-6524641
-Node: Bitwise Functions524907
-Ref: table-bitwise-ops525465
-Ref: Bitwise Functions-Footnote-1529686
-Node: Type Functions529870
-Node: I18N Functions531021
-Node: User-defined532648
-Node: Definition Syntax533452
-Ref: Definition Syntax-Footnote-1538362
-Node: Function Example538431
-Node: Function Caveats541025
-Node: Calling A Function541446
-Node: Variable Scope542561
-Node: Pass By Value/Reference545524
-Node: Return Statement549032
-Node: Dynamic Typing552013
-Node: Indirect Calls552944
-Node: Library Functions562629
-Ref: Library Functions-Footnote-1566142
-Ref: Library Functions-Footnote-2566285
-Node: Library Names566456
-Ref: Library Names-Footnote-1569927
-Ref: Library Names-Footnote-2570147
-Node: General Functions570233
-Node: Strtonum Function571261
-Node: Assert Function574191
-Node: Round Function577517
-Node: Cliff Random Function579060
-Node: Ordinal Functions580076
-Ref: Ordinal Functions-Footnote-1583146
-Ref: Ordinal Functions-Footnote-2583398
-Node: Join Function583607
-Ref: Join Function-Footnote-1585378
-Node: Getlocaltime Function585578
-Node: Readfile Function589319
-Node: Data File Management591158
-Node: Filetrans Function591790
-Node: Rewind Function595859
-Node: File Checking597246
-Node: Empty Files598340
-Node: Ignoring Assigns600570
-Node: Getopt Function602123
-Ref: Getopt Function-Footnote-1613427
-Node: Passwd Functions613630
-Ref: Passwd Functions-Footnote-1622605
-Node: Group Functions622693
-Node: Walking Arrays630777
-Node: Sample Programs632914
-Node: Running Examples633588
-Node: Clones634316
-Node: Cut Program635540
-Node: Egrep Program645385
-Ref: Egrep Program-Footnote-1653158
-Node: Id Program653268
-Node: Split Program656884
-Ref: Split Program-Footnote-1660403
-Node: Tee Program660531
-Node: Uniq Program663334
-Node: Wc Program670763
-Ref: Wc Program-Footnote-1675029
-Ref: Wc Program-Footnote-2675229
-Node: Miscellaneous Programs675321
-Node: Dupword Program676509
-Node: Alarm Program678540
-Node: Translate Program683289
-Ref: Translate Program-Footnote-1687676
-Ref: Translate Program-Footnote-2687904
-Node: Labels Program688038
-Ref: Labels Program-Footnote-1691409
-Node: Word Sorting691493
-Node: History Sorting695377
-Node: Extract Program697216
-Ref: Extract Program-Footnote-1704717
-Node: Simple Sed704845
-Node: Igawk Program707907
-Ref: Igawk Program-Footnote-1723064
-Ref: Igawk Program-Footnote-2723265
-Node: Anagram Program723403
-Node: Signature Program726471
-Node: Advanced Features727571
-Node: Nondecimal Data729453
-Node: Array Sorting731036
-Node: Controlling Array Traversal731733
-Node: Array Sorting Functions739971
-Ref: Array Sorting Functions-Footnote-1743645
-Ref: Array Sorting Functions-Footnote-2743738
-Node: Two-way I/O743932
-Ref: Two-way I/O-Footnote-1749364
-Node: TCP/IP Networking749434
-Node: Profiling752278
-Node: Internationalization759775
-Node: I18N and L10N761200
-Node: Explaining gettext761886
-Ref: Explaining gettext-Footnote-1766954
-Ref: Explaining gettext-Footnote-2767138
-Node: Programmer i18n767303
-Node: Translator i18n771505
-Node: String Extraction772298
-Ref: String Extraction-Footnote-1773259
-Node: Printf Ordering773345
-Ref: Printf Ordering-Footnote-1776129
-Node: I18N Portability776193
-Ref: I18N Portability-Footnote-1778642
-Node: I18N Example778705
-Ref: I18N Example-Footnote-1781343
-Node: Gawk I18N781415
-Node: Debugger782036
-Node: Debugging783007
-Node: Debugging Concepts783440
-Node: Debugging Terms785296
-Node: Awk Debugging787893
-Node: Sample Debugging Session788785
-Node: Debugger Invocation789305
-Node: Finding The Bug790637
-Node: List of Debugger Commands797125
-Node: Breakpoint Control798459
-Node: Debugger Execution Control802123
-Node: Viewing And Changing Data805483
-Node: Execution Stack808839
-Node: Debugger Info810306
-Node: Miscellaneous Debugger Commands814288
-Node: Readline Support819464
-Node: Limitations820295
-Node: Arbitrary Precision Arithmetic822547
-Ref: Arbitrary Precision Arithmetic-Footnote-1824198
-Node: General Arithmetic824346
-Node: Floating Point Issues826066
-Node: String Conversion Precision826947
-Ref: String Conversion Precision-Footnote-1828652
-Node: Unexpected Results828761
-Node: POSIX Floating Point Problems830914
-Ref: POSIX Floating Point Problems-Footnote-1834739
-Node: Integer Programming834777
-Node: Floating-point Programming836516
-Ref: Floating-point Programming-Footnote-1842847
-Ref: Floating-point Programming-Footnote-2843117
-Node: Floating-point Representation843381
-Node: Floating-point Context844546
-Ref: table-ieee-formats845385
-Node: Rounding Mode846769
-Ref: table-rounding-modes847248
-Ref: Rounding Mode-Footnote-1850263
-Node: Gawk and MPFR850442
-Node: Arbitrary Precision Floats851697
-Ref: Arbitrary Precision Floats-Footnote-1854140
-Node: Setting Precision854456
-Ref: table-predefined-precision-strings855142
-Node: Setting Rounding Mode857287
-Ref: table-gawk-rounding-modes857691
-Node: Floating-point Constants858878
-Node: Changing Precision860307
-Ref: Changing Precision-Footnote-1861707
-Node: Exact Arithmetic861881
-Node: Arbitrary Precision Integers865019
-Ref: Arbitrary Precision Integers-Footnote-1868037
-Node: Dynamic Extensions868184
-Node: Extension Intro869642
-Node: Plugin License870907
-Node: Extension Mechanism Outline871592
-Ref: load-extension872009
-Ref: load-new-function873487
-Ref: call-new-function874482
-Node: Extension API Description876497
-Node: Extension API Functions Introduction877710
-Node: General Data Types882576
-Ref: General Data Types-Footnote-1888178
-Node: Requesting Values888477
-Ref: table-value-types-returned889208
-Node: Constructor Functions890162
-Node: Registration Functions893182
-Node: Extension Functions893867
-Node: Exit Callback Functions896092
-Node: Extension Version String897341
-Node: Input Parsers897991
-Node: Output Wrappers907748
-Node: Two-way processors912258
-Node: Printing Messages914466
-Ref: Printing Messages-Footnote-1915543
-Node: Updating `ERRNO'915695
-Node: Accessing Parameters916434
-Node: Symbol Table Access917664
-Node: Symbol table by name918176
-Node: Symbol table by cookie919923
-Ref: Symbol table by cookie-Footnote-1924053
-Node: Cached values924116
-Ref: Cached values-Footnote-1927565
-Node: Array Manipulation927656
-Ref: Array Manipulation-Footnote-1928754
-Node: Array Data Types928793
-Ref: Array Data Types-Footnote-1931496
-Node: Array Functions931588
-Node: Flattening Arrays935354
-Node: Creating Arrays942206
-Node: Extension API Variables946931
-Node: Extension Versioning947567
-Node: Extension API Informational Variables949468
-Node: Extension API Boilerplate950554
-Node: Finding Extensions954358
-Node: Extension Example954918
-Node: Internal File Description955649
-Node: Internal File Ops959740
-Ref: Internal File Ops-Footnote-1971248
-Node: Using Internal File Ops971388
-Ref: Using Internal File Ops-Footnote-1973741
-Node: Extension Samples974007
-Node: Extension Sample File Functions975531
-Node: Extension Sample Fnmatch984018
-Node: Extension Sample Fork985744
-Node: Extension Sample Inplace986962
-Node: Extension Sample Ord988740
-Node: Extension Sample Readdir989576
-Node: Extension Sample Revout991108
-Node: Extension Sample Rev2way991701
-Node: Extension Sample Read write array992391
-Node: Extension Sample Readfile994274
-Node: Extension Sample API Tests995092
-Node: Extension Sample Time995617
-Node: gawkextlib996981
-Node: Language History999741
-Node: V7/SVR3.11001263
-Node: SVR41003584
-Node: POSIX1005026
-Node: BTL1006412
-Node: POSIX/GNU1007146
-Node: Common Extensions1012681
-Node: Ranges and Locales1013987
-Ref: Ranges and Locales-Footnote-11018605
-Ref: Ranges and Locales-Footnote-21018632
-Ref: Ranges and Locales-Footnote-31018892
-Node: Contributors1019113
-Node: Installation1023992
-Node: Gawk Distribution1024886
-Node: Getting1025370
-Node: Extracting1026196
-Node: Distribution contents1027888
-Node: Unix Installation1033149
-Node: Quick Installation1033766
-Node: Additional Configuration Options1036210
-Node: Configuration Philosophy1037687
-Node: Non-Unix Installation1040041
-Node: PC Installation1040499
-Node: PC Binary Installation1041798
-Node: PC Compiling1043646
-Node: PC Testing1046590
-Node: PC Using1047766
-Node: Cygwin1051951
-Node: MSYS1052951
-Node: VMS Installation1053465
-Node: VMS Compilation1054068
-Ref: VMS Compilation-Footnote-11055075
-Node: VMS Installation Details1055133
-Node: VMS Running1056768
-Node: VMS Old Gawk1058375
-Node: Bugs1058849
-Node: Other Versions1062701
-Node: Notes1068782
-Node: Compatibility Mode1069582
-Node: Additions1070365
-Node: Accessing The Source1071292
-Node: Adding Code1072732
-Node: New Ports1078777
-Node: Derived Files1082912
-Ref: Derived Files-Footnote-11088233
-Ref: Derived Files-Footnote-21088267
-Ref: Derived Files-Footnote-31088867
-Node: Future Extensions1088965
-Node: Implementation Limitations1089546
-Node: Extension Design1090798
-Node: Old Extension Problems1091952
-Ref: Old Extension Problems-Footnote-11093460
-Node: Extension New Mechanism Goals1093517
-Ref: Extension New Mechanism Goals-Footnote-11096883
-Node: Extension Other Design Decisions1097069
-Node: Extension Future Growth1099175
-Node: Old Extension Mechanism1100011
-Node: Basic Concepts1101751
-Node: Basic High Level1102432
-Ref: figure-general-flow1102703
-Ref: figure-process-flow1103302
-Ref: Basic High Level-Footnote-11106531
-Node: Basic Data Typing1106716
-Node: Glossary1110071
-Node: Copying1135533
-Node: GNU Free Documentation License1173090
-Node: Index1198227
+Node: Exit Status136827
+Node: Include Files137502
+Node: Loading Shared Libraries141071
+Node: Obsolete142435
+Node: Undocumented143132
+Node: Regexp143375
+Node: Regexp Usage144764
+Node: Escape Sequences146790
+Node: Regexp Operators152459
+Ref: Regexp Operators-Footnote-1159839
+Ref: Regexp Operators-Footnote-2159986
+Node: Bracket Expressions160084
+Ref: table-char-classes161974
+Node: GNU Regexp Operators164497
+Node: Case-sensitivity168220
+Ref: Case-sensitivity-Footnote-1171188
+Ref: Case-sensitivity-Footnote-2171423
+Node: Leftmost Longest171531
+Node: Computed Regexps172732
+Node: Reading Files176069
+Node: Records178072
+Ref: Records-Footnote-1186961
+Node: Fields186998
+Ref: Fields-Footnote-1190031
+Node: Nonconstant Fields190117
+Node: Changing Fields192319
+Node: Field Separators198278
+Node: Default Field Splitting200907
+Node: Regexp Field Splitting202024
+Node: Single Character Fields205366
+Node: Command Line Field Separator206425
+Node: Field Splitting Summary209866
+Ref: Field Splitting Summary-Footnote-1212977
+Node: Constant Size213078
+Node: Splitting By Content217662
+Ref: Splitting By Content-Footnote-1221388
+Node: Multiple Line221428
+Ref: Multiple Line-Footnote-1227275
+Node: Getline227454
+Node: Plain Getline229670
+Node: Getline/Variable231765
+Node: Getline/File232912
+Node: Getline/Variable/File234253
+Ref: Getline/Variable/File-Footnote-1235852
+Node: Getline/Pipe235939
+Node: Getline/Variable/Pipe238639
+Node: Getline/Coprocess239746
+Node: Getline/Variable/Coprocess240998
+Node: Getline Notes241735
+Node: Getline Summary244522
+Ref: table-getline-variants244930
+Node: Read Timeout245842
+Ref: Read Timeout-Footnote-1249583
+Node: Command line directories249640
+Node: Printing250270
+Node: Print251901
+Node: Print Examples253238
+Node: Output Separators256022
+Node: OFMT257782
+Node: Printf259140
+Node: Basic Printf260046
+Node: Control Letters261585
+Node: Format Modifiers265397
+Node: Printf Examples271406
+Node: Redirection274121
+Node: Special Files281086
+Node: Special FD281619
+Ref: Special FD-Footnote-1285244
+Node: Special Network285318
+Node: Special Caveats286168
+Node: Close Files And Pipes286964
+Ref: Close Files And Pipes-Footnote-1293947
+Ref: Close Files And Pipes-Footnote-2294095
+Node: Expressions294245
+Node: Values295377
+Node: Constants296053
+Node: Scalar Constants296733
+Ref: Scalar Constants-Footnote-1297592
+Node: Nondecimal-numbers297774
+Node: Regexp Constants300774
+Node: Using Constant Regexps301249
+Node: Variables304304
+Node: Using Variables304959
+Node: Assignment Options306683
+Node: Conversion308555
+Ref: table-locale-affects314056
+Ref: Conversion-Footnote-1314680
+Node: All Operators314789
+Node: Arithmetic Ops315419
+Node: Concatenation317924
+Ref: Concatenation-Footnote-1320717
+Node: Assignment Ops320837
+Ref: table-assign-ops325825
+Node: Increment Ops327156
+Node: Truth Values and Conditions330591
+Node: Truth Values331674
+Node: Typing and Comparison332723
+Node: Variable Typing333512
+Ref: Variable Typing-Footnote-1337409
+Node: Comparison Operators337531
+Ref: table-relational-ops337941
+Node: POSIX String Comparison341490
+Ref: POSIX String Comparison-Footnote-1342446
+Node: Boolean Ops342584
+Ref: Boolean Ops-Footnote-1346662
+Node: Conditional Exp346753
+Node: Function Calls348485
+Node: Precedence352079
+Node: Locales355748
+Node: Patterns and Actions356837
+Node: Pattern Overview357891
+Node: Regexp Patterns359560
+Node: Expression Patterns360103
+Node: Ranges363788
+Node: BEGIN/END366754
+Node: Using BEGIN/END367516
+Ref: Using BEGIN/END-Footnote-1370247
+Node: I/O And BEGIN/END370353
+Node: BEGINFILE/ENDFILE372635
+Node: Empty375549
+Node: Using Shell Variables375865
+Node: Action Overview378150
+Node: Statements380507
+Node: If Statement382361
+Node: While Statement383860
+Node: Do Statement385904
+Node: For Statement387060
+Node: Switch Statement390212
+Node: Break Statement392309
+Node: Continue Statement394299
+Node: Next Statement396092
+Node: Nextfile Statement398482
+Node: Exit Statement401125
+Node: Built-in Variables403541
+Node: User-modified404636
+Ref: User-modified-Footnote-1412996
+Node: Auto-set413058
+Ref: Auto-set-Footnote-1426528
+Ref: Auto-set-Footnote-2426733
+Node: ARGC and ARGV426789
+Node: Arrays430640
+Node: Array Basics432145
+Node: Array Intro432971
+Node: Reference to Elements437289
+Node: Assigning Elements439559
+Node: Array Example440050
+Node: Scanning an Array441782
+Node: Controlling Scanning444096
+Ref: Controlling Scanning-Footnote-1449019
+Node: Delete449335
+Ref: Delete-Footnote-1452100
+Node: Numeric Array Subscripts452157
+Node: Uninitialized Subscripts454340
+Node: Multi-dimensional455968
+Node: Multi-scanning459062
+Node: Arrays of Arrays460653
+Node: Functions465294
+Node: Built-in466113
+Node: Calling Built-in467191
+Node: Numeric Functions469179
+Ref: Numeric Functions-Footnote-1473011
+Ref: Numeric Functions-Footnote-2473368
+Ref: Numeric Functions-Footnote-3473416
+Node: String Functions473685
+Ref: String Functions-Footnote-1497243
+Ref: String Functions-Footnote-2497372
+Ref: String Functions-Footnote-3497620
+Node: Gory Details497707
+Ref: table-sub-escapes499386
+Ref: table-sub-posix-92500740
+Ref: table-sub-proposed502091
+Ref: table-posix-sub503445
+Ref: table-gensub-escapes504990
+Ref: Gory Details-Footnote-1506166
+Ref: Gory Details-Footnote-2506217
+Node: I/O Functions506368
+Ref: I/O Functions-Footnote-1513353
+Node: Time Functions513500
+Ref: Time Functions-Footnote-1524433
+Ref: Time Functions-Footnote-2524501
+Ref: Time Functions-Footnote-3524659
+Ref: Time Functions-Footnote-4524770
+Ref: Time Functions-Footnote-5524882
+Ref: Time Functions-Footnote-6525109
+Node: Bitwise Functions525375
+Ref: table-bitwise-ops525933
+Ref: Bitwise Functions-Footnote-1530154
+Node: Type Functions530338
+Node: I18N Functions531489
+Node: User-defined533116
+Node: Definition Syntax533920
+Ref: Definition Syntax-Footnote-1538830
+Node: Function Example538899
+Node: Function Caveats541493
+Node: Calling A Function541914
+Node: Variable Scope543029
+Node: Pass By Value/Reference545992
+Node: Return Statement549500
+Node: Dynamic Typing552481
+Node: Indirect Calls553412
+Node: Library Functions563097
+Ref: Library Functions-Footnote-1566610
+Ref: Library Functions-Footnote-2566753
+Node: Library Names566924
+Ref: Library Names-Footnote-1570395
+Ref: Library Names-Footnote-2570615
+Node: General Functions570701
+Node: Strtonum Function571729
+Node: Assert Function574659
+Node: Round Function577985
+Node: Cliff Random Function579528
+Node: Ordinal Functions580544
+Ref: Ordinal Functions-Footnote-1583614
+Ref: Ordinal Functions-Footnote-2583866
+Node: Join Function584075
+Ref: Join Function-Footnote-1585846
+Node: Getlocaltime Function586046
+Node: Readfile Function589787
+Node: Data File Management591626
+Node: Filetrans Function592258
+Node: Rewind Function596327
+Node: File Checking597714
+Node: Empty Files598808
+Node: Ignoring Assigns601038
+Node: Getopt Function602591
+Ref: Getopt Function-Footnote-1613895
+Node: Passwd Functions614098
+Ref: Passwd Functions-Footnote-1623073
+Node: Group Functions623161
+Node: Walking Arrays631245
+Node: Sample Programs633382
+Node: Running Examples634056
+Node: Clones634784
+Node: Cut Program636008
+Node: Egrep Program645853
+Ref: Egrep Program-Footnote-1653626
+Node: Id Program653736
+Node: Split Program657352
+Ref: Split Program-Footnote-1660871
+Node: Tee Program660999
+Node: Uniq Program663802
+Node: Wc Program671231
+Ref: Wc Program-Footnote-1675497
+Ref: Wc Program-Footnote-2675697
+Node: Miscellaneous Programs675789
+Node: Dupword Program676977
+Node: Alarm Program679008
+Node: Translate Program683757
+Ref: Translate Program-Footnote-1688144
+Ref: Translate Program-Footnote-2688372
+Node: Labels Program688506
+Ref: Labels Program-Footnote-1691877
+Node: Word Sorting691961
+Node: History Sorting695845
+Node: Extract Program697684
+Ref: Extract Program-Footnote-1705185
+Node: Simple Sed705313
+Node: Igawk Program708375
+Ref: Igawk Program-Footnote-1723532
+Ref: Igawk Program-Footnote-2723733
+Node: Anagram Program723871
+Node: Signature Program726939
+Node: Advanced Features728039
+Node: Nondecimal Data729921
+Node: Array Sorting731504
+Node: Controlling Array Traversal732201
+Node: Array Sorting Functions740439
+Ref: Array Sorting Functions-Footnote-1744113
+Ref: Array Sorting Functions-Footnote-2744206
+Node: Two-way I/O744400
+Ref: Two-way I/O-Footnote-1749832
+Node: TCP/IP Networking749902
+Node: Profiling752746
+Node: Internationalization760243
+Node: I18N and L10N761668
+Node: Explaining gettext762354
+Ref: Explaining gettext-Footnote-1767422
+Ref: Explaining gettext-Footnote-2767606
+Node: Programmer i18n767771
+Node: Translator i18n771973
+Node: String Extraction772766
+Ref: String Extraction-Footnote-1773727
+Node: Printf Ordering773813
+Ref: Printf Ordering-Footnote-1776597
+Node: I18N Portability776661
+Ref: I18N Portability-Footnote-1779110
+Node: I18N Example779173
+Ref: I18N Example-Footnote-1781811
+Node: Gawk I18N781883
+Node: Debugger782504
+Node: Debugging783475
+Node: Debugging Concepts783908
+Node: Debugging Terms785764
+Node: Awk Debugging788361
+Node: Sample Debugging Session789253
+Node: Debugger Invocation789773
+Node: Finding The Bug791105
+Node: List of Debugger Commands797593
+Node: Breakpoint Control798927
+Node: Debugger Execution Control802591
+Node: Viewing And Changing Data805951
+Node: Execution Stack809307
+Node: Debugger Info810774
+Node: Miscellaneous Debugger Commands814756
+Node: Readline Support819932
+Node: Limitations820763
+Node: Arbitrary Precision Arithmetic823015
+Ref: Arbitrary Precision Arithmetic-Footnote-1824666
+Node: General Arithmetic824814
+Node: Floating Point Issues826534
+Node: String Conversion Precision827415
+Ref: String Conversion Precision-Footnote-1829120
+Node: Unexpected Results829229
+Node: POSIX Floating Point Problems831382
+Ref: POSIX Floating Point Problems-Footnote-1835207
+Node: Integer Programming835245
+Node: Floating-point Programming836984
+Ref: Floating-point Programming-Footnote-1843315
+Ref: Floating-point Programming-Footnote-2843585
+Node: Floating-point Representation843849
+Node: Floating-point Context845014
+Ref: table-ieee-formats845853
+Node: Rounding Mode847237
+Ref: table-rounding-modes847716
+Ref: Rounding Mode-Footnote-1850731
+Node: Gawk and MPFR850910
+Node: Arbitrary Precision Floats852165
+Ref: Arbitrary Precision Floats-Footnote-1854608
+Node: Setting Precision854924
+Ref: table-predefined-precision-strings855610
+Node: Setting Rounding Mode857755
+Ref: table-gawk-rounding-modes858159
+Node: Floating-point Constants859346
+Node: Changing Precision860775
+Ref: Changing Precision-Footnote-1862175
+Node: Exact Arithmetic862349
+Node: Arbitrary Precision Integers865487
+Ref: Arbitrary Precision Integers-Footnote-1868505
+Node: Dynamic Extensions868652
+Node: Extension Intro870110
+Node: Plugin License871375
+Node: Extension Mechanism Outline872060
+Ref: load-extension872477
+Ref: load-new-function873955
+Ref: call-new-function874950
+Node: Extension API Description876965
+Node: Extension API Functions Introduction878178
+Node: General Data Types883044
+Ref: General Data Types-Footnote-1888646
+Node: Requesting Values888945
+Ref: table-value-types-returned889676
+Node: Constructor Functions890630
+Node: Registration Functions893650
+Node: Extension Functions894335
+Node: Exit Callback Functions896560
+Node: Extension Version String897809
+Node: Input Parsers898459
+Node: Output Wrappers908216
+Node: Two-way processors912726
+Node: Printing Messages914934
+Ref: Printing Messages-Footnote-1916011
+Node: Updating `ERRNO'916163
+Node: Accessing Parameters916902
+Node: Symbol Table Access918132
+Node: Symbol table by name918644
+Node: Symbol table by cookie920391
+Ref: Symbol table by cookie-Footnote-1924521
+Node: Cached values924584
+Ref: Cached values-Footnote-1928033
+Node: Array Manipulation928124
+Ref: Array Manipulation-Footnote-1929222
+Node: Array Data Types929261
+Ref: Array Data Types-Footnote-1931964
+Node: Array Functions932056
+Node: Flattening Arrays935822
+Node: Creating Arrays942674
+Node: Extension API Variables947399
+Node: Extension Versioning948035
+Node: Extension API Informational Variables949936
+Node: Extension API Boilerplate951022
+Node: Finding Extensions954826
+Node: Extension Example955386
+Node: Internal File Description956117
+Node: Internal File Ops960208
+Ref: Internal File Ops-Footnote-1971716
+Node: Using Internal File Ops971856
+Ref: Using Internal File Ops-Footnote-1974209
+Node: Extension Samples974475
+Node: Extension Sample File Functions975999
+Node: Extension Sample Fnmatch984486
+Node: Extension Sample Fork986212
+Node: Extension Sample Inplace987430
+Node: Extension Sample Ord989208
+Node: Extension Sample Readdir990044
+Node: Extension Sample Revout991576
+Node: Extension Sample Rev2way992169
+Node: Extension Sample Read write array992859
+Node: Extension Sample Readfile994742
+Node: Extension Sample API Tests995560
+Node: Extension Sample Time996085
+Node: gawkextlib997449
+Node: Language History1000209
+Node: V7/SVR3.11001731
+Node: SVR41004052
+Node: POSIX1005494
+Node: BTL1006880
+Node: POSIX/GNU1007614
+Node: Common Extensions1013149
+Node: Ranges and Locales1014455
+Ref: Ranges and Locales-Footnote-11019073
+Ref: Ranges and Locales-Footnote-21019100
+Ref: Ranges and Locales-Footnote-31019360
+Node: Contributors1019581
+Node: Installation1024460
+Node: Gawk Distribution1025354
+Node: Getting1025838
+Node: Extracting1026664
+Node: Distribution contents1028356
+Node: Unix Installation1033617
+Node: Quick Installation1034234
+Node: Additional Configuration Options1036678
+Node: Configuration Philosophy1038155
+Node: Non-Unix Installation1040509
+Node: PC Installation1040967
+Node: PC Binary Installation1042266
+Node: PC Compiling1044114
+Node: PC Testing1047058
+Node: PC Using1048234
+Node: Cygwin1052419
+Node: MSYS1053419
+Node: VMS Installation1053933
+Node: VMS Compilation1054536
+Ref: VMS Compilation-Footnote-11055543
+Node: VMS Installation Details1055601
+Node: VMS Running1057236
+Node: VMS Old Gawk1058843
+Node: Bugs1059317
+Node: Other Versions1063169
+Node: Notes1069250
+Node: Compatibility Mode1070050
+Node: Additions1070833
+Node: Accessing The Source1071760
+Node: Adding Code1073200
+Node: New Ports1079245
+Node: Derived Files1083380
+Ref: Derived Files-Footnote-11088701
+Ref: Derived Files-Footnote-21088735
+Ref: Derived Files-Footnote-31089335
+Node: Future Extensions1089433
+Node: Implementation Limitations1090014
+Node: Extension Design1091266
+Node: Old Extension Problems1092420
+Ref: Old Extension Problems-Footnote-11093928
+Node: Extension New Mechanism Goals1093985
+Ref: Extension New Mechanism Goals-Footnote-11097351
+Node: Extension Other Design Decisions1097537
+Node: Extension Future Growth1099643
+Node: Old Extension Mechanism1100479
+Node: Basic Concepts1102219
+Node: Basic High Level1102900
+Ref: figure-general-flow1103171
+Ref: figure-process-flow1103770
+Ref: Basic High Level-Footnote-11106999
+Node: Basic Data Typing1107184
+Node: Glossary1110539
+Node: Copying1136001
+Node: GNU Free Documentation License1173558
+Node: Index1198695

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 99b0a8c3..e8d4cc41 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -3956,10 +3956,6 @@ for use by the @command{gawk} developers for testing and tuning.
They are subject to change. The variables are:
@table @env
-@item AVG_CHAIN_MAX
-The average number of items @command{gawk} will maintain on a
-hash chain for managing arrays.
-
@item AWK_HASH
If this variable exists with a value of @samp{gst}, @command{gawk}
will switch to using the hash function from GNU Smalltalk for
@@ -3972,6 +3968,13 @@ files one line at a time, instead of reading in blocks. This exists
for debugging problems on filesystems on non-POSIX operating systems
where I/O is performed in records, not in blocks.
+@item GAWK_MSG_SRC
+If this variable exists, @command{gawk} includes the source file
+name and line number from which warning and/or fatal messages
+are generated. Its purpose is to help isolate the source of a
+message, since there can be multiple places which produce the
+same warning or error message.
+
@item GAWK_NO_DFA
If this variable exists, @command{gawk} does not use the DFA regexp matcher
for ``does it match'' kinds of tests. This can cause @command{gawk}
@@ -3984,6 +3987,14 @@ coordinate with each other.)
This specifies the amount by which @command{gawk} should grow its
internal evaluation stack, when needed.
+@item INT_CHAIN_MAX
+The average number of items @command{gawk} will maintain on a
+hash chain for managing arrays indexed by integers.
+
+@item STR_CHAIN_MAX
+The average number of items @command{gawk} will maintain on a
+hash chain for managing arrays indexed by strings.
+
@item TIDYMEM
If this variable exists, @command{gawk} uses the @code{mtrace()} library
calls from GNU LIBC to help track down possible memory leaks.
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 6d55c611..9b3b2a84 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -3884,10 +3884,6 @@ for use by the @command{gawk} developers for testing and tuning.
They are subject to change. The variables are:
@table @env
-@item AVG_CHAIN_MAX
-The average number of items @command{gawk} will maintain on a
-hash chain for managing arrays.
-
@item AWK_HASH
If this variable exists with a value of @samp{gst}, @command{gawk}
will switch to using the hash function from GNU Smalltalk for
@@ -3900,6 +3896,13 @@ files one line at a time, instead of reading in blocks. This exists
for debugging problems on filesystems on non-POSIX operating systems
where I/O is performed in records, not in blocks.
+@item GAWK_MSG_SRC
+If this variable exists, @command{gawk} includes the source file
+name and line number from which warning and/or fatal messages
+are generated. Its purpose is to help isolate the source of a
+message, since there can be multiple places which produce the
+same warning or error message.
+
@item GAWK_NO_DFA
If this variable exists, @command{gawk} does not use the DFA regexp matcher
for ``does it match'' kinds of tests. This can cause @command{gawk}
@@ -3912,6 +3915,14 @@ coordinate with each other.)
This specifies the amount by which @command{gawk} should grow its
internal evaluation stack, when needed.
+@item INT_CHAIN_MAX
+The average number of items @command{gawk} will maintain on a
+hash chain for managing arrays indexed by integers.
+
+@item STR_CHAIN_MAX
+The average number of items @command{gawk} will maintain on a
+hash chain for managing arrays indexed by strings.
+
@item TIDYMEM
If this variable exists, @command{gawk} uses the @code{mtrace()} library
calls from GNU LIBC to help track down possible memory leaks.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index ff33673d..d0664ac9 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,10 @@
+2013-10-23 Michael Haubenwallner <michael.haubenwallner@salomon.at>
+
+ Fix portability for AIX.
+
+ * inplace.c (_XOPEN_SOURCE): Define when not defined yet.
+ (_XOPEN_SOURCE_EXTENDED): Ditto. Needs to define a number.
+
2013-08-22 Arnold D. Robbins <arnold@skeeve.com>
Clean up some warnings from -Wextra.
diff --git a/extension/inplace.c b/extension/inplace.c
index 133b40f0..91b1a229 100644
--- a/extension/inplace.c
+++ b/extension/inplace.c
@@ -27,8 +27,12 @@
#include <config.h>
#endif
-#define _XOPEN_SOURCE
-#define _XOPEN_SOURCE_EXTENDED
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE
+#endif
+#ifndef _XOPEN_SOURCE_EXTENDED
+# define _XOPEN_SOURCE_EXTENDED 1
+#endif
#include <stdio.h>
#include <assert.h>
diff --git a/io.c b/io.c
index e0632d8b..3daadb32 100644
--- a/io.c
+++ b/io.c
@@ -1261,12 +1261,15 @@ flush_io()
int status = 0;
errno = 0;
+ /* we don't warn about stdout/stderr if EPIPE, but we do error exit */
if (fflush(stdout)) {
- warning(_("error writing standard output (%s)"), strerror(errno));
+ if (errno != EPIPE)
+ warning(_("error writing standard output (%s)"), strerror(errno));
status++;
}
if (fflush(stderr)) {
- warning(_("error writing standard error (%s)"), strerror(errno));
+ if (errno != EPIPE)
+ warning(_("error writing standard error (%s)"), strerror(errno));
status++;
}
for (rp = red_head; rp != NULL; rp = rp->next)
@@ -1316,13 +1319,16 @@ close_io(bool *stdio_problem)
* them, we just flush them, and do that across the board.
*/
*stdio_problem = false;
- if (fflush(stdout)) {
- warning(_("error writing standard output (%s)"), strerror(errno));
+ /* we don't warn about stdout/stderr if EPIPE, but we do error exit */
+ if (fflush(stdout) != 0) {
+ if (errno != EPIPE)
+ warning(_("error writing standard output (%s)"), strerror(errno));
status++;
*stdio_problem = true;
}
- if (fflush(stderr)) {
- warning(_("error writing standard error (%s)"), strerror(errno));
+ if (fflush(stderr) != 0) {
+ if (errno != EPIPE)
+ warning(_("error writing standard error (%s)"), strerror(errno));
status++;
*stdio_problem = true;
}
diff --git a/main.c b/main.c
index 8e1da06b..289a220f 100644
--- a/main.c
+++ b/main.c
@@ -157,7 +157,7 @@ GETGROUPS_T *groupset; /* current group set */
int ngroups; /* size of said set */
#endif
-void (*lintfunc)(const char *mesg, ...) = warning;
+void (*lintfunc)(const char *mesg, ...) = r_warning;
static const struct option optab[] = {
{ "traditional", no_argument, NULL, 'c' },
@@ -289,6 +289,14 @@ main(int argc, char **argv)
* Ignore SIGPIPE so that writes to pipes that fail don't
* kill the process but instead return -1 and set errno.
* That lets us print a fatal message instead of dieing suddenly.
+ *
+ * Note that this requires ignoring EPIPE when writing and
+ * flushing stdout/stderr in other parts of the program. E.g.,
+ *
+ * gawk 'BEGIN { print "hi" }' | exit
+ *
+ * should not give us "broken pipe" messages --- mainly because
+ * it did not do so in the past and people would complain.
*/
signal(SIGPIPE, SIG_IGN);
#endif
@@ -849,8 +857,13 @@ By default it reads standard input and writes standard output.\n\n"), fp);
fflush(fp);
if (ferror(fp)) {
- if (fp == stdout)
- warning(_("error writing standard output (%s)"), strerror(errno));
+ /* don't warn about stdout/stderr if EPIPE, but do error exit */
+ if (errno != EPIPE) {
+ if (fp == stdout)
+ warning(_("error writing standard output (%s)"), strerror(errno));
+ else if (fp == stderr)
+ warning(_("error writing standard error (%s)"), strerror(errno));
+ }
exit(EXIT_FAILURE);
}
@@ -887,7 +900,9 @@ along with this program. If not, see http://www.gnu.org/licenses/.\n");
fflush(stdout);
if (ferror(stdout)) {
- warning(_("error writing standard output (%s)"), strerror(errno));
+ /* don't warn about stdout if EPIPE, but do error exit */
+ if (errno != EPIPE)
+ warning(_("error writing standard output (%s)"), strerror(errno));
exit(EXIT_FAILURE);
}
diff --git a/msg.c b/msg.c
index edacdd1c..16fef73a 100644
--- a/msg.c
+++ b/msg.c
@@ -44,15 +44,22 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp)
char *file;
const char *me;
+ static bool first = true;
+ static bool add_src_info = false;
+
+ if (first) {
+ first = false;
+ add_src_info = (getenv("GAWK_MSG_SRC") != NULL);
+ }
+
(void) fflush(output_fp);
me = myname;
(void) fprintf(stderr, "%s: ", me);
-#ifdef GAWKDEBUG
- if (srcfile != NULL) {
+
+ if (srcfile != NULL && add_src_info) {
fprintf(stderr, "%s:%d:", srcfile, srcline);
srcfile = NULL;
}
-#endif /* GAWKDEBUG */
if (sourceline > 0) {
if (source != NULL)
@@ -109,10 +116,10 @@ msg(const char *mesg, ...)
va_end(args);
}
-/* warning --- print a warning message */
+/* r_warning --- print a warning message */
void
-warning(const char *mesg, ...)
+r_warning(const char *mesg, ...)
{
va_list args;
va_start(args, mesg);
diff --git a/test/ChangeLog b/test/ChangeLog
index f8da4d82..53b9aaf6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,14 @@
+2013-10-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (pipeio3): Enhance test to be more resilient to variations
+ in error messages produced by different Bourne shells when a command
+ is not found.
+
+2013-10-17 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (pipeio3): New test.
+ * pipeio3.awk, pipeio3.ok: New files.
+
2013-10-10 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (backbigs1, backsmalls1): New tests.
diff --git a/test/Makefile.am b/test/Makefile.am
index e574a22e..118be1d8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1890,6 +1890,12 @@ backsmalls1:
AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+pipeio3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @sed 's/sh.*cart:.*not found/sh: 1: cart: not found/' < _$@ >_x$@ ; mv _x$@ _$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 31e59c13..dfd9ad89 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -2282,6 +2282,12 @@ backsmalls1:
@[ -z "$$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
AWKPATH="$(srcdir)" $(AWK) -f $@.awk "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+pipeio3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @sed 's/sh.*cart:.*not found/sh: 1: cart: not found/' < _$@ >_x$@ ; mv _x$@ _$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
@@ -3191,11 +3197,6 @@ getlnhd:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-pipeio3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
aadelete1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 29f9a17c..df272ce8 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -907,11 +907,6 @@ getlnhd:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-pipeio3:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
aadelete1:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@