diff options
author | Greg Hudson <ghudson@mit.edu> | 2014-04-29 11:03:03 -0400 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2014-04-30 18:10:17 -0400 |
commit | 939bb6c500aba6359f80bd27ba6269c23168fc16 (patch) | |
tree | db75a79238a545e9ea76d45a952805119fb7e752 | |
parent | 4d08c9abfee0b5978d9db2280c10c85b3bf2ae11 (diff) | |
download | krb5-939bb6c500aba6359f80bd27ba6269c23168fc16.tar.gz krb5-939bb6c500aba6359f80bd27ba6269c23168fc16.tar.xz krb5-939bb6c500aba6359f80bd27ba6269c23168fc16.zip |
Remove compile_et.c
We have used awk scripts in preference to the C version of compile_et
since 1994 (r4426). Get rid of the sources for the C version and all
of the Makefile.in references to them.
-rw-r--r-- | src/util/et/Makefile.in | 59 | ||||
-rw-r--r-- | src/util/et/compile_et.c | 347 | ||||
-rw-r--r-- | src/util/et/compiler.h | 15 | ||||
-rw-r--r-- | src/util/et/error_table.y | 225 | ||||
-rw-r--r-- | src/util/et/et_lex.lex.l | 23 | ||||
-rw-r--r-- | src/util/et/init_et.c | 109 | ||||
-rw-r--r-- | src/util/et/internal.h | 18 |
7 files changed, 6 insertions, 790 deletions
diff --git a/src/util/et/Makefile.in b/src/util/et/Makefile.in index 25edc2801..ae1306584 100644 --- a/src/util/et/Makefile.in +++ b/src/util/et/Makefile.in @@ -20,7 +20,7 @@ LIBINITFUNC=com_err_initialize LIBFINIFUNC=com_err_terminate all-unix:: all-liblinks -clean-unix:: clean-liblinks clean-libs clean-libobjs clean-lclint +clean-unix:: clean-liblinks clean-libs clean-libobjs install-unix:: install-libs LINTFLAGS=-uhvb @@ -28,8 +28,7 @@ LINTFILES= error_message.c et_name.c com_err.c LIBOBJS=$(OUTPRE)com_err.$(OBJEXT) \ $(OUTPRE)error_message.$(OBJEXT) \ $(OUTPRE)et_name.$(OBJEXT) -# for et_lex.lex.c include in error_table.y -LOCALINCLUDES=-I. -I$(srcdir) +LOCALINCLUDES=-I. SRCS= $(srcdir)/error_message.c \ $(srcdir)/et_name.c \ @@ -62,15 +61,8 @@ $(COM_ERR_HDR): com_err.h generate-files-mac: compile_et -error_table.c: et_lex.lex.c -error_table.c: $(srcdir)/error_table.y - -error_table.o: error_table.c et_lex.lex.c - $(CC) $(ALL_CFLAGS) -c error_table.c - com_err.o : com_err.c -et_lex.lex.o: et_lex.lex.c test1.o: test1.c test2.o: test2.c test_et.o: test1.h test2.h @@ -80,36 +72,6 @@ test1.c test2.c et1.c et2.c test1.h test2.h et1.h et2.h: \ compile_et et_c.awk et_h.awk t_com_err.o: et1.h et2.h t_com_err.c -# /u1/kr/lclint-2.5q/bin/lclint -warnposix -D__sparc -LCLINT=lclint -# +posixlib gets more complete errno list than ansilib -# -usedef turns off bogus warnings from poor dataflow analysis (should be -# redundant with gcc warnings anyways) -# -warnposix -# +charintliteral -# +ignoresigns -# -predboolint -# -exportlocal -# -retvalint allow ignoring of int return values (e.g., fputs) -LCLINTOPTS=+posixlib \ - -usedef -warnposix +charintliteral +ignoresigns -predboolint +boolint \ - -exportlocal -retvalint \ - +mod-uncon +modinternalstrict +modfilesys -com_err.lcd: error_table.c error_table.h et_lex.lex.c com_err.h - $(LCLINT) $(LCLINTOPTS) $(LOCALINCLUDES) $(DEFS) $(SRCS) \ - -dump com_err.new -expect 1 - mv -f com_err.new com_err.lcd -do-lclint: com_err.lcd t_com_err.c et1.c et2.c et1.h et2.h - $(LCLINT) $(LCLINTOPTS) $(LOCALINCLUDES) \ - $(srcdir)/t_com_err.c et1.c et2.c -# "-load com_err.lcd" -> lclint brokenness -clean-lclint: - $(RM) com_err.new com_err.lcd -ITS4=its4 -ITS4OPTS= -do-its4: error_table.y et_lex.lex.c - $(ITS4) $(ITS4OPTS) $(SRCS) - #test_et: test_et.o test1.o test2.o $(LIBOBJS) # $(CC) -o test_et test_et.o test1.o test2.o $(LIBOBJS) #t_com_err: t_com_err.o et1.o et2.o $(LIBOBJS) @@ -149,12 +111,6 @@ check-windows:: $(OUTPRE)test_et$(EXEEXT) path $(OUTPRE)test_et$(EXEEXT) -# The real compile_et just isn't portable. (But then again, anything using -# lex and yacc isn't portable by definition. :-( ) -# -#compile_et: compile_et.o error_table.o -# $(CC) $(CFLAGS) -o $@ compile_et.o error_table.o $(LEXLIB) $(BSDLIB) -# install-unix:: compile_et $(INSTALL) compile_et $(DESTDIR)$(bindir)/compile_et test -d $(DESTDIR)$(mydatadir) || mkdir $(DESTDIR)$(mydatadir) @@ -199,8 +155,7 @@ clean-files:: *.cp *.fn *.ky *.log *.pg *.tp *.vr \ *.o profiled/?*.o libcom_err.a libcom_err_p.a \ com_err.o compile_et \ - et.ar TAGS y.tab.c lex.yy.c error_table.c \ - et_lex.lex.c \ + et.ar TAGS \ test1.h test1.c test2.h test2.c test_et \ et1.c et1.h et2.c et2.h t_com_err \ eddep makedep *.ln @@ -217,12 +172,10 @@ libcom_err.o: $(LIBOBJS) archive: et.tar -TAGS: et_name.c error_message.c compile_et.c error_table.c \ - lex.yy.c init_et.c - etags et_name.c error_message.c compile_et.c \ - error_table.c init_et.c +TAGS: et_name.c error_message.c + etags et_name.c error_message.c -depend:: et_lex.lex.c includes compile_et +depend:: includes compile_et @lib_frag@ diff --git a/src/util/et/compile_et.c b/src/util/et/compile_et.c deleted file mode 100644 index 47c563791..000000000 --- a/src/util/et/compile_et.c +++ /dev/null @@ -1,347 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * Copyright 1986, 1987, 1988 - * by MIT Student Information Processing Board. - * - * For copyright info, see "mit-sipb-copyright.h". - */ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - */ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/file.h> -#include <string.h> -#include <sys/param.h> -#include <stdlib.h> -#include <errno.h> -#include "mit-sipb-copyright.h" -#include "compiler.h" - -#ifndef lint -static const char copyright[] = - "Copyright 1987,1988 by MIT Student Information Processing Board"; -#endif - -extern char *gensym(); -extern char *current_token; -extern int table_number, current; -char buffer[BUFSIZ]; -char *table_name = (char *)NULL; -FILE *hfile, *cfile; - -/* lex stuff */ -extern FILE *yyin; -extern int yylineno; - -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[] = { - "#if defined(__STDC__) || defined(_WIN32)\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, - "const struct error_table et_%s_error_table = { text, %ldL, %d };\n\n", - table_name, 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); - fprintf(cfile, " link.table = &et_%s_error_table;\n", table_name); - 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); -#ifdef NO_YYLINENO - fprintf(stderr, "\nLast token was '%s'\n", current_token); -#else - fprintf(stderr, "\nLine number %d; last token was '%s'\n", - yylineno, current_token); -#endif -} - -#ifdef NEED_STRCASECMP -/* Need strcasecmp for this machine */ - -/* based on @(#)strcasecmp.c 1.3 (Berkeley) 8/3/87 */ - -/* - * This array is designed for mapping upper and lower case letter - * together for a case independent comparison. The mappings are - * based upon ascii character sequences. - */ -static char charmap[] = { - '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', - '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', - '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', - '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', - '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', - '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', - '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', - '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', - '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', - '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', - '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', - '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', - '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', - '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', - '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', - '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', - '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', - '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', - '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', - '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', - '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', - '\300', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\333', '\334', '\335', '\336', '\337', - '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', - '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', - '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', - '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', -}; - -strcasecmp(s1, s2) -register char *s1, *s2; -{ - register char *cm = charmap; - - while (cm[*s1] == cm[*s2++]) - if (*s1++ == '\0') - return(0); - return(cm[*s1] - cm[*--s2]); -} - -#endif diff --git a/src/util/et/compiler.h b/src/util/et/compiler.h deleted file mode 100644 index 8b7014405..000000000 --- a/src/util/et/compiler.h +++ /dev/null @@ -1,15 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * definitions common to the source files of the error table compiler - */ - -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/src/util/et/error_table.y b/src/util/et/error_table.y deleted file mode 100644 index 750e9d973..000000000 --- a/src/util/et/error_table.y +++ /dev/null @@ -1,225 +0,0 @@ -%{ -#include <stdio.h> -char *str_concat(), *ds(), *quote(); -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -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 mit-sipb-copyright.h. - */ - -#include <string.h> -#include <assert.h> -#include <ctype.h> -#include <sys/types.h> -#include <sys/time.h> -#include "com_err.h" -#include "internal.h" -#include "error_table.h" -#include "mit-sipb-copyright.h" - - -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 = malloc(32 * sizeof(char)); - gensym_n++; - sprintf(symbol, "et%ld", gensym_n); - return(symbol); -} - -char * -ds(string) - char const *string; -{ - return strdup(string); -} - -char * -quote(string) - char const *string; -{ - char *rv; - asprintf(&rv, "\"%s\"", string); - 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; -} - -#include "et_lex.lex.c" diff --git a/src/util/et/et_lex.lex.l b/src/util/et/et_lex.lex.l deleted file mode 100644 index b363e8ca4..000000000 --- a/src/util/et/et_lex.lex.l +++ /dev/null @@ -1,23 +0,0 @@ -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 ] ; - -\"{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 ; - -. { return (*yytext); } -%% diff --git a/src/util/et/init_et.c b/src/util/et/init_et.c deleted file mode 100644 index 2c8974ac0..000000000 --- a/src/util/et/init_et.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * Copyright 1997, 2008 by Massachusetts Institute of Technology - * - * Copyright 1986, 1987, 1988 by MIT Student Information Processing Board - * - * 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. - * Furthermore if you modify this software you must label - * your software as modified software and not distribute it in such a - * fashion that it might be confused with the original M.I.T. software. - * 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 "com_err.h" -#include "error_table.h" - -#if 0 -/* - * XXX This function is provided without any prototypes in the public - * interface, and isn't used internally. It's probably safe to make - * it go away. - */ -struct foobar { - struct et_list etl; - struct error_table et; -}; - -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 ENOMEM; /* 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; -} - -extern errcode_t KRB5_CALLCONV et_init(ectx) - et_ctx *ectx; -{ - struct et_context *ctx; - - ctx = malloc(sizeof(struct et_context)); - if (!ctx) - return ENOMEM; - ctx->tables = 0; - ctx->hook_func = 0; - ctx->hook_func_data = 0; - - *ectx = ctx; - return 0; -} - -extern void KRB5_CALLCONV et_shutdown(ectx) - et_ctx ectx; -{ - struct et_list *p, *n; - - p = ectx->tables; - while (p) { - n = p->next; - free(p); - p = n; - } - free(ectx); -} - -extern errcode_t KRB5_CALLCONV et_add_error_table(ectx, tbl) - et_ctx ectx; - struct error_table *tbl; -{ - struct et_list *e; - - e = malloc(sizeof(struct et_list)); - if (!e) - return ENOMEM; - - e->table = tbl; - e->next = ectx->tables; - ectx->tables = e; - - return 0; -} - -#endif diff --git a/src/util/et/internal.h b/src/util/et/internal.h deleted file mode 100644 index 1e8d62dff..000000000 --- a/src/util/et/internal.h +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ -/* - * internal include file for com_err package - */ -#include "mit-sipb-copyright.h" - -#include <errno.h> - -#include "k5-platform.h" - -#ifndef SYS_ERRLIST_DECLARED -extern char const * const sys_errlist[]; -extern const int sys_nerr; -#endif - -#if defined(__STDC__) && !defined(HDR_HAS_PERROR) && !defined(WIN32) -void perror (const char *); -#endif |