diff --git a/lib/et/ChangeLog b/lib/et/ChangeLog index 60d18d09..5f3095cb 100644 --- a/lib/et/ChangeLog +++ b/lib/et/ChangeLog @@ -1,3 +1,7 @@ +2003-08-01 Philipp Thomas + + * et_c.awk, et_h.awk: Add Heimdal compile_et extensions + 2003-07-25 Theodore Ts'o * Release of E2fsprogs 1.34 diff --git a/lib/et/et_c.awk b/lib/et/et_c.awk index 4e4fa7cf..6ca35d91 100644 --- a/lib/et/et_c.awk +++ b/lib/et/et_c.awk @@ -68,10 +68,16 @@ c2n["_"]=63 /^#/ { next } /^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ { table_number = 0 - table_name = $2 mod_base = 1000000 - for(i=1; i<=length(table_name); i++) { - table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)] + if (NF > 2) { + table_name = $3 + base_name = $2 + } else { + table_name = $2 + base_name = table_name + } + for(i=1; i<=length(base_name); i++) { + table_number=(table_number*char_shift)+c2n[substr(base_name,i,1)] } # We start playing *_high, *low games here because the some @@ -136,6 +142,11 @@ c2n["_"]=63 continuation = 0; } +/^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[^ \t]/ { + # Be tolerant to missing whitespace after `,' ... + sub(/,/, ", ") +} + /^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,[ \t]*$/ { table_item_count++ skipone=1 @@ -180,6 +191,10 @@ c2n["_"]=63 skipone=0 } +/^[ \t]*(prefix)$/ { + prefix_str = "" +} + /^[ \t]*(prefix)[ \t]+[A-Z_0-9]+/ { prefix_str = $2 "_" } @@ -229,7 +244,7 @@ END { print " }" > outfile print "}" > outfile print "" > outfile - print "/* For Heimdall compatibility */" > outfile + print "/* For Heimdal compatibility */" > outfile print "void initialize_" table_name "_error_table_r(struct et_list **list)" > outfile print "{" > outfile print " struct et_list *et, **end;" > outfile diff --git a/lib/et/et_h.awk b/lib/et/et_h.awk index 687fc6b1..f5983934 100644 --- a/lib/et/et_h.awk +++ b/lib/et/et_h.awk @@ -68,10 +68,16 @@ c2n["_"]=63 /^#/ { next } /^[ \t]*(error_table|et)[ \t]+[a-zA-Z][a-zA-Z0-9_]+/ { table_number = 0 - table_name = $2 mod_base = 1000000 - for(i=1; i<=length(table_name); i++) { - table_number=(table_number*char_shift)+c2n[substr(table_name,i,1)] + if (NF > 2) { + table_name = $3 + base_name = $2 + } else { + table_name = $2 + base_name = table_name + } + for(i=1; i<=length(base_name); i++) { + table_number=(table_number*char_shift)+c2n[substr(base_name,i,1)] } # We start playing *_high, *low games here because the some # awk programs do not have the necessary precision (sigh) @@ -126,6 +132,9 @@ c2n["_"]=63 } /^[ \t]*(error_code|ec)[ \t]+[A-Z_0-9]+,/ { + # Be tolerant to missing whitespace after `,' ... + sub(/,/, ", ") + tag=prefix_str substr($2,1,length($2)-1) if (curr_high == 0) { printf "#define %-40s (%dL)\n", tag, \ @@ -146,6 +155,10 @@ c2n["_"]=63 } } +/^[ \t]*(prefix)$/ { + prefix_str = "" +} + /^[ \t]*(prefix)[ \t]+[A-Z_0-9]+/ { prefix_str = $2 "_" } @@ -168,6 +181,10 @@ c2n["_"]=63 END { print "extern const struct error_table et_" table_name "_error_table;" > outfile print "extern void initialize_" table_name "_error_table(void);" > outfile + print "" > outfile + print "/* For compatibility with Heimdal */" > outfile + print "extern void initialize_" table_name "_error_table_r(void);" > outfile + print "" > outfile if (tab_base_high == 0) { print "#define ERROR_TABLE_BASE_" table_name " (" \ sprintf("%d", tab_base_sign*tab_base_low) \ diff --git a/lib/et/test_cases/continuation.c b/lib/et/test_cases/continuation.c index a203242b..91886c98 100644 --- a/lib/et/test_cases/continuation.c +++ b/lib/et/test_cases/continuation.c @@ -35,7 +35,7 @@ void initialize_ovk_error_table(void) { } } -/* For Heimdall compatibility */ +/* For Heimdal compatibility */ void initialize_ovk_error_table_r(struct et_list **list) { struct et_list *et, **end; diff --git a/lib/et/test_cases/continuation.h b/lib/et/test_cases/continuation.h index 45818ce1..cea41179 100644 --- a/lib/et/test_cases/continuation.h +++ b/lib/et/test_cases/continuation.h @@ -8,6 +8,10 @@ #define CHPASS_UTIL_PASSWORD_IN_DICTIONARY (43787520L) extern const struct error_table et_ovk_error_table; extern void initialize_ovk_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_ovk_error_table_r(void); + #define ERROR_TABLE_BASE_ovk (43787520L) /* for compatibility with older versions... */ diff --git a/lib/et/test_cases/heimdal3.c b/lib/et/test_cases/heimdal3.c new file mode 100644 index 00000000..faebadae --- /dev/null +++ b/lib/et/test_cases/heimdal3.c @@ -0,0 +1,53 @@ +/* + * heimdal3.c: + * This file is automatically generated; please do not edit it. + */ + +#include + +static const char * const text[] = { + "Test message 1", + "Test message 2", + 0 +}; + +struct error_table { + char const * const * msgs; + long base; + int n_msgs; +}; +struct et_list { + struct et_list *next; + const struct error_table * table; +}; +extern struct et_list *_et_list; + +const struct error_table et_h3test_error_table = { text, 43787520L, 2 }; + +static struct et_list link = { 0, 0 }; + +void initialize_h3test_error_table(void); + +void initialize_h3test_error_table(void) { + if (!link.table) { + link.next = _et_list; + link.table = &et_h3test_error_table; + _et_list = &link; + } +} + +/* For Heimdal compatibility */ +void initialize_h3test_error_table_r(struct et_list **list) +{ + struct et_list *et, **end; + + for (end = list, et = *list; et; end = &et->next, et = et->next) + if (et->table->msgs == text) + return; + et = malloc(sizeof(struct et_list)); + if (et == 0) + return; + et->table = &et_h3test_error_table; + et->next = 0; + *end = et; +} diff --git a/lib/et/test_cases/heimdal3.et b/lib/et/test_cases/heimdal3.et new file mode 100644 index 00000000..a0bd5c1e --- /dev/null +++ b/lib/et/test_cases/heimdal3.et @@ -0,0 +1,5 @@ +error_table ovk h3test +prefix H3TEST +ec TEST1, "Test message 1" +ec TEST2, "Test message 2" +end diff --git a/lib/et/test_cases/heimdal3.h b/lib/et/test_cases/heimdal3.h new file mode 100644 index 00000000..d8a17c53 --- /dev/null +++ b/lib/et/test_cases/heimdal3.h @@ -0,0 +1,20 @@ +/* + * heimdal3.h: + * This file is automatically generated; please do not edit it. + */ + +#include + +#define H3TEST_TEST1 (43787520L) +#define H3TEST_TEST2 (43787521L) +extern const struct error_table et_h3test_error_table; +extern void initialize_h3test_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_h3test_error_table_r(void); + +#define ERROR_TABLE_BASE_h3test (43787520L) + +/* for compatibility with older versions... */ +#define init_h3test_err_tbl initialize_h3test_error_table +#define h3test_err_base ERROR_TABLE_BASE_h3test diff --git a/lib/et/test_cases/heimdall.c b/lib/et/test_cases/heimdall.c index 942b231c..432fb22d 100644 --- a/lib/et/test_cases/heimdall.c +++ b/lib/et/test_cases/heimdall.c @@ -116,7 +116,7 @@ void initialize_krb_error_table(void) { } } -/* For Heimdall compatibility */ +/* For Heimdal compatibility */ void initialize_krb_error_table_r(struct et_list **list) { struct et_list *et, **end; diff --git a/lib/et/test_cases/heimdall.h b/lib/et/test_cases/heimdall.h index 132b1a88..d5421887 100644 --- a/lib/et/test_cases/heimdall.h +++ b/lib/et/test_cases/heimdall.h @@ -53,6 +53,10 @@ #define KRBET_KNAME_FMT (39525457L) extern const struct error_table et_krb_error_table; extern void initialize_krb_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_krb_error_table_r(void); + #define ERROR_TABLE_BASE_krb (39525376L) /* for compatibility with older versions... */ diff --git a/lib/et/test_cases/heimdall2.c b/lib/et/test_cases/heimdall2.c index 3cb0c945..4bcb850c 100644 --- a/lib/et/test_cases/heimdall2.c +++ b/lib/et/test_cases/heimdall2.c @@ -102,7 +102,7 @@ void initialize_kadm_error_table(void) { } } -/* For Heimdall compatibility */ +/* For Heimdal compatibility */ void initialize_kadm_error_table_r(struct et_list **list) { struct et_list *et, **end; diff --git a/lib/et/test_cases/heimdall2.h b/lib/et/test_cases/heimdall2.h index d828a6ce..05510aa6 100644 --- a/lib/et/test_cases/heimdall2.h +++ b/lib/et/test_cases/heimdall2.h @@ -47,6 +47,10 @@ #define KADM_PASS_Q_DICT (-1783126205L) extern const struct error_table et_kadm_error_table; extern void initialize_kadm_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_kadm_error_table_r(void); + #define ERROR_TABLE_BASE_kadm (-1783126272L) /* for compatibility with older versions... */ diff --git a/lib/et/test_cases/simple.c b/lib/et/test_cases/simple.c index 099ac17a..61e94f73 100644 --- a/lib/et/test_cases/simple.c +++ b/lib/et/test_cases/simple.c @@ -56,7 +56,7 @@ void initialize_krb_error_table(void) { } } -/* For Heimdall compatibility */ +/* For Heimdal compatibility */ void initialize_krb_error_table_r(struct et_list **list) { struct et_list *et, **end; diff --git a/lib/et/test_cases/simple.h b/lib/et/test_cases/simple.h index c6aa024b..8cd14cb0 100644 --- a/lib/et/test_cases/simple.h +++ b/lib/et/test_cases/simple.h @@ -29,6 +29,10 @@ #define KRB_SKDC_CANT (39525397L) extern const struct error_table et_krb_error_table; extern void initialize_krb_error_table(void); + +/* For compatibility with Heimdal */ +extern void initialize_krb_error_table_r(void); + #define ERROR_TABLE_BASE_krb (39525376L) /* for compatibility with older versions... */