Fri, 16 Sep 2011 09:14:59 +0200
removed dynamic programm name
.cproject | file | annotate | diff | comparison | revisions | |
cline.c | file | annotate | diff | comparison | revisions | |
cline.h | file | annotate | diff | comparison | revisions |
--- a/.cproject Thu Sep 15 13:38:03 2011 +0200 +++ b/.cproject Fri Sep 16 09:14:59 2011 +0200 @@ -60,4 +60,24 @@ <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> </scannerConfigBuildInfo> </storageModule> + <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> + <buildTargets> + <target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> + <buildCommand>make</buildCommand> + <buildArguments/> + <buildTarget>all</buildTarget> + <stopOnError>true</stopOnError> + <useDefaultCommand>true</useDefaultCommand> + <runAllBuilders>false</runAllBuilders> + </target> + <target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> + <buildCommand>make</buildCommand> + <buildArguments/> + <buildTarget>clean</buildTarget> + <stopOnError>true</stopOnError> + <useDefaultCommand>true</useDefaultCommand> + <runAllBuilders>false</runAllBuilders> + </target> + </buildTargets> + </storageModule> </cproject>
--- a/cline.c Thu Sep 15 13:38:03 2011 +0200 +++ b/cline.c Fri Sep 16 09:14:59 2011 +0200 @@ -8,13 +8,14 @@ #include "cline.h" #include "scanner.h" #include "settings.h" +#include "arguments.h" -void printHelpText(const char* prgName) { +void printHelpText() { // Help text const char* helpText = "\nUsage:" - "\n %s [-hrm][-s suffix][<directory>]" - "\n %s [-hrm][-S suffix][<directory>]" + "\n cline [-hrm][-s suffix][<directory>]" + "\n cline [-hrm][-S suffix][<directory>]" "\n\nCounts the line terminator characters (\\n) within all" " files in the specified\ndirectory." "\n\nOptions:" @@ -27,16 +28,16 @@ "\n -r, -R - includes subdirectories" "\n\n" "The default call without any options is:" - "\n %s ./\n" + "\n cline ./\n" "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"; + "\n cline -rs .c\n"; - printf(helpText, prgName, prgName, prgName, prgName); + printf(helpText); } -int exit_with_help(char* prgName, settings_t* settings, int code) { - printHelpText(prgName); +int exit_with_help(settings_t* settings, int code) { + printHelpText(); destroy_settings_t(settings); return code; } @@ -50,15 +51,6 @@ return 1; } - // Program name - char* prgName = strrchr(argv[0], settings->fileSeparator); - - if (prgName == NULL) { - prgName = argv[0]; - } else { - prgName++; - } - // Get arguments char* directory = "./"; char* suffix = " "; @@ -72,49 +64,49 @@ // s if ((argflags & 2) > 0) { if (registerArgument(&checked, 6)) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } settings->includeSuffixes = true; t++; if (t >= argc) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } suffix = argv[t]; } // S if ((argflags & 4) > 0) { if (registerArgument(&checked, 6)) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } settings->includeSuffixes = false; t++; if (t >= argc) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } suffix = argv[t]; } // h if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } // r, R if ((argflags & 24) > 0) { if (registerArgument(&checked, 24)) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } settings->recursive = true; } // m if ((argflags & 32) > 0) { if (registerArgument(&checked, 32)) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } settings->matchesOnly = true; } // Path if (argflags == 0) { if (registerArgument(&checked, 1024)) { - return exit_with_help(prgName, settings, 1); + return exit_with_help(settings, 1); } directory = argv[t]; }