diff --git a/src/nebula/oned.cc b/src/nebula/oned.cc index f4db6145a4..d80322bde2 100644 --- a/src/nebula/oned.cc +++ b/src/nebula/oned.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "Nebula.h" @@ -49,10 +50,10 @@ static void print_help() << "SYNOPSIS\n" << " Starts the OpenNebula daemon\n\n" << "OPTIONS\n" - << " -v\toutput version information and exit\n" - << " -h\tdisplay this help and exit\n" - << " -f\tforeground, do not fork the oned daemon\n" - << " -i\tinitialize the dabase and exit\n"; + << " -v, --verbose\toutput version information and exit\n" + << " -h, --help\tdisplay this help and exit\n" + << " -f, --foreground\tforeground, do not fork the oned daemon\n" + << " -i, --init-db\tinitialize the dabase and exit\n"; } /* ------------------------------------------------------------------------- */ @@ -104,7 +105,19 @@ int main(int argc, char **argv) string wd; int rc; - while((opt = getopt(argc,argv,"vhif")) != -1) + static struct option long_options[] = { + {"version", no_argument, 0, 'v'}, + {"help", no_argument, 0, 'h'}, + {"foreground", no_argument, 0, 'f'}, + {"init-db", no_argument, 0, 'i'}, + {0, 0, 0, 0} + }; + + int long_index = 0; + + while ((opt = getopt_long(argc, argv, "vhif", + long_options, &long_index)) != -1) + { switch(opt) { case 'v': @@ -127,6 +140,7 @@ int main(int argc, char **argv) exit(-1); break; } + } // --------------------------------- // Check if other oned is running