+static const char magic_ident_string[16] = "agedu index file";
+struct trie_magic {
+ /*
+ * 'Magic numbers' to go at the start of an agedu index file.
+ * These are checked (using trie_check_magic) by every agedu mode
+ * which reads a pre-existing index.
+ *
+ * As well as identifying an agedu file from any other kind of
+ * file, this magic-number structure is also intended to detect
+ * agedu files which were written on the wrong platform and hence
+ * whose structure layouts are incompatible. To make that as
+ * reliable as possible, I design the structure of magic numbers
+ * as follows: it contains one of each integer type I might use,
+ * each containing a different magic number, and each followed by
+ * a char to indicate where it ends in the file. One byte is set
+ * to the length of the magic-number structure itself, which means
+ * that no two structures of different lengths can possibly
+ * compare equal even if by some chance they match up to the
+ * length of the shorter one. Finally, the whole magic number
+ * structure is memset to another random byte value before
+ * initialising any of these fields, so that padding in between
+ * can be readily identified.
+ */
+ char ident[16]; /* human-readable string */
+
+ unsigned char magic_len;
+
+ unsigned long long longlong_magic;
+ unsigned char postlonglong_char_magic;
+
+ off_t offset_magic;
+ unsigned char postoffset_char_magic;
+
+ size_t size_magic;
+ unsigned char postsize_char_magic;
+
+ void *null_pointer;
+ unsigned char postptr_char_magic;
+
+ unsigned long long_magic;
+ unsigned char postlong_char_magic;
+
+ unsigned short short_magic;
+ unsigned char postshort_char_magic;
+};
+