| 1 |
/** |
| 2 |
* This file is part of the Detox package. |
| 3 |
* |
| 4 |
* Copyright (c) Doug Harple <[email protected]> |
| 5 |
* |
| 6 |
* For the full copyright and license information, please view the LICENSE |
| 7 |
* file that was distributed with this source code. |
| 8 |
*/ |
| 9 |
|
| 10 |
#include <stdio.h> |
| 11 |
|
| 12 |
#include "detox_struct.h" |
| 13 |
|
| 14 |
#include "config_file_dump.h" |
| 15 |
#include "filelist.h" |
| 16 |
|
| 17 |
void dump_config_file(config_file_t *config_file, options_t *main_options) |
| 18 |
{ |
| 19 |
sequence_t *sequence = NULL; |
| 20 |
filter_t *filter = NULL; |
| 21 |
char *file_walk; |
| 22 |
int count = 0; |
| 23 |
|
| 24 |
if (!main_options->verbose) { |
| 25 |
printf("available sequences:\n"); |
| 26 |
} |
| 27 |
|
| 28 |
sequence = config_file->sequences; |
| 29 |
|
| 30 |
while (sequence != NULL) { |
| 31 |
if (main_options->verbose) { |
| 32 |
if (count++ > 0) { |
| 33 |
printf("\n"); |
| 34 |
} |
| 35 |
printf("sequence name: "); |
| 36 |
} else { |
| 37 |
printf("\t"); |
| 38 |
} |
| 39 |
printf("%s%s\n", sequence->name, (main_options->sequence_to_use == sequence) ? " (*)" : ""); |
| 40 |
if (main_options->verbose) { |
| 41 |
printf("\tsource file: %s\n", sequence->source_filename); |
| 42 |
|
| 43 |
filter = sequence->filters; |
| 44 |
while (filter != NULL) { |
| 45 |
if (filter->cleaner == FILTER_UNCGI) { |
| 46 |
printf("\tcleaner: uncgi\n"); |
| 47 |
} else if (filter->cleaner == FILTER_SAFE) { |
| 48 |
printf("\tcleaner: safe\n"); |
| 49 |
} else if (filter->cleaner == FILTER_WIPEUP) { |
| 50 |
printf("\tcleaner: wipeup\n"); |
| 51 |
printf("\t\tremove trailing: %s\n", filter->remove_trailing ? "yes" : "no"); |
| 52 |
} else if (filter->cleaner == FILTER_ISO8859_1) { |
| 53 |
printf("\tcleaner: iso8859_1\n"); |
| 54 |
} else if (filter->cleaner == FILTER_UTF_8) { |
| 55 |
printf("\tcleaner: utf_8\n"); |
| 56 |
} else if (filter->cleaner == FILTER_MAX_LENGTH) { |
| 57 |
printf("\tcleaner: max length\n"); |
| 58 |
printf("\t\tlength: %d\n", (unsigned int) filter->max_length); |
| 59 |
} else if (filter->cleaner == FILTER_LOWER) { |
| 60 |
printf("\tcleaner: lower\n"); |
| 61 |
} |
| 62 |
|
| 63 |
if (filter->builtin != NULL) { |
| 64 |
printf("\t\tbuiltin table: %s\n", filter->builtin); |
| 65 |
} else if (filter->filename != NULL) { |
| 66 |
printf("\t\ttranslation table: %s\n", filter->filename); |
| 67 |
} |
| 68 |
|
| 69 |
filter = filter->next; |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
sequence = sequence->next; |
| 74 |
} |
| 75 |
|
| 76 |
if (filelist_count(config_file->files_to_ignore) > 0) { |
| 77 |
printf("\nfiles to ignore:\n"); |
| 78 |
|
| 79 |
while ((file_walk = filelist_get(config_file->files_to_ignore))) { |
| 80 |
printf("\t%s\n", file_walk); |
| 81 |
} |
| 82 |
} |
| 83 |
} |