Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!agate!darkstar!cats.ucsc.edu!jik From: jik@cats.ucsc.edu (Jonathan I Kamens) Newsgroups: comp.unix.questions Subject: Re: errno Message-ID: <17313@darkstar.ucsc.edu> Date: 21 Jun 91 20:06:40 GMT References: <1991Jun15.151924.24619@thunder.mcrcim.mcgill.edu> <2157@mitisft.Convergent.COM> <17138@darkstar.ucsc.edu> <1991Jun19.215654.18120@alias.com> Sender: usenet@darkstar.ucsc.edu Organization: University of California, Santa Cruz Lines: 76 In article <1991Jun19.215654.18120@alias.com>, dcoskun@alias.com (Denis Coskun) writes: |> In <17138@darkstar.ucsc.edu> jik@cats.ucsc.edu (Jonathan I. Kamens) writes: |> > Sys_nerr records the number of elements in the sys_errlist array, |> > which means the highest valid index in the array is sys_nerr-1, |> > and the lowest is 0. |> |> While I agree that this makes sense, is this really established practice |> or standardized? I ask because SGIs (Irix 3.3.2) have messages for indices |> 0 through sys_nerr. Well, here's my test program: main() { extern int sys_nerr; extern char *sys_errlist[]; printf("sys_nerr = %d\n", sys_nerr); printf("sys_errlist[sys_nerr] = 0x%x\n", sys_errlist[sys_nerr]); printf("sys_errlist[sys_nerr] = \"%s\"\n", sys_errlist[sys_nerr]); } It produces the following on an IBM RT/PC running AOS 4.3: sys_nerr = 76 sys_errlist[sys_nerr] = 0x4c sys_errlist[sys_nerr] = "1 h__" It produces the following on a VAX running BSD 4.3: sys_nerr = 76 sys_errlist[sys_nerr] = 0x4c sys_errlist[sys_nerr] = "}" It produces the following on a DECstation 3100 running Ultrix 3.1: sys_nerr = 75 sys_errlist[sys_nerr] = 0x20746f4e Segmentation violation (core dumped) It produces the following on the NeXT machine: sys_nerr = 84 sys_errlist[sys_nerr] = 0x0 sys_errlist[sys_nerr] = "(null pointer)" It produces the following on an IBM PS/2 running AIX 1.2: sys_nerr = 109 sys_errlist[sys_nerr] = 0x6d sys_errlist[sys_nerr] = "!" It produces the following on an i386 machine running SysVr4: sys_nerr = 152 sys_errlist[sys_nerr] = 0x98 sys_errlist[sys_nerr] = "" It produces the following on a Mac running A/UX: sys_nerr = 103 sys_errlist[sys_nerr] = 0x67 sys_errlist[sys_nerr] = "d" It produces the following on a Sparc running SunOS 4.1.1: sys_nerr = 91 sys_errlist[sys_nerr] = 0x5b Segmentation fault In case it's not obvious by now :-), what I'm trying to imply is that Irix 3.3.2 is probably wrong here. -- Jonathan Kamens jik@CATS.UCSC.EDU