[lxc-devel] [lxc/master] lxc_config: Add -h and --help flags handler

marcosps on Github lxc-bot at linuxcontainers.org
Sat Dec 30 18:37:35 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 452 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171230/56acdc58/attachment.bin>
-------------- next part --------------
From f63ac53e318b82c8d43b3498d9a73d98dbe52a98 Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Sat, 30 Dec 2017 16:35:52 -0200
Subject: [PATCH] lxc_config: Add -h and --help flags handler

As the other tools already handle, show usage message when -h or --help
are used.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
---
 src/lxc/tools/lxc_config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/tools/lxc_config.c b/src/lxc/tools/lxc_config.c
index c204447ae..86187bd57 100644
--- a/src/lxc/tools/lxc_config.c
+++ b/src/lxc/tools/lxc_config.c
@@ -64,7 +64,8 @@ int main(int argc, char *argv[])
 
 	setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
 
-	if (argc < 2)
+	if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
+			strcmp(argv[1], "--help") == 0)
 		usage(argv[0]);
 	if (strcmp(argv[1], "-l") == 0)
 		list_config_items();


More information about the lxc-devel mailing list