[ros-diffs] [cfinck] 30279: Make cpucount more similar to the RosBE-Unix version - Show the Usage text, when any unknown parameter has been specified - Makes the whole code a bit smaller :-D
cfinck at svn.reactos.org
cfinck at svn.reactos.org
Thu Nov 8 21:20:59 CET 2007
Author: cfinck
Date: Thu Nov 8 23:20:59 2007
New Revision: 30279
URL: http://svn.reactos.org/svn/reactos?rev=30279&view=rev
Log:
Make cpucount more similar to the RosBE-Unix version
- Show the Usage text, when any unknown parameter has been specified
- Makes the whole code a bit smaller :-D
Modified:
trunk/tools/RosBE-Windows/Tools/cpucount.c
Modified: trunk/tools/RosBE-Windows/Tools/cpucount.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Tools/cpucount.c?rev=30279&r1=30278&r2=30279&view=diff
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/cpucount.c (original)
+++ trunk/tools/RosBE-Windows/Tools/cpucount.c Thu Nov 8 23:20:59 2007
@@ -20,34 +20,30 @@
fprintf(stderr, "%s: Error too many parameters specified.\n", argv[0]);
return -1;
}
+
GetSystemInfo(&SystemInformation);
- if (argc == 1)
+
+ if(argc != 1)
{
- printf("%ld\n", SystemInformation.dwNumberOfProcessors);
- }
- else if ((!strncmp(argv[1], "/?", 2)) ||
- (!strncmp(argv[1], "-h", 2)) ||
- (!strncmp(argv[1], "--help", 6)))
- {
- printf("Usage: %s [OPTIONS]\n", argv[0]);
- printf("Running cpucount without options returns the number of\n");
- printf("processors in the system.\n");
- printf("-x1 - Number of processors in the system, plus 1.\n");
- printf("-x2 - Number of processors in the system, doubled.\n");
- }
- else if (!strncmp(argv[1], "-x1", 3))
- {
- printf("%ld\n", (SystemInformation.dwNumberOfProcessors + 1));
- }
- else if (!strncmp(argv[1], "-x2", 3))
- {
- printf("%ld\n", (SystemInformation.dwNumberOfProcessors + SystemInformation.dwNumberOfProcessors));
- }
- else
- {
- fprintf(stderr, "%s: Error unknown parameter '%s' specified.\n", argv[0], argv[1]);
- return -1;
+ if(!strncmp(argv[1], "-x1", 3))
+ {
+ SystemInformation.dwNumberOfProcessors++;
+ }
+ else if(!strncmp(argv[1], "-x2", 3))
+ {
+ SystemInformation.dwNumberOfProcessors += SystemInformation.dwNumberOfProcessors;
+ }
+ else
+ {
+ printf("Usage: %s [OPTIONS]\n", argv[0]);
+ printf("Running cpucount without options returns the number of\n");
+ printf("processors in the system.\n");
+ printf("-x1 - Number of processors in the system, plus 1.\n");
+ printf("-x2 - Number of processors in the system, doubled.\n");
+ return 0;
+ }
}
+ printf("%u\n", SystemInformation.dwNumberOfProcessors);
return 0;
}
More information about the Ros-diffs
mailing list