bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Gawk compile error Mingw32


From: arnold
Subject: Re: [bug-gawk] Gawk compile error Mingw32
Date: Thu, 27 Oct 2016 01:04:31 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

> However please note that there is some warning given by
> bison :
>
>  $ make awkgram.c
> -| bison -o awkgram.c ../awkgram.y
> -| ../awkgram.y: conflicts: 36 shift/reduce

This is normal. The awk grammar is weird; I don't think it can be
written without shift/reduce conflicts.

> My problem is that I would like to test existence of a file FILE in an
> AWK script I would like to write something like
>
>  if(system("test -f FILE") == 0)
>     ... file exists processing ...
>  else
>     ... file does not exist processing ...

See 
https://www.gnu.org/software/gawk/manual/html_node/File-Checking.html#File-Checking

You can do it portably with

        if ((getline junk < "FILE") < 0)
                ... file does not exist processing (or can't be accessed)
        else {
                close("FILE")
                ... files does exist processing
        }

Can you use the MinGW binary that Eli builds?  Do you have to
compile gawk yourself?  (See https://sourceforge.net/projects/ezwinports/)

Thanks,

Arnold



reply via email to

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