help-gawk
[Top][All Lists]
Advanced

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

re: @include suggesting feature: PROCINFO[ "include" ] array


From: J Naman
Subject: re: @include suggesting feature: PROCINFO[ "include" ] array
Date: Sat, 8 Jan 2022 13:20:58 -0500

Denis: I am very sympathetic with your problem. I have a work-around for
some of these issues.
a) In the Gawk User Guide Chap 2.2 Command-Line Options
--include source-file or -i source-file
The guide says, "This option is *completely equivalent to using the
@include directive* inside your program"
*BUT it gives you access to the filename!*
gawk makes the full command line, including program text and options,
available in PROCINFO["argv"]; see Section 7.5.2 [Built-in Variables That
Convey Information], page 159.)
from guide: 'BEGIN { for (i = 0; i < length(PROCINFO["argv"]); i++); print
i, PROCINFO["argv"][i];}'
I made a test:
PROCINFO["argv"][0]="gawk";
PROCINFO["argv"][1]="-i";
PROCINFO["argv"][2]="\\ShrN\Nsoft\TEST.GawkIncludeFileNetDrive.awk";
# ^^^ note: network file works to centralize Gawk Library code ...
PROCINFO["argv"][3]="-i";
PROCINFO["argv"][4]="awkg@strncnt.afunc.awk";
# ^^^ works, does not show the fully qualified path (%AWKPATH%)
 Note that your shell or Win .BAT script needs to fill in the filenames
 And can draw on environment variables

*filename of the nested subincludes is not solved with the command line -i
<include>*
*(no surprise)*
*-J Naman*


reply via email to

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