mesh: Align option names with functionality
authorInga Stotland <inga.stotland@intel.com>
Thu, 3 Sep 2020 20:00:52 +0000 (13:00 -0700)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Mon, 28 Dec 2020 06:20:04 +0000 (11:50 +0530)
Change option "config" ('c') to "storage" ('s) to specify
a custom storage directory for node configuration.

Change option 'f' (long name was missing) to "config" ('c')
to specify a custom mesh configuration file to override the
default mesh-main.conf

Change-Id: Idcf869faed62bdf401c9994754589698eeade2a6
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
mesh/main.c

index e90f5c4..c4b9e73 100644 (file)
@@ -38,7 +38,7 @@
 #include "mesh/mesh-io.h"
 #include "mesh/util.h"
 
-static const char *config_dir;
+static const char *storage_dir;
 static const char *mesh_conf_fname;
 static enum mesh_io_type io_type;
 static void *io_opts;
@@ -48,7 +48,8 @@ bool use_raw = false;
 
 static const struct option main_options[] = {
        { "io",         required_argument,      NULL, 'i' },
-       { "config",     optional_argument,      NULL, 'c' },
+       { "storage",    required_argument,      NULL, 's' },
+       { "config",     required_argument,      NULL, 'c' },
        { "nodetach",   no_argument,            NULL, 'n' },
        { "debug",      no_argument,            NULL, 'd' },
        { "dbus-debug", no_argument,            NULL, 'b' },
@@ -113,7 +114,7 @@ static void request_name_callback(struct l_dbus *dbus, bool success,
                return;
        }
 
-       if (!mesh_init(config_dir, mesh_conf_fname, io_type, io_opts,
+       if (!mesh_init(storage_dir, mesh_conf_fname, io_type, io_opts,
                                        mesh_ready_callback, dbus)) {
                l_error("Failed to initialize mesh");
                l_main_quit();
@@ -209,7 +210,7 @@ int main(int argc, char *argv[])
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                opt = getopt_long(argc, argv, "i:c:f:ndbhr", main_options, NULL);
 #else
-               opt = getopt_long(argc, argv, "i:c:f:ndbh", main_options, NULL);
+               opt = getopt_long(argc, argv, "i:s:c:ndbh", main_options, NULL);
 #endif
                if (opt < 0)
                        break;
@@ -228,10 +229,10 @@ int main(int argc, char *argv[])
                case 'd':
                        enable_debug();
                        break;
-               case 'c':
-                       config_dir = optarg;
+               case 's':
+                       storage_dir = optarg;
                        break;
-               case 'f':
+               case 'c':
                        mesh_conf_fname = optarg;
                        break;
                case 'b':