help-gawk
[Top][All Lists]
Advanced

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

Re: readdir extension on windows with getline


From: Jim Dailey
Subject: Re: readdir extension on windows with getline
Date: Fri, 27 Jan 2023 06:34:08 -0600
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1


Btw, the original script does have one bug:

      PathCount = split(ENVIRON["AWKPATH"],AwkPath,/;/)
      for (i = 1; i <= PathCount; i++) {
          while (getline < AwkPath[i]) {  <<<<<<<<<<<<<<<<<<<<<<<
              split($0,Data,/\//)
              print Data[2]
          }
      }

The line I indicated with "<<<<<<<<<<<<" should be

       while ((getline < AwkPath[i]) > 0)

because a negative return from getline means a failure.  With that
change, and the patch I posted, the script works as expected, showing
all the files in AWKPATH directories.

Thanks for looking into and fixing this, Eli.  And, of course, for
pointing out my bug. :-)

reply via email to

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