tools: make "-n" optional

This lets users use the tools with "lxc-* -n <container-name>" or "lxc-* <container-name>". Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent b28e2826
......@@ -256,10 +256,18 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
}
/* Check the command options */
if (!args->name && strcmp(args->progname, "lxc-autostart") != 0) {
lxc_error(args, "missing container name, use --name option");
return -1;
if (args->argv) {
args->name = argv[optind];
optind++;
args->argv = &argv[optind];
args->argc = argc - optind;
}
if (!args->name) {
lxc_error(args, "No container name specified");
return -1;
}
}
if (args->checker)
......
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