2
# process @include directives
4
function pathto(file, i, t, junk)
6
if (index(file, "/") != 0)
9
for (i = 1; i <= ndirs; i++) {
10
t = (pathlist[i] "/" file)
11
if ((getline junk < t) > 0) {
20
path = ENVIRON["AWKPATH"]
21
ndirs = split(path, pathlist, ";")
22
for (i = 1; i <= ndirs; i++) {
23
if (pathlist[i] == "")
27
input[stackptr] = ARGV[1] # ARGV[1] is first file
29
for (; stackptr >= 0; stackptr--) {
30
while ((getline < input[stackptr]) > 0) {
31
if (tolower($1) != "@include") {
37
printf("igawk:%s:%d: cannot find %s\n", \
38
input[stackptr], FNR, $2) > "/dev/stderr"
41
if (! (fpath in processed)) {
42
processed[fpath] = input[stackptr]
43
input[++stackptr] = fpath
45
print $2, "included in", input[stackptr], \
46
"already included in", \
47
processed[fpath] > "/dev/stderr"
49
close(input[stackptr])