diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-15 19:02:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-15 19:02:53 +0000 |
commit | 187e72a6cc9c4382d1b1c034e8faf1083a0f2345 (patch) | |
tree | 963134ef5edb46922339eefc7da528b00369bc41 /lib | |
parent | 656339011714db1f25d3e90c207a8f439b734f14 (diff) |
now built into krb5
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcom_err/Makefile | 14 | ||||
-rw-r--r-- | lib/libcom_err/com_err.3 | 95 | ||||
-rw-r--r-- | lib/libcom_err/com_err.c | 156 | ||||
-rw-r--r-- | lib/libcom_err/com_err.h | 88 | ||||
-rw-r--r-- | lib/libcom_err/error.c | 96 | ||||
-rw-r--r-- | lib/libcom_err/error_message.c | 90 | ||||
-rw-r--r-- | lib/libcom_err/error_table.h | 41 | ||||
-rw-r--r-- | lib/libcom_err/et_name.c | 56 | ||||
-rw-r--r-- | lib/libcom_err/shlib_version | 3 |
9 files changed, 0 insertions, 639 deletions
diff --git a/lib/libcom_err/Makefile b/lib/libcom_err/Makefile deleted file mode 100644 index 93644e3af57..00000000000 --- a/lib/libcom_err/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 2000/02/19 12:10:27 hin Exp $ - -LIB= com_err -SRCS= com_err.c error.c -CFLAGS+=-I${.CURDIR} -MAN= com_err.3 - -includes: - -cd ${.CURDIR}; cmp -s com_err.h ${DESTDIR}/usr/include/com_err.h > \ - /dev/null 2>&1 || \ - ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 com_err.h \ - ${DESTDIR}/usr/include/com_err.h - -.include <bsd.lib.mk> diff --git a/lib/libcom_err/com_err.3 b/lib/libcom_err/com_err.3 deleted file mode 100644 index ed8159fbfde..00000000000 --- a/lib/libcom_err/com_err.3 +++ /dev/null @@ -1,95 +0,0 @@ -.\" Copyright (c) 1988 Massachusetts Institute of Technology, -.\" Student Information Processing Board. All rights reserved. -.\" -.\" $OpenBSD: com_err.3,v 1.1 1996/11/11 04:55:02 downsj Exp $ -.TH COM_ERR 3 "22 Nov 1988" SIPB -.SH NAME -com_err \- common error display routine -.SH SYNOPSIS -.nf - #include <com_err.h> -.PP -void com_err (whoami, code, format, ...); - const char *whoami; - long code; - const char *format; -.PP -proc = set_com_err_hook (proc); -.fi -void (* -.I proc -) (const char *, long, const char *, va_list); -.nf -.PP -proc = reset_com_err_hook (); -.PP -void initialize_XXXX_error_table (); -.fi -.SH DESCRIPTION -.I Com_err -displays an error message on the standard error stream -.I stderr -(see -.IR stdio (3S)) -composed of the -.I whoami -string, which should specify the program name or some subportion of -a program, followed by an error message generated from the -.I code -value (derived from -.IR compile_et (1)), -and a string produced using the -.I format -string and any following arguments, in the same style as -.IR fprintf (3). - -The behavior of -.I com_err -can be modified using -.I set_com_err_hook; -this defines a procedure which is called with the arguments passed to -.I com_err, -instead of the default internal procedure which sends the formatted -text to error output. Thus the error messages from a program can all -easily be diverted to another form of diagnostic logging, such as -.IR syslog (3). -.I Reset_com_err_hook -may be used to restore the behavior of -.I com_err -to its default form. Both procedures return the previous ``hook'' -value. These ``hook'' procedures must have the declaration given for -.I proc -above in the synopsis. - -The -.I initialize_XXXX_error_table -routine is generated mechanically by -.IR compile_et (1) -from a source file containing names and associated strings. Each -table has a name of up to four characters, which is used in place of -the -.B XXXX -in the name of the routine. These routines should be called before -any of the corresponding error codes are used, so that the -.I com_err -library will recognize error codes from these tables when they are -used. - -The -.B com_err.h -header file should be included in any source file that uses routines -from the -.I com_err -library; executable files must be linked using -.I ``-lcom_err'' -in order to cause the -.I com_err -library to be included. - -.\" .IR for manual entries -.\" .PP for paragraph breaks - -.SH "SEE ALSO" -compile_et (1), syslog (3). - -Ken Raeburn, "A Common Error Description Library for UNIX". diff --git a/lib/libcom_err/com_err.c b/lib/libcom_err/com_err.c deleted file mode 100644 index 8c1fac1a683..00000000000 --- a/lib/libcom_err/com_err.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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: 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" - -struct et_list *_et_list; - - -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 - snprintf(msg, sizeof msg, "Unknown error %ld", code); - return msg; -} - -int -init_error_table(const char **msgs, long base, int count) -{ - initialize_error_table_r(&_et_list, msgs, count, base); - return 0; -} - -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"); /* ??? */ -} - -static errf com_err_hook = default_proc; - -void -com_err_va (const char *whoami, - long code, - const char *fmt, - va_list args) -{ - (*com_err_hook) (whoami, code, fmt, args); -} - -void -com_err (const char *whoami, - long code, - const char *fmt, - ...) -{ - va_list ap; - va_start(ap, fmt); - com_err_va (whoami, code, fmt, ap); - va_end(ap); -} - -errf -set_com_err_hook (errf new) -{ - errf old = com_err_hook; - - if (new) - com_err_hook = new; - else - com_err_hook = default_proc; - - return old; -} - -errf -reset_com_err_hook (void) -{ - return set_com_err_hook(NULL); -} - -#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 deleted file mode 100644 index 277bf705c6f..00000000000 --- a/lib/libcom_err/com_err.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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_err.h,v 1.3 1998/05/02 20:13:28 assar Exp $ */ - -/* MIT compatible com_err library */ - -#ifndef __COM_ERR_H__ -#define __COM_ERR_H__ - -#include <stdarg.h> - -/* - * 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)(const char *, long, const char *, va_list); - -const char * error_message(long); -int init_error_table(const char**, long, int); - -void com_err_va(const char *, long, const char *, va_list); -void com_err(const char *, long, const char *, ...); - -errf set_com_err_hook(errf); -errf reset_com_err_hook(void); - -const char *error_table_name(int num); - -#endif /* __COM_ERR_H__ */ diff --git a/lib/libcom_err/error.c b/lib/libcom_err/error.c deleted file mode 100644 index 692fb225551..00000000000 --- a/lib/libcom_err/error.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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_err.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/error_message.c b/lib/libcom_err/error_message.c deleted file mode 100644 index 91f7ae28ebc..00000000000 --- a/lib/libcom_err/error_message.c +++ /dev/null @@ -1,90 +0,0 @@ -/* $OpenBSD: error_message.c,v 1.4 2003/04/03 12:07:24 hin 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 <string.h> -#include <errno.h> -#include "error_table.h" - -#ifndef lint -static const char rcsid[] = - "$OpenBSD: error_message.c,v 1.4 2003/04/03 12:07:24 hin Exp $"; -static const char copyright[] = - "Copyright 1986, 1987, 1988 by the Student Information Processing Board\nand the department of Information Systems\nof the Massachusetts Institute of Technology"; -#endif - -static char buffer[25]; - -struct et_list * _et_list = (struct et_list *) NULL; - -const char * -error_message (code) - long code; -{ - int offset; - struct et_list *et; - int table_num; - int started = 0; - char *cp; - - offset = (int)(code & ((1<<ERRCODE_RANGE)-1)); - table_num = (int)code - offset; - if (!table_num) { -#ifdef HAS_SYS_ERRLIST - if (offset < sys_nerr) - return(sys_errlist[offset]); - else - goto oops; -#else - cp = strerror(offset); - if (cp) - return(cp); - else - goto oops; -#endif - } - for (et = _et_list; et; et = et->next) { - if (et->table->base == table_num) { - /* This is the right table */ - if (et->table->n_msgs <= offset) - goto oops; - return(et->table->msgs[offset]); - } - } -oops: - strlcpy (buffer, "Unknown code ", sizeof(buffer)); - if (table_num) { - strcat (buffer, error_table_name (table_num)); - strcat (buffer, " "); - } - for (cp = buffer; *cp; cp++) - ; - if (offset >= 100) { - *cp++ = '0' + offset / 100; - offset %= 100; - started++; - } - if (started || offset >= 10) { - *cp++ = '0' + offset / 10; - offset %= 10; - } - *cp++ = '0' + offset; - *cp = '\0'; - return(buffer); -} diff --git a/lib/libcom_err/error_table.h b/lib/libcom_err/error_table.h deleted file mode 100644 index 03ed6bf183b..00000000000 --- a/lib/libcom_err/error_table.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $OpenBSD: error_table.h,v 1.2 2003/07/03 02:23:19 deraadt 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. - */ - -#ifndef _ET_H -#define _ET_H - -struct error_table { - char const * const * msgs; - long base; - int n_msgs; -}; - -struct et_list { - struct et_list *next; - const struct error_table *table; -}; - -extern struct et_list * _et_list; - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -extern const char *error_table_name(int); - -#endif diff --git a/lib/libcom_err/et_name.c b/lib/libcom_err/et_name.c deleted file mode 100644 index a3375bc17e4..00000000000 --- a/lib/libcom_err/et_name.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: et_name.c,v 1.2 1996/12/14 06:55:57 tholo 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 "error_table.h" - -#ifndef lint -static const char copyright[] = - "Copyright 1987,1988 by Student Information Processing Board, Massachusetts Institute of Technology"; -static const char rcsid_et_name_c[] = - "$Id: et_name.c,v 1.2 1996/12/14 06:55:57 tholo Exp $"; -#endif - -static const char char_set[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; - -static char buf[6]; - -const char * -error_table_name(n) - int n; -{ - unsigned num = n; - 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/shlib_version b/lib/libcom_err/shlib_version deleted file mode 100644 index 561c75b8e6c..00000000000 --- a/lib/libcom_err/shlib_version +++ /dev/null @@ -1,3 +0,0 @@ -major=1 -minor=0 - |