errno
Jonathan I Kamens
jik at cats.ucsc.edu
Sat Jun 22 06:06:40 AEST 1991
In article <1991Jun19.215654.18120 at alias.com>, dcoskun at alias.com (Denis Coskun) writes:
|> In <17138 at darkstar.ucsc.edu> jik at 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 at CATS.UCSC.EDU
More information about the Comp.unix.questions
mailing list