aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorBarattero Laurent <laurent@larueluberlu.net>2014-01-29 13:15:33 +0100
committerBarattero Laurent <laurent@larueluberlu.net>2014-01-29 13:15:33 +0100
commit49fe49f7f0c6ad3ec81fbcbcd266ce627379182a (patch)
tree254009fe02287bf16664aaf233c06112d27877b1 /src/main.cpp
parent0c924969382da97ab2012948cfe2022fb7c39696 (diff)
Fix getoptlong --version
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp141
1 files changed, 73 insertions, 68 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b385006..e9cf981 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -98,75 +98,80 @@ main ( int argc, char *argv[] )
switch (c)
{
- case 'o':
- manager.addItemStart(optarg);
- break;
-
- case 't':
- manager.addItemTest(optarg);
- break;
-
- case 'c':
- try
- {
- manager.subRoutine(FLAG_COLOR);
- }
- catch ( const string & Msg )
- {
- cerr << "Error : " << Msg << endl;
- return(EXIT_FAILURE);
- }
- break;
-
- case 'G':
- manager.addItemGetSerial(optarg);
- break;
-
- case 'S':
- try
- {
- manager.subRoutine(FLAG_SET_SER);
- }
- catch ( const string & Msg )
- {
- cerr << "Error : " << Msg << endl;
- return(EXIT_FAILURE);
- }
- break;
+ case 0:
+ /* If this option set a flag, do nothing else now. */
+ if (long_options[option_index].flag != 0)
+ break;
+
+ case 'o':
+ manager.addItemStart(optarg);
+ break;
+
+ case 't':
+ manager.addItemTest(optarg);
+ break;
+
+ case 'c':
+ try
+ {
+ manager.subRoutine(FLAG_COLOR);
+ }
+ catch ( const string & Msg )
+ {
+ cerr << "Error : " << Msg << endl;
+ return(EXIT_FAILURE);
+ }
+ break;
+
+ case 'G':
+ manager.addItemGetSerial(optarg);
+ break;
+
+ case 'S':
+ try
+ {
+ manager.subRoutine(FLAG_SET_SER);
+ }
+ catch ( const string & Msg )
+ {
+ cerr << "Error : " << Msg << endl;
+ return(EXIT_FAILURE);
+ }
+ break;
- case 'i':
- manager.addItemVerify(optarg);
- break;
-
- case 'u':
- manager.subRoutine(FLAG_UP_GLO);
- break;
-
- case 'U':
- manager.subRoutine(FLAG_UP_GLOC);
- break;
-
- case 'k':
- manager.addItemSymlink(optarg);
- break;
-
- case 'v':
- VERBOSE_AERO = true;
- break;
-
- case 'h':
- help = 1;
- break;
-
- case '?':
- /* getopt_long already printed an error message. */
- puts("To get help : 'aeroup --help' or 'man aeroup'");
- return EXIT_FAILURE;
- break;
-
- default:
- abort ();
- }
+ case 'i':
+ manager.addItemVerify(optarg);
+ break;
+
+ case 'u':
+ manager.subRoutine(FLAG_UP_GLO);
+ break;
+
+ case 'U':
+ manager.subRoutine(FLAG_UP_GLOC);
+ break;
+
+ case 'k':
+ manager.addItemSymlink(optarg);
+ break;
+
+ case 'v':
+ VERBOSE_AERO = true;
+ break;
+
+ case 'h':
+ help = 1;
+ break;
+
+ case '?':
+ /* getopt_long already printed an error message. */
+ puts("To get help : 'aeroup --help' or 'man aeroup'");
+ return EXIT_FAILURE;
+ break;
+
+ default:
+ abort ();
+ }
}
/* Print any remaining command line arguments (not options). */