summaryrefslogtreecommitdiffstats
path: root/src/lib/krb4
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2003-02-07 21:39:44 +0000
committerTom Yu <tlyu@mit.edu>2003-02-07 21:39:44 +0000
commitf783834660ced3cabc14fdc184f4808606c856a8 (patch)
tree56e5ae5a500c70d971aeb7b322b9b033d63b7cc4 /src/lib/krb4
parente8ee901a519d2f5eaf73b3b83dbac41c88d3d34c (diff)
downloadkrb5-f783834660ced3cabc14fdc184f4808606c856a8.tar.gz
krb5-f783834660ced3cabc14fdc184f4808606c856a8.tar.xz
krb5-f783834660ced3cabc14fdc184f4808606c856a8.zip
Fix ABI divergence between Unix and Mac krb4 libraries in declaration
of krb_err_txt by means of a gross hack. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15165 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb4')
-rw-r--r--src/lib/krb4/ChangeLog9
-rw-r--r--src/lib/krb4/Makefile.in7
-rw-r--r--src/lib/krb4/err_txt.c10
-rw-r--r--src/lib/krb4/et_errtxt.awk71
4 files changed, 92 insertions, 5 deletions
diff --git a/src/lib/krb4/ChangeLog b/src/lib/krb4/ChangeLog
index ada0773b9..0ba4774f0 100644
--- a/src/lib/krb4/ChangeLog
+++ b/src/lib/krb4/ChangeLog
@@ -1,3 +1,12 @@
+2003-02-07 Tom Yu <tlyu@mit.edu>
+
+ * Makefile.in: Add rules to generate krb_err_txt.c.
+
+ * err_txt.c: Include two copies of the error table, one generated
+ by com_err, and one generated by a special-purpose awk script.
+
+ * et_errtxt.awk: New file; used to generate krb_err_txt.c
+
2003-02-04 Tom Yu <tlyu@mit.edu>
* decomp_tkt.c (dcmp_tkt_int): Patch from Booker Bense to use
diff --git a/src/lib/krb4/Makefile.in b/src/lib/krb4/Makefile.in
index bdb43f467..c9b9ff889 100644
--- a/src/lib/krb4/Makefile.in
+++ b/src/lib/krb4/Makefile.in
@@ -206,6 +206,13 @@ krb_err.c: krb_err.et
kadm_err.h: kadm_err.et
kadm_err.c: kadm_err.et
+GEN_ERRTXT=$(AWK) -f $(srcdir)$(S)et_errtxt.awk outfile=$@
+
+krb_err_txt.c: krb_err.et $(srcdir)$(S)et_errtxt.awk
+ $(GEN_ERRTXT) $(srcdir)/krb_err.et
+
+err_txt.so err_txt.po $(OUTPRE)err_txt.$(OBJEXT): err_txt.c krb_err_txt.c
+
depend-dependencies: krb_err.h $(EHDRDIR)$(S)krb_err.h \
kadm_err.h $(EHDRDIR)$(S)kadm_err.h \
krb_err.c
diff --git a/src/lib/krb4/err_txt.c b/src/lib/krb4/err_txt.c
index 64663b3d7..57d346a40 100644
--- a/src/lib/krb4/err_txt.c
+++ b/src/lib/krb4/err_txt.c
@@ -29,8 +29,10 @@
/*
* This is gross. We want krb_err_txt to match the contents of the
- * com_err error table, but the text is static in krb_err.c. To avoid
- * multiple registrations of the error table, we also want to override
+ * com_err error table, but the text is static in krb_err.c. We can't
+ * alias it by making a pointer to it, either, so we have to suck in
+ * another copy of it that is named differently. Also, to avoid
+ * multiple registrations of the error table, we want to override
* initialize_krb_error_table() in case someone decides to call it.
*/
#undef initialize_krb_error_table
@@ -38,12 +40,10 @@
void krb4int_init_krb_err_tbl(void);
#include "krb_err.c"
#undef initialize_krb_error_table
+#include "krb_err_txt.c"
void initialize_krb_error_table(void);
-/* YUCK -- depends on naming of the static table. */
-const char * const * const krb_err_txt = text;
-
static int inited = 0;
void
diff --git a/src/lib/krb4/et_errtxt.awk b/src/lib/krb4/et_errtxt.awk
new file mode 100644
index 000000000..888dad695
--- /dev/null
+++ b/src/lib/krb4/et_errtxt.awk
@@ -0,0 +1,71 @@
+/^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ {
+ print "/*" > outfile
+ print " * " outfile ":" > outfile
+ print " * This file is automatically generated; please do not edit it." > outfile
+ print " */" > outfile
+ print "#if TARGET_OS_MAC" > outfile
+ print "const char * const * const krb_err_txt" > outfile
+ print "#else" > outfile
+ print "const char * const krb_err_txt[]" > outfile
+ print "#endif" > outfile
+ print "\t= {" > outfile
+ table_item_count = 0
+}
+
+(continuation == 1) && ($0 ~ /\\[ \t]*$/) {
+ text=substr($0,1,length($0)-1);
+# printf "\t\t\"%s\"\n", text > outfile
+ cont_buf=cont_buf text;
+}
+
+(continuation == 1) && ($0 ~ /"[ \t]*$/) {
+# "
+# printf "\t\t\"%s,\n", $0 > outfile
+ printf "\t%s,\n", cont_buf $0 > outfile
+ continuation = 0;
+}
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*$/ {
+ table_item_count++
+ skipone=1
+ next
+}
+
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*".*"[ \t]*$/ {
+ text=""
+ for (i=3; i<=NF; i++) {
+ text = text FS $i
+ }
+ text=substr(text,2,length(text)-1);
+ printf "\t%s,\n", text > outfile
+ table_item_count++
+}
+/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*".*\\[ \t]*$/ {
+ text=""
+ for (i=3; i<=NF; i++) {
+ text = text FS $i
+ }
+ text=substr(text,2,length(text)-2);
+# printf "\t%s\"\n", text > outfile
+ cont_buf=text
+ continuation++;
+}
+
+/^[ \t]*".*\\[ \t]*$/ {
+ if (skipone) {
+ text=substr($0,1,length($0)-1);
+# printf "\t%s\"\n", text > outfile
+ cont_buf=text
+ continuation++;
+ }
+ skipone=0
+}
+
+{
+ if (skipone) {
+ printf "\t%s,\n", $0 > outfile
+ }
+ skipone=0
+}
+END {
+ print "};" > outfile
+}