Author: peterw
Date: Thu Oct 25 12:16:01 2007
New Revision: 29867
URL:
http://svn.reactos.org/svn/reactos?rev=29867&view=rev
Log:
- Cleanup cpucount a bit, add usage info etc...
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…
==============================================================================
--- trunk/tools/RosBE-Windows/Tools/cpucount.c (original)
+++ trunk/tools/RosBE-Windows/Tools/cpucount.c Thu Oct 25 12:16:01 2007
@@ -15,27 +15,39 @@
{
SYSTEM_INFO SystemInformation;
+ if (argc > 2)
+ {
+ fprintf(stderr, "%s: Error too many parameters specified.\n",
argv[0]);
+ return -1;
+ }
+ GetSystemInfo(&SystemInformation);
if (argc == 1)
{
- GetSystemInfo(&SystemInformation);
printf("%ld\n", SystemInformation.dwNumberOfProcessors);
- return 0;
}
- else if (!strcmp(argv[1], "-x1"))
+ else if ((!strncmp(argv[1], "/?", 2)) ||
+ (!strncmp(argv[1], "-h", 2)) ||
+ (!strncmp(argv[1], "--help", 6)))
{
- GetSystemInfo(&SystemInformation);
+ printf("Usage: %s [OPTIONS]\n", argv[0]);
+ printf("Running cpucount without options returns\n");
+ printf("the number of 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));
- return 0;
}
- else if (!strcmp(argv[1], "-x2"))
+ else if (!strncmp(argv[1], "-x2", 3))
{
- GetSystemInfo(&SystemInformation);
printf("%ld\n", (SystemInformation.dwNumberOfProcessors +
SystemInformation.dwNumberOfProcessors));
- return 0;
}
else
{
- printf("Unknown parameter specified. Exiting.\n");
- return 1;
+ fprintf(stderr, "%s: Error unknown parameter '%s'
specified.\n", argv[0], argv[1]);
+ return -1;
}
+
+ return 0;
}