Show help when no arguments
Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
18
README.md
18
README.md
@@ -22,6 +22,24 @@ To build and install the latest version with [meson](http://mesonbuild.com):
|
|||||||
|
|
||||||
The more classical autotools suite is also available but not recommended.
|
The more classical autotools suite is also available but not recommended.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
Just run `glorytun` with no arguments to view the list of available commands:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ glorytun
|
||||||
|
available commands:
|
||||||
|
|
||||||
|
show show all running tunnels
|
||||||
|
bench start a crypto bench
|
||||||
|
bind start a new tunnel
|
||||||
|
set change tunnel properties
|
||||||
|
keygen generate a new secret key
|
||||||
|
path manage paths
|
||||||
|
version show version
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
### Mini HowTo
|
### Mini HowTo
|
||||||
|
|
||||||
Glorytun does not touch network configuration of its interface,
|
Glorytun does not touch network configuration of its interface,
|
||||||
|
|||||||
13
src/main.c
13
src/main.c
@@ -69,15 +69,14 @@ main(int argc, char **argv)
|
|||||||
{"version", "show version", gt_version},
|
{"version", "show version", gt_version},
|
||||||
{NULL}};
|
{NULL}};
|
||||||
|
|
||||||
if (argc < 2)
|
if (argv[1]) {
|
||||||
return gt_show(argc, argv);
|
for (int k = 0; cmd[k].name; k++) {
|
||||||
|
if (!str_cmp(cmd[k].name, argv[1]))
|
||||||
for (int k = 0; cmd[k].name; k++) {
|
return cmd[k].call(argc - 1, argv + 1);
|
||||||
if (!str_cmp(cmd[k].name, argv[1]))
|
}
|
||||||
return cmd[k].call(argc - 1, argv + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("unknown command `%s', available commands:\n\n", argv[1]);
|
printf("available commands:\n\n");
|
||||||
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user