summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1999-09-04 09:52:36 +0000
committermarkm <markm@FreeBSD.org>1999-09-04 09:52:36 +0000
commit3f27ca11404bfee6ad95039f41fe9625062bf654 (patch)
tree0dfea1e6c3c821e4454301f7c4824fe1a7ae9bf6 /lib
parent444a62d6e11e4184062a6f4999c3986590ebbdfc (diff)
downloadFreeBSD-src-3f27ca11404bfee6ad95039f41fe9625062bf654.zip
FreeBSD-src-3f27ca11404bfee6ad95039f41fe9625062bf654.tar.gz
Build this from contrib/ now.
Diffstat (limited to 'lib')
-rw-r--r--lib/libcom_err/Makefile10
-rw-r--r--lib/libcom_err/com_err.396
-rw-r--r--lib/libcom_err/com_err.c111
-rw-r--r--lib/libcom_err/com_err.h36
-rw-r--r--lib/libcom_err/error_message.c72
-rw-r--r--lib/libcom_err/error_table.h30
-rw-r--r--lib/libcom_err/et_name.c43
-rw-r--r--lib/libcom_err/init_et.c54
-rw-r--r--lib/libcom_err/internal.h18
-rw-r--r--lib/libcom_err/mit-sipb-copyright.h19
-rw-r--r--lib/libcom_err/test/test.c47
-rw-r--r--lib/libcom_err/test/test1.et69
-rw-r--r--lib/libcom_err/test/test2.et9
13 files changed, 7 insertions, 607 deletions
diff --git a/lib/libcom_err/Makefile b/lib/libcom_err/Makefile
index 85df262..847497d 100644
--- a/lib/libcom_err/Makefile
+++ b/lib/libcom_err/Makefile
@@ -1,14 +1,18 @@
# $FreeBSD$
LIB= com_err
-SRCS= com_err.c error_message.c et_name.c init_et.c
+SRCS= com_err.c error.c
MAN3= com_err.3
+COM_ERRDIR= ${.CURDIR}/../../contrib/com_err
+CFLAGS+= -I${COM_ERRDIR}
SUBDIR= doc
beforeinstall:
- ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/com_err.h \
- ${DESTDIR}/usr/include
+ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
+ ${COM_ERRDIR}/com_err.h ${COM_ERRDIR}/com_right.h \
+ ${DESTDIR}/usr/include
.include <bsd.lib.mk>
+.PATH: ${COM_ERRDIR}
diff --git a/lib/libcom_err/com_err.3 b/lib/libcom_err/com_err.3
deleted file mode 100644
index e6eeea1..0000000
--- a/lib/libcom_err/com_err.3
+++ /dev/null
@@ -1,96 +0,0 @@
-.\" Copyright (c) 1988 Massachusetts Institute of Technology,
-.\" Student Information Processing Board. All rights reserved.
-.\"
-.\" $FreeBSD$
-.\"
-.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 04000e3..0000000
--- a/lib/libcom_err/com_err.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 1987, 1988 by MIT Student Information Processing Board.
- *
- * For copyright info, see mit-sipb-copyright.h.
- */
-
-#include <stdio.h>
-#include "mit-sipb-copyright.h"
-
-#include <stdarg.h>
-
-#include "error_table.h"
-#include "internal.h"
-#include "com_err.h"
-
-#if ! lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* ! lint */
-
-static void
-#ifdef __STDC__
- default_com_err_proc (const char *whoami, long code, const char *fmt, va_list args)
-#else
- default_com_err_proc (whoami, code, fmt, args)
- const char *whoami;
- long code;
- const char *fmt;
- va_list args;
-#endif
-{
- if (whoami) {
- fputs(whoami, stderr);
- fputs(": ", stderr);
- }
- if (code) {
- fputs(error_message(code), stderr);
- fputs(" ", stderr);
- }
- if (fmt) {
- vfprintf (stderr, fmt, args);
- }
- putc('\n', stderr);
- /* should do this only on a tty in raw mode */
- putc('\r', stderr);
- fflush(stderr);
-}
-
-#ifdef __STDC__
-typedef void (*errf) (const char *, long, const char *, va_list);
-#else
-typedef void (*errf) ();
-#endif
-
-errf com_err_hook = default_com_err_proc;
-
-void com_err_va (whoami, code, fmt, args)
- const char *whoami;
- long code;
- const char *fmt;
- va_list args;
-{
- (*com_err_hook) (whoami, code, fmt, args);
-}
-
-#if ! VARARGS
-void com_err (const char *whoami,
- long code,
- const char *fmt, ...)
-{
-#else
-void com_err (va_alist)
- va_dcl
-{
- const char *whoami, *fmt;
- long 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, long);
- fmt = va_arg (pvar, const char *);
-#else
- va_start(pvar, fmt);
-#endif
- com_err_va (whoami, code, fmt, pvar);
- va_end(pvar);
-}
-
-errf set_com_err_hook (new_proc)
- errf new_proc;
-{
- errf x = com_err_hook;
-
- if (new_proc)
- com_err_hook = new_proc;
- else
- com_err_hook = default_com_err_proc;
-
- return x;
-}
-
-errf reset_com_err_hook () {
- errf x = com_err_hook;
- com_err_hook = default_com_err_proc;
- return x;
-}
diff --git a/lib/libcom_err/com_err.h b/lib/libcom_err/com_err.h
deleted file mode 100644
index 7bea010..0000000
--- a/lib/libcom_err/com_err.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Header file for common error description library.
- *
- * Copyright 1988, Student Information Processing Board of the
- * Massachusetts Institute of Technology.
- *
- * For copyright and distribution info, see the documentation supplied
- * with this package.
- */
-
-#ifndef __COM_ERR_H
-
-#ifdef __STDC__
-#ifndef __HIGHC__ /* gives us STDC but not stdarg */
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-/* ANSI C -- use prototypes etc */
-void com_err (const char *, long, const char *, ...);
-char const *error_message (long);
-void (*com_err_hook) (const char *, long, const char *, va_list);
-void (*set_com_err_hook (void (*) (const char *, long, const char *, va_list)))
- (const char *, long, const char *, va_list);
-void (*reset_com_err_hook ()) (const char *, long, const char *, va_list);
-#else
-/* no prototypes */
-void com_err ();
-char *error_message ();
-void (*com_err_hook) ();
-void (*set_com_err_hook ()) ();
-void (*reset_com_err_hook ()) ();
-#endif
-
-#define __COM_ERR_H
-#endif /* ! defined(__COM_ERR_H) */
diff --git a/lib/libcom_err/error_message.c b/lib/libcom_err/error_message.c
deleted file mode 100644
index 1efe21c..0000000
--- a/lib/libcom_err/error_message.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * $FreeBSD$
- * $Source: /home/ncvs/src/lib/libcom_err/error_message.c,v $
- * $Locker: $
- *
- * Copyright 1987 by the Student Information Processing Board
- * of the Massachusetts Institute of Technology
- *
- * For copyright info, see "mit-sipb-copyright.h".
- */
-
-#include <stdio.h>
-#include <string.h>
-#include "error_table.h"
-#include "mit-sipb-copyright.h"
-#include "internal.h"
-
-static const char rcsid[] =
- "$FreeBSD$";
-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";
-
-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 = code & ((1<<ERRCODE_RANGE)-1);
- table_num = code - offset;
- if (!table_num) {
- if (offset < sys_nerr)
- return(sys_errlist[offset]);
- else
- goto oops;
- }
- 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:
- strcpy (buffer, "Unknown code ");
- 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 78f7db2..0000000
--- a/lib/libcom_err/error_table.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 1988 by the Student Information Processing Board of the
- * Massachusetts Institute of Technology.
- *
- * For copyright info, see mit-sipb-copyright.h.
- */
-
-#ifndef _ET_H
-/* Are we using ANSI C? */
-#ifndef __STDC__
-#define const
-#endif
-extern int errno;
-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();
-#define _ET_H
-#endif
diff --git a/lib/libcom_err/et_name.c b/lib/libcom_err/et_name.c
deleted file mode 100644
index cd711f0..0000000
--- a/lib/libcom_err/et_name.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 1987 by MIT Student Information Processing Board
- *
- * For copyright info, see mit-sipb-copyright.h.
- */
-
-#include "error_table.h"
-#include "mit-sipb-copyright.h"
-#include "internal.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[] =
- "$FreeBSD$";
-#endif
-
-static const char char_set[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
-
-static char buf[6];
-
-const char * error_table_name(num)
- 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/init_et.c b/lib/libcom_err/init_et.c
deleted file mode 100644
index 0d8ba10..0000000
--- a/lib/libcom_err/init_et.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * $FreeBSD$
- * $Source: /home/ncvs/src/lib/libcom_err/init_et.c,v $
- * $Locker: $
- *
- * Copyright 1986, 1987, 1988 by MIT Information Systems and
- * the MIT Student Information Processing Board.
- *
- * For copyright info, see mit-sipb-copyright.h.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "error_table.h"
-#include "mit-sipb-copyright.h"
-
-#ifndef __STDC__
-#define const
-#endif
-
-#ifndef lint
-static const char rcsid_init_et_c[] =
- "$FreeBSD$";
-#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;
-}
diff --git a/lib/libcom_err/internal.h b/lib/libcom_err/internal.h
deleted file mode 100644
index 880fe76..0000000
--- a/lib/libcom_err/internal.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * internal include file for com_err package
- */
-#include "mit-sipb-copyright.h"
-#ifndef __STDC__
-#undef const
-#define const
-#endif
-
-extern int errno;
-extern char const * const sys_errlist[];
-extern /* const */ int sys_nerr;
-
-#ifdef __STDC__
-void perror (const char *);
-#else
-int perror ();
-#endif
diff --git a/lib/libcom_err/mit-sipb-copyright.h b/lib/libcom_err/mit-sipb-copyright.h
deleted file mode 100644
index 2f7eb29..0000000
--- a/lib/libcom_err/mit-sipb-copyright.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-
-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.
-
-*/
-
diff --git a/lib/libcom_err/test/test.c b/lib/libcom_err/test/test.c
deleted file mode 100644
index 955cb96..0000000
--- a/lib/libcom_err/test/test.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <stdio.h>
-#include <errno.h>
-#include "com_err.h"
-#include "test1.h"
-#include "test2.h"
-
-extern int sys_nerr, errno;
-
-main()
-{
- printf("Before initiating error table:\n\n");
- printf("Table name '%s'\n", error_table_name(KRB_MK_AP_TGTEXP));
- printf("UNIX name '%s'\n", error_table_name(EPERM));
- printf("Msg TGT-expired is '%s'\n", error_message(KRB_MK_AP_TGTEXP));
- printf("Msg EPERM is '%s'\n", error_message(EPERM));
- printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
- printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
- printf("Msg {sys_nerr} is '%s'\n", error_message(sys_nerr));
-
- printf("With 0: tgt-expired -> %s\n", error_message(KRB_MK_AP_TGTEXP));
-
- initialize_krb_error_table();
- printf("KRB error table initialized: base %d (%s), name %s\n",
- ERROR_TABLE_BASE_krb, error_message(ERROR_TABLE_BASE_krb),
- error_table_name(ERROR_TABLE_BASE_krb));
- initialize_krb_error_table();
- printf("With krb: tgt-expired -> %s\n",
- error_message(KRB_MK_AP_TGTEXP));
-
- initialize_quux_error_table();
- printf("QUUX error table initialized: base %d (%s), name %s\n",
- ERROR_TABLE_BASE_quux, error_message(ERROR_TABLE_BASE_quux),
- error_table_name(ERROR_TABLE_BASE_quux));
-
- printf("Msg for TGT-expired is '%s'\n",
- error_message(KRB_MK_AP_TGTEXP));
- printf("Msg {sys_nerr-1} is '%s'\n", error_message(sys_nerr-1));
- printf("Msg FOO_ERR is '%s'\n", error_message(FOO_ERR));
- printf("Msg KRB_SKDC_CANT is '%s'\n",
- error_message(KRB_SKDC_CANT));
- printf("Msg 1e6 (8B 64) is '%s'\n", error_message(1000000));
- printf("\n\nCOM_ERR tests:\n");
- com_err("whoami", FOO_ERR, (char *)NULL);
- com_err("whoami", FOO_ERR, " -- message goes %s", "here");
- com_err("whoami", 0, (char *)0);
- com_err("whoami", 0, "error number %d\n", 0);
-}
diff --git a/lib/libcom_err/test/test1.et b/lib/libcom_err/test/test1.et
deleted file mode 100644
index 4c7b77f..0000000
--- a/lib/libcom_err/test/test1.et
+++ /dev/null
@@ -1,69 +0,0 @@
- error_table krb
-
- error_code KRB_MK_AP_TKFIL,
- "Can't read ticket file"
-
- ec KRB_MK_AP_NOTKT,
- "Can't find ticket or TGT"
-
- ec KRB_MK_AP_TGTEXP,
- "TGT expired"
-
- ec KRB_RD_AP_UNDEC,
- "Can't decode authenticator"
-
- ec KRB_RD_AP_EXP,
- "Ticket expired"
-
- ec KRB_RD_AP_REPEAT,
- "Repeated request"
-
- ec KRB_RD_AP_NOT_US,
- "The ticket isn't for us"
-
- ec KRB_RD_AP_INCON,
- "Request is inconsistent"
-
- ec KRB_RD_AP_TIME,
- "Delta-T too big"
-
- ec KRB_RD_AP_BADD,
- "Incorrect net address"
-
- ec KRB_RD_AP_VERSION,
- "Protocol version mismatch"
-
- ec KRB_RD_AP_MSG_TYPE,
- "Invalid message type"
-
- ec KRB_RD_AP_MODIFIED,
- "Message stream modified"
-
- ec KRB_RD_AP_ORDER,
- "Message out of order"
-
- ec KRB_RD_AP_UNAUTHOR,
- "Unauthorized request"
-
- ec KRB_GT_PW_NULL,
- "Current password is null"
-
- ec KRB_GT_PW_BADPW,
- "Incorrect current password"
-
- ec KRB_GT_PW_PROT,
- "Protocol error"
-
- ec KRB_GT_PW_KDCERR,
- "Error returned by KDC"
-
- ec KRB_GT_PW_NULLTKT,
- "Null ticket returned by KDC"
-
- ec KRB_SKDC_RETRY,
- "Retry count exceeded"
-
- ec KRB_SKDC_CANT,
- "Can't send request"
-
- end
diff --git a/lib/libcom_err/test/test2.et b/lib/libcom_err/test/test2.et
deleted file mode 100644
index 55ad74e..0000000
--- a/lib/libcom_err/test/test2.et
+++ /dev/null
@@ -1,9 +0,0 @@
- error_table quux
-
- ec FOO_ERR, "foo"
-
- ec BAR_ERR, "bar"
-
- ec BAZ_ERR, "meow"
-
- end
OpenPOWER on IntegriCloud