diff options
Diffstat (limited to 'usr.bin/compile_et')
-rw-r--r-- | usr.bin/compile_et/error_message.c | 77 | ||||
-rw-r--r-- | usr.bin/compile_et/error_table.h | 17 | ||||
-rw-r--r-- | usr.bin/compile_et/et_name.c | 44 | ||||
-rw-r--r-- | usr.bin/compile_et/init_et.c | 67 | ||||
-rw-r--r-- | usr.bin/compile_et/perror.c | 76 | ||||
-rw-r--r-- | usr.bin/compile_et/test/test.c | 43 | ||||
-rw-r--r-- | usr.bin/compile_et/test/test1.et | 69 | ||||
-rw-r--r-- | usr.bin/compile_et/test/test2.et | 9 |
8 files changed, 0 insertions, 402 deletions
diff --git a/usr.bin/compile_et/error_message.c b/usr.bin/compile_et/error_message.c deleted file mode 100644 index 92cec57..0000000 --- a/usr.bin/compile_et/error_message.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 1987 by the Student Information Processing Board - * of the Massachusetts Institute of Technology - * For copyright info, see "Copyright.SIPB". - * - * from: error_message.c,v 1.1 86/11/10 21:34:34 spook Exp $ - * $Id: error_message.c,v 1.3 1994/09/09 21:43:22 g89r4222 Exp $ - */ - -#include <stdio.h> -#include "error_table.h" -extern int sys_nerr; - -static char buffer[25]; - -char * -error_message(code) - int code; -{ - register int offset; - register error_table **et; - register int table_num; - register int div; - register char *cp; - - offset = code & ((1<<ERRCODE_RANGE)-1); - table_num = code - offset; - if ((_et_list == (error_table **)NULL) && table_num) - goto oops; - if (!table_num) { - if (offset < sys_nerr) - return(sys_errlist[offset]); - else - goto oops; - } - for (et = _et_list; *et != (error_table *)NULL; et++) { - if ((*et)->base == table_num) { - /* This is the right table */ - if ((*et)->n_msgs <= offset) - goto oops; - return((*et)->msgs[offset]); - } - } - oops: - cp = buffer; - { - register char *cp1; - for (cp1 = "Unknown code "; *cp1; cp1++, cp++) - *cp = *cp1; - if (table_num) { - for (cp1 = error_table_name(table_num); *cp1; cp1++, cp++) - *cp = *cp1; - *cp++ = ' '; - *cp = '\0'; - } - } - div = 1000000000; - if (offset == 0) { - *cp++ = '0'; - *cp = '\0'; - return(buffer); - } - while (div > offset) - div /= 10; - do { - register int n = offset / div; - *cp++ = '0' + n; - offset -= n * div; - div /= 10; - } while (offset && div); - while (div) { - *cp++ = '0'; - div /= 10; - } - *cp = '\0'; - return(buffer); -} diff --git a/usr.bin/compile_et/error_table.h b/usr.bin/compile_et/error_table.h deleted file mode 100644 index e32ec30..0000000 --- a/usr.bin/compile_et/error_table.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _ET -extern int errno; -typedef struct { - char **msgs; - int base; - int n_msgs; -} error_table; -extern error_table **_et_list; - -#define ERROR_CODE "int" /* type used for error codes */ - -#define ERRCODE_RANGE 8 /* # of bits to shift table number */ -#define BITS_PER_CHAR 6 /* # bits to shift per character in name */ - -extern char *error_table_name(); -#define _ET -#endif diff --git a/usr.bin/compile_et/et_name.c b/usr.bin/compile_et/et_name.c deleted file mode 100644 index 98ccb08..0000000 --- a/usr.bin/compile_et/et_name.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 1987 by MIT Student Information Processing Board - * For copyright info, see Copyright.SIPB. - * - * $Id: et_name.c,v 1.2 1994/07/19 19:21:27 g89r4222 Exp $ - */ - -#include "error_table.h" - -static char copyright[] = "Copyright 1987 by MIT Student Information Processing Board"; - -char *malloc(); - -char * -error_table_name(num) - int num; -{ - register int ch; - register int i; - register char *buf, *p; - - /* num = aa aaa abb bbb bcc ccc cdd ddd d?? ??? ??? */ - buf = malloc(5); - 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 = 0; i < 5; i++) { - ch = (num >> 24-6*i) & 077; - if (ch == 0) - continue; - else if (ch < 27) - *p++ = ch - 1 + 'A'; - else if (ch < 53) - *p++ = ch - 27 + 'a'; - else if (ch < 63) - *p++ = ch - 53 + '0'; - else /* ch == 63 */ - *p++ = '_'; - } - return(buf); -} - diff --git a/usr.bin/compile_et/init_et.c b/usr.bin/compile_et/init_et.c deleted file mode 100644 index c23facb..0000000 --- a/usr.bin/compile_et/init_et.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 1986 by MIT Information Systems and - * MIT Student Information Processing Board - * For copyright info, see Copyright.SIPB. - * - * form: init_et.c,v 1.1 86/11/10 21:42:26 spook Exp $ - * $Id: init_et.c,v 1.2 1994/07/19 19:21:28 g89r4222 Exp $ - */ - -#include <stdio.h> -#include "error_table.h" - -static char copyright[] = "Copyright 1987 by MIT Student Information Processing Board"; - -extern char *malloc(), *realloc(); - -/* useful */ -typedef error_table *etp; -typedef etp *etpp; - -etpp _et_list = (etpp)NULL; -static int n_allocated = 0, n_used = 0; - -int -init_error_table(msgs, base, count) - char **msgs; - register int base; - int count; -{ - register int i; - register etp new_et; - register etpp list; - - if (!base || !count || !msgs) - return; - - new_et = (etp)malloc(sizeof(error_table)); - new_et->msgs = msgs; - new_et->base = base; - new_et->n_msgs= count; - - list = _et_list; - if (list == (etpp)NULL) { - _et_list = (etpp) malloc(10*sizeof(etp)); - list = _et_list; - if (list == (etpp)NULL) - return; /* oops */ - list[0] = new_et; - list[1] = (etp)NULL; - n_allocated = 10; - n_used = 1; - return; - } - for (i = 0; i < n_used; i++) - if (list[i]->base == base) - return; /* avoid duplicates */ - if (n_used+2 > n_allocated) { - n_allocated += 10; /* don't re-allocate too often */ - list = (etpp) realloc((char *)list, - (unsigned)n_allocated * sizeof(etp)); - _et_list = list; - if (list == (etpp)NULL) - return; /* oops */ - } - list[n_used++] = new_et; - list[n_used] = (etp)NULL; -} diff --git a/usr.bin/compile_et/perror.c b/usr.bin/compile_et/perror.c deleted file mode 100644 index ef50e07..0000000 --- a/usr.bin/compile_et/perror.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 1987 by MIT Student Information Processing Board - * For copyright info, see Copyright.SIPB - * - * $Id: perror.c,v 1.2 1994/07/19 19:21:30 g89r4222 Exp $ - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/uio.h> -#include "error_table.h" - -typedef int (*int_func)(); - -#if defined(mips) && defined(ultrix) -int errno; /* this is needed to keep the loader from complaining */ -#endif - -int_func com_err_hook = (int_func) NULL; -char *error_message(); - -void -com_err(whoami, code, message) - char *whoami; - int code; - char *message; -{ - struct iovec strings[6]; - - if (com_err_hook) { - (*com_err_hook)(whoami, code, message); - return; - } - - strings[0].iov_base = whoami; - strings[0].iov_len = strlen(whoami); - if (whoami) { - strings[1].iov_base = ": "; - strings[1].iov_len = 2; - } else - strings[1].iov_len = 0; - if (code) { - register char *errmsg = error_message(code); - strings[2].iov_base = errmsg; - strings[2].iov_len = strlen(errmsg); - } else - strings[2].iov_len = 0; - strings[3].iov_base = " "; - strings[3].iov_len = 1; - strings[4].iov_base = message; - strings[4].iov_len = strlen(message); - strings[5].iov_base = "\n"; - strings[5].iov_len = 1; - (void) writev(2, strings, 6); -} - -int_func -set_com_err_hook(new_proc) - int_func new_proc; -{ - register int_func x = com_err_hook; - com_err_hook = new_proc; - return (x); -} - -reset_com_err_hook() -{ - com_err_hook = (int_func) NULL; -} - -void -perror(msg) - register const char *msg; -{ - com_err(msg, errno, (char *)NULL); -} diff --git a/usr.bin/compile_et/test/test.c b/usr.bin/compile_et/test/test.c deleted file mode 100644 index df430da..0000000 --- a/usr.bin/compile_et/test/test.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <stdio.h> -#include <errno.h> -#include "test1.h" -#include "test2.h" -char *error_message(); -extern int sys_nerr, errno; - -main() -{ - printf("\nBefore 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)); - - init_error_table(0, 0, 0); - printf("With 0: tgt-expired -> %s\n", error_message(KRB_MK_AP_TGTEXP)); - - init_krb_err_tbl(); - printf("KRB error table initialized: base %d (%s), name %s\n", - krb_err_base, error_message(krb_err_base), - error_table_name(krb_err_base)); - printf("With krb: tgt-expired -> %s\n", - error_message(KRB_MK_AP_TGTEXP)); - - init_quux_err_tbl(); - printf("QUUX error table initialized: base %d (%s), name %s\n", - quux_err_base, error_message(quux_err_base), - error_table_name(quux_err_base)); - - 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 is '%s'\n", error_message(1000000)); - errno = FOO_ERR; - perror("FOO_ERR"); -} diff --git a/usr.bin/compile_et/test/test1.et b/usr.bin/compile_et/test/test1.et deleted file mode 100644 index 4c7b77f..0000000 --- a/usr.bin/compile_et/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/usr.bin/compile_et/test/test2.et b/usr.bin/compile_et/test/test2.et deleted file mode 100644 index 55ad74e..0000000 --- a/usr.bin/compile_et/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 |