Subject: err(3) and error handling
To: None <current-users@NetBSD.ORG>
From: VaX#n8 <>
List: current-users
Date: 02/04/1995 16:44:05
I was looking at a strange error message given by mount_msdos the
other day... if you don't send it a proper partition (i.e. a MS-DOS one),
it complains:
"mount_msdos: invalid argument"
This was a bit puzzling to my friend who is new to Unix.  I eventually
tracked down why a bad partition was an invalid argument; EINVAL was being
returned from mount(2), and err(3) was spitting out the error message.

So my question is, what is the right way to give a more descriptive
error message?
1) Special-case the EINVAL and print something better out.  Taken to the
extreme, this implies making a lot of source much bigger and harder to read.
2) Add another E* error code and description.  Again, taken to the extreme,
this means a lot of E* error codes
3) Wait around for some kind of system-wide message database thing, probably
one that supports natural language for different locales... is there such a
thing in the works?  This probably (at least) means defining a big array
of error messages for your code and then calling the nl-supp funcs with an
appropriate index.
VaX#n8 (vak-sa-nate) - n, CS senior++ and Unix junkie -
Information Freedom Fighter                           - PGP key on request