+#endif
+
+/** @brief Order two stringlists
+ * @param a First stringlist
+ * @param b Second stringlist
+ * @return <0, 0 or >0 if a<b, a=b or a>b
+ */
+static int stringlist_compare(const struct stringlist *a,
+ const struct stringlist *b) {
+ int n = 0, c;
+
+ while(n < a->n && n < b->n) {
+ if((c = strcmp(a->s[n], b->s[n])))
+ return c;
+ ++n;
+ }
+ if(a->n < b->n)
+ return -1;
+ else if(a->n > b->n)
+ return 1;
+ else
+ return 0;
+}
+
+/** @brief Order two namepart definitions
+ * @param a First namepart definition
+ * @param b Second namepart definition
+ * @return <0, 0 or >0 if a<b, a=b or a>b
+ */
+static int namepart_compare(const struct namepart *a,
+ const struct namepart *b) {
+ int c;
+
+ if((c = strcmp(a->part, b->part)))
+ return c;
+ if((c = strcmp(a->res, b->res)))
+ return c;
+ if((c = strcmp(a->replace, b->replace)))
+ return c;
+ if((c = strcmp(a->context, b->context)))
+ return c;
+ if(a->reflags > b->reflags)
+ return 1;
+ if(a->reflags < b->reflags)
+ return -1;
+ return 0;
+}
+
+/** @brief Order two lists of namepart definitions
+ * @param a First list of namepart definitions
+ * @param b Second list of namepart definitions
+ * @return <0, 0 or >0 if a<b, a=b or a>b
+ */
+static int namepartlist_compare(const struct namepartlist *a,
+ const struct namepartlist *b) {
+ int n = 0, c;
+
+ while(n < a->n && n < b->n) {
+ if((c = namepart_compare(&a->s[n], &b->s[n])))
+ return c;
+ ++n;
+ }
+ if(a->n > b->n)
+ return 1;
+ else if(a->n < b->n)
+ return -1;
+ else
+ return 0;
+}
+
+/** @brief Verify configuration table.
+ * @return The number of problems found
+*/
+int config_verify(void) {
+ int fails = 0;
+ size_t n;
+ for(n = 1; n < sizeof conf / sizeof *conf; ++n)
+ if(strcmp(conf[n-1].name, conf[n].name) >= 0) {
+ fprintf(stderr, "%s >= %s\n", conf[n-1].name, conf[n].name);
+ ++fails;
+ }
+ return fails;
+}