Whamcloud - gitweb
Add Heimdal compile_et extensions from Philipp Thomas <pthomas@suse.de>
authorTheodore Ts'o <tytso@mit.edu>
Fri, 1 Aug 2003 12:59:40 +0000 (08:59 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 1 Aug 2003 12:59:40 +0000 (08:59 -0400)
14 files changed:
lib/et/ChangeLog
lib/et/et_c.awk
lib/et/et_h.awk
lib/et/test_cases/continuation.c
lib/et/test_cases/continuation.h
lib/et/test_cases/heimdal3.c [new file with mode: 0644]
lib/et/test_cases/heimdal3.et [new file with mode: 0644]
lib/et/test_cases/heimdal3.h [new file with mode: 0644]
lib/et/test_cases/heimdall.c
lib/et/test_cases/heimdall.h
lib/et/test_cases/heimdall2.c
lib/et/test_cases/heimdall2.h
lib/et/test_cases/simple.c
lib/et/test_cases/simple.h

index 60d18d0..5f3095c 100644 (file)
@@ -1,3 +1,7 @@
+2003-08-01  Philipp Thomas <pthomas@suse.de>
+
+       * et_c.awk, et_h.awk: Add Heimdal compile_et extensions
+
 2003-07-25  Theodore Ts'o  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.34
index 4e4fa7c..6ca35d9 100644 (file)
@@ -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
index 687fc6b..f598393 100644 (file)
@@ -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) \
index a203242..91886c9 100644 (file)
@@ -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;
index 45818ce..cea4117 100644 (file)
@@ -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 (file)
index 0000000..faebada
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * heimdal3.c:
+ * This file is automatically generated; please do not edit it.
+ */
+
+#include <stdlib.h>
+
+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 (file)
index 0000000..a0bd5c1
--- /dev/null
@@ -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 (file)
index 0000000..d8a17c5
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * heimdal3.h:
+ * This file is automatically generated; please do not edit it.
+ */
+
+#include <et/com_err.h>
+
+#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
index 942b231..432fb22 100644 (file)
@@ -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;
index 132b1a8..d542188 100644 (file)
 #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... */
index 3cb0c94..4bcb850 100644 (file)
@@ -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;
index d828a6c..05510aa 100644 (file)
 #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... */
index 099ac17..61e94f7 100644 (file)
@@ -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;
index c6aa024..8cd14cb 100644 (file)
 #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... */