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 |
1.1 --- a/.cproject Thu Sep 15 13:38:03 2011 +0200 1.2 +++ b/.cproject Fri Sep 16 09:14:59 2011 +0200 1.3 @@ -60,4 +60,24 @@ 1.4 <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/> 1.5 </scannerConfigBuildInfo> 1.6 </storageModule> 1.7 + <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"> 1.8 + <buildTargets> 1.9 + <target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> 1.10 + <buildCommand>make</buildCommand> 1.11 + <buildArguments/> 1.12 + <buildTarget>all</buildTarget> 1.13 + <stopOnError>true</stopOnError> 1.14 + <useDefaultCommand>true</useDefaultCommand> 1.15 + <runAllBuilders>false</runAllBuilders> 1.16 + </target> 1.17 + <target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder"> 1.18 + <buildCommand>make</buildCommand> 1.19 + <buildArguments/> 1.20 + <buildTarget>clean</buildTarget> 1.21 + <stopOnError>true</stopOnError> 1.22 + <useDefaultCommand>true</useDefaultCommand> 1.23 + <runAllBuilders>false</runAllBuilders> 1.24 + </target> 1.25 + </buildTargets> 1.26 + </storageModule> 1.27 </cproject>
2.1 --- a/cline.c Thu Sep 15 13:38:03 2011 +0200 2.2 +++ b/cline.c Fri Sep 16 09:14:59 2011 +0200 2.3 @@ -8,13 +8,14 @@ 2.4 #include "cline.h" 2.5 #include "scanner.h" 2.6 #include "settings.h" 2.7 +#include "arguments.h" 2.8 2.9 -void printHelpText(const char* prgName) { 2.10 +void printHelpText() { 2.11 // Help text 2.12 const char* helpText = 2.13 "\nUsage:" 2.14 - "\n %s [-hrm][-s suffix][<directory>]" 2.15 - "\n %s [-hrm][-S suffix][<directory>]" 2.16 + "\n cline [-hrm][-s suffix][<directory>]" 2.17 + "\n cline [-hrm][-S suffix][<directory>]" 2.18 "\n\nCounts the line terminator characters (\\n) within all" 2.19 " files in the specified\ndirectory." 2.20 "\n\nOptions:" 2.21 @@ -27,16 +28,16 @@ 2.22 "\n -r, -R - includes subdirectories" 2.23 "\n\n" 2.24 "The default call without any options is:" 2.25 - "\n %s ./\n" 2.26 + "\n cline ./\n" 2.27 "So each file in the working directory is counted. If you want to count C" 2.28 "\nsource code in your working directory and its subdirectories, type:" 2.29 - "\n %s -rs .c\n"; 2.30 + "\n cline -rs .c\n"; 2.31 2.32 - printf(helpText, prgName, prgName, prgName, prgName); 2.33 + printf(helpText); 2.34 } 2.35 2.36 -int exit_with_help(char* prgName, settings_t* settings, int code) { 2.37 - printHelpText(prgName); 2.38 +int exit_with_help(settings_t* settings, int code) { 2.39 + printHelpText(); 2.40 destroy_settings_t(settings); 2.41 return code; 2.42 } 2.43 @@ -50,15 +51,6 @@ 2.44 return 1; 2.45 } 2.46 2.47 - // Program name 2.48 - char* prgName = strrchr(argv[0], settings->fileSeparator); 2.49 - 2.50 - if (prgName == NULL) { 2.51 - prgName = argv[0]; 2.52 - } else { 2.53 - prgName++; 2.54 - } 2.55 - 2.56 // Get arguments 2.57 char* directory = "./"; 2.58 char* suffix = " "; 2.59 @@ -72,49 +64,49 @@ 2.60 // s 2.61 if ((argflags & 2) > 0) { 2.62 if (registerArgument(&checked, 6)) { 2.63 - return exit_with_help(prgName, settings, 1); 2.64 + return exit_with_help(settings, 1); 2.65 } 2.66 settings->includeSuffixes = true; 2.67 t++; 2.68 if (t >= argc) { 2.69 - return exit_with_help(prgName, settings, 1); 2.70 + return exit_with_help(settings, 1); 2.71 } 2.72 suffix = argv[t]; 2.73 } 2.74 // S 2.75 if ((argflags & 4) > 0) { 2.76 if (registerArgument(&checked, 6)) { 2.77 - return exit_with_help(prgName, settings, 1); 2.78 + return exit_with_help(settings, 1); 2.79 } 2.80 settings->includeSuffixes = false; 2.81 t++; 2.82 if (t >= argc) { 2.83 - return exit_with_help(prgName, settings, 1); 2.84 + return exit_with_help(settings, 1); 2.85 } 2.86 suffix = argv[t]; 2.87 } 2.88 // h 2.89 if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) { 2.90 - return exit_with_help(prgName, settings, 1); 2.91 + return exit_with_help(settings, 1); 2.92 } 2.93 // r, R 2.94 if ((argflags & 24) > 0) { 2.95 if (registerArgument(&checked, 24)) { 2.96 - return exit_with_help(prgName, settings, 1); 2.97 + return exit_with_help(settings, 1); 2.98 } 2.99 settings->recursive = true; 2.100 } 2.101 // m 2.102 if ((argflags & 32) > 0) { 2.103 if (registerArgument(&checked, 32)) { 2.104 - return exit_with_help(prgName, settings, 1); 2.105 + return exit_with_help(settings, 1); 2.106 } 2.107 settings->matchesOnly = true; 2.108 } 2.109 // Path 2.110 if (argflags == 0) { 2.111 if (registerArgument(&checked, 1024)) { 2.112 - return exit_with_help(prgName, settings, 1); 2.113 + return exit_with_help(settings, 1); 2.114 } 2.115 directory = argv[t]; 2.116 }
3.1 --- a/cline.h Thu Sep 15 13:38:03 2011 +0200 3.2 +++ b/cline.h Fri Sep 16 09:14:59 2011 +0200 3.3 @@ -15,8 +15,8 @@ 3.4 extern "C" { 3.5 #endif 3.6 3.7 -void printHelpText(const char*); 3.8 -int exit_with_help(char*, settings_t*, int); 3.9 +void printHelpText(); 3.10 +int exit_with_help(settings_t*, int); 3.11 3.12 #ifdef _cplusplus 3.13 }