Xref: utzoo comp.lang.misc:1514 comp.misc:2309 comp.sources.bugs:929 Path: utzoo!mnetor!uunet!mcvax!ukc!its63b!hwcs!zen!vic From: vic@zen.UUCP (Victor Gavin) Newsgroups: comp.lang.misc,comp.misc,comp.sources.bugs Subject: Perl apology -- and enhancement Message-ID: <1231@zen.UUCP> Date: 27 Apr 88 14:31:23 GMT Reply-To: vic@zen.UUCP (Victor Gavin) Organization: Zengrange Limited, Leeds, England Lines: 72 Keywords: HPUX I said: > Can anyone fill me in on the current status of perl as we still haven't got it > working. > We are running an HP9000 model 840 with HPUX 1.2, perl is at patchlevel 29. I now say: Sorry folks, I f***ed up (horrific sounds of programmer hitting himself). I though I had it all re-compiled and linked -- I hadn't. After fixing the problem that stopped it from linking (HPUX doesn't have the functions set[er][gu]id()) the tests ran perfectly -- except for failing symlink(), which is present in release 2.0 of HPUX for the series 800. Whilst I'm here, for anyone that's interested, here's some code that will fix (system "/bin/sh -c 'exit 1'") so that it returns 1 and not 256: ....................... cut along the dotted line .............................. *** arg.c.orig Wed Apr 27 14:50:31 1988 --- arg.c Sat Apr 16 09:18:34 1988 *************** *** 2180,2185 ; if (maxarg == -1) argflags = -1; signal(SIGINT, ihand); signal(SIGQUIT, qhand); statusvalue = argflags; --- 2180,2211 ----- ; if (maxarg == -1) argflags = -1; + #ifdef hpux + /* the return value from this command is not the same as that + * produced by shell, in particular + * system("/bin/sh -c 'exit 1'") returns 256 not 1 + * + * HPUX return three different values through the parameter to + * wait() -- taken as a 16 bit integer. + * + * 1. If lower 8 bits are FF then process stopped and + * reason is in upper 8 bits. + * + * 2. If lower 8 bits are 00 then process exit()'ed and + * status is in upper 8 bits. + * + * 3. If upper 8 bits are 00 then process was hit by signal + * which is in lower 8 bits. + * + */ + else if ( !(argflags & (int)0xFF) ) + { + /* the program terminated so transpose the 8 bits to get the + * status + */ + argflags = ((argflags>>8)&0xFF) | ((argflags&0xFF)<<8); + } + #endif signal(SIGINT, ihand); signal(SIGQUIT, qhand); statusvalue = argflags; ................................................................................ -- Victor Gavin vic@zen.co.uk || ..!mcvax!ukc!zen.co.uk!vic Computer Psychoanalyst Zengrange Limited, Leeds LS9 8DB, England