diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-26 08:52:23 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-26 08:52:23 -0800 |
commit | fb9f3a3a46a40dff1122c1410291a0eaf3353331 (patch) | |
tree | 986d721b6725ab52831bc8c2e7c8f7fbd024d079 /txr.1 | |
parent | 6899c7cd2b6890acd8ef86f4f2301708c6f59c1d (diff) | |
download | txr-fb9f3a3a46a40dff1122c1410291a0eaf3353331.tar.gz txr-fb9f3a3a46a40dff1122c1410291a0eaf3353331.tar.bz2 txr-fb9f3a3a46a40dff1122c1410291a0eaf3353331.zip |
awk macro: provide name of current input via fname.
* share/txr/stdlib/awk.tl (sys:awk-state): New slot, file-name.
(sys:awk-state loop): Set file-name from current input name,
or else from the stream name property if the current input
is a stream object.
(sys:awk-mac-let): New awk macro, fname.
* txr.1: Documented fname.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -43122,6 +43122,30 @@ Thereafter, it is incremented whenever .code awk switches to a new input source. +.coNP Variable @ fname +.desc +The awk variable +.code fname +provides access to a character string which, if the current input is +a file stream, is the name of the underlying file. Assigning to this +variable changes its value, but has no effect on the input stream. +Whenever a new input source is used by +.code awk +it sets this variable either from the file name on which it is opening +a stream.. When using an existing stream rather than opening a file, +.code awk +sets this variable from the +.code :name +property of the stream. + +Note that the redirection macros +.code <- +and +.code <! +have no effect on this variable. Within their scope, +.code fname +retains its value. + .coNP Variable @ rs .desc The awk variable |