[Top][All Lists]
[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 10:17:09 -0400 |
> Date: Tue, 22 Jul 2008 09:36:08 -0400
> From: Aharon Robbins <address@hidden>
> Cc: address@hidden
>
> Hi. This is cc'ed to the bug list so that perhaps someone else can find
> the problem. (And bcc'ed to the gawk Windows maintainer.)
>
> The issue is that under Windows, current gawk
>
> gawk 'BEGIN { print system("exit 11") }'
>
> doesn't print the correct exit status.
I think that's because awk.h has this snippet:
#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.