Article View: gnu.misc.discuss
Article #74212GNU should adopt com_err
From: Garrett Wollman
Date: Sun, 23 Jun 1991 02:33
Date: Sun, 23 Jun 1991 02:33
59 lines
3412 bytes
3412 bytes
A while ago, someone made the radical suggestion that the GNU Project
should adopt Imake to make installation of its programs and libraries
easier. I would like to make a somewhat different suggestion, one
which will make *programming* of GNU programs and libraries.
I would like to suggest that the GNU Project adopt the MIT Common
Error Description Library as its error-management system. com_err
offers several advantages to the programmer: all error messages are
kept in a separate file, foo.et, which is then processed to create
foo.h and foo.c (with the error numbers and messages, respectively);
all routines and libraries which use it have the same interface for
passing back errors and formatting error messages; Kerberos v5 and
many other MIT programs and libraries already use it, which means it
will be bundled with (at least) DCE.
The terms for use are New Berkeley, which should present no problems,
since GNU already uses several other packages, such as flex, which are
under those same terms; copyright is held by MIT SIPB.
Here is the abstract of "A Common Error Description Library for UNIX",
draft of 1 January 1989, by Ken Raeburn and Bill Sommerfeld:
UNIX has always had a clean and simple system call interface,
with a standard set of error codes passed between the kernel
and user programs. Unofrtunately, the same cannot be said of
many of the libraries layered on top of the primitives
provided by the kernel. Typically, each one has used a
different style of indicating errors to their callers, leading
to a total hodgepodge of error handling, and considerable
amounts of work for the programmer. This paper describes a
library and associated utilities which allows a more uniform
way for libraries to return errors to their callers, and for
programs to describe errors and exceptional conditions to
their users.
The Common Error system is available from pit-manager.mit.edu. It
consists (when compiled) of compile_et, the error table compiler, and
libcom_err.a, the library. The library provides the following routines:
com_err(const char *whoami, long error_code, const char *fmt,...)
- prints whoami: error_message(error_code) vsprintf(fmt,args)
com_err_va(const char *whoami, long error_code, const char *fmt,
va_list args)
- prints the same as com_err, but for variadic functions
error_message(long error_code)
- returns the message corresponding to error_code
set_com_err_hook(void (*)(const char *,long,const char *,va_list))
- dynamically substitutes a routine for com_err_va (e.g., to call
syslog instead of printf)
-GAWollman
Garrett A. Wollman - wollman@emily.uvm.edu
Disclaimer: I'm not even sure this represents *my* opinion, never
mind UVM's, EMBA's, EMBA-CF's, or indeed anyone else's.
Technical Details
Message-ID:
<1991Jun23.023336.5921@uvm.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!rutgers!mit-eddie!bbn.com!nic!kira!emily!wollmanShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,33f2a176a0f109a5,start X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 1991-06-23 18:46:35 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!stanford.edu!rutgers!mit-eddie!bbn.com!nic!kira!emily!wollman From: wollman@emily.uvm.edu (Garrett Wollman) Newsgroups: gnu.misc.discuss Subject: GNU should adopt com_err Message-ID: <1991Jun23.023336.5921@uvm.edu> Date: 23 Jun 91 02:33:36 GMT Sender: news@uvm.edu Organization: University of Vermont - EMBA Computing Facility Lines: 59