From 5129e949cbffebb9675b133bfb9f43b135210959 Mon Sep 17 00:00:00 2001 From: Amit Kucheria Date: Fri, 2 Jan 2015 13:21:03 +0530 Subject: Keep program options sorted alphabetically making them easy to find Makes it easier to add/remove options and keep them sync'ed. Signed-off-by: Amit Kucheria Reviewed-by: Tuukka Tikkanen --- idlestat.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/idlestat.c b/idlestat.c index ca49d31..624b779 100644 --- a/idlestat.c +++ b/idlestat.c @@ -964,23 +964,26 @@ static void version(const char *cmd) int getoptions(int argc, char *argv[], struct program_options *options) { + /* Keep options sorted alphabetically and make sure the short options + * are also added to the getopt_long call below + */ struct option long_options[] = { { "trace", no_argument, &options->mode, TRACE }, { "import", no_argument, &options->mode, IMPORT }, - { "trace-file", required_argument, NULL, 'f' }, { "baseline-trace", required_argument, NULL, 'b' }, - { "output-file", required_argument, NULL, 'o' }, + { "idle", no_argument, NULL, 'c' }, + { "energy-model-file", required_argument, NULL, 'e' }, + { "trace-file", required_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, + { "output-file", required_argument, NULL, 'o' }, + { "frequency", no_argument, NULL, 'p' }, + { "report-format", required_argument, NULL, 'r' }, { "duration", required_argument, NULL, 't' }, - { "version", no_argument, NULL, 'V' }, { "verbose", no_argument, NULL, 'v' }, - { "idle", no_argument, NULL, 'c' }, - { "frequency", no_argument, NULL, 'p' }, { "wakeup", no_argument, NULL, 'w' }, - { "energy-model-file", required_argument, NULL, 'e' }, - { "report-format", required_argument, NULL, 'r' }, - { "csv-report", no_argument, NULL, 'C' }, { "boxless-report", no_argument, NULL, 'B' }, + { "csv-report", no_argument, NULL, 'C' }, + { "version", no_argument, NULL, 'V' }, { 0, 0, 0, 0 } }; int c; @@ -994,7 +997,7 @@ int getoptions(int argc, char *argv[], struct program_options *options) int optindex = 0; - c = getopt_long(argc, argv, ":b:e:f:o:ht:r:cpwVvCB", + c = getopt_long(argc, argv, ":b:ce:f:ho:pr:t:vwBCV", long_options, &optindex); if (c == -1) break; -- cgit v1.2.3