bug-gawk
[Top][All Lists]
Advanced

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

Re: Include directive bug fix


From: arnold
Subject: Re: Include directive bug fix
Date: Sun, 07 May 2023 00:58:40 -0600
User-agent: Heirloom mailx 12.5 7/5/10

I think J Naman's suggestion to use cppawk is the right thing for you.
Gawk's behavior has been in place for over a decade; changing it now
is likely to break things.

I will probably add a mention of cppawk to the manual.

Thanks,

Arnold

ykulebiakin <ykulebiakin@protonmail.com> wrote:

> Are there any methods for including files by path relative to the directory 
> in AWKPATH?
>
> I want to separate my "header" files (there are plenty
> of them, and therefore I do not want to use them all by
> AWKPATH=include:include/dir1:include:dir2) into different categories
> (include/dir1, include/dir2) such as in my example. Simply speaking,
> I want the behaviour of C++ preprocessor's #include directive.
>
> Yours sincerely,
> Yehor
>
> ------- Original Message -------
> On Friday, May 5th, 2023 at 07:28, arnold@skeeve.com arnold@skeeve.com wrote:
>
> > Hello.
> >
> > Thank you for taking the time to report an issue. In the future,
> > please use the `gawkbug' script for doing so.
> >
> > In this case, gawk is behaving as designed and as documented
> > in the manual. In particular, see
> > https://www.gnu.org/software/gawk/manual/html_node/AWKPATH-Variable.html
> > In particular, this statement:
> >
> > But with gawk, if the file name supplied to the -f or -i
> > options does not contain a directory separator ‘/’, then
> > gawk searches a list of directories (called the search path)
> > one by one, looking for a file with the specified name.
> >
> > Arnold
> >
> > ykulebiakin via "Bug reports only for gawk." bug-gawk@gnu.org wrote:
> >
> >> Hello,
> >>
> >> I found an issue with the @include directive: it does not always search 
> >> directories mentioned in AWKPATH.
> >>
> >> For example, if we have the following directory structure:
> >>
> >> <root>
> >>
> >> main.awk
> >>
> >> @include "dir1/include.awk"
> >>
> >> include/
> >>
> >> dir1/
> >>
> >> include.awk
> >>
> >> then the following command will not work: AWKPATH=include gawk -f 
> >> ./main.awk, because AWKPATH is not used then we have a path (with the 
> >> directory separator) in the @include directive.
> >>
> >> I apply the patch to the io.c file which will solve the problem.
> >>
> >> Yours sincerely,
> >>
> >> Yehor



reply via email to

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