summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-11-11 04:42:34 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-11-11 04:42:34 +0000
commite1f3fe3d0e5692a676c8be1703f378fb580ae38f (patch)
tree2c026c588c7cb32964e2a769091fc2b8198b6456
parent57a0b7ae90dcce6a72af2cd045c8ce85a0431313 (diff)
com_err is moving out into the main tree
-rw-r--r--kerberosIV/Makefile5
-rw-r--r--kerberosIV/Makefile.inc14
-rw-r--r--kerberosIV/com_err/Makefile8
-rw-r--r--kerberosIV/com_err/com_err.395
-rw-r--r--kerberosIV/com_err/com_err.c151
-rw-r--r--kerberosIV/com_err/error_message.c80
-rw-r--r--kerberosIV/com_err/error_table.h41
-rw-r--r--kerberosIV/com_err/et_name.c55
-rw-r--r--kerberosIV/com_err/init_et.c63
-rw-r--r--kerberosIV/compile_et/Makefile16
-rw-r--r--kerberosIV/compile_et/compile_et.179
-rw-r--r--kerberosIV/compile_et/compile_et.c289
-rw-r--r--kerberosIV/compile_et/compiler.h22
-rw-r--r--kerberosIV/compile_et/error_table.y260
-rw-r--r--kerberosIV/compile_et/et_lex.lex.l31
-rw-r--r--kerberosIV/include/kerberosIV/com_err.h28
16 files changed, 5 insertions, 1232 deletions
diff --git a/kerberosIV/Makefile b/kerberosIV/Makefile
index 155b309045e..4a12509bd17 100644
--- a/kerberosIV/Makefile
+++ b/kerberosIV/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.5 1996/06/21 23:45:46 dm Exp $
+# $OpenBSD: Makefile,v 1.6 1996/11/11 04:42:25 downsj Exp $
# from @(#)Makefile 5.1 (Berkeley) 6/25/90
# do compile_et and mk_cmds first, used by other directories
@@ -11,7 +11,7 @@ SUBDIR= compile_et mk_cmds
SUBDIR+=include
.endif
-SUBDIR+=acl com_err des krb kadm kafs kdb ss
+SUBDIR+=acl des krb kadm kafs kdb ss
SUBDIR+=ext_srvtab kadmin kadmind kdb_destroy kdb_edit kdb_init kdb_util \
kdestroy kerberos kinit klist kpasswdd kprop kpropd ksrvtgt ksrvutil \
@@ -26,7 +26,6 @@ build:
${MAKE} includes
(cd ${.CURDIR}/mk_cmds && ${MAKE} depend && ${MAKE})
(cd ${.CURDIR}/acl && ${MAKE} depend && ${MAKE} && ${MAKE} install)
- (cd ${.CURDIR}/com_err && ${MAKE} depend && ${MAKE} && ${MAKE} install)
(cd ${.CURDIR}/des && ${MAKE} depend && ${MAKE} && ${MAKE} install)
(cd ${.CURDIR}/krb && ${MAKE} depend && ${MAKE} && ${MAKE} install)
(cd ${.CURDIR}/kadm && ${MAKE} depend && ${MAKE} && ${MAKE} install)
diff --git a/kerberosIV/Makefile.inc b/kerberosIV/Makefile.inc
index 7abf567d195..c5497ca1272 100644
--- a/kerberosIV/Makefile.inc
+++ b/kerberosIV/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.3 1996/07/16 07:49:08 pefo Exp $
+# $OpenBSD: Makefile.inc,v 1.4 1996/11/11 04:42:26 downsj Exp $
CFLAGS+=-I${.CURDIR}/../include
BINDIR?=/usr/sbin
@@ -15,20 +15,8 @@ MK_CMDS=${.CURDIR}/../mk_cmds/${__objdir}/mk_cmds
MK_CMDS=${.CURDIR}/../mk_cmds/mk_cmds
.endif
-.if exists(${.CURDIR}/../compile_et/${__objdir})
-COMPILE_ET=${.CURDIR}/../compile_et/${__objdir}/compile_et
-.else
-COMPILE_ET=${.CURDIR}/../compile_et/compile_et
-.endif
-
.if (${MACHINE_ARCH} != "mips")
COM_ERR_PIC= -lcom_err_pic
.else
COM_ERR_PIC= -lcom_err
.endif
-
-.if exists(${.CURDIR}/../com_err/${__objdir})
-COM_ERR=-L${.CURDIR}/../com_err/${__objdir} ${COM_ERR_PIC}
-.else
-COM_ERR=-L${.CURDIR}/../com_err ${COM_ERR_PIC}
-.endif
diff --git a/kerberosIV/com_err/Makefile b/kerberosIV/com_err/Makefile
deleted file mode 100644
index 1826213c95f..00000000000
--- a/kerberosIV/com_err/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id: Makefile,v 1.1 1995/12/14 06:52:33 tholo Exp $
-
-LIB= com_err
-SRCS= com_err.c error_message.c et_name.c init_et.c
-CFLAGS+=-I${.CURDIR}
-MAN= com_err.3
-
-.include <bsd.lib.mk>
diff --git a/kerberosIV/com_err/com_err.3 b/kerberosIV/com_err/com_err.3
deleted file mode 100644
index 842307238fb..00000000000
--- a/kerberosIV/com_err/com_err.3
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" Copyright (c) 1988 Massachusetts Institute of Technology,
-.\" Student Information Processing Board. All rights reserved.
-.\"
-.\" $Id: com_err.3,v 1.1 1995/12/14 06:52:33 tholo 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/kerberosIV/com_err/com_err.c b/kerberosIV/com_err/com_err.c
deleted file mode 100644
index bab440da561..00000000000
--- a/kerberosIV/com_err/com_err.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $Id: com_err.c,v 1.1 1995/12/14 06:52:33 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 <stdio.h>
-
-#if __STDC__
-# undef VARARGS
-# include <stdarg.h>
-#else
-# undef VARARGS
-# define VARARGS 1
-# include <varargs.h>
-#endif
-
-#include "kerberosIV/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 "kerberosIV/com_err.h"
-#undef com_err
-#endif
-
-#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.1 1995/12/14 06:52:33 tholo Exp $";
-#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);
- }
-#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);
-}
-
-typedef void (*errf) __P((const char *, long, const char *, va_list));
-
-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;
-{
- 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,
- 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/kerberosIV/com_err/error_message.c b/kerberosIV/com_err/error_message.c
deleted file mode 100644
index 58c68258c3e..00000000000
--- a/kerberosIV/com_err/error_message.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $Id: error_message.c,v 1.2 1996/01/30 06:00:35 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 <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "error_table.h"
-
-static const char rcsid[] =
- "$Id: error_message.c,v 1.2 1996/01/30 06:00:35 tholo 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";
-
-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/kerberosIV/com_err/error_table.h b/kerberosIV/com_err/error_table.h
deleted file mode 100644
index fbffb237885..00000000000
--- a/kerberosIV/com_err/error_table.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $Id: error_table.h,v 1.1 1995/12/14 06:52:32 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.
- */
-
-#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();
-
-#endif
diff --git a/kerberosIV/com_err/et_name.c b/kerberosIV/com_err/et_name.c
deleted file mode 100644
index b31482a25c5..00000000000
--- a/kerberosIV/com_err/et_name.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $Id: et_name.c,v 1.1 1995/12/14 06:52:32 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.1 1995/12/14 06:52:32 tholo Exp $";
-#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/kerberosIV/com_err/init_et.c b/kerberosIV/com_err/init_et.c
deleted file mode 100644
index 00828911201..00000000000
--- a/kerberosIV/com_err/init_et.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $Id: init_et.c,v 1.1 1995/12/14 06:52:32 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 <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 1995/12/14 06:52:32 tholo 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;
-}
diff --git a/kerberosIV/compile_et/Makefile b/kerberosIV/compile_et/Makefile
deleted file mode 100644
index 1b9775a41a7..00000000000
--- a/kerberosIV/compile_et/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# $Id: Makefile,v 1.2 1996/10/12 01:13:26 deraadt Exp $
-
-PROG= compile_et
-SRCS= compile_et.c error_table.y #et_lex.lex.l
-CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../com_err
-DPADD= ${LIBL}
-LDADD= -ll
-CLEANFILES=error_table.c y.tab.h et_lex.lex.c
-CC=${HOSTCC}
-
-beforedepend: et_lex.lex.c
-error_table.o: et_lex.lex.c
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/kerberosIV/compile_et/compile_et.1 b/kerberosIV/compile_et/compile_et.1
deleted file mode 100644
index b9530ca5fef..00000000000
--- a/kerberosIV/compile_et/compile_et.1
+++ /dev/null
@@ -1,79 +0,0 @@
-.\" Copyright (c) 1988 Massachusetts Institute of Technology,
-.\" Student Information Processing Board. All rights reserved.
-.\"
-.\" $Id: compile_et.1,v 1.1 1995/12/14 06:52:50 tholo Exp $
-.\"
-.TH COMPILE_ET 1 "22 Nov 1988" SIPB
-.SH NAME
-compile_et \- error table compiler
-.SH SYNOPSIS
-.B compile_et
-file
-.SH DESCRIPTION
-.B Compile_et
-converts a table listing error-code names and associated messages into
-a C source file suitable for use with the
-.IR com_err (3)
-library.
-
-The source file name must end with a suffix of ``.et''; the file
-consists of a declaration supplying the name (up to four characters
-long) of the error-code table:
-
-.B error_table
-.I name
-
-followed by up to 256 entries of the form:
-
-.B error_code
-.I name,
-"
-.I string
-"
-
-and a final
-
-.B end
-
-to indicate the end of the table.
-
-The name of the table is used to construct the name of a subroutine
-.I initialize_XXXX_error_table
-which must be called in order for the
-.I com_err
-library to recognize the error table.
-
-The various error codes defined are assigned sequentially increasing
-numbers (starting with a large number computed as a hash function of
-the name of the table); thus for compatibility it is suggested that
-new codes be added only to the end of an existing table, and that no
-codes be removed from tables.
-
-The names defined in the table are placed into a C header file with
-preprocessor directives defining them as integer constants of up to
-32 bits in magnitude.
-
-A C source file is also generated which should be compiled and linked
-with the object files which reference these error codes; it contains
-the text of the messages and the initialization subroutine. Both C
-files have names derived from that of the original source file, with
-the ``.et'' suffix replaced by ``.c'' and ``.h''.
-
-A ``#'' in the source file is treated as a comment character, and all
-remaining text to the end of the source line will be ignored.
-
-.SH BUGS
-
-Since
-.B compile_et
-uses a very simple parser based on
-.IR yacc (1),
-its error recovery leaves much to be desired.
-
-.\" .IR for manual entries
-.\" .PP for paragraph breaks
-
-.SH "SEE ALSO"
-com_err (3).
-
-Ken Raeburn, "A Common Error Description Library for UNIX".
diff --git a/kerberosIV/compile_et/compile_et.c b/kerberosIV/compile_et/compile_et.c
deleted file mode 100644
index d40256e9f37..00000000000
--- a/kerberosIV/compile_et/compile_et.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/* $id$ */
-
-/*
- * Copyright 1986, 1987, 1988
- * by MIT Student Information Processing Board.
- *
- * For copyright info, see "mit-sipb-copyright.h".
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <string.h>
-#include <sys/param.h>
-#include "compiler.h"
-
-#ifndef __STDC__
-#define const
-#endif
-
-#ifndef lint
-static const char copyright[] =
- "Copyright 1987,1988 by MIT Student Information Processing Board";
-
-static const char rcsid_compile_et_c[] =
- "$Id: compile_et.c,v 1.1 1995/12/14 06:52:49 tholo Exp $";
-#endif
-
-extern char *gensym();
-extern char *current_token;
-extern int table_number, current;
-char buffer[BUFSIZ];
-char *table_name = (char *)NULL;
-FILE *hfile, *cfile;
-
-/* C library */
-extern char *malloc();
-extern int errno;
-
-/* lex stuff */
-extern FILE *yyin;
-extern unsigned lineno;
-
-char * xmalloc (size) unsigned int size; {
- char * p = malloc (size);
- if (!p) {
- perror (whoami);
- exit (1);
- }
- return p;
-}
-
-static int check_arg (str_list, arg) char const *const *str_list, *arg; {
- while (*str_list)
- if (!strcmp(arg, *str_list++))
- return 1;
- return 0;
-}
-
-static const char *const debug_args[] = {
- "d",
- "debug",
- 0,
-};
-
-static const char *const lang_args[] = {
- "lang",
- "language",
- 0,
-};
-
-static const char *const language_names[] = {
- "C",
- "K&R C",
- "C++",
- 0,
-};
-
-static const char * const c_src_prolog[] = {
- "static const char * const text[] = {\n",
- 0,
-};
-
-static const char * const krc_src_prolog[] = {
- "#ifdef __STDC__\n",
- "#define NOARGS void\n",
- "#else\n",
- "#define NOARGS\n",
- "#define const\n",
- "#endif\n\n",
- "static const char * const text[] = {\n",
- 0,
-};
-
-static const char *const struct_def[] = {
- "struct error_table {\n",
- " char const * const * msgs;\n",
- " long base;\n",
- " int n_msgs;\n",
- "};\n",
- "struct et_list {\n",
- " struct et_list *next;\n",
- " const struct error_table * table;\n",
- "};\n",
- "extern struct et_list *_et_list;\n",
- "\n", 0,
-};
-
-static const char warning[] =
- "/*\n * %s:\n * This file is automatically generated; please do not edit it.\n */\n";
-
-/* pathnames */
-char c_file[MAXPATHLEN]; /* output file */
-char h_file[MAXPATHLEN]; /* output */
-
-static void usage () {
- fprintf (stderr, "%s: usage: %s ERROR_TABLE\n",
- whoami, whoami);
- exit (1);
-}
-
-static void dup_err (type, one, two) char const *type, *one, *two; {
- fprintf (stderr, "%s: multiple %s specified: `%s' and `%s'\n",
- whoami, type, one, two);
- usage ();
-}
-
-int main (argc, argv) int argc; char **argv; {
- char *p, *ename;
- int len;
- char const * const *cpp;
- int got_language = 0;
-
- /* argument parsing */
- debug = 0;
- filename = 0;
- whoami = argv[0];
- p = strrchr (whoami, '/');
- if (p)
- whoami = p+1;
- while (argv++, --argc) {
- char *arg = *argv;
- if (arg[0] != '-') {
- if (filename)
- dup_err ("filenames", filename, arg);
- filename = arg;
- }
- else {
- arg++;
- if (check_arg (debug_args, arg))
- debug++;
- else if (check_arg (lang_args, arg)) {
- got_language++;
- arg = *++argv, argc--;
- if (!arg)
- usage ();
- if (language)
- dup_err ("languanges", language_names[(int)language], arg);
-#define check_lang(x,v) else if (!strcasecmp(arg,x)) language = v
- check_lang ("c", lang_C);
- check_lang ("ansi_c", lang_C);
- check_lang ("ansi-c", lang_C);
- check_lang ("krc", lang_KRC);
- check_lang ("kr_c", lang_KRC);
- check_lang ("kr-c", lang_KRC);
- check_lang ("k&r-c", lang_KRC);
- check_lang ("k&r_c", lang_KRC);
- check_lang ("c++", lang_CPP);
- check_lang ("cplusplus", lang_CPP);
- check_lang ("c-plus-plus", lang_CPP);
-#undef check_lang
- else {
- fprintf (stderr, "%s: unknown language name `%s'\n",
- whoami, arg);
- fprintf (stderr, "\tpick one of: C K&R-C\n");
- exit (1);
- }
- }
- else {
- fprintf (stderr, "%s: unknown control argument -`%s'\n",
- whoami, arg);
- usage ();
- }
- }
- }
- if (!filename)
- usage ();
- if (!got_language)
- language = lang_KRC;
- else if (language == lang_CPP) {
- fprintf (stderr, "%s: Sorry, C++ support is not yet finished.\n",
- whoami);
- exit (1);
- }
-
- p = xmalloc (strlen (filename) + 5);
- strcpy (p, filename);
- filename = p;
- p = strrchr(filename, '/');
- if (p == (char *)NULL)
- p = filename;
- else
- p++;
- ename = p;
- len = strlen (ename);
- p += len - 3;
- if (strcmp (p, ".et"))
- p += 3;
- *p++ = '.';
- /* now p points to where "et" suffix should start */
- /* generate new filenames */
- strcpy (p, "c");
- strcpy (c_file, ename);
- *p = 'h';
- strcpy (h_file, ename);
- strcpy (p, "et");
-
- yyin = fopen(filename, "r");
- if (!yyin) {
- perror(filename);
- exit(1);
- }
-
- hfile = fopen(h_file, "w");
- if (hfile == (FILE *)NULL) {
- perror(h_file);
- exit(1);
- }
- fprintf (hfile, warning, h_file);
-
- cfile = fopen(c_file, "w");
- if (cfile == (FILE *)NULL) {
- perror(c_file);
- exit(1);
- }
- fprintf (cfile, warning, c_file);
-
- /* prologue */
- if (language == lang_C)
- cpp = c_src_prolog;
- else if (language == lang_KRC)
- cpp = krc_src_prolog;
- else
- abort ();
- while (*cpp)
- fputs (*cpp++, cfile);
-
- /* parse it */
- yyparse();
- fclose(yyin); /* bye bye input file */
-
- fputs (" 0\n};\n\n", cfile);
- for (cpp = struct_def; *cpp; cpp++)
- fputs (*cpp, cfile);
- fprintf(cfile,
- "static const struct error_table et = { text, %ldL, %d };\n\n",
- table_number, current);
- fputs("static struct et_list link = { 0, 0 };\n\n",
- cfile);
- fprintf(cfile, "void initialize_%s_error_table (%s) {\n",
- table_name, (language == lang_C) ? "void" : "NOARGS");
- fputs(" if (!link.table) {\n", cfile);
- fputs(" link.next = _et_list;\n", cfile);
- fputs(" link.table = &et;\n", cfile);
- fputs(" _et_list = &link;\n", cfile);
- fputs(" }\n", cfile);
- fputs("}\n", cfile);
- fclose(cfile);
-
- fprintf (hfile, "extern void initialize_%s_error_table ();\n",
- table_name);
- fprintf (hfile, "#define ERROR_TABLE_BASE_%s (%ldL)\n",
- table_name, table_number);
- /* compatibility... */
- fprintf (hfile, "\n/* for compatibility with older versions... */\n");
- fprintf (hfile, "#define init_%s_err_tbl initialize_%s_error_table\n",
- table_name, table_name);
- fprintf (hfile, "#define %s_err_base ERROR_TABLE_BASE_%s\n", table_name,
- table_name);
- fclose(hfile); /* bye bye include file */
-
- return 0;
-}
-
-int yyerror(s) char *s; {
- fputs(s, stderr);
- fprintf(stderr, "\nLine number %d; last token was '%s'\n",
- lineno, current_token);
-}
diff --git a/kerberosIV/compile_et/compiler.h b/kerberosIV/compile_et/compiler.h
deleted file mode 100644
index 9b92e8d1223..00000000000
--- a/kerberosIV/compile_et/compiler.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $Id: compiler.h,v 1.1 1995/12/14 06:52:49 tholo Exp $ */
-
-/*
- * definitions common to the source files of the error table compiler
- */
-
-#ifndef __STDC__
-/* loser */
-#undef const
-#define const
-#endif
-
-enum lang {
- lang_C, /* ANSI C (default) */
- lang_KRC, /* C: ANSI + K&R */
- lang_CPP /* C++ */
-};
-
-int debug; /* dump debugging info? */
-char *filename; /* error table source */
-enum lang language;
-const char *whoami;
diff --git a/kerberosIV/compile_et/error_table.y b/kerberosIV/compile_et/error_table.y
deleted file mode 100644
index 2bb86fd0d50..00000000000
--- a/kerberosIV/compile_et/error_table.y
+++ /dev/null
@@ -1,260 +0,0 @@
-%{
-/* $Id: error_table.y,v 1.2 1996/09/15 23:27:09 millert 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>
-char *str_concat(), *ds(), *quote();
-char *current_token = (char *)NULL;
-extern char *table_name;
-%}
-%union {
- char *dynstr;
-}
-
-%token ERROR_TABLE ERROR_CODE_ENTRY END
-%token <dynstr> STRING QUOTED_STRING
-%type <dynstr> ec_name description table_id
-%{
-%}
-%start error_table
-%%
-
-error_table : ERROR_TABLE table_id error_codes END
- { table_name = ds($2);
- current_token = table_name;
- put_ecs(); }
- ;
-
-table_id : STRING
- { current_token = $1;
- set_table_num($1);
- $$ = $1; }
- ;
-
-error_codes : error_codes ec_entry
- | ec_entry
- ;
-
-ec_entry : ERROR_CODE_ENTRY ec_name ',' description
- { add_ec($2, $4);
- free($2);
- free($4); }
- | ERROR_CODE_ENTRY ec_name '=' STRING ',' description
- { add_ec_val($2, $4, $6);
- free($2);
- free($4);
- free($6);
- }
- ;
-
-ec_name : STRING
- { $$ = ds($1);
- current_token = $$; }
- ;
-
-description : QUOTED_STRING
- { $$ = ds($1);
- current_token = $$; }
- ;
-
-%%
-/*
- * 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 <string.h>
-#include <assert.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include "error_table.h"
-
-#ifndef lint
-static char const rcsid_error_table_y[] =
- "$Id: error_table.y,v 1.2 1996/09/15 23:27:09 millert Exp $";
-#endif
-
-#include "et_lex.lex.c"
-
-extern FILE *hfile, *cfile;
-
-static long gensym_n = 0;
-char *
-gensym(x)
- char const *x;
-{
- char *symbol;
- if (!gensym_n) {
- struct timeval tv;
- struct timezone tzp;
- gettimeofday(&tv, &tzp);
- gensym_n = (tv.tv_sec%10000)*100 + tv.tv_usec/10000;
- }
- symbol = (char *)malloc(32 * sizeof(char));
- gensym_n++;
- snprintf(symbol, 32 * sizeof(char), "et%ld", gensym_n);
- return(symbol);
-}
-
-char *
-ds(string)
- char const *string;
-{
- char *rv;
- rv = (char *)malloc(strlen(string)+1);
- strcpy(rv, string);
- return(rv);
-}
-
-char *
-quote(string)
- char const *string;
-{
- char *rv;
- rv = (char *)malloc(strlen(string)+3);
- strcpy(rv, "\"");
- strcat(rv, string);
- strcat(rv, "\"");
- return(rv);
-}
-
-long table_number;
-int current = 0;
-char **error_codes = (char **)NULL;
-
-add_ec(name, description)
- char const *name, *description;
-{
- fprintf(cfile, "\t\"%s\",\n", description);
- if (error_codes == (char **)NULL) {
- error_codes = (char **)malloc(sizeof(char *));
- *error_codes = (char *)NULL;
- }
- error_codes = (char **)realloc((char *)error_codes,
- (current + 2)*sizeof(char *));
- error_codes[current++] = ds(name);
- error_codes[current] = (char *)NULL;
-}
-
-add_ec_val(name, val, description)
- char const *name, *val, *description;
-{
- const int ncurrent = atoi(val);
- if (ncurrent < current) {
- printf("Error code %s (%d) out of order", name,
- current);
- return;
- }
-
- while (ncurrent > current)
- fputs("\t(char *)NULL,\n", cfile), current++;
-
- fprintf(cfile, "\t\"%s\",\n", description);
- if (error_codes == (char **)NULL) {
- error_codes = (char **)malloc(sizeof(char *));
- *error_codes = (char *)NULL;
- }
- error_codes = (char **)realloc((char *)error_codes,
- (current + 2)*sizeof(char *));
- error_codes[current++] = ds(name);
- error_codes[current] = (char *)NULL;
-}
-
-put_ecs()
-{
- int i;
- for (i = 0; i < current; i++) {
- if (error_codes[i] != (char *)NULL)
- fprintf(hfile, "#define %-40s (%ldL)\n",
- error_codes[i], table_number + i);
- }
-}
-
-/*
- * char_to_num -- maps letters and numbers into a small numbering space
- * uppercase -> 1-26
- * lowercase -> 27-52
- * digits -> 53-62
- * underscore-> 63
- */
-
-static const char char_set[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
-
-int char_to_num(c)
- char c;
-{
- const char *where;
- int diff;
-
- where = strchr (char_set, c);
- if (where) {
- diff = where - char_set + 1;
- assert (diff < (1 << ERRCODE_RANGE));
- return diff;
- }
- else if (isprint (c))
- fprintf (stderr,
- "Illegal character `%c' in error table name\n",
- c);
- else
- fprintf (stderr,
- "Illegal character %03o in error table name\n",
- c);
- exit (1);
-}
-
-set_table_num(string)
- char *string;
-{
- if (char_to_num (string[0]) > char_to_num ('z')) {
- fprintf (stderr, "%s%s%s%s",
- "First character of error table name must be ",
- "a letter; name ``",
- string, "'' rejected\n");
- exit (1);
- }
- if (strlen(string) > 4) {
- fprintf(stderr, "Table name %s too long, truncated ",
- string);
- string[4] = '\0';
- fprintf(stderr, "to %s\n", string);
- }
- while (*string != '\0') {
- table_number = (table_number << BITS_PER_CHAR)
- + char_to_num(*string);
- string++;
- }
- table_number = table_number << ERRCODE_RANGE;
-}
-
diff --git a/kerberosIV/compile_et/et_lex.lex.l b/kerberosIV/compile_et/et_lex.lex.l
deleted file mode 100644
index ea521f2cf92..00000000000
--- a/kerberosIV/compile_et/et_lex.lex.l
+++ /dev/null
@@ -1,31 +0,0 @@
-%{
- unsigned lineno = 1;
-%}
-
-PC [^\"]
-AN [A-Z_a-z0-9]
-%%
-
-error_table return ERROR_TABLE;
-et return ERROR_TABLE;
-error_code return ERROR_CODE_ENTRY;
-ec return ERROR_CODE_ENTRY;
-end return END;
-
-[\t ] ;
-\n ++lineno;
-
-\"{PC}*\" { register char *p; yylval.dynstr = ds(yytext+1);
- if (p=strrchr(yylval.dynstr, '"')) *p='\0';
- return QUOTED_STRING;
- }
-
-{AN}* { yylval.dynstr = ds(yytext); return STRING; }
-
-#.*\n ++lineno;
-
-. { return (*yytext); }
-%%
-#ifndef lint
-static char rcsid_et_lex_lex_l[] = "$Id: et_lex.lex.l,v 1.1 1995/12/14 06:52:49 tholo Exp $";
-#endif
diff --git a/kerberosIV/include/kerberosIV/com_err.h b/kerberosIV/include/kerberosIV/com_err.h
index e5dcd0c4aad..cc1df0d8c32 100644
--- a/kerberosIV/include/kerberosIV/com_err.h
+++ b/kerberosIV/include/kerberosIV/com_err.h
@@ -1,27 +1,3 @@
-/* $Id: com_err.h,v 1.1 1995/12/14 06:52:34 tholo Exp $ */
+/* $OpenBSD: com_err.h,v 1.2 1996/11/11 04:42:27 downsj Exp $ */
-/*-
- * 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
-#define __COM_ERR_H
-
-#include <stdarg.h>
-
-/* ANSI C -- use prototypes etc */
-void com_err __P((const char *, long, const char *, ...));
-char const *error_message __P((long));
-void (*com_err_hook) __P((const char *, long, const char *, va_list));
-void (*set_com_err_hook __P((void (*) (const char *, long, const char *, va_list))))
- __P((const char *, long, const char *, va_list));
-void (*reset_com_err_hook __P((void)))
- __P((const char *, long, const char *, va_list));
-
-#endif /* ! defined(__COM_ERR_H) */
+#include <com_err.h>