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
     1.1 --- a/cline.c	Fri May 27 14:45:16 2011 +0200
     1.2 +++ b/cline.c	Fri May 27 15:10:23 2011 +0200
     1.3 @@ -65,8 +65,8 @@
     1.4      "\n\n"
     1.5      "The default call without any options is:"    
     1.6      "\n  %s ./\n"
     1.7 -    "That means each file in each subdirectory is counted. If you want to count"
     1.8 -    "\nC source code in your working directory and its subdirectories, type:"
     1.9 +    "So each file in the working directory is counted. If you want to count C"
    1.10 +    "\nsource code in your working directory and its subdirectories, type:"
    1.11      "\n  %s -rs .c\n";
    1.12      
    1.13    printf(helpText, prgName, prgName, prgName, prgName);
    1.14 @@ -90,16 +90,9 @@
    1.15      prgName++;
    1.16    }
    1.17  
    1.18 -  // Defaults
    1.19 -  char* _suffix = " ";
    1.20 -  char _directory[3];
    1.21 -  _directory[0] = '.';
    1.22 -  _directory[1] = settings->fileSeparator;
    1.23 -  _directory[2] = 0;
    1.24 -
    1.25    // Get arguments
    1.26 -  char* directory;
    1.27 -  char* suffix;
    1.28 +  char* directory = "./";
    1.29 +  char* suffix = " ";
    1.30    bool showHelp = false;
    1.31    char checked = 0;
    1.32  
    1.33 @@ -189,15 +182,6 @@
    1.34      return 0;
    1.35    }
    1.36  
    1.37 -  // Default values
    1.38 -  if ((checked & 1) == 0) {
    1.39 -    suffix = _suffix;
    1.40 -  }
    1.41 -
    1.42 -  if ((checked & 8) == 0) {
    1.43 -    directory = _directory;
    1.44 -  }
    1.45 -
    1.46    // Find tokens
    1.47    char* finder = strtok(suffix, ",");
    1.48    while (finder != NULL) {
    1.49 @@ -216,6 +200,7 @@
    1.50    // Scan directory
    1.51    int lines = scanDirectory(dir, 0, directory, settings);
    1.52    closedir(dir);
    1.53 +  destroy_settings_t(settings);
    1.54  
    1.55    // Print double line and line count
    1.56    #ifdef _WIN32
    1.57 @@ -233,7 +218,5 @@
    1.58      printf("\n%74d lines\n", lines);
    1.59    #endif /* _WIN32 */
    1.60  
    1.61 -  destroy_settings_t(settings);
    1.62 -
    1.63    return 0;
    1.64  }

mercurial