aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoran Markovic <zoran.markovic@linaro.org>2014-01-21 16:05:58 -0800
committerZoran Markovic <zoran.markovic@linaro.org>2014-01-21 16:05:58 -0800
commit1205f672a9cda067d4118ec1cfa249d5fcfbaf77 (patch)
tree53bd9c348e9e1cff38f3058a0194e84837f78ba8
parent40e6c76d45f326d21b35527a39b6d5554b9a5b6e (diff)
Fixed launchpad bug #1269455.
Added -o option to help, allowed any user to run with -h or -V.
-rw-r--r--idlestat.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/idlestat.c b/idlestat.c
index a8b5fb1..a1bc574 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -16,7 +16,7 @@
#include "list.h"
#include "topology.h"
-#define IDLESTAT_VERSION "0.2"
+#define IDLESTAT_VERSION "0.3-rc1"
static char irq_type_name[][8] = {
"irq",
@@ -524,14 +524,12 @@ struct cpuidle_cstates *physical_cluster_data(struct cpu_physical *s_phy)
static void help(const char *cmd)
{
- fprintf(stderr, "%s [-d/--dump] [-c/--cstate=x] <file>\n", basename(cmd));
- exit(0);
+ fprintf(stderr, "%s [-d|--dump] [-c|--cstate=x] [-o|--output-file] <file>\n", basename(cmd));
}
static void version(const char *cmd)
{
printf("%s version %s\n", basename(cmd), IDLESTAT_VERSION);
- exit(0);
}
static struct option long_options[] = {
@@ -593,9 +591,11 @@ int getoptions(int argc, char *argv[], struct idledebug_options *options)
break;
case 'h':
help(argv[0]);
+ exit(0);
break;
case 'V':
version(argv[0]);
+ exit(0);
break;
case '?':
fprintf(stderr, "%s: Unknown option %c'.\n",
@@ -713,15 +713,15 @@ int main(int argc, char *argv[])
struct idledebug_options options;
struct rusage rusage;
+ if (getoptions(argc, argv, &options))
+ return 1;
+
/* We have to manipulate some files only accessible to root */
if (getuid()) {
fprintf(stderr, "must be root to run the tool\n");
return -1;
}
- if (getoptions(argc, argv, &options))
- return 1;
-
/* init cpu topoinfo */
init_cpu_topo_info();