aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xChangeLog7
-rw-r--r--NEWS3
-rw-r--r--doc/ChangeLog5
-rw-r--r--doc/gawk.122
-rw-r--r--doc/gawk.info806
-rw-r--r--doc/gawk.texi33
-rw-r--r--doc/gawktexi.in33
-rw-r--r--main.c24
8 files changed, 544 insertions, 389 deletions
diff --git a/ChangeLog b/ChangeLog
index e3719562..0b0ba249 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2018-11-25 Arnold D. Robbins <arnold@skeeve.com>
+ * main.c (platform_name): New function returning platform name.
+ (load_procinfo): Use `platform_name()' to add "platform" element.
+ Thanks to Eli Zaretskii for the suggestion.
+ * NEWS: Updated with info about PROCINFO["platform"].
+
+2018-11-25 Arnold D. Robbins <arnold@skeeve.com>
+
* config.sub: Updated from GNULIB.
2018-11-24 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/NEWS b/NEWS
index 7ad4471c..a25c30d7 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ Changes from 4.2.x to 5.0.0
3. The code now makes some stronger assumptions about a C99 environment.
+4. PROCINFO["platform"] yields a string indicating the platform for
+ which gawk was compiled.
+
Changes from 4.2.1 to 4.2.2
---------------------------
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 4aa10163..16364354 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,10 @@
2018-11-25 Arnold D. Robbins <arnold@skeeve.com>
+ * gawktexi.in: Document PROCINFO["platform"].
+ * gawk.1: Ditto.
+
+2018-11-25 Arnold D. Robbins <arnold@skeeve.com>
+
* gawktexi.in: Small typo fix.
2018-11-24 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/doc/gawk.1 b/doc/gawk.1
index a2448695..17e25768 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -1202,6 +1202,28 @@ doesn't know yet).
The identifier is a user-defined function.
.RE
.TP
+\fBPROCINFO["platform"]\fP
+A string indicating the platform for which
+.I gawk
+was compiled. It is one of:
+.RS
+.TP
+\fB"vms"\fR
+OpenVMS or Vax/VMS.
+.TP
+\fB"macosx"\fR
+Mac OS X.
+.TP
+\fB"cygwin"\fR, \fB"djgpp"\fR, \fB"mingw"\fR
+Microsoft Windows, using either Cygwin, DJGPP, or MinGW, respectively.
+.TP
+\fB"os2"\fR
+OS/2.
+.TP
+\fB"posix"\fR
+GNU/Linux and legacy Unix systems.
+.RE
+.TP
\fBPROCINFO["pgrpid"]\fP
The process group ID of the current process.
.TP
diff --git a/doc/gawk.info b/doc/gawk.info
index 0edef816..986c97d4 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -11043,6 +11043,28 @@ they are not special:
after it has finished parsing the program; they are _not_
updated while the program runs.
+ 'PROCINFO["platform"]'
+ This element gives a string indicating the platform for which
+ 'gawk' was compiled. The value will be one of the following:
+
+ '"vms"'
+ OpenVMS or Vax/VMS.
+
+ '"macosx"'
+ Mac OS X.
+
+ '"cygwin"'
+ '"djgpp"'
+ '"mingw"'
+ Microsoft Windows, using either Cygwin, DJGPP, or MinGW,
+ respectively.
+
+ '"os2"'
+ OS/2.
+
+ '"posix"'
+ GNU/Linux and legacy Unix systems.
+
'PROCINFO["pgrpid"]'
The process group ID of the current process.
@@ -28416,6 +28438,11 @@ POSIX 'awk', in the order they were added to 'gawk'.
* Support for GNU/Linux on Alpha was removed.
+ Version 5.0 added the following features:
+
+ * The 'PROCINFO["platform"]' array element, which allows you to write
+ code that takes the operating system / platform into account.
+

File: gawk.info, Node: Common Extensions, Next: Ranges and Locales, Prev: Feature History, Up: Language History
@@ -33874,7 +33901,7 @@ Index
* dark corner, field separators: Full Line Fields. (line 22)
* dark corner, FILENAME variable: Getline Notes. (line 19)
* dark corner, FILENAME variable <1>: Auto-set. (line 108)
-* dark corner, FNR/NR variables: Auto-set. (line 389)
+* dark corner, FNR/NR variables: Auto-set. (line 411)
* dark corner, format-control characters: Control Letters. (line 33)
* dark corner, format-control characters <1>: Control Letters.
(line 108)
@@ -34110,7 +34137,7 @@ Index
(line 6)
* differences in awk and gawk, RS/RT variables: gawk split records.
(line 58)
-* differences in awk and gawk, RT variable: Auto-set. (line 327)
+* differences in awk and gawk, RT variable: Auto-set. (line 349)
* differences in awk and gawk, single-character fields: Single Character Fields.
(line 6)
* differences in awk and gawk, split() function: String Functions.
@@ -34119,7 +34146,7 @@ Index
* differences in awk and gawk, strings <1>: Scalar Constants. (line 53)
* differences in awk and gawk, strings, storing: gawk split records.
(line 76)
-* differences in awk and gawk, SYMTAB variable: Auto-set. (line 331)
+* differences in awk and gawk, SYMTAB variable: Auto-set. (line 353)
* differences in awk and gawk, TEXTDOMAIN variable: User-modified.
(line 155)
* differences in awk and gawk, trunc-mod operation: Arithmetic Ops.
@@ -34283,7 +34310,7 @@ Index
(line 6)
* extension API version: Extension Versioning.
(line 6)
-* extension API, version number: Auto-set. (line 266)
+* extension API, version number: Auto-set. (line 288)
* extension example: Extension Example. (line 6)
* extension registration: Registration Functions.
(line 6)
@@ -34442,7 +34469,7 @@ Index
(line 12)
* FNR variable: Records. (line 6)
* FNR variable <1>: Auto-set. (line 118)
-* FNR variable, changing: Auto-set. (line 389)
+* FNR variable, changing: Auto-set. (line 411)
* for statement: For Statement. (line 6)
* for statement, looping over arrays: Scanning an Array. (line 20)
* fork() extension function: Extension Sample Fork.
@@ -34546,7 +34573,7 @@ Index
* G., Daniel Richard <1>: Maintainers. (line 14)
* Garfinkle, Scott: Contributors. (line 35)
* gawk program, dynamic profiling: Profiling. (line 177)
-* gawk version: Auto-set. (line 241)
+* gawk version: Auto-set. (line 263)
* gawk, ARGIND variable in: Other Arguments. (line 15)
* gawk, awk and: Preface. (line 21)
* gawk, awk and <1>: This Manual. (line 14)
@@ -34622,13 +34649,13 @@ Index
* gawk, regular expressions, precedence: Regexp Operators. (line 161)
* gawk, RT variable in: awk split records. (line 131)
* gawk, RT variable in <1>: Multiple Line. (line 130)
-* gawk, RT variable in <2>: Auto-set. (line 327)
+* gawk, RT variable in <2>: Auto-set. (line 349)
* gawk, See Also awk: Preface. (line 34)
* gawk, source code, obtaining: Getting. (line 6)
* gawk, splitting fields and: Testing field creation.
(line 6)
* gawk, string-translation functions: I18N Functions. (line 6)
-* gawk, SYMTAB array in: Auto-set. (line 331)
+* gawk, SYMTAB array in: Auto-set. (line 353)
* gawk, TEXTDOMAIN variable in: User-modified. (line 155)
* gawk, timestamps: Time Functions. (line 6)
* gawk, uses for: Preface. (line 34)
@@ -35026,7 +35053,7 @@ Index
* mawk utility <2>: Concatenation. (line 36)
* mawk utility <3>: Nextfile Statement. (line 47)
* mawk utility <4>: Other Versions. (line 39)
-* maximum precision supported by MPFR library: Auto-set. (line 255)
+* maximum precision supported by MPFR library: Auto-set. (line 277)
* McIlroy, Doug: Glossary. (line 255)
* McPhee, Patrick: Contributors. (line 103)
* message object files: Explaining gettext. (line 42)
@@ -35039,7 +35066,7 @@ Index
* messages from extensions: Printing Messages. (line 6)
* metacharacters in regular expressions: Regexp Operators. (line 6)
* metacharacters, escape sequences for: Escape Sequences. (line 140)
-* minimum precision required by MPFR library: Auto-set. (line 258)
+* minimum precision required by MPFR library: Auto-set. (line 280)
* mktime: Time Functions. (line 25)
* modifiers, in format specifiers: Format Modifiers. (line 6)
* monetary information, localization: Explaining gettext. (line 104)
@@ -35098,7 +35125,7 @@ Index
* not Boolean-logic operator: Boolean Ops. (line 6)
* NR variable: Records. (line 6)
* NR variable <1>: Auto-set. (line 143)
-* NR variable, changing: Auto-set. (line 389)
+* NR variable, changing: Auto-set. (line 411)
* null strings: awk split records. (line 121)
* null strings <1>: Regexp Field Splitting.
(line 43)
@@ -35218,7 +35245,7 @@ Index
* p debugger command (alias for print): Viewing And Changing Data.
(line 35)
* Papadopoulos, Panos: Contributors. (line 131)
-* parent process ID of gawk process: Auto-set. (line 230)
+* parent process ID of gawk process: Auto-set. (line 252)
* parentheses (), in a profile: Profiling. (line 146)
* parentheses (), regexp operator: Regexp Operators. (line 81)
* password file: Passwd Functions. (line 16)
@@ -35251,6 +35278,7 @@ Index
* pipe, output: Redirection. (line 57)
* Pitts, Dave: Acknowledgments. (line 60)
* Pitts, Dave <1>: Maintainers. (line 14)
+* platform running on, PROCINFO["platform"]: Auto-set. (line 224)
* Plauger, P.J.: Library Functions. (line 12)
* plug-in: Extension Intro. (line 6)
* plus sign (+), + operator: Precedence. (line 51)
@@ -35387,8 +35415,8 @@ Index
* printing, unduplicated lines of text: Uniq Program. (line 6)
* printing, user information: Id Program. (line 6)
* private variables: Library Names. (line 11)
-* process group ID of gawk process: Auto-set. (line 224)
-* process ID of gawk process: Auto-set. (line 227)
+* process group ID of gawk process: Auto-set. (line 246)
+* process ID of gawk process: Auto-set. (line 249)
* processes, two-way communications with: Two-way I/O. (line 6)
* processing data: Basic High Level. (line 6)
* PROCINFO array: Auto-set. (line 148)
@@ -35565,7 +35593,7 @@ Index
* right shift: Bitwise Functions. (line 54)
* right shift, bitwise: Bitwise Functions. (line 32)
* Ritchie, Dennis: Basic Data Typing. (line 54)
-* RLENGTH variable: Auto-set. (line 314)
+* RLENGTH variable: Auto-set. (line 336)
* RLENGTH variable, match() function and: String Functions. (line 228)
* Robbins, Arnold: Command Line Field Separator.
(line 71)
@@ -35593,11 +35621,11 @@ Index
* RS variable <1>: User-modified. (line 136)
* RS variable, multiline records and: Multiple Line. (line 17)
* rshift: Bitwise Functions. (line 54)
-* RSTART variable: Auto-set. (line 320)
+* RSTART variable: Auto-set. (line 342)
* RSTART variable, match() function and: String Functions. (line 228)
* RT variable: awk split records. (line 131)
* RT variable <1>: Multiple Line. (line 130)
-* RT variable <2>: Auto-set. (line 327)
+* RT variable <2>: Auto-set. (line 349)
* Rubin, Paul: History. (line 30)
* Rubin, Paul <1>: Contributors. (line 16)
* rule, definition of: Getting Started. (line 21)
@@ -35615,7 +35643,7 @@ Index
* scanning arrays: Scanning an Array. (line 6)
* scanning multidimensional arrays: Multiscanning. (line 11)
* Schorr, Andrew: Acknowledgments. (line 60)
-* Schorr, Andrew <1>: Auto-set. (line 359)
+* Schorr, Andrew <1>: Auto-set. (line 381)
* Schorr, Andrew <2>: Contributors. (line 136)
* Schreiber, Bert: Acknowledgments. (line 38)
* Schreiber, Rita: Acknowledgments. (line 38)
@@ -35701,7 +35729,7 @@ Index
* sidebar, Beware The Smoke and Mirrors!: Bitwise Functions. (line 127)
* sidebar, Changing FS Does Not Affect the Fields: Full Line Fields.
(line 14)
-* sidebar, Changing NR and FNR: Auto-set. (line 387)
+* sidebar, Changing NR and FNR: Auto-set. (line 409)
* sidebar, Controlling Output Buffering with system(): I/O Functions.
(line 166)
* sidebar, Escape Sequences for Metacharacters: Escape Sequences.
@@ -35868,9 +35896,9 @@ Index
* substr: String Functions. (line 485)
* substring: String Functions. (line 485)
* Sumner, Andrew: Other Versions. (line 64)
-* supplementary groups of gawk process: Auto-set. (line 271)
+* supplementary groups of gawk process: Auto-set. (line 293)
* switch statement: Switch Statement. (line 6)
-* SYMTAB array: Auto-set. (line 331)
+* SYMTAB array: Auto-set. (line 353)
* syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops.
(line 149)
* system: I/O Functions. (line 106)
@@ -36052,10 +36080,10 @@ Index
* variables, uninitialized, as array subscripts: Uninitialized Subscripts.
(line 6)
* variables, user-defined: Variables. (line 6)
-* version of gawk: Auto-set. (line 241)
-* version of gawk extension API: Auto-set. (line 266)
-* version of GNU MP library: Auto-set. (line 249)
-* version of GNU MPFR library: Auto-set. (line 251)
+* version of gawk: Auto-set. (line 263)
+* version of gawk extension API: Auto-set. (line 288)
+* version of GNU MP library: Auto-set. (line 271)
+* version of GNU MPFR library: Auto-set. (line 273)
* vertical bar (|): Regexp Operators. (line 70)
* vertical bar (|), | operator (I/O): Getline/Pipe. (line 10)
* vertical bar (|), | operator (I/O) <1>: Precedence. (line 64)
@@ -36334,369 +36362,369 @@ Node: Exit Statement454653
Node: Built-in Variables457056
Node: User-modified458189
Node: Auto-set465956
-Ref: Auto-set-Footnote-1482258
-Ref: Auto-set-Footnote-2482464
-Node: ARGC and ARGV482520
-Node: Pattern Action Summary486733
-Node: Arrays489163
-Node: Array Basics490492
-Node: Array Intro491336
-Ref: figure-array-elements493311
-Ref: Array Intro-Footnote-1496015
-Node: Reference to Elements496143
-Node: Assigning Elements498607
-Node: Array Example499098
-Node: Scanning an Array500857
-Node: Controlling Scanning503879
-Ref: Controlling Scanning-Footnote-1509278
-Node: Numeric Array Subscripts509594
-Node: Uninitialized Subscripts511778
-Node: Delete513397
-Ref: Delete-Footnote-1516149
-Node: Multidimensional516206
-Node: Multiscanning519301
-Node: Arrays of Arrays520892
-Node: Arrays Summary525660
-Node: Functions527753
-Node: Built-in528791
-Node: Calling Built-in529872
-Node: Numeric Functions531868
-Ref: Numeric Functions-Footnote-1535896
-Ref: Numeric Functions-Footnote-2536253
-Ref: Numeric Functions-Footnote-3536301
-Node: String Functions536573
-Ref: String Functions-Footnote-1560282
-Ref: String Functions-Footnote-2560410
-Ref: String Functions-Footnote-3560658
-Node: Gory Details560745
-Ref: table-sub-escapes562536
-Ref: table-sub-proposed564055
-Ref: table-posix-sub565418
-Ref: table-gensub-escapes566959
-Ref: Gory Details-Footnote-1567782
-Node: I/O Functions567936
-Ref: table-system-return-values574404
-Ref: I/O Functions-Footnote-1576484
-Ref: I/O Functions-Footnote-2576632
-Node: Time Functions576752
-Ref: Time Functions-Footnote-1587423
-Ref: Time Functions-Footnote-2587491
-Ref: Time Functions-Footnote-3587649
-Ref: Time Functions-Footnote-4587760
-Ref: Time Functions-Footnote-5587872
-Ref: Time Functions-Footnote-6588099
-Node: Bitwise Functions588365
-Ref: table-bitwise-ops588959
-Ref: Bitwise Functions-Footnote-1595022
-Ref: Bitwise Functions-Footnote-2595195
-Node: Type Functions595386
-Node: I18N Functions598137
-Node: User-defined599788
-Node: Definition Syntax600593
-Ref: Definition Syntax-Footnote-1606280
-Node: Function Example606351
-Ref: Function Example-Footnote-1609273
-Node: Function Caveats609295
-Node: Calling A Function609813
-Node: Variable Scope610771
-Node: Pass By Value/Reference613765
-Node: Return Statement617264
-Node: Dynamic Typing620243
-Node: Indirect Calls621173
-Ref: Indirect Calls-Footnote-1631425
-Node: Functions Summary631553
-Node: Library Functions634258
-Ref: Library Functions-Footnote-1637865
-Ref: Library Functions-Footnote-2638008
-Node: Library Names638179
-Ref: Library Names-Footnote-1641639
-Ref: Library Names-Footnote-2641862
-Node: General Functions641948
-Node: Strtonum Function643051
-Node: Assert Function646073
-Node: Round Function649399
-Node: Cliff Random Function650939
-Node: Ordinal Functions651955
-Ref: Ordinal Functions-Footnote-1655018
-Ref: Ordinal Functions-Footnote-2655270
-Node: Join Function655480
-Ref: Join Function-Footnote-1657250
-Node: Getlocaltime Function657450
-Node: Readfile Function661192
-Node: Shell Quoting663169
-Node: Data File Management664570
-Node: Filetrans Function665202
-Node: Rewind Function669298
-Node: File Checking671208
-Ref: File Checking-Footnote-1672542
-Node: Empty Files672743
-Node: Ignoring Assigns674722
-Node: Getopt Function676272
-Ref: Getopt Function-Footnote-1687741
-Node: Passwd Functions687941
-Ref: Passwd Functions-Footnote-1696780
-Node: Group Functions696868
-Ref: Group Functions-Footnote-1704766
-Node: Walking Arrays704973
-Node: Library Functions Summary707981
-Node: Library Exercises709387
-Node: Sample Programs709852
-Node: Running Examples710622
-Node: Clones711350
-Node: Cut Program712574
-Node: Egrep Program722503
-Ref: Egrep Program-Footnote-1730015
-Node: Id Program730125
-Node: Split Program733805
-Ref: Split Program-Footnote-1737263
-Node: Tee Program737392
-Node: Uniq Program740182
-Node: Wc Program747608
-Ref: Wc Program-Footnote-1751863
-Node: Miscellaneous Programs751957
-Node: Dupword Program753170
-Node: Alarm Program755200
-Node: Translate Program760055
-Ref: Translate Program-Footnote-1764620
-Node: Labels Program764890
-Ref: Labels Program-Footnote-1768241
-Node: Word Sorting768325
-Node: History Sorting772397
-Node: Extract Program774232
-Node: Simple Sed782286
-Node: Igawk Program785360
-Ref: Igawk Program-Footnote-1799691
-Ref: Igawk Program-Footnote-2799893
-Ref: Igawk Program-Footnote-3800015
-Node: Anagram Program800130
-Node: Signature Program803192
-Node: Programs Summary804439
-Node: Programs Exercises805653
-Ref: Programs Exercises-Footnote-1809782
-Node: Advanced Features809873
-Node: Nondecimal Data811863
-Node: Array Sorting813454
-Node: Controlling Array Traversal814154
-Ref: Controlling Array Traversal-Footnote-1822522
-Node: Array Sorting Functions822640
-Ref: Array Sorting Functions-Footnote-1827731
-Node: Two-way I/O827927
-Ref: Two-way I/O-Footnote-1835647
-Ref: Two-way I/O-Footnote-2835834
-Node: TCP/IP Networking835916
-Node: Profiling839034
-Ref: Profiling-Footnote-1847706
-Node: Advanced Features Summary848029
-Node: Internationalization849873
-Node: I18N and L10N851353
-Node: Explaining gettext852040
-Ref: Explaining gettext-Footnote-1857932
-Ref: Explaining gettext-Footnote-2858117
-Node: Programmer i18n858282
-Ref: Programmer i18n-Footnote-1863231
-Node: Translator i18n863280
-Node: String Extraction864074
-Ref: String Extraction-Footnote-1865206
-Node: Printf Ordering865292
-Ref: Printf Ordering-Footnote-1868078
-Node: I18N Portability868142
-Ref: I18N Portability-Footnote-1870598
-Node: I18N Example870661
-Ref: I18N Example-Footnote-1873467
-Node: Gawk I18N873540
-Node: I18N Summary874185
-Node: Debugger875526
-Node: Debugging876549
-Node: Debugging Concepts876990
-Node: Debugging Terms878799
-Node: Awk Debugging881374
-Node: Sample Debugging Session882280
-Node: Debugger Invocation882814
-Node: Finding The Bug884200
-Node: List of Debugger Commands890678
-Node: Breakpoint Control892011
-Node: Debugger Execution Control895705
-Node: Viewing And Changing Data899067
-Node: Execution Stack902441
-Node: Debugger Info904078
-Node: Miscellaneous Debugger Commands908149
-Node: Readline Support913211
-Node: Limitations914107
-Node: Debugging Summary916216
-Node: Arbitrary Precision Arithmetic917495
-Node: Computer Arithmetic918980
-Ref: table-numeric-ranges922746
-Ref: table-floating-point-ranges923239
-Ref: Computer Arithmetic-Footnote-1923897
-Node: Math Definitions923954
-Ref: table-ieee-formats927270
-Ref: Math Definitions-Footnote-1927873
-Node: MPFR features927978
-Node: FP Math Caution929696
-Ref: FP Math Caution-Footnote-1930768
-Node: Inexactness of computations931137
-Node: Inexact representation932097
-Node: Comparing FP Values933457
-Node: Errors accumulate934698
-Node: Getting Accuracy936131
-Node: Try To Round938841
-Node: Setting precision939740
-Ref: table-predefined-precision-strings940437
-Node: Setting the rounding mode942267
-Ref: table-gawk-rounding-modes942641
-Ref: Setting the rounding mode-Footnote-1946572
-Node: Arbitrary Precision Integers946751
-Ref: Arbitrary Precision Integers-Footnote-1949926
-Node: Checking for MPFR950075
-Node: POSIX Floating Point Problems951549
-Ref: POSIX Floating Point Problems-Footnote-1955834
-Node: Floating point summary955872
-Node: Dynamic Extensions958062
-Node: Extension Intro959615
-Node: Plugin License960881
-Node: Extension Mechanism Outline961678
-Ref: figure-load-extension962117
-Ref: figure-register-new-function963682
-Ref: figure-call-new-function964774
-Node: Extension API Description966836
-Node: Extension API Functions Introduction968478
-Node: General Data Types974018
-Ref: General Data Types-Footnote-1982379
-Node: Memory Allocation Functions982678
-Ref: Memory Allocation Functions-Footnote-1986888
-Node: Constructor Functions986987
-Node: Registration Functions990573
-Node: Extension Functions991258
-Node: Exit Callback Functions996473
-Node: Extension Version String997723
-Node: Input Parsers998386
-Node: Output Wrappers1011107
-Node: Two-way processors1015619
-Node: Printing Messages1017884
-Ref: Printing Messages-Footnote-11019055
-Node: Updating ERRNO1019208
-Node: Requesting Values1019947
-Ref: table-value-types-returned1020684
-Node: Accessing Parameters1021620
-Node: Symbol Table Access1022855
-Node: Symbol table by name1023367
-Node: Symbol table by cookie1025156
-Ref: Symbol table by cookie-Footnote-11029341
-Node: Cached values1029405
-Ref: Cached values-Footnote-11032941
-Node: Array Manipulation1033094
-Ref: Array Manipulation-Footnote-11034185
-Node: Array Data Types1034222
-Ref: Array Data Types-Footnote-11036880
-Node: Array Functions1036972
-Node: Flattening Arrays1041470
-Node: Creating Arrays1048446
-Node: Redirection API1053213
-Node: Extension API Variables1056046
-Node: Extension Versioning1056757
-Ref: gawk-api-version1057186
-Node: Extension GMP/MPFR Versioning1058917
-Node: Extension API Informational Variables1060545
-Node: Extension API Boilerplate1061618
-Node: Changes from API V11065592
-Node: Finding Extensions1067164
-Node: Extension Example1067723
-Node: Internal File Description1068521
-Node: Internal File Ops1072601
-Ref: Internal File Ops-Footnote-11083951
-Node: Using Internal File Ops1084091
-Ref: Using Internal File Ops-Footnote-11086474
-Node: Extension Samples1086748
-Node: Extension Sample File Functions1088277
-Node: Extension Sample Fnmatch1095926
-Node: Extension Sample Fork1097413
-Node: Extension Sample Inplace1098631
-Node: Extension Sample Ord1101848
-Node: Extension Sample Readdir1102684
-Ref: table-readdir-file-types1103573
-Node: Extension Sample Revout1104378
-Node: Extension Sample Rev2way1104967
-Node: Extension Sample Read write array1105707
-Node: Extension Sample Readfile1107649
-Node: Extension Sample Time1108744
-Node: Extension Sample API Tests1110092
-Node: gawkextlib1110584
-Node: Extension summary1113502
-Node: Extension Exercises1117204
-Node: Language History1118702
-Node: V7/SVR3.11120358
-Node: SVR41122510
-Node: POSIX1123944
-Node: BTL1125324
-Node: POSIX/GNU1126053
-Node: Feature History1131831
-Node: Common Extensions1147690
-Node: Ranges and Locales1148973
-Ref: Ranges and Locales-Footnote-11153589
-Ref: Ranges and Locales-Footnote-21153616
-Ref: Ranges and Locales-Footnote-31153851
-Node: Contributors1154072
-Node: History summary1160017
-Node: Installation1161397
-Node: Gawk Distribution1162341
-Node: Getting1162825
-Node: Extracting1163788
-Node: Distribution contents1165426
-Node: Unix Installation1171906
-Node: Quick Installation1172588
-Node: Shell Startup Files1175002
-Node: Additional Configuration Options1176091
-Node: Configuration Philosophy1178256
-Node: Non-Unix Installation1180625
-Node: PC Installation1181085
-Node: PC Binary Installation1181923
-Node: PC Compiling1182358
-Node: PC Using1183475
-Node: Cygwin1186690
-Node: MSYS1187789
-Node: VMS Installation1188290
-Node: VMS Compilation1189081
-Ref: VMS Compilation-Footnote-11190310
-Node: VMS Dynamic Extensions1190368
-Node: VMS Installation Details1192053
-Node: VMS Running1194306
-Node: VMS GNV1198585
-Node: VMS Old Gawk1199320
-Node: Bugs1199791
-Node: Bug address1200454
-Node: Usenet1203436
-Node: Maintainers1204440
-Node: Other Versions1205701
-Node: Installation summary1212259
-Node: Notes1213461
-Node: Compatibility Mode1214255
-Node: Additions1215037
-Node: Accessing The Source1215962
-Node: Adding Code1217399
-Node: New Ports1223618
-Node: Derived Files1228106
-Ref: Derived Files-Footnote-11233752
-Ref: Derived Files-Footnote-21233787
-Ref: Derived Files-Footnote-31234385
-Node: Future Extensions1234499
-Node: Implementation Limitations1235157
-Node: Extension Design1236340
-Node: Old Extension Problems1237484
-Ref: Old Extension Problems-Footnote-11239002
-Node: Extension New Mechanism Goals1239059
-Ref: Extension New Mechanism Goals-Footnote-11242423
-Node: Extension Other Design Decisions1242612
-Node: Extension Future Growth1244725
-Node: Notes summary1245561
-Node: Basic Concepts1246736
-Node: Basic High Level1247417
-Ref: figure-general-flow1247699
-Ref: figure-process-flow1248384
-Ref: Basic High Level-Footnote-11251685
-Node: Basic Data Typing1251870
-Node: Glossary1255198
-Node: Copying1287036
-Node: GNU Free Documentation License1324579
-Node: Index1349699
+Ref: Auto-set-Footnote-1482806
+Ref: Auto-set-Footnote-2483012
+Node: ARGC and ARGV483068
+Node: Pattern Action Summary487281
+Node: Arrays489711
+Node: Array Basics491040
+Node: Array Intro491884
+Ref: figure-array-elements493859
+Ref: Array Intro-Footnote-1496563
+Node: Reference to Elements496691
+Node: Assigning Elements499155
+Node: Array Example499646
+Node: Scanning an Array501405
+Node: Controlling Scanning504427
+Ref: Controlling Scanning-Footnote-1509826
+Node: Numeric Array Subscripts510142
+Node: Uninitialized Subscripts512326
+Node: Delete513945
+Ref: Delete-Footnote-1516697
+Node: Multidimensional516754
+Node: Multiscanning519849
+Node: Arrays of Arrays521440
+Node: Arrays Summary526208
+Node: Functions528301
+Node: Built-in529339
+Node: Calling Built-in530420
+Node: Numeric Functions532416
+Ref: Numeric Functions-Footnote-1536444
+Ref: Numeric Functions-Footnote-2536801
+Ref: Numeric Functions-Footnote-3536849
+Node: String Functions537121
+Ref: String Functions-Footnote-1560830
+Ref: String Functions-Footnote-2560958
+Ref: String Functions-Footnote-3561206
+Node: Gory Details561293
+Ref: table-sub-escapes563084
+Ref: table-sub-proposed564603
+Ref: table-posix-sub565966
+Ref: table-gensub-escapes567507
+Ref: Gory Details-Footnote-1568330
+Node: I/O Functions568484
+Ref: table-system-return-values574952
+Ref: I/O Functions-Footnote-1577032
+Ref: I/O Functions-Footnote-2577180
+Node: Time Functions577300
+Ref: Time Functions-Footnote-1587971
+Ref: Time Functions-Footnote-2588039
+Ref: Time Functions-Footnote-3588197
+Ref: Time Functions-Footnote-4588308
+Ref: Time Functions-Footnote-5588420
+Ref: Time Functions-Footnote-6588647
+Node: Bitwise Functions588913
+Ref: table-bitwise-ops589507
+Ref: Bitwise Functions-Footnote-1595570
+Ref: Bitwise Functions-Footnote-2595743
+Node: Type Functions595934
+Node: I18N Functions598685
+Node: User-defined600336
+Node: Definition Syntax601141
+Ref: Definition Syntax-Footnote-1606828
+Node: Function Example606899
+Ref: Function Example-Footnote-1609821
+Node: Function Caveats609843
+Node: Calling A Function610361
+Node: Variable Scope611319
+Node: Pass By Value/Reference614313
+Node: Return Statement617812
+Node: Dynamic Typing620791
+Node: Indirect Calls621721
+Ref: Indirect Calls-Footnote-1631973
+Node: Functions Summary632101
+Node: Library Functions634806
+Ref: Library Functions-Footnote-1638413
+Ref: Library Functions-Footnote-2638556
+Node: Library Names638727
+Ref: Library Names-Footnote-1642187
+Ref: Library Names-Footnote-2642410
+Node: General Functions642496
+Node: Strtonum Function643599
+Node: Assert Function646621
+Node: Round Function649947
+Node: Cliff Random Function651487
+Node: Ordinal Functions652503
+Ref: Ordinal Functions-Footnote-1655566
+Ref: Ordinal Functions-Footnote-2655818
+Node: Join Function656028
+Ref: Join Function-Footnote-1657798
+Node: Getlocaltime Function657998
+Node: Readfile Function661740
+Node: Shell Quoting663717
+Node: Data File Management665118
+Node: Filetrans Function665750
+Node: Rewind Function669846
+Node: File Checking671756
+Ref: File Checking-Footnote-1673090
+Node: Empty Files673291
+Node: Ignoring Assigns675270
+Node: Getopt Function676820
+Ref: Getopt Function-Footnote-1688289
+Node: Passwd Functions688489
+Ref: Passwd Functions-Footnote-1697328
+Node: Group Functions697416
+Ref: Group Functions-Footnote-1705314
+Node: Walking Arrays705521
+Node: Library Functions Summary708529
+Node: Library Exercises709935
+Node: Sample Programs710400
+Node: Running Examples711170
+Node: Clones711898
+Node: Cut Program713122
+Node: Egrep Program723051
+Ref: Egrep Program-Footnote-1730563
+Node: Id Program730673
+Node: Split Program734353
+Ref: Split Program-Footnote-1737811
+Node: Tee Program737940
+Node: Uniq Program740730
+Node: Wc Program748156
+Ref: Wc Program-Footnote-1752411
+Node: Miscellaneous Programs752505
+Node: Dupword Program753718
+Node: Alarm Program755748
+Node: Translate Program760603
+Ref: Translate Program-Footnote-1765168
+Node: Labels Program765438
+Ref: Labels Program-Footnote-1768789
+Node: Word Sorting768873
+Node: History Sorting772945
+Node: Extract Program774780
+Node: Simple Sed782834
+Node: Igawk Program785908
+Ref: Igawk Program-Footnote-1800239
+Ref: Igawk Program-Footnote-2800441
+Ref: Igawk Program-Footnote-3800563
+Node: Anagram Program800678
+Node: Signature Program803740
+Node: Programs Summary804987
+Node: Programs Exercises806201
+Ref: Programs Exercises-Footnote-1810330
+Node: Advanced Features810421
+Node: Nondecimal Data812411
+Node: Array Sorting814002
+Node: Controlling Array Traversal814702
+Ref: Controlling Array Traversal-Footnote-1823070
+Node: Array Sorting Functions823188
+Ref: Array Sorting Functions-Footnote-1828279
+Node: Two-way I/O828475
+Ref: Two-way I/O-Footnote-1836195
+Ref: Two-way I/O-Footnote-2836382
+Node: TCP/IP Networking836464
+Node: Profiling839582
+Ref: Profiling-Footnote-1848254
+Node: Advanced Features Summary848577
+Node: Internationalization850421
+Node: I18N and L10N851901
+Node: Explaining gettext852588
+Ref: Explaining gettext-Footnote-1858480
+Ref: Explaining gettext-Footnote-2858665
+Node: Programmer i18n858830
+Ref: Programmer i18n-Footnote-1863779
+Node: Translator i18n863828
+Node: String Extraction864622
+Ref: String Extraction-Footnote-1865754
+Node: Printf Ordering865840
+Ref: Printf Ordering-Footnote-1868626
+Node: I18N Portability868690
+Ref: I18N Portability-Footnote-1871146
+Node: I18N Example871209
+Ref: I18N Example-Footnote-1874015
+Node: Gawk I18N874088
+Node: I18N Summary874733
+Node: Debugger876074
+Node: Debugging877097
+Node: Debugging Concepts877538
+Node: Debugging Terms879347
+Node: Awk Debugging881922
+Node: Sample Debugging Session882828
+Node: Debugger Invocation883362
+Node: Finding The Bug884748
+Node: List of Debugger Commands891226
+Node: Breakpoint Control892559
+Node: Debugger Execution Control896253
+Node: Viewing And Changing Data899615
+Node: Execution Stack902989
+Node: Debugger Info904626
+Node: Miscellaneous Debugger Commands908697
+Node: Readline Support913759
+Node: Limitations914655
+Node: Debugging Summary916764
+Node: Arbitrary Precision Arithmetic918043
+Node: Computer Arithmetic919528
+Ref: table-numeric-ranges923294
+Ref: table-floating-point-ranges923787
+Ref: Computer Arithmetic-Footnote-1924445
+Node: Math Definitions924502
+Ref: table-ieee-formats927818
+Ref: Math Definitions-Footnote-1928421
+Node: MPFR features928526
+Node: FP Math Caution930244
+Ref: FP Math Caution-Footnote-1931316
+Node: Inexactness of computations931685
+Node: Inexact representation932645
+Node: Comparing FP Values934005
+Node: Errors accumulate935246
+Node: Getting Accuracy936679
+Node: Try To Round939389
+Node: Setting precision940288
+Ref: table-predefined-precision-strings940985
+Node: Setting the rounding mode942815
+Ref: table-gawk-rounding-modes943189
+Ref: Setting the rounding mode-Footnote-1947120
+Node: Arbitrary Precision Integers947299
+Ref: Arbitrary Precision Integers-Footnote-1950474
+Node: Checking for MPFR950623
+Node: POSIX Floating Point Problems952097
+Ref: POSIX Floating Point Problems-Footnote-1956382
+Node: Floating point summary956420
+Node: Dynamic Extensions958610
+Node: Extension Intro960163
+Node: Plugin License961429
+Node: Extension Mechanism Outline962226
+Ref: figure-load-extension962665
+Ref: figure-register-new-function964230
+Ref: figure-call-new-function965322
+Node: Extension API Description967384
+Node: Extension API Functions Introduction969026
+Node: General Data Types974566
+Ref: General Data Types-Footnote-1982927
+Node: Memory Allocation Functions983226
+Ref: Memory Allocation Functions-Footnote-1987436
+Node: Constructor Functions987535
+Node: Registration Functions991121
+Node: Extension Functions991806
+Node: Exit Callback Functions997021
+Node: Extension Version String998271
+Node: Input Parsers998934
+Node: Output Wrappers1011655
+Node: Two-way processors1016167
+Node: Printing Messages1018432
+Ref: Printing Messages-Footnote-11019603
+Node: Updating ERRNO1019756
+Node: Requesting Values1020495
+Ref: table-value-types-returned1021232
+Node: Accessing Parameters1022168
+Node: Symbol Table Access1023403
+Node: Symbol table by name1023915
+Node: Symbol table by cookie1025704
+Ref: Symbol table by cookie-Footnote-11029889
+Node: Cached values1029953
+Ref: Cached values-Footnote-11033489
+Node: Array Manipulation1033642
+Ref: Array Manipulation-Footnote-11034733
+Node: Array Data Types1034770
+Ref: Array Data Types-Footnote-11037428
+Node: Array Functions1037520
+Node: Flattening Arrays1042018
+Node: Creating Arrays1048994
+Node: Redirection API1053761
+Node: Extension API Variables1056594
+Node: Extension Versioning1057305
+Ref: gawk-api-version1057734
+Node: Extension GMP/MPFR Versioning1059465
+Node: Extension API Informational Variables1061093
+Node: Extension API Boilerplate1062166
+Node: Changes from API V11066140
+Node: Finding Extensions1067712
+Node: Extension Example1068271
+Node: Internal File Description1069069
+Node: Internal File Ops1073149
+Ref: Internal File Ops-Footnote-11084499
+Node: Using Internal File Ops1084639
+Ref: Using Internal File Ops-Footnote-11087022
+Node: Extension Samples1087296
+Node: Extension Sample File Functions1088825
+Node: Extension Sample Fnmatch1096474
+Node: Extension Sample Fork1097961
+Node: Extension Sample Inplace1099179
+Node: Extension Sample Ord1102396
+Node: Extension Sample Readdir1103232
+Ref: table-readdir-file-types1104121
+Node: Extension Sample Revout1104926
+Node: Extension Sample Rev2way1105515
+Node: Extension Sample Read write array1106255
+Node: Extension Sample Readfile1108197
+Node: Extension Sample Time1109292
+Node: Extension Sample API Tests1110640
+Node: gawkextlib1111132
+Node: Extension summary1114050
+Node: Extension Exercises1117752
+Node: Language History1119250
+Node: V7/SVR3.11120906
+Node: SVR41123058
+Node: POSIX1124492
+Node: BTL1125872
+Node: POSIX/GNU1126601
+Node: Feature History1132379
+Node: Common Extensions1148425
+Node: Ranges and Locales1149708
+Ref: Ranges and Locales-Footnote-11154324
+Ref: Ranges and Locales-Footnote-21154351
+Ref: Ranges and Locales-Footnote-31154586
+Node: Contributors1154807
+Node: History summary1160752
+Node: Installation1162132
+Node: Gawk Distribution1163076
+Node: Getting1163560
+Node: Extracting1164523
+Node: Distribution contents1166161
+Node: Unix Installation1172641
+Node: Quick Installation1173323
+Node: Shell Startup Files1175737
+Node: Additional Configuration Options1176826
+Node: Configuration Philosophy1178991
+Node: Non-Unix Installation1181360
+Node: PC Installation1181820
+Node: PC Binary Installation1182658
+Node: PC Compiling1183093
+Node: PC Using1184210
+Node: Cygwin1187425
+Node: MSYS1188524
+Node: VMS Installation1189025
+Node: VMS Compilation1189816
+Ref: VMS Compilation-Footnote-11191045
+Node: VMS Dynamic Extensions1191103
+Node: VMS Installation Details1192788
+Node: VMS Running1195041
+Node: VMS GNV1199320
+Node: VMS Old Gawk1200055
+Node: Bugs1200526
+Node: Bug address1201189
+Node: Usenet1204171
+Node: Maintainers1205175
+Node: Other Versions1206436
+Node: Installation summary1212994
+Node: Notes1214196
+Node: Compatibility Mode1214990
+Node: Additions1215772
+Node: Accessing The Source1216697
+Node: Adding Code1218134
+Node: New Ports1224353
+Node: Derived Files1228841
+Ref: Derived Files-Footnote-11234487
+Ref: Derived Files-Footnote-21234522
+Ref: Derived Files-Footnote-31235120
+Node: Future Extensions1235234
+Node: Implementation Limitations1235892
+Node: Extension Design1237075
+Node: Old Extension Problems1238219
+Ref: Old Extension Problems-Footnote-11239737
+Node: Extension New Mechanism Goals1239794
+Ref: Extension New Mechanism Goals-Footnote-11243158
+Node: Extension Other Design Decisions1243347
+Node: Extension Future Growth1245460
+Node: Notes summary1246296
+Node: Basic Concepts1247471
+Node: Basic High Level1248152
+Ref: figure-general-flow1248434
+Ref: figure-process-flow1249119
+Ref: Basic High Level-Footnote-11252420
+Node: Basic Data Typing1252605
+Node: Glossary1255933
+Node: Copying1287771
+Node: GNU Free Documentation License1325314
+Node: Index1350434

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 177d02f2..3be098ba 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -15752,6 +15752,31 @@ The values indicate what @command{gawk} knows about the identifiers
after it has finished parsing the program; they are @emph{not} updated
while the program runs.
+@item PROCINFO["platform"]
+@cindex platform running on, @code{PROCINFO["platform"]}
+This element gives a string indicating the platform for which
+@command{gawk} was compiled. The value will be one of the following:
+
+@c nested table
+@table @code
+@item "vms"
+OpenVMS or Vax/VMS.
+
+@item "macosx"
+Mac OS X.
+
+@item "cygwin"
+@itemx "djgpp"
+@itemx "mingw"
+Microsoft Windows, using either Cygwin, DJGPP, or MinGW, respectively.
+
+@item "os2"
+OS/2.
+
+@item "posix"
+GNU/Linux and legacy Unix systems.
+@end table
+
@item PROCINFO["pgrpid"]
@cindex process group ID of @command{gawk} process
The process group ID of the current process.
@@ -38868,6 +38893,14 @@ Support for GNU/Linux on Alpha was removed.
@end itemize
+Version 5.0 added the following features:
+
+@itemize
+@item
+The @code{PROCINFO["platform"]} array element, which allows you
+to write code that takes the operating system / platform into account.
+@end itemize
+
@c XXX ADD MORE STUFF HERE
@end ifclear
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 8b0b219c..894fd559 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -15070,6 +15070,31 @@ The values indicate what @command{gawk} knows about the identifiers
after it has finished parsing the program; they are @emph{not} updated
while the program runs.
+@item PROCINFO["platform"]
+@cindex platform running on, @code{PROCINFO["platform"]}
+This element gives a string indicating the platform for which
+@command{gawk} was compiled. The value will be one of the following:
+
+@c nested table
+@table @code
+@item "vms"
+OpenVMS or Vax/VMS.
+
+@item "macosx"
+Mac OS X.
+
+@item "cygwin"
+@itemx "djgpp"
+@itemx "mingw"
+Microsoft Windows, using either Cygwin, DJGPP, or MinGW, respectively.
+
+@item "os2"
+OS/2.
+
+@item "posix"
+GNU/Linux and legacy Unix systems.
+@end table
+
@item PROCINFO["pgrpid"]
@cindex process group ID of @command{gawk} process
The process group ID of the current process.
@@ -37842,6 +37867,14 @@ Support for GNU/Linux on Alpha was removed.
@end itemize
+Version 5.0 added the following features:
+
+@itemize
+@item
+The @code{PROCINFO["platform"]} array element, which allows you
+to write code that takes the operating system / platform into account.
+@end itemize
+
@c XXX ADD MORE STUFF HERE
@end ifclear
diff --git a/main.c b/main.c
index de3ed72a..a97bd180 100644
--- a/main.c
+++ b/main.c
@@ -68,6 +68,7 @@ static void version(void) ATTRIBUTE_NORETURN;
static void init_fds(void);
static void init_groupset(void);
static void save_argv(int, char **);
+static const char *platform_name();
/* These nodes store all the special variables AWK uses */
NODE *ARGC_node, *ARGIND_node, *ARGV_node, *BINMODE_node, *CONVFMT_node;
@@ -981,6 +982,7 @@ load_procinfo()
update_PROCINFO_str("version", VERSION);
update_PROCINFO_str("strftime", def_strftime_format);
+ update_PROCINFO_str("platform", platform_name());
#ifdef HAVE_MPFR
sprintf(name, "GNU MPFR %s", mpfr_get_version());
@@ -1769,3 +1771,25 @@ set_locale_stuff(void)
(void) bindtextdomain(PACKAGE, locale_dir);
(void) textdomain(PACKAGE);
}
+
+/* platform_name --- return the platform name */
+
+static const char *
+platform_name()
+{
+#if defined(__VMS)
+ return "vms";
+#elif defined(__APPLE__)
+ return "macosx";
+#elif defined(__MINGW32__)
+ return "mingw";
+#elif defined(__DJGPP__)
+ return "djgpp";
+#elif defined(__CYGWIN__)
+ return "cygwin";
+#elif defined(__EMX__)
+ return "os2";
+#else
+ return "posix";
+#endif
+}