From bc29722caef4b5866c6d60fb99eb79ff0758ea66 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 3 Jul 2002 22:40:42 +0000 Subject: [PATCH] 2002-07-03 Tom Yu * Makefile.in: Fix rebuild rules et_?.perl -> et_?.pl. Also, strip the "#!" line. * error_table.h: Fix mac conditional, due to _et_list declaration moving from et_c.awk * et_c.perl, et_h.perl: Remove. * et_c.pl, et_h.pl: Generate. [porting some 1-2-2-branch changes] * com_err.h: Windows should include as opposed to * et_c.perl, et_h.perl: Renamed to et_c.pl and et_h.pl because the extension is used as a newline separator heuristic in MacPerl parser * et_c.perl, et_h.perl: Removed #! from the first line to avoid confusing MacPerl * com_err.h, error_message.c, et.pbexp, et_c.awk, et_h.awk: conditionalized com_err so it doesn't need to export et_list on Mac OS X [pullups from 1-2-2-branch] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14599 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/et/ChangeLog | 36 ++++++++++++++++++++++++++++++ src/util/et/Makefile.in | 8 +++---- src/util/et/com_err.h | 13 ++++++++++- src/util/et/error_message.c | 16 +++++++++---- src/util/et/error_table.h | 2 +- src/util/et/et.pbexp | 10 +++++++++ src/util/et/et_c.awk | 6 ++++- src/util/et/{et_c.perl => et_c.pl} | 15 +++++++++++-- src/util/et/et_h.awk | 6 ++++- src/util/et/{et_h.perl => et_h.pl} | 13 +++++++++-- 10 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 src/util/et/et.pbexp rename src/util/et/{et_c.perl => et_c.pl} (93%) rename src/util/et/{et_h.perl => et_h.pl} (92%) diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index 7e27e5689..4b767f953 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,39 @@ +2002-07-03 Tom Yu + + * Makefile.in: Fix rebuild rules et_?.perl -> et_?.pl. Also, + strip the "#!" line. + + * error_table.h: Fix mac conditional, due to _et_list declaration + moving from et_c.awk + + * et_c.perl, et_h.perl: Remove. + + * et_c.pl, et_h.pl: Generate. + +2002-07-03 Danilo Almeida + + * com_err.h: Windows should include as opposed + to + [pullup from 1-2-2-branch] + +2002-07-03 Miro Jurisic + + * et_c.perl, et_h.perl: + Renamed to et_c.pl and et_h.pl because the extension is used + as a newline separator heuristic in MacPerl parser + + * et_c.perl, et_h.perl: + Removed #! from the first line to avoid confusing MacPerl + + [pullups from 1-2-2-branch] + +2002-07-03 Alexandra Ellwood + + * com_err.h, error_message.c, et.pbexp, et_c.awk, et_h.awk: + conditionalized com_err so it doesn't need to export et_list + on Mac OS X + [pullup from 1-2-2-branch] + 2001-10-05 Ken Raeburn * com_err.h (KRB5_EXPORTVAR): Don't define. diff --git a/src/util/et/Makefile.in b/src/util/et/Makefile.in index c7e3651c9..9ddecfb31 100644 --- a/src/util/et/Makefile.in +++ b/src/util/et/Makefile.in @@ -164,11 +164,11 @@ compile_et: $(srcdir)/compile_et.sh $(srcdir)/config_script rebuild: rebuild-c rebuild-h rebuild-c: - a2p < $(srcdir)/et_c.awk > $(srcdir)/et_c.tmp - mv -f $(srcdir)/et_c.tmp $(srcdir)/et_c.perl + a2p < $(srcdir)/et_c.awk | awk 'NR != 1 || $$0 !~ /^\043!/{print;}' > $(srcdir)/et_c.tmp + mv -f $(srcdir)/et_c.tmp $(srcdir)/et_c.pl rebuild-h: - a2p < $(srcdir)/et_h.awk > $(srcdir)/et_h.tmp - mv -f $(srcdir)/et_h.tmp $(srcdir)/et_h.perl + a2p < $(srcdir)/et_h.awk | awk 'NR != 1 || $$0 !~ /^\043!/{print;}' > $(srcdir)/et_h.tmp + mv -f $(srcdir)/et_h.tmp $(srcdir)/et_h.pl clean-unix:: $(RM) compile_et diff --git a/src/util/et/com_err.h b/src/util/et/com_err.h index c56fad2b1..8738a5a7f 100644 --- a/src/util/et/com_err.h +++ b/src/util/et/com_err.h @@ -13,7 +13,14 @@ #ifndef __COM_ERR_H #if defined(_WIN32) || defined(macintosh) +#ifdef _WIN32 #include +#else +#include +#endif +#if defined(macintosh) && defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) +#pragma import on +#endif #endif #ifndef KRB5_CALLCONV @@ -53,7 +60,7 @@ extern errcode_t KRB5_CALLCONV remove_error_table (const struct error_table *) /*@modifies internalState@*/; -#if !defined(_WIN32) && !defined(macintosh) +#if !defined(_WIN32) && !defined(macintosh) && !defined(__MACH__) /* * The display routine should be application specific. A global hook, * may cause inappropriate display procedures to be called between @@ -68,5 +75,9 @@ extern et_old_error_hook_func reset_com_err_hook (void); } #endif +#if defined(macintosh) && defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) +#pragma import reset +#endif + #define __COM_ERR_H #endif /* ! defined(__COM_ERR_H) */ diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c index 827b52aa7..450148f06 100644 --- a/src/util/et/error_message.c +++ b/src/util/et/error_message.c @@ -27,8 +27,9 @@ #include "com_err.h" #include "error_table.h" -#ifdef macintosh -#include +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) + #include + #include #endif #if defined(_WIN32) @@ -48,7 +49,7 @@ extern const int sys_nerr; static char buffer[ET_EBUFSIZ]; -#if (defined(_WIN32) || defined(macintosh)) +#if (defined(_WIN32) || defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))) /*@null@*/ static struct et_list * _et_list = (struct et_list *) NULL; #else /* Old interface compatibility */ @@ -199,12 +200,19 @@ error_message(long code) oops: -#if defined(macintosh) +#if TARGET_OS_MAC { /* This may be a Mac OS Toolbox error or an MIT Support Library Error. Ask ErrorLib */ if (GetErrorLongString(code, buffer, ET_EBUFSIZ - 1) == noErr) { return buffer; } + +#if TARGET_API_MAC_OSX + /* ComErr and ErrorLib don't know about this error, ask the system */ + /* Of course there's no way to tell if it knew what error it got */ + return (strerror (code)); +#endif + } #endif diff --git a/src/util/et/error_table.h b/src/util/et/error_table.h index d30457d3f..505521dfe 100644 --- a/src/util/et/error_table.h +++ b/src/util/et/error_table.h @@ -19,7 +19,7 @@ struct et_list { /*@dependent@*//*@null@*/ struct et_list *next; /*@dependent@*//*@null@*/ const struct error_table *table; }; -#if !defined(_WIN32) && !defined(macintosh) +#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__)) /*@null@*//*@dependent@*/ extern struct et_list * _et_list; #endif diff --git a/src/util/et/et.pbexp b/src/util/et/et.pbexp new file mode 100644 index 000000000..31097615a --- /dev/null +++ b/src/util/et/et.pbexp @@ -0,0 +1,10 @@ +# +# comerr library Macintosh export file +# +# $Header$ + +_com_err +_com_err_va +_error_message +_add_error_table +_remove_error_table diff --git a/src/util/et/et_c.awk b/src/util/et/et_c.awk index 023c831c3..10662b6e5 100644 --- a/src/util/et/et_c.awk +++ b/src/util/et/et_c.awk @@ -113,7 +113,9 @@ c2n["_"]=63 print "# include \"win-mac.h\"" > outfile print "#endif" > outfile print "" > outfile + print "#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))" > outfile print "extern void initialize_" table_name "_error_table (void);" > outfile + print "#endif" > outfile print "" > outfile print "/* Lclint doesn't handle null annotations on arrays" > outfile print " properly, so we need this typedef in each" > outfile @@ -185,7 +187,9 @@ END { print " 0" > outfile print "};" > outfile print "" > outfile + print "#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))" > outfile print "#include " > outfile + print "#endif" > outfile print "" > outfile if (tab_base_high == 0) { print "const struct error_table et_" table_name "_error_table = { text, " \ @@ -197,7 +201,7 @@ END { tab_base_low, table_item_count) > outfile } print "" > outfile - print "#if !defined(_WIN32) && !defined(macintosh)" > outfile + print "#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))" > outfile print "void initialize_" table_name "_error_table (void)" > outfile print " /*@modifies internalState@*/" > outfile print "{" > outfile diff --git a/src/util/et/et_c.perl b/src/util/et/et_c.pl similarity index 93% rename from src/util/et/et_c.perl rename to src/util/et/et_c.pl index ad85ec759..fff4a56ff 100644 --- a/src/util/et/et_c.perl +++ b/src/util/et/et_c.pl @@ -1,4 +1,3 @@ -#!/usr/athena/bin/perl eval 'exec /usr/athena/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. @@ -144,10 +143,16 @@ line: while (<>) { (print $fh '#endif'); &Pick('>', $outfile) && (print $fh ''); + &Pick('>', $outfile) && + (print $fh + + '#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))'); &Pick('>', $outfile) && (print $fh 'extern void initialize_' . $table_name . '_error_table (void);'); + &Pick('>', $outfile) && + (print $fh '#endif'); &Pick('>', $outfile) && (print $fh ''); &Pick('>', $outfile) && @@ -233,8 +238,14 @@ line: while (<>) { (print $fh '};'); &Pick('>', $outfile) && (print $fh ''); +&Pick('>', $outfile) && + (print $fh + + '#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))'); &Pick('>', $outfile) && (print $fh '#include '); +&Pick('>', $outfile) && + (print $fh '#endif'); &Pick('>', $outfile) && (print $fh ''); if ($tab_base_high == 0) { @@ -258,7 +269,7 @@ else { &Pick('>', $outfile) && (print $fh - '#if !defined(_WIN32) && !defined(macintosh)'); + '#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))'); &Pick('>', $outfile) && (print $fh 'void initialize_' . $table_name . '_error_table (void)'); &Pick('>', $outfile) && diff --git a/src/util/et/et_h.awk b/src/util/et/et_h.awk index 2cea1532d..1bbe5e972 100644 --- a/src/util/et/et_h.awk +++ b/src/util/et/et_h.awk @@ -111,7 +111,11 @@ c2n["_"]=63 print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile print "" > outfile + print "#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))" > outfile + print "#include " > outfile + print "#else" > outfile print "#include " > outfile + print "#endif" > outfile print "" > outfile } @@ -148,7 +152,7 @@ END { print "" > outfile print "extern struct error_table et_" table_name "_error_table;" > outfile print "" > outfile - print "#if !defined(_WIN32) && !defined(macintosh)" > outfile + print "#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))" > outfile print "/* for compatibility with older versions... */" > outfile print "extern void initialize_" table_name "_error_table () /*@modifies internalState@*/;" > outfile print "#define init_" table_name "_err_tbl initialize_" table_name "_error_table" > outfile diff --git a/src/util/et/et_h.perl b/src/util/et/et_h.pl similarity index 92% rename from src/util/et/et_h.perl rename to src/util/et/et_h.pl index 5789617a4..5debb4869 100644 --- a/src/util/et/et_h.perl +++ b/src/util/et/et_h.pl @@ -1,4 +1,3 @@ -#!/usr/athena/bin/perl eval 'exec /usr/athena/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # this emulates #! processing on NIH machines. @@ -137,8 +136,18 @@ line: while (<>) { (print $fh ' */'); &Pick('>', $outfile) && (print $fh ''); + &Pick('>', $outfile) && + (print $fh + + '#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))'); + &Pick('>', $outfile) && + (print $fh '#include '); + &Pick('>', $outfile) && + (print $fh '#else'); &Pick('>', $outfile) && (print $fh '#include '); + &Pick('>', $outfile) && + (print $fh '#endif'); &Pick('>', $outfile) && (print $fh ''); } @@ -194,7 +203,7 @@ else { &Pick('>', $outfile) && (print $fh - '#if !defined(_WIN32) && !defined(macintosh)'); + '#if !defined(_WIN32) && !defined(macintosh) && !(defined(__MACH__) && defined(__APPLE__))'); &Pick('>', $outfile) && (print $fh '/* for compatibility with older versions... */'); &Pick('>', $outfile) && -- 2.26.2