cline.c

changeset 10
ecf787666f44
parent 8
28319b20968c
child 11
06cbd0ec003d
--- a/cline.c	Mon May 30 08:45:08 2011 +0200
+++ b/cline.c	Thu Sep 15 13:29:06 2011 +0200
@@ -1,50 +1,13 @@
-#include "cline.h"
-#include "functions.h"
-
-suffix_list_t* new_suffix_list_t() {
-  suffix_list_t* suffixList = malloc(sizeof(suffix_list_t*));
-  suffixList->count = 0;
-  suffixList->items = NULL;
-}
-
-void destroy_suffix_list_t(suffix_list_t* list) {
-  while (--list->count >= 0) {
-    free(list->items[list->count]);
-  }
-  free(list);
-}
+/*
+ * cline.c
+ *
+ *  Created on: 23.05.2011
+ *      Author: beckermi
+ */
 
-void add_suffix(suffix_list_t* list, char* item) {
-  char** reallocated_list =
-    realloc(list->items, sizeof(char**) * list->count + 1);
-  if (reallocated_list != NULL) {
-    list->items = reallocated_list;
-    list->items[list->count] = item;
-    list->count++;
-  }
-}
-
-settings_t* new_settings_t() {
-  settings_t *settings = malloc(sizeof(settings_t*));
-  if (settings != NULL) {
-  #ifdef _WIN32
-    settings->fileSeparator      = '\\';
-  #else
-    settings->fileSeparator      = '/';
-  #endif /* _WIN32 */
-    settings->recursive          = false;
-    settings->includeSuffixes    = false;
-    settings->matchesOnly        = false;
-    settings->suffixList         = new_suffix_list_t();
-  }
-  
-  return settings;
-}
-
-void destroy_settings_t(settings_t* settings) {
-  destroy_suffix_list_t(settings->suffixList);
-  free(settings);
-}
+#include "cline.h"
+#include "scanner.h"
+#include "settings.h"
 
 void printHelpText(const char* prgName) {
   // Help text
@@ -132,10 +95,7 @@
     }
     // h
     if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) {
-      if (registerArgument(&checked, 1)) {
-        return exit_with_help(prgName, settings, 1);
-      }
-      showHelp = true;
+      return exit_with_help(prgName, settings, 1);
     }
     // r, R
     if ((argflags & 24) > 0) {
@@ -160,11 +120,6 @@
     }
   }
 
-  // Show help and quit
-  if (showHelp) {
-    return exit_with_help(prgName, settings, 0);
-  }
-
   // Find tokens
   char* finder = strtok(suffix, ",");
   while (finder != NULL) {

mercurial