aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.1
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawk.1')
-rw-r--r--doc/gawk.175
1 files changed, 70 insertions, 5 deletions
diff --git a/doc/gawk.1 b/doc/gawk.1
index 7bcef9d6..4b188aef 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Nov 26 2018" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Dec 12 2018" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -132,6 +132,9 @@ Multiple
(or
.BR \-\^\-file )
options may be used.
+Files read with
+.B \-f
+are treated as if they begin with an implict \fB@namespace "awk"\fR statement.
.TP
.PD 0
.BI \-F " fs"
@@ -253,6 +256,9 @@ and
options) with source code entered on the command line.
It is intended primarily for medium to large \*(AK programs used
in shell scripts.
+Each argument supplied via
+.B \-e
+is treated as if it begins with an implict \fB@namespace "awk"\fR statement.
.TP
.PD 0
.BI "\-E " file
@@ -310,6 +316,9 @@ be made after appending the
suffix. The file will be loaded only
once (i.e., duplicates are eliminated), and the code does not constitute
the main program source.
+Files read with
+.B \-i
+are treated as if they begin with an implict \fB@namespace "awk"\fR statement.
.TP
.PD 0
.BI "\-l " lib
@@ -577,9 +586,11 @@ pattern-action statements,
and optional function definitions.
.RS
.PP
-\fB@include "\fIfilename\fB"
+\fB@include "\fIfilename\^\fB"
+.br
+\fB@load "\fIfilename\^\fB"
.br
-\fB@load "\fIfilename\fB"
+\fB@namespace "\fIname\^\fB"
.br
\fIpattern\fB { \fIaction statements\fB }\fR
.br
@@ -1202,6 +1213,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
@@ -1403,7 +1436,8 @@ You may not use the
.B delete
statement with the
.B SYMTAB
-array.
+array, nor assign to elements with an index that is
+not a variable name.
.TP
.B TEXTDOMAIN
The text domain of the \*(AK program; used to find the localized
@@ -1497,6 +1531,37 @@ You can do this by creating an element in the subarray and then
deleting it with the
.B delete
statement.
+.SS Namespaces
+.I Gawk
+provides a simple
+.I namespace
+facility to help work around the fact that all variables in
+AWK are global.
+.PP
+A
+.I "qualified name"
+consists of a two simple identifiers joined by a double colon
+.RB ( :: ).
+The left-hand identifier represents the namespace and the right-hand
+identifier is the variable within it.
+All simple (non-qualified) names are considered to be in the
+``current'' namespace; the default namespace is
+.BR awk .
+However, simple identifiers consisting solely of upper-case
+letters are forced into the
+.B awk
+namespace, even if the current namespace is different.
+.PP
+You change the current namespace with an
+\fB@namespace "\fIname\^\fB"\fR
+directive.
+.PP
+The standard predefined builtin function names may not be used as
+namespace names. The names of additional functions provided by
+.I gawk
+may be used as namespace names or as simple identifiers in other
+namespaces.
+For more details, see \*(EP.
.SS Variable Typing And Conversion
.PP
Variables and fields
@@ -1645,7 +1710,7 @@ regular expression constants. Thus,
.B /a\e52b/
is equivalent to
.BR /a\e*b/ .
-.SS "Regexp Constants"
+.SS Regexp Constants
A regular expression constant is a sequence of characters enclosed
between forward slashes (like
.BR /value/ ).