summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHans Insulander <hin@cvs.openbsd.org>2000-02-19 12:10:28 +0000
committerHans Insulander <hin@cvs.openbsd.org>2000-02-19 12:10:28 +0000
commit39e6a1fd2f3b5feea1f400f2d16ab075d9492889 (patch)
tree178628323b66b663fbe63a5f07750e8b0dd745c1 /lib
parentb569828a4448d7136edb08499c3d8a6a22fa2b92 (diff)
Update to a newer version from KTH-Kerberos.
(most work by art@)
Diffstat (limited to 'lib')
-rw-r--r--lib/libcom_err/Makefile4
-rw-r--r--lib/libcom_err/com_err.c251
-rw-r--r--lib/libcom_err/com_err.h113
-rw-r--r--lib/libcom_err/com_right.h59
-rw-r--r--lib/libcom_err/error.c96
-rw-r--r--lib/libcom_err/init_et.c63
6 files changed, 376 insertions, 210 deletions
diff --git a/lib/libcom_err/Makefile b/lib/libcom_err/Makefile
index 7376055a47b..93644e3af57 100644
--- a/lib/libcom_err/Makefile
+++ b/lib/libcom_err/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.3 1997/04/27 20:56:07 millert Exp $
+# $OpenBSD: Makefile,v 1.4 2000/02/19 12:10:27 hin Exp $
LIB= com_err
-SRCS= com_err.c error_message.c et_name.c init_et.c
+SRCS= com_err.c error.c
CFLAGS+=-I${.CURDIR}
MAN= com_err.3
diff --git a/lib/libcom_err/com_err.c b/lib/libcom_err/com_err.c
index 841084c5c8b..b6ce80e026e 100644
--- a/lib/libcom_err/com_err.c
+++ b/lib/libcom_err/com_err.c
@@ -1,151 +1,156 @@
-/* $OpenBSD: com_err.c,v 1.4 1998/05/13 17:53:25 art Exp $ */
-
-/*-
- * Copyright 1987, 1988 by the Student Information Processing Board
- * of the Massachusetts Institute of Technology
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice
- * appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation,
- * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
- * used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.
- * M.I.T. and the M.I.T. S.I.P.B. make no representations about
- * the suitability of this software for any purpose. It is
- * provided "as is" without express or implied warranty.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
-#include <stdio.h>
-
-#ifdef __STDC__
-# undef VARARGS
-# include <stdarg.h>
-#else
-# undef VARARGS
-# define VARARGS 1
-# include <varargs.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+/* RCSID("$KTH: com_err.c,v 1.13 1999/03/12 15:17:08 bg Exp $"); */
#endif
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+/* #include <roken.h> */
#include "com_err.h"
-#include "error_table.h"
-/*
- * Protect us from header version (externally visible) of com_err, so
- * we can survive in a <varargs.h> environment. I think.
- */
-#if VARARGS
-#define com_err com_err_external
-#include "com_err.h"
-#undef com_err
-#endif
+struct et_list *_et_list;
-#ifdef NPOSIX
-#undef vfprintf
-#define vfprintf(stream,fmt,args) _doprnt(fmt,args,stream)
-#endif
-#if !defined(lint)
-static const char rcsid[] =
- "$Id: com_err.c,v 1.4 1998/05/13 17:53:25 art Exp $";
-#endif /* ! lint */
+const char *
+error_message (long code)
+{
+ static char msg[128];
+ const char *p = com_right(_et_list, code);
+ if (p == NULL)
+ p = strerror(code);
+ if (p != NULL && *p != '\0') {
+ strncpy(msg, p, sizeof(msg) - 1);
+ msg[sizeof(msg) - 1] = 0;
+ } else
+ sprintf(msg, "Unknown error %ld", code);
+ return msg;
+}
-static void
-#ifdef __STDC__
- default_com_err_proc (const char *whoami, errcode_t code, const char *fmt, va_list args)
-#else
- default_com_err_proc (whoami, code, fmt, args)
- const char *whoami;
- errcode_t code;
- const char *fmt;
- va_list args;
-#endif
+int
+init_error_table(const char **msgs, long base, int count)
{
- if (whoami) {
- fputs(whoami, stderr);
- fputs(": ", stderr);
- }
-#ifdef SOLARIS
- if (code) {
- fputs(error_message(code), stderr);
- fputs(" ", stderr);
- } else {
- vfprintf (stderr, fmt, args);
- }
-#else
- if (code) {
- fputs(error_message(code), stderr);
- fputs(" ", stderr);
- }
- if (fmt) {
- vfprintf (stderr, fmt, args);
- }
-#endif
- putc('\n', stderr);
- /* should do this only on a tty in raw mode */
- putc('\r', stderr);
- fflush(stderr);
+ initialize_error_table_r(&_et_list, msgs, count, base);
+ return 0;
}
-typedef void (*errf) __P((const char *, errcode_t, const char *, va_list));
+static void
+default_proc (const char *whoami, long code, const char *fmt, va_list args)
+{
+ if (whoami)
+ fprintf(stderr, "%s: ", whoami);
+ if (code)
+ fprintf(stderr, "%s ", error_message(code));
+ if (fmt)
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\r\n"); /* ??? */
+}
-errf com_err_hook = default_com_err_proc;
+static errf com_err_hook = default_proc;
-void com_err_va (whoami, code, fmt, args)
- const char *whoami;
- errcode_t code;
- const char *fmt;
- va_list args;
+void
+com_err_va (const char *whoami,
+ long code,
+ const char *fmt,
+ va_list args)
{
- if (! com_err_hook)
- com_err_hook = default_com_err_proc;
(*com_err_hook) (whoami, code, fmt, args);
}
-#if ! VARARGS
-void com_err (const char *whoami,
- errcode_t code,
- const char *fmt, ...)
-{
-#else
-void com_err (va_alist)
- va_dcl
+void
+com_err (const char *whoami,
+ long code,
+ const char *fmt,
+ ...)
{
- const char *whoami, *fmt;
- errcode_t code;
-#endif
- va_list pvar;
-
- if (!com_err_hook)
- com_err_hook = default_com_err_proc;
-#if VARARGS
- va_start (pvar);
- whoami = va_arg (pvar, const char *);
- code = va_arg (pvar, errcode_t);
- fmt = va_arg (pvar, const char *);
-#else
- va_start(pvar, fmt);
-#endif
- com_err_va (whoami, code, fmt, pvar);
- va_end(pvar);
+ va_list ap;
+ va_start(ap, fmt);
+ com_err_va (whoami, code, fmt, ap);
+ va_end(ap);
}
-errf set_com_err_hook (new_proc)
- errf new_proc;
+errf
+set_com_err_hook (errf new)
{
- errf x = com_err_hook;
+ errf old = com_err_hook;
- if (new_proc)
- com_err_hook = new_proc;
+ if (new)
+ com_err_hook = new;
else
- com_err_hook = default_com_err_proc;
+ com_err_hook = default_proc;
+
+ return old;
+}
- return x;
+errf
+reset_com_err_hook (void)
+{
+ return set_com_err_hook(NULL);
}
-errf reset_com_err_hook () {
- errf x = com_err_hook;
- com_err_hook = default_com_err_proc;
- return x;
+#define ERRCODE_RANGE 8 /* # of bits to shift table number */
+#define BITS_PER_CHAR 6 /* # bits to shift per character in name */
+
+static const char char_set[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
+
+static char buf[6];
+
+const char *
+error_table_name(int num)
+{
+ int ch;
+ int i;
+ char *p;
+
+ /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */
+ p = buf;
+ num >>= ERRCODE_RANGE;
+ /* num = ?? ??? ??? aaa aaa bbb bbb ccc ccc ddd ddd */
+ num &= 077777777;
+ /* num = 00 000 000 aaa aaa bbb bbb ccc ccc ddd ddd */
+ for (i = 4; i >= 0; i--) {
+ ch = (num >> BITS_PER_CHAR * i) & ((1 << BITS_PER_CHAR) - 1);
+ if (ch != 0)
+ *p++ = char_set[ch-1];
+ }
+ *p = '\0';
+ return(buf);
}
diff --git a/lib/libcom_err/com_err.h b/lib/libcom_err/com_err.h
index d58cefeedf1..642e51cdffe 100644
--- a/lib/libcom_err/com_err.h
+++ b/lib/libcom_err/com_err.h
@@ -1,30 +1,99 @@
-/* $OpenBSD: com_err.h,v 1.3 1998/05/13 17:53:26 art Exp $ */
-
-/*-
- * Header file for common error description library.
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Kungliga Tekniska
+ * Högskolan and its contributors.
*
- * Copyright 1988, Student Information Processing Board of the
- * Massachusetts Institute of Technology.
+ * 4. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
- * For copyright and distribution info, see the documentation supplied
- * with this package.
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*/
-#ifndef __COM_ERR_H
-#define __COM_ERR_H
+/* $KTH: com_err.h,v 1.3 1998/05/02 20:13:28 assar Exp $ */
-typedef int errcode_t; /* XXX compatibilty with newer version */
+/* MIT compatible com_err library */
+#ifndef __COM_ERR_H__
+#define __COM_ERR_H__
+
+#ifdef __STDC__
#include <stdarg.h>
+#endif
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(X) X
+#else
+#define __P(X) ()
+#endif
+#endif
+
+
+/*
+ * For compatibility with MIT's com_err the com_right.h include
+ * file is inserted here.
+ */
+/* $KTH: com_right.h,v 1.8 1998/02/17 21:19:43 bg Exp $ */
+
+#ifndef __COM_RIGHT_H__
+#define __COM_RIGHT_H__
+
+struct error_table {
+ char const * const * msgs;
+ long base;
+ int n_msgs;
+};
+struct et_list {
+ struct et_list *next;
+ struct error_table *table;
+};
+extern struct et_list *_et_list;
+
+const char *com_right(struct et_list *list, long code);
+void initialize_error_table_r(struct et_list **, const char **, int, long);
+void free_error_table(struct et_list *);
+
+#endif /* __COM_RIGHT_H__ */
+
+
+typedef void (*errf) __P((const char *, long, const char *, va_list));
+
+const char * error_message __P((long));
+int init_error_table __P((const char**, long, int));
+
+void com_err_va __P((const char *, long, const char *, va_list));
+void com_err __P((const char *, long, const char *, ...));
+
+errf set_com_err_hook __P((errf));
+errf reset_com_err_hook __P((void));
+
+const char *error_table_name(int num);
-/* ANSI C -- use prototypes etc */
-void com_err __P((const char *, errcode_t, const char *, ...));
-void com_err_va __P((const char *, errcode_t, const char *, va_list));
-char const *error_message __P((long));
-void (*com_err_hook) __P((const char *, errcode_t, const char *, va_list));
-void (*set_com_err_hook __P((void (*) (const char *, errcode_t, const char *, va_list))))
- __P((const char *, errcode_t, const char *, va_list));
-void (*reset_com_err_hook __P((void)))
- __P((const char *, errcode_t, const char *, va_list));
-
-#endif /* ! defined(__COM_ERR_H) */
+#endif /* __COM_ERR_H__ */
diff --git a/lib/libcom_err/com_right.h b/lib/libcom_err/com_right.h
new file mode 100644
index 00000000000..6a6e557fb84
--- /dev/null
+++ b/lib/libcom_err/com_right.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/* $KTH: com_right.h,v 1.8 1998/02/17 21:19:43 bg Exp $ */
+
+#ifndef __COM_RIGHT_H__
+#define __COM_RIGHT_H__
+
+struct error_table {
+ char const * const * msgs;
+ long base;
+ int n_msgs;
+};
+struct et_list {
+ struct et_list *next;
+ struct error_table *table;
+};
+extern struct et_list *_et_list;
+
+const char *com_right(struct et_list *list, long code);
+void initialize_error_table_r(struct et_list **, const char **, int, long);
+void free_error_table(struct et_list *);
+
+#endif /* __COM_RIGHT_H__ */
diff --git a/lib/libcom_err/error.c b/lib/libcom_err/error.c
new file mode 100644
index 00000000000..a3fdb2e7d65
--- /dev/null
+++ b/lib/libcom_err/error.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Kungliga Tekniska
+ * Högskolan and its contributors.
+ *
+ * 4. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+RCSID("$KTH: error.c,v 1.13 1998/02/17 21:19:44 bg Exp $");
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <com_right.h>
+
+const char *
+com_right(struct et_list *list, long code)
+{
+ struct et_list *p;
+ for (p = list; p; p = p->next) {
+ if (code >= p->table->base && code < p->table->base + p->table->n_msgs)
+ return p->table->msgs[code - p->table->base];
+ }
+ return NULL;
+}
+
+struct foobar {
+ struct et_list etl;
+ struct error_table et;
+};
+
+void
+initialize_error_table_r(struct et_list **list,
+ const char **messages,
+ int num_errors,
+ long base)
+{
+ struct et_list *et;
+ struct foobar *f;
+ for (et = *list; et; et = et->next)
+ if (et->table->msgs == messages)
+ return;
+ f = malloc(sizeof(*f));
+ if (f == NULL)
+ return;
+ et = &f->etl;
+ et->table = &f->et;
+ et->table->msgs = messages;
+ et->table->n_msgs = num_errors;
+ et->table->base = base;
+ et->next = *list;
+ *list = et;
+}
+
+
+void
+free_error_table(struct et_list *et)
+{
+ while(et){
+ struct et_list *p = et;
+ et = et->next;
+ free(p);
+ }
+}
diff --git a/lib/libcom_err/init_et.c b/lib/libcom_err/init_et.c
deleted file mode 100644
index ba714189bab..00000000000
--- a/lib/libcom_err/init_et.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: init_et.c,v 1.1 1996/11/11 04:55:05 downsj Exp $ */
-
-/*-
- * Copyright 1987, 1988 by the Student Information Processing Board
- * of the Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is
- * hereby granted, provided that the above copyright notice
- * appear in all copies and that both that copyright notice and
- * this permission notice appear in supporting documentation,
- * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
- * used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.
- * M.I.T. and the M.I.T. S.I.P.B. make no representations about
- * the suitability of this software for any purpose. It is
- * provided "as is" without express or implied warranty.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "error_table.h"
-
-#ifndef __STDC__
-#define const
-#endif
-
-#ifndef lint
-static const char rcsid_init_et_c[] =
- "$Id: init_et.c,v 1.1 1996/11/11 04:55:05 downsj Exp $";
-#endif
-
-struct foobar {
- struct et_list etl;
- struct error_table et;
-};
-
-extern struct et_list * _et_list;
-
-int
-init_error_table(msgs, base, count)
- const char * const * msgs;
- int base;
- int count;
-{
- struct foobar * new_et;
-
- if (!base || !count || !msgs)
- return 0;
-
- new_et = (struct foobar *) malloc(sizeof(struct foobar));
- if (!new_et)
- return errno; /* oops */
- new_et->etl.table = &new_et->et;
- new_et->et.msgs = msgs;
- new_et->et.base = base;
- new_et->et.n_msgs= count;
-
- new_et->etl.next = _et_list;
- _et_list = &new_et->etl;
- return 0;
-}