# HG changeset patch # User Mike Becker # Date 1306501823 -7200 # Node ID 1b55f3fa52c9c1f1c96b48532fd92d5c3bfb0876 # Parent be923400164ca8413056ddf01a5baa4a4b09bc0d Fixed helpText and removed extra variables for default values diff -r be923400164c -r 1b55f3fa52c9 cline.c --- 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; }