Commit b27cdf66 by 2xsec

tools: lxc-config: share internal API symbols

Signed-off-by: 's avatar2xsec <dh48.jeong@samsung.com>
parent d2ba12a8
...@@ -268,7 +268,7 @@ if ENABLE_TOOLS ...@@ -268,7 +268,7 @@ if ENABLE_TOOLS
lxc_attach_SOURCES = tools/lxc_attach.c tools/arguments.c lxc_attach_SOURCES = tools/lxc_attach.c tools/arguments.c
lxc_autostart_SOURCES = tools/lxc_autostart.c tools/arguments.c lxc_autostart_SOURCES = tools/lxc_autostart.c tools/arguments.c
lxc_cgroup_SOURCES = tools/lxc_cgroup.c tools/arguments.c lxc_cgroup_SOURCES = tools/lxc_cgroup.c tools/arguments.c
lxc_config_SOURCES = tools/lxc_config.c tools/arguments.c tools/tool_utils.c lxc_config_SOURCES = tools/lxc_config.c tools/arguments.c
lxc_console_SOURCES = tools/lxc_console.c tools/arguments.c tools/tool_utils.c lxc_console_SOURCES = tools/lxc_console.c tools/arguments.c tools/tool_utils.c
lxc_destroy_SOURCES = tools/lxc_destroy.c tools/arguments.c tools/tool_utils.c lxc_destroy_SOURCES = tools/lxc_destroy.c tools/arguments.c tools/tool_utils.c
lxc_device_SOURCES = tools/lxc_device.c tools/arguments.c tools/tool_utils.c lxc_device_SOURCES = tools/lxc_device.c tools/arguments.c tools/tool_utils.c
......
...@@ -52,6 +52,7 @@ static void list_config_items(void) ...@@ -52,6 +52,7 @@ static void list_config_items(void)
for (i = &items[0]; i->name; i++) for (i = &items[0]; i->name; i++)
printf("%s\n", i->name); printf("%s\n", i->name);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -60,21 +61,25 @@ int main(int argc, char *argv[]) ...@@ -60,21 +61,25 @@ int main(int argc, char *argv[])
struct lxc_config_items *i; struct lxc_config_items *i;
const char *value; const char *value;
if (argc < 2 || strcmp(argv[1], "-h") == 0 || if (argc < 2 || !strncmp(argv[1], "-h", strlen(argv[1])) ||
strcmp(argv[1], "--help") == 0) !strncmp(argv[1], "--help", strlen(argv[1])))
usage(argv[0]); usage(argv[0]);
if (strcmp(argv[1], "-l") == 0)
if (!strncmp(argv[1], "-l", strlen(argv[1])))
list_config_items(); list_config_items();
for (i = &items[0]; i->name; i++) { for (i = &items[0]; i->name; i++) {
if (strcmp(argv[1], i->name) == 0) { if (!strncmp(argv[1], i->name, strlen(argv[1]))) {
value = lxc_get_global_config_item(i->name); value = lxc_get_global_config_item(i->name);
if (value) if (value)
printf("%s\n", value); printf("%s\n", value);
else else
printf("%s is not set.\n", argv[1]); printf("%s is not set.\n", argv[1]);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
} }
printf("Unknown configuration item: %s\n", argv[1]); printf("Unknown configuration item: %s\n", argv[1]);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment