]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: lxc-config: share internal API symbols
author2xsec <dh48.jeong@samsung.com>
Fri, 29 Jun 2018 05:48:34 +0000 (14:48 +0900)
committer2xsec <dh48.jeong@samsung.com>
Sat, 30 Jun 2018 09:45:21 +0000 (18:45 +0900)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/Makefile.am
src/lxc/tools/lxc_config.c

index cfaab8edb5f8688ec07ec65c67ff3a6177644ab0..f5ee8b17c5512e8bc55d7835640612e3bd8d338a 100644 (file)
@@ -268,7 +268,7 @@ if ENABLE_TOOLS
 lxc_attach_SOURCES = tools/lxc_attach.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_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_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
index 775923e34d41983556648c2b1dc5f48ab4fc2701..b1f99c574cd51a4f88bc3fdddbfcda3294207830 100644 (file)
@@ -52,6 +52,7 @@ static void list_config_items(void)
 
        for (i = &items[0]; i->name; i++)
                printf("%s\n", i->name);
+
        exit(EXIT_SUCCESS);
 }
 
@@ -60,21 +61,25 @@ int main(int argc, char *argv[])
        struct lxc_config_items *i;
        const char *value;
 
-       if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
-                       strcmp(argv[1], "--help") == 0)
+       if (argc < 2 || !strncmp(argv[1], "-h", strlen(argv[1])) ||
+                       !strncmp(argv[1], "--help", strlen(argv[1])))
                usage(argv[0]);
-       if (strcmp(argv[1], "-l") == 0)
+
+       if (!strncmp(argv[1], "-l", strlen(argv[1])))
                list_config_items();
+
        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);
                        if (value)
                                printf("%s\n", value);
                        else
                                printf("%s is not set.\n", argv[1]);
+
                        exit(EXIT_SUCCESS);
                }
        }
+
        printf("Unknown configuration item: %s\n", argv[1]);
        exit(EXIT_FAILURE);
 }