Fixed helpText and removed extra variables for default values

Fri, 27 May 2011 15:10:23 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 27 May 2011 15:10:23 +0200
changeset 7
1b55f3fa52c9
parent 6
be923400164c
child 8
28319b20968c

Fixed helpText and removed extra variables for default values

cline.c file | annotate | diff | comparison | revisions
--- a/cline.c	Fri May 27 14:45:16 2011 +0200
+++ b/cline.c	Fri May 27 15:10:23 2011 +0200
@@ -65,8 +65,8 @@
     "\n\n"
     "The default call without any options is:"    
     "\n  %s ./\n"
-    "That means each file in each subdirectory is counted. If you want to count"
-    "\nC source code in your working directory and its subdirectories, type:"
+    "So each file in the working directory is counted. If you want to count C"
+    "\nsource code in your working directory and its subdirectories, type:"
     "\n  %s -rs .c\n";
     
   printf(helpText, prgName, prgName, prgName, prgName);
@@ -90,16 +90,9 @@
     prgName++;
   }
 
-  // Defaults
-  char* _suffix = " ";
-  char _directory[3];
-  _directory[0] = '.';
-  _directory[1] = settings->fileSeparator;
-  _directory[2] = 0;
-
   // Get arguments
-  char* directory;
-  char* suffix;
+  char* directory = "./";
+  char* suffix = " ";
   bool showHelp = false;
   char checked = 0;
 
@@ -189,15 +182,6 @@
     return 0;
   }
 
-  // Default values
-  if ((checked & 1) == 0) {
-    suffix = _suffix;
-  }
-
-  if ((checked & 8) == 0) {
-    directory = _directory;
-  }
-
   // Find tokens
   char* finder = strtok(suffix, ",");
   while (finder != NULL) {
@@ -216,6 +200,7 @@
   // Scan directory
   int lines = scanDirectory(dir, 0, directory, settings);
   closedir(dir);
+  destroy_settings_t(settings);
 
   // Print double line and line count
   #ifdef _WIN32
@@ -233,7 +218,5 @@
     printf("\n%74d lines\n", lines);
   #endif /* _WIN32 */
 
-  destroy_settings_t(settings);
-
   return 0;
 }

mercurial