+ return value_string;
+}
+
+char *getSetupLine(struct TokenInfo *token_info, char *prefix, int token_nr)
+{
+ int i;
+ static char entry[MAX_LINE_LEN];
+ int token_type = token_info[token_nr].type;
+ void *setup_value = token_info[token_nr].value;
+ char *token_text = token_info[token_nr].text;
+ char *value_string = getSetupValue(token_type, setup_value);
+
+ /* start with the prefix, token and some spaces to format output line */
+ sprintf(entry, "%s%s:", prefix, token_text);
+ for (i=strlen(entry); i<TOKEN_VALUE_POSITION; i++)
+ strcat(entry, " ");
+
+ /* continue with the token's value (which can have different types) */
+ strcat(entry, value_string);
+
+ if (token_type == TYPE_KEY)
+ {
+ Key key = *(Key *)setup_value;
+ char *keyname = getKeyNameFromKey(key);
+
+ /* add comment, if useful */
+ if (strcmp(keyname, "(undefined)") != 0 &&
+ strcmp(keyname, "(unknown)") != 0)
+ {
+ for (i=strlen(entry); i<50; i++)
+ strcat(entry, " ");
+
+ strcat(entry, "# ");
+ strcat(entry, keyname);
+ }
+ }
+