+#define SUFFIX_NO_MATCH 0
+#define SUFFIX_MATCH (1 << 0)
+#define SUFFIX_MATCH_COMPLETE (1 << 1)
+
+static int token_suffix_match(char *token, char *suffix, int start_pos)
+{
+ int len_token = strlen(token);
+ int len_suffix = strlen(suffix);
+
+ if (start_pos + len_suffix > len_token)
+ return SUFFIX_NO_MATCH;
+
+ if (strncmp(&token[start_pos], suffix, len_suffix) != 0)
+ return SUFFIX_NO_MATCH;
+
+ if (token[start_pos + len_suffix] == '\0')
+ return SUFFIX_MATCH_COMPLETE;
+
+ if (token[start_pos + len_suffix] == '.')
+ return SUFFIX_MATCH;
+
+ return SUFFIX_NO_MATCH;
+}
+
+#define KNOWN_TOKEN_VALUE "[KNOWN_TOKEN]"
+
+static void read_token_parameters(struct SetupFileList *setup_file_list,
+ struct ConfigInfo *suffix_list,
+ struct FileInfo *file_list_entry)
+{
+ /* check for config token that is the base token without any suffixes */
+ char *filename = getTokenValue(setup_file_list, file_list_entry->token);
+ char *known_token_value = KNOWN_TOKEN_VALUE;
+ int i;
+
+ if (filename != NULL)
+ {
+ /* when file definition found, set all parameters to default values */
+ for (i=0; suffix_list[i].token != NULL; i++)
+ file_list_entry->parameter[i] =
+ get_parameter_value(suffix_list[i].type, suffix_list[i].value);
+
+ file_list_entry->filename = getStringCopy(filename);
+
+ /* mark config file token as well known from default config */
+ setTokenValue(setup_file_list, file_list_entry->token, known_token_value);
+ }
+ else
+ file_list_entry->filename =
+ getStringCopy(file_list_entry->default_filename);
+
+ /* check for config tokens that can be build by base token and suffixes */
+ for (i=0; suffix_list[i].token != NULL; i++)
+ {
+ char *token = getStringCat2(file_list_entry->token, suffix_list[i].token);
+ char *value = getTokenValue(setup_file_list, token);
+
+ if (value != NULL)
+ {
+ file_list_entry->parameter[i] =
+ get_parameter_value(suffix_list[i].type, value);
+
+ /* mark config file token as well known from default config */
+ setTokenValue(setup_file_list, token, known_token_value);
+ }
+
+ free(token);
+ }
+}
+