summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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++];