sys_nerr
Wichmann, Mats D
mats.d.wichmann at intel.com
Wed Feb 6 07:57:12 PST 2002
> >I've got an app I'm trying to compile in LSB mode.
> >It builds a table of its' own (short) error messages,
> >not wanting to use strerror/perror for some reason
> >I'm not aware of.
>
> Not using strerror() is a really bad idea if it is present
> on a specific platform.
The program in question - a scripting language - REALLY
wants to use its' own text if I understand it; "system errors"
are only one class of errors and it builds a table of short
string codes that can be "caught"; here it doesn't want (possibly
language-varying) multiword text error messages like strerror
can return. Elsewhere it /does/ use strerror for certain printouts.
> Note that there are funny platforms like BeOS where valid
> errno values cover a sparse range and use large negative values!
I see code in the app that tries to work with BeOS - now it
makes a bit more sense.
> >Of course, sys_nerr is not a public symbol in the LSB.
> >How would I work around this?
>
> Call strerror() and check if it returns a NULL pointer.
sterror doesn't return NULL; it returns "Unknown error x" if
you call it with an out-of-range x.
More information about the lsb-discuss
mailing list