Article View: gnu.bash.bug
Article #1156question about nojobs.c, bash-1.04
From: Richard Goerwitz
Date: Fri, 09 Feb 1990 18:37
Date: Fri, 09 Feb 1990 18:37
54 lines
1968 bytes
1968 bytes
Silly question?
/* from jobs.h */
union wait {
struct { /* clever way of getting at
unsigned char low; * wait's high and low
unsigned char high; * status bytes
} * /
bytes;
short word;
};
#define WSTOPPED 0177
#define w_status word
#define w_termsig bytes.low & 0x7f /* mask out eighth bit */
#define w_stopsig bytes.high
#define w_retcode bytes.high
/* from nojobs.c, line 163 and following: */
while ((got_pid = wait (&status)) != pid)
{
if (got_pid < 0 && errno == ECHILD)
{
status.w_termsig = status.w_retcode = 0; /* <-- NOTE */
break;
}
else if (got_pid < 0 && errno != EINTR)
programming_error ("got errno %d while waiting for %d", errno, pid);
}
The hitch here is that w_termsig expands to bytes.low & 0x7f. Hence the
entire expression expands to
status.bytes.low & 0x7f = status.w_retcode = 0;
What is the intention here? I'm just curious. If the attempt is being
made to zero out the lower seven bits of status.bytes.low, wouldn't
status.bytes.low &= 0x80;
be more appropriate?
I don't claim to be a wizard. I'm just trying to compile Bash on my
Xenix box.
If this is a silly question, and I should have seen what was going on
I'd still like to know about my mistake.
-Richard L. Goerwitz goer%sophist@uchicago.bitnet
goer@sophist.uchicago.edu rutgers!oddjob!gide!sophist!goer
Technical Details
Message-ID:
<7551@tank.uchicago.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!asuvax!ncar!tank!sophist!goerShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!asuvax!ncar!tank!sophist!goer From: goer@sophist.uucp (Richard Goerwitz) Newsgroups: gnu.bash.bug Subject: question about nojobs.c, bash-1.04 Message-ID: <7551@tank.uchicago.edu> Date: 9 Feb 90 18:37:47 GMT Sender: news@tank.uchicago.edu Reply-To: goer@sophist.UUCP (Richard Goerwitz) Organization: University of Chicago Lines: 54