summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/compile_et/Makefile15
-rw-r--r--usr.bin/compile_et/compile_et.c172
-rw-r--r--usr.bin/compile_et/error_message.c77
-rw-r--r--usr.bin/compile_et/error_table.h17
-rw-r--r--usr.bin/compile_et/error_table.y205
-rw-r--r--usr.bin/compile_et/et_lex.lex.l29
-rw-r--r--usr.bin/compile_et/et_name.c44
-rw-r--r--usr.bin/compile_et/init_et.c67
-rw-r--r--usr.bin/compile_et/perror.c76
-rw-r--r--usr.bin/compile_et/test/test.c43
-rw-r--r--usr.bin/compile_et/test/test1.et69
-rw-r--r--usr.bin/compile_et/test/test2.et9
12 files changed, 823 insertions, 0 deletions
diff --git a/usr.bin/compile_et/Makefile b/usr.bin/compile_et/Makefile
new file mode 100644
index 0000000..9b988267
--- /dev/null
+++ b/usr.bin/compile_et/Makefile
@@ -0,0 +1,15 @@
+# From: @(#)Makefile 5.1 (Berkeley) 6/25/90
+# $Id: Makefile,v 1.2 1994/07/19 19:21:23 g89r4222 Exp $
+
+PROG= compile_et
+CFLAGS+=-I. -I${.CURDIR}
+SRCS= compile_et.c error_message.c et_name.c init_et.c perror.c
+OBJS+= error_table.o
+DPADD= ${LIBL}
+LDADD= -ll
+CLEANFILES=et_lex.lex.c y.tab.c y.tab.h error_table.c
+NOMAN= noman
+
+error_table.c: et_lex.lex.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/compile_et/compile_et.c b/usr.bin/compile_et/compile_et.c
new file mode 100644
index 0000000..25be70b
--- /dev/null
+++ b/usr.bin/compile_et/compile_et.c
@@ -0,0 +1,172 @@
+/*
+ *
+ * Copyright 1986, 1987 by MIT Student Information Processing Board
+ * For copyright info, see "Copyright.SIPB".
+ *
+ * $Id: compile_et.c,v 1.2 1994/07/19 19:21:24 g89r4222 Exp $
+ */
+
+#include <stdio.h>
+#include <sys/file.h>
+#include <strings.h>
+#include <sys/param.h>
+
+static char copyright[] = "Copyright 1987 by MIT Student Information Processing Board";
+
+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 int yylineno;
+
+/* pathnames */
+char c_file[MAXPATHLEN]; /* temporary file */
+char h_file[MAXPATHLEN]; /* output */
+char o_file[MAXPATHLEN]; /* output */
+char et_file[MAXPATHLEN]; /* input */
+
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ register char *p;
+ int n_flag = 0, debug = 0;
+
+ while (argc > 2) {
+ register char *arg, ch;
+ arg = argv[--argc];
+ if (strlen(arg) != 2 || arg[0] != '-')
+ goto usage;
+ ch = arg[1];
+ if (ch == 'n')
+ n_flag++;
+ else if (ch == 'd')
+ debug++;
+ else
+ goto usage;
+ }
+
+ if (argc != 2) {
+ usage:
+ fprintf(stderr, "Usage: %s et_file [-n]\n", argv[0]);
+ exit(1);
+ }
+
+ strcpy(et_file, argv[1]);
+ p = rindex(et_file, '/');
+ if (p == (char *)NULL)
+ p = et_file;
+ else
+ p++;
+ p = rindex(p, '.');
+ if (!strcmp(p, ".et"))
+ *++p = '\0';
+ else {
+ if (!p)
+ p = et_file;
+ while (*p)
+ p++;
+ *p++ = '.';
+ *p = '\0';
+ }
+ /* p points at null where suffix should be */
+ strcpy(p, "et.c");
+ strcpy(c_file, et_file);
+ p[0] = 'h';
+ p[1] = '\0';
+ strcpy(h_file, et_file);
+ p[0] = 'o';
+ strcpy(o_file, et_file);
+ p[0] = 'e';
+ p[1] = 't';
+ p[2] = '\0';
+
+ yyin = fopen(et_file, "r");
+ if (!yyin) {
+ perror(et_file);
+ exit(1);
+ }
+
+ hfile = fopen(h_file, "w");
+ if (hfile == (FILE *)NULL) {
+ perror(h_file);
+ exit(1);
+ }
+
+ cfile = fopen(c_file, "w");
+ if (cfile == (FILE *)NULL) {
+ perror("Can't open temp file");
+ exit(1);
+ }
+
+ /* parse it */
+ fputs("#define NULL 0\n", cfile);
+ fputs("static char *_et[] = {\n", cfile);
+
+ yyparse();
+ fclose(yyin); /* bye bye input file */
+
+ fputs("\t(char *)0\n};\n", cfile);
+ fputs("extern int init_error_table();\n\n", cfile);
+ fprintf(cfile, "int %s_err_base = %d;\n\n", table_name, table_number);
+ fprintf(cfile, "int\ninit_%s_err_tbl()\n", table_name);
+ fprintf(cfile, "{\n\treturn(init_error_table(_et, %d, %d));\n}\n",
+ table_number, current);
+ fclose(cfile);
+
+ fputs("extern int init_", hfile);
+ fputs(table_name, hfile);
+ fputs("_err_tbl();\nextern int ", hfile);
+ fputs(table_name, hfile);
+ fputs("_err_base;\n", hfile);
+ fclose(hfile); /* bye bye hfile */
+
+ if (n_flag)
+ exit(0);
+
+ if (!fork()) {
+ p = rindex(c_file, '/');
+ if (p) {
+ *p++ = '\0';
+ chdir(c_file);
+ }
+ else
+ p = c_file;
+ execlp("cc", "cc", "-c", "-R", "-O", p, 0);
+ perror("cc");
+ exit(1);
+ }
+ else wait(0);
+
+ if (!debug)
+ (void) unlink(c_file);
+ /* make it .o file name */
+ c_file[strlen(c_file)-1] = 'o';
+ if (!fork()) {
+ execlp("cp", "cp", c_file, o_file, 0);
+ perror("cp");
+ exit(1);
+ }
+ else wait(0);
+ if (!debug)
+ (void) unlink(c_file);
+
+ exit(0);
+}
+
+yyerror(s)
+ char *s;
+{
+ fputs(s, stderr);
+ fprintf(stderr, "\nLine number %d; last token was '%s'\n",
+ yylineno, current_token);
+}
diff --git a/usr.bin/compile_et/error_message.c b/usr.bin/compile_et/error_message.c
new file mode 100644
index 0000000..92cec57
--- /dev/null
+++ b/usr.bin/compile_et/error_message.c
@@ -0,0 +1,77 @@
+/*
+ * 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
new file mode 100644
index 0000000..e32ec30
--- /dev/null
+++ b/usr.bin/compile_et/error_table.h
@@ -0,0 +1,17 @@
+#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/error_table.y b/usr.bin/compile_et/error_table.y
new file mode 100644
index 0000000..3913a84
--- /dev/null
+++ b/usr.bin/compile_et/error_table.y
@@ -0,0 +1,205 @@
+%{
+#include <stdio.h>
+char *str_concat(), *ds(), *quote(), *malloc(), *realloc();
+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 1986, 1987 by the MIT Student Information Processing Board
+ * For copyright info, see Copyright.SIPB.
+ */
+
+#include <stdlib.h>
+#include <strings.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include "error_table.h"
+
+extern FILE *hfile, *cfile;
+
+static long gensym_n = 0;
+char *
+gensym(x)
+ char *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 = malloc(32 * sizeof(char));
+ gensym_n++;
+ sprintf(symbol, "et%ld", gensym_n);
+ return(symbol);
+}
+
+char *
+ds(string)
+ char *string;
+{
+ char *rv;
+ rv = malloc(strlen(string)+1);
+ strcpy(rv, string);
+ return(rv);
+}
+
+char *
+quote(string)
+ char *string;
+{
+ char *rv;
+ rv = malloc(strlen(string)+3);
+ strcpy(rv, "\"");
+ strcat(rv, string);
+ strcat(rv, "\"");
+ return(rv);
+}
+
+int table_number;
+int current = 0;
+char **error_codes = (char **)NULL;
+
+add_ec(name, description)
+ char *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 *name, *val, *description;
+{
+ 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 ((%s)%d)\n",
+ error_codes[i], ERROR_CODE, 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
+ */
+int
+char_to_num(c)
+ char c;
+{
+ if (isupper(c))
+ return(c-'A'+1);
+ else if (islower(c))
+ return(c-'a'+27);
+ else if (isdigit(c))
+ return(c-'0'+53);
+ else {
+ fprintf(stderr, "Illegal character in name: %c\n", c);
+ exit(1);
+ /*NOTREACHED*/
+ }
+}
+
+set_table_num(string)
+ char *string;
+{
+ 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;
+}
+
+#include "et_lex.lex.c"
diff --git a/usr.bin/compile_et/et_lex.lex.l b/usr.bin/compile_et/et_lex.lex.l
new file mode 100644
index 0000000..c041819
--- /dev/null
+++ b/usr.bin/compile_et/et_lex.lex.l
@@ -0,0 +1,29 @@
+%{
+extern int yylineno;
+int yylineno = 1;
+%}
+
+PC [^\"\n]
+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 ++yylineno;
+
+\"{PC}*\" { register char *p; yylval.dynstr = ds(yytext+1);
+ if (p=rindex(yylval.dynstr, '"')) *p='\0';
+ return QUOTED_STRING;
+ }
+
+{AN}* { yylval.dynstr = ds(yytext); return STRING; }
+
+#.*\n ++yylineno;
+
+. { return (*yytext); }
+%%
diff --git a/usr.bin/compile_et/et_name.c b/usr.bin/compile_et/et_name.c
new file mode 100644
index 0000000..98ccb08
--- /dev/null
+++ b/usr.bin/compile_et/et_name.c
@@ -0,0 +1,44 @@
+/*
+ * 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
new file mode 100644
index 0000000..c23facb
--- /dev/null
+++ b/usr.bin/compile_et/init_et.c
@@ -0,0 +1,67 @@
+/*
+ * 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
new file mode 100644
index 0000000..ef50e07
--- /dev/null
+++ b/usr.bin/compile_et/perror.c
@@ -0,0 +1,76 @@
+/*
+ * 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
new file mode 100644
index 0000000..df430da
--- /dev/null
+++ b/usr.bin/compile_et/test/test.c
@@ -0,0 +1,43 @@
+#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
new file mode 100644
index 0000000..4c7b77f
--- /dev/null
+++ b/usr.bin/compile_et/test/test1.et
@@ -0,0 +1,69 @@
+ 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
new file mode 100644
index 0000000..55ad74e
--- /dev/null
+++ b/usr.bin/compile_et/test/test2.et
@@ -0,0 +1,9 @@
+ error_table quux
+
+ ec FOO_ERR, "foo"
+
+ ec BAR_ERR, "bar"
+
+ ec BAZ_ERR, "meow"
+
+ end
OpenPOWER on IntegriCloud