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: Eli Zaretskii
Subject: Re: [bug-gawk] Gawk compile error Mingw32
Date: Thu, 22 Dec 2016 19:46:03 +0200

> From: address@hidden (Vincent Belaïche)
> Cc: Vincent Belaïche <address@hidden> ,address@hidden, address@hidden
> Date: Wed, 21 Dec 2016 17:13:45 +0100
> 
>  $ c:/Users/Vincent/Downloads/gawk-4.1.4-w32-bin/bin/gawk.exe 
> 'END{exit(-1);}' dummy_file.txt; echo $?
> -| 0
>  $ c:/Users/Vincent/Downloads/gawk-4.1.4-w32-bin/bin/gawk.exe 'END{exit(1);}' 
> dummy_file.txt; echo $?
> -| 1
>  $ /bin/gawk-3.1.7.exe 'END{exit(-1);}' dummy_file.txt; echo $?
> -| 255
>  $ /bin/gawk-3.1.7.exe 'END{exit(1);}' dummy_file.txt; echo $?
> -| 1
> --8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----
> 
> Eli's port gawk.exe version 4.1.4 give exit status 0 when meeting
> 
> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
> END{ exit(-1); }
> --8<----8<----8<----8<----8<--  end  -->8---->8---->8---->8---->8----
> 
> while MSYS gawk version 3.1.7 gives 255 in that case.

I cannot reproduce this:

  D:\gnu\gawk-4.1.4>gawk "END {exit(-1);}" empty_file

  D:\gnu\gawk-4.1.4>echo %ERRORLEVEL%
  -1

Are you running this from some Bash?  If so, it's the problem with the
shell you use: it tries to interpret the -1 value in the Unixy way of
taking just the high 8 bits or somesuch.

The code in Gawk where we end up when processing the 'exit' statement
is very simple:

  void
  final_exit(int status)
  {
          /* run any extension exit handlers */
          run_ext_exit_handlers(status);

          /* we could close_io() here */
          close_extensions();

          exit(status);
  }

and there's nothing on MSDN about any funky interpretation of negative
return values by the MS runtime.



reply via email to

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