+struct FileInfo *getFileListFromConfigList(struct ConfigInfo *config_list,
+ char *suffix_list[],
+ int num_file_list_entries)
+{
+ struct FileInfo *file_list;
+ int num_suffix_list_entries = 0;
+ int list_pos = -1;
+ int i, j;
+
+ file_list = checked_calloc(num_file_list_entries * sizeof(struct FileInfo));
+
+ for (i=0; suffix_list[i] != NULL; i++)
+ num_suffix_list_entries++;
+
+ if (num_suffix_list_entries > 0)
+ {
+ for (i=0; i<num_file_list_entries; i++)
+ {
+ file_list[i].default_parameter =
+ checked_calloc(num_suffix_list_entries * sizeof(int));
+ file_list[i].parameter =
+ checked_calloc(num_suffix_list_entries * sizeof(int));
+
+ for (j=0; j<num_suffix_list_entries; j++)
+ {
+ file_list[i].default_parameter[j] = -1;
+ file_list[i].parameter[j] = -1;
+ }
+ }
+ }
+
+ for (i=0; config_list[i].token != NULL; i++)
+ {
+ int len_config_token = strlen(config_list[i].token);
+ boolean is_file_entry = TRUE;
+
+ for (j=0; suffix_list[j] != NULL; j++)
+ {
+ int len_suffix = strlen(suffix_list[j]);
+
+ if (len_suffix < len_config_token &&
+ strcmp(&config_list[i].token[len_config_token - len_suffix],
+ suffix_list[j]) == 0)
+ {
+ file_list[list_pos].default_parameter[j] = atoi(config_list[i].value);
+
+ is_file_entry = FALSE;
+ break;
+ }
+ }
+
+ if (is_file_entry)
+ {
+ list_pos++;
+
+ if (list_pos >= num_file_list_entries)
+ Error(ERR_EXIT, "inconsistant config list information -- please fix");
+
+ file_list[list_pos].token = config_list[i].token;
+ file_list[list_pos].default_filename = config_list[i].value;
+ }
+ }
+
+ if (list_pos != num_file_list_entries - 1)
+ Error(ERR_EXIT, "inconsistant config list information -- please fix");
+
+ return file_list;
+}
+