summaryrefslogtreecommitdiffhomepage
path: root/gre.c
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2020-10-16 23:42:24 +0200
committerMikael Magnusson <mikma@users.sourceforge.net>2020-10-16 23:43:12 +0200
commit0cbc33781e33602f35a677bc6a9688d3d8cf3031 (patch)
treed1233d331834c1bfcde87c2fbd3491a2a0fc48f4 /gre.c
parent3962be0c8af4287b57b7f1370751acb07f5458bd (diff)
add help optiongretap
Diffstat (limited to 'gre.c')
-rw-r--r--gre.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gre.c b/gre.c
index 68f4a14..b6d7cdb 100644
--- a/gre.c
+++ b/gre.c
@@ -62,6 +62,13 @@ static int daemonize(void);
static int inet_addr_storage(const char *cp, struct sockaddr_storage *sp, size_t *sp_len);
static int is_any(const struct sockaddr_storage *ss);
+static int usage(const char *arg0)
+{
+ printf("usage: %s [-n|--tun|-p|--tap] <tun> [remote] local\n", arg0);
+ exit(EXIT_FAILURE);
+}
+
+
int main(int argc, char **argv)
{
fd_set readset;
@@ -71,6 +78,7 @@ int main(int argc, char **argv)
int option_index = 0;
static struct option long_options[] = {
{"foreground", no_argument, 0, 'f' },
+ {"help", no_argument, 0, 'h' },
{"tun", no_argument, 0, 'n' },
{"tap", no_argument, 0, 'p' },
{0, 0, 0, 0 }
@@ -85,6 +93,11 @@ int main(int argc, char **argv)
case 'f':
foreground = 1;
break;
+
+ case 'h':
+ usage(argv[0]);
+ break;
+
case 'n':
printf("tun\n");
type = IFF_TUN;
@@ -107,8 +120,7 @@ int main(int argc, char **argv)
if (optnum < 2 || optnum > 3)
{
- printf("usage: %s [-n|--tun|-p|--tap] <tun> [remote] local\n", argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
}
const char *dev = argv[optind++];