bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk bug when calling system()


From: Eli Zaretskii
Subject: Re: gawk bug when calling system()
Date: Tue, 22 Jul 2008 18:01:35 -0400

> Date: Tue, 22 Jul 2008 18:10:01 +0200
> From: Manuel Collado <address@hidden>
> Newsgroups: gnu.utils.bug
> CC: address@hidden
> 
> >     #ifndef WEXITSTATUS
> >     #define WEXITSTATUS(stat_val) ((((unsigned) (stat_val)) >> 8) & 0xFF)
> >     #endif
> > 
> > It does the wrong thing for Windows, since the status there is not
> > returned in the top 8 bits, but rather begins at the LSB.  I just
> > tried
> > 
> >    gawk "BEGIN { print system (\"exit 512\") }"
> > 
> > on Windows, and sure thing, it printed 2.
> 
> Well, it depends on the particular Windows port of gawk:
> 
> - the DJGPP port (3.1.6) prints 0
> - the MinGW port (3.1.6) prints 2
> - the Cygwin port (3.1.5) prints 512

I cannot look where I'm typing this, but I'm betting that DJGPP and
Cygwin have the correct definitions of WEXITSTATUS in their headers,
so the above does not apply to them.  MinGW does not have a definition
of WEXITSTATUS.




reply via email to

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