cline.c

changeset 10
ecf787666f44
parent 8
28319b20968c
child 11
06cbd0ec003d
     1.1 --- a/cline.c	Mon May 30 08:45:08 2011 +0200
     1.2 +++ b/cline.c	Thu Sep 15 13:29:06 2011 +0200
     1.3 @@ -1,50 +1,13 @@
     1.4 +/*
     1.5 + * cline.c
     1.6 + *
     1.7 + *  Created on: 23.05.2011
     1.8 + *      Author: beckermi
     1.9 + */
    1.10 +
    1.11  #include "cline.h"
    1.12 -#include "functions.h"
    1.13 -
    1.14 -suffix_list_t* new_suffix_list_t() {
    1.15 -  suffix_list_t* suffixList = malloc(sizeof(suffix_list_t*));
    1.16 -  suffixList->count = 0;
    1.17 -  suffixList->items = NULL;
    1.18 -}
    1.19 -
    1.20 -void destroy_suffix_list_t(suffix_list_t* list) {
    1.21 -  while (--list->count >= 0) {
    1.22 -    free(list->items[list->count]);
    1.23 -  }
    1.24 -  free(list);
    1.25 -}
    1.26 -
    1.27 -void add_suffix(suffix_list_t* list, char* item) {
    1.28 -  char** reallocated_list =
    1.29 -    realloc(list->items, sizeof(char**) * list->count + 1);
    1.30 -  if (reallocated_list != NULL) {
    1.31 -    list->items = reallocated_list;
    1.32 -    list->items[list->count] = item;
    1.33 -    list->count++;
    1.34 -  }
    1.35 -}
    1.36 -
    1.37 -settings_t* new_settings_t() {
    1.38 -  settings_t *settings = malloc(sizeof(settings_t*));
    1.39 -  if (settings != NULL) {
    1.40 -  #ifdef _WIN32
    1.41 -    settings->fileSeparator      = '\\';
    1.42 -  #else
    1.43 -    settings->fileSeparator      = '/';
    1.44 -  #endif /* _WIN32 */
    1.45 -    settings->recursive          = false;
    1.46 -    settings->includeSuffixes    = false;
    1.47 -    settings->matchesOnly        = false;
    1.48 -    settings->suffixList         = new_suffix_list_t();
    1.49 -  }
    1.50 -  
    1.51 -  return settings;
    1.52 -}
    1.53 -
    1.54 -void destroy_settings_t(settings_t* settings) {
    1.55 -  destroy_suffix_list_t(settings->suffixList);
    1.56 -  free(settings);
    1.57 -}
    1.58 +#include "scanner.h"
    1.59 +#include "settings.h"
    1.60  
    1.61  void printHelpText(const char* prgName) {
    1.62    // Help text
    1.63 @@ -132,10 +95,7 @@
    1.64      }
    1.65      // h
    1.66      if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) {
    1.67 -      if (registerArgument(&checked, 1)) {
    1.68 -        return exit_with_help(prgName, settings, 1);
    1.69 -      }
    1.70 -      showHelp = true;
    1.71 +      return exit_with_help(prgName, settings, 1);
    1.72      }
    1.73      // r, R
    1.74      if ((argflags & 24) > 0) {
    1.75 @@ -160,11 +120,6 @@
    1.76      }
    1.77    }
    1.78  
    1.79 -  // Show help and quit
    1.80 -  if (showHelp) {
    1.81 -    return exit_with_help(prgName, settings, 0);
    1.82 -  }
    1.83 -
    1.84    // Find tokens
    1.85    char* finder = strtok(suffix, ",");
    1.86    while (finder != NULL) {

mercurial