+/* ------------------------------------------------------------------------- */
+/* setup file list and hash handling functions */
+/* ------------------------------------------------------------------------- */
+
+char *getFormattedSetupEntry(char *token, char *value)
+{
+ int i;
+ static char entry[MAX_LINE_LEN];
+
+ /* if value is an empty string, just return token without value */
+ if (*value == '\0')
+ return token;
+
+ /* start with the token and some spaces to format output line */
+ sprintf(entry, "%s:", token);
+ for (i = strlen(entry); i < token_value_position; i++)
+ strcat(entry, " ");
+
+ /* continue with the token's value */
+ strcat(entry, value);
+
+ return entry;
+}
+
+SetupFileList *newSetupFileList(char *token, char *value)
+{
+ SetupFileList *new = checked_malloc(sizeof(SetupFileList));
+
+ new->token = getStringCopy(token);
+ new->value = getStringCopy(value);
+
+ new->next = NULL;
+
+ return new;
+}
+
+void freeSetupFileList(SetupFileList *list)
+{
+ if (list == NULL)
+ return;
+
+ checked_free(list->token);
+ checked_free(list->value);
+
+ if (list->next)
+ freeSetupFileList(list->next);
+
+ free(list);
+}
+
+char *getListEntry(SetupFileList *list, char *token)
+{
+ if (list == NULL)
+ return NULL;
+
+ if (strcmp(list->token, token) == 0)
+ return list->value;
+ else
+ return getListEntry(list->next, token);
+}
+
+SetupFileList *setListEntry(SetupFileList *list, char *token, char *value)
+{
+ if (list == NULL)
+ return NULL;
+
+ if (strcmp(list->token, token) == 0)
+ {
+ checked_free(list->value);
+
+ list->value = getStringCopy(value);
+
+ return list;
+ }
+ else if (list->next == NULL)
+ return (list->next = newSetupFileList(token, value));
+ else
+ return setListEntry(list->next, token, value);
+}
+
+SetupFileList *addListEntry(SetupFileList *list, char *token, char *value)
+{
+ if (list == NULL)
+ return NULL;
+
+ if (list->next == NULL)
+ return (list->next = newSetupFileList(token, value));
+ else
+ return addListEntry(list->next, token, value);
+}
+
+#ifdef DEBUG
+static void printSetupFileList(SetupFileList *list)
+{
+ if (!list)
+ return;
+
+ printf("token: '%s'\n", list->token);
+ printf("value: '%s'\n", list->value);
+
+ printSetupFileList(list->next);
+}
+#endif
+
+#ifdef DEBUG
+DEFINE_HASHTABLE_INSERT(insert_hash_entry, char, char);
+DEFINE_HASHTABLE_SEARCH(search_hash_entry, char, char);
+DEFINE_HASHTABLE_CHANGE(change_hash_entry, char, char);
+DEFINE_HASHTABLE_REMOVE(remove_hash_entry, char, char);
+#else
+#define insert_hash_entry hashtable_insert
+#define search_hash_entry hashtable_search
+#define change_hash_entry hashtable_change
+#define remove_hash_entry hashtable_remove
+#endif
+
+static unsigned int get_hash_from_key(void *key)
+{
+ /*
+ djb2