"Fossies" - the Fresh Open Source Software Archive

Member "detox-1.4.5/src/config_file_dump.c" (15 Aug 2021, 3011 Bytes) of package /linux/privat/detox-1.4.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "config_file_dump.c" see the Fossies "Dox" file reference documentation.

    1 /**
    2  * This file is part of the Detox package.
    3  *
    4  * Copyright (c) Doug Harple <detox.dharple@gmail.com>
    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 "config.h"
   11 
   12 #include <stdio.h>
   13 #include <stdlib.h>
   14 #include <string.h>
   15 
   16 #include "detox.h"
   17 #include "config_file_dump.h"
   18 #include "clean_string.h"
   19 
   20 void dump_config_file(struct detox_parse_results *parse_results, struct detox_options *main_options)
   21 {
   22     struct detox_sequence_list *list_work = NULL;
   23     struct detox_sequence_entry *work = NULL;
   24     struct detox_ignore_entry *ignore_walk = NULL;
   25 
   26     if (!main_options->verbose) {
   27         printf("available sequences:\n");
   28     }
   29 
   30     list_work = parse_results->sequences;
   31 
   32     while (list_work != NULL) {
   33         if (main_options->verbose) {
   34             printf("sequence name: ");
   35         }
   36         else {
   37             printf("\t");
   38         }
   39         printf("%s%s\n", list_work->name, (main_options->sequence_to_use == list_work->head) ? " (*)" : "");
   40         if (main_options->verbose) {
   41             printf("\tsource file: %s\n", list_work->source_filename);
   42 
   43             work = list_work->head;
   44             while (work != NULL) {
   45                 if (work->cleaner == &clean_uncgi) {
   46                     printf("\tcleaner: uncgi\n");
   47                 }
   48                 else if (work->cleaner == &clean_safe) {
   49                     printf("\tcleaner: safe\n");
   50                     if (work->options != NULL) {
   51                         struct clean_string_options *opts = work->options;
   52                         if (opts->filename != NULL) {
   53                             printf("\t\ttranslation table: %s\n", opts->filename);
   54                         }
   55                     }
   56                 }
   57                 else if (work->cleaner == &clean_wipeup) {
   58                     printf("\tcleaner: wipeup\n");
   59                     if (work->options != NULL) {
   60                         struct clean_string_options *opts = work->options;
   61                         printf("\t\tremove trailing: %s\n", opts->remove_trailing ? "yes" : "no");
   62                     }
   63                 }
   64                 else if (work->cleaner == &clean_iso8859_1) {
   65                     printf("\tcleaner: iso8859_1\n");
   66                     if (work->options != NULL) {
   67                         struct clean_string_options *opts = work->options;
   68                         if (opts->filename != NULL) {
   69                             printf("\t\ttranslation table: %s\n", opts->filename);
   70                         }
   71                     }
   72                 }
   73                 else if (work->cleaner == &clean_utf_8) {
   74                     printf("\tcleaner: utf_8\n");
   75                     if (work->options != NULL) {
   76                         struct clean_string_options *opts = work->options;
   77                         if (opts->filename != NULL) {
   78                             printf("\t\ttranslation table: %s\n", opts->filename);
   79                         }
   80                     }
   81                 }
   82                 else if (work->cleaner == &clean_max_length) {
   83                     printf("\tcleaner: max length\n");
   84                     if (work->options != NULL) {
   85                         struct clean_string_options *opts = work->options;
   86                         printf("\t\tlength: %d\n", (unsigned int)opts->max_length);
   87                     }
   88                 }
   89                 if (work->cleaner == &clean_lower) {
   90                     printf("\tcleaner: lower\n");
   91                 }
   92 
   93                 work = work->next;
   94             }
   95         }
   96 
   97         list_work = list_work->next;
   98     }
   99 
  100 
  101     if (parse_results->files_to_ignore) {
  102         printf("\nfiles to ignore:\n");
  103 
  104         ignore_walk = parse_results->files_to_ignore;
  105 
  106         while (ignore_walk != NULL) {
  107             printf("\t%s\n", ignore_walk->filename);
  108             ignore_walk = ignore_walk->next;
  109         }
  110     }
  111 
  112 }