From ae5177d320a7284688ad1799ad342779fdf1b54b Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Sun, 11 Jun 2006 13:27:48 +0000 Subject: [PATCH] A try at printing version --- iodine.c | 18 +++++++++++++++--- iodined.c | 18 +++++++++++++++--- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/iodine.c b/iodine.c index d889b5e..7d0c646 100644 --- a/iodine.c +++ b/iodine.c @@ -117,18 +117,27 @@ extern char *__progname; static void usage() { - printf("Usage: %s [-f] [-u user] nameserver topdomain\n", __progname); + printf("Usage: %s [-v] [-h] [-f] [-u user] nameserver topdomain\n", __progname); exit(2); } static void help() { - printf("Usage: %s [-f] [-u user] nameserver topdomain\n", __progname); + printf("iodine IP over DNS tunneling client\n"); + printf("Usage: %s [-v] [-h] [-f] [-u user] nameserver topdomain\n", __progname); printf(" -f is to keep running in foreground\n"); printf(" -u name to drop privileges and run as user 'name'\n"); exit(0); } +static void +version() { + char *svnver = "$Id$"; + printf("iodine IP over DNS tunneling client\n"); + printf("SVN version: %s\n", svnver); + exit(0); +} + int main(int argc, char **argv) { @@ -147,8 +156,11 @@ main(int argc, char **argv) usage(); } - while ((choice = getopt(argc, argv, "fhu:")) != -1) { + while ((choice = getopt(argc, argv, "vfhu:")) != -1) { switch(choice) { + case 'v': + version(); + break; case 'f': foreground = 1; break; diff --git a/iodined.c b/iodined.c index 4cffdd8..bc868c6 100644 --- a/iodined.c +++ b/iodined.c @@ -116,18 +116,27 @@ extern char *__progname; static void usage() { - printf("Usage: %s [-f] [-u user] topdomain\n", __progname); + printf("Usage: %s [-v] [-h] [-f] [-u user] topdomain\n", __progname); exit(2); } static void help() { - printf("Usage: %s [-f] [-u user] topdomain\n", __progname); + printf("iodine IP over DNS tunneling client\n"); + printf("Usage: %s [-v] [-h] [-f] [-u user] topdomain\n", __progname); printf(" -f to keep running in foreground\n"); printf(" -u name to drop privileges and run as user 'name'\n"); exit(0); } +static void +version() { + char *svnver = "$Id$"; + printf("iodine IP over DNS tunneling server\n"); + printf("SVN version: %s\n", svnver); + exit(0); +} + int main(int argc, char **argv) { @@ -146,8 +155,11 @@ main(int argc, char **argv) usage(); } - while ((choice = getopt(argc, argv, "fhu:")) != -1) { + while ((choice = getopt(argc, argv, "vfhu:")) != -1) { switch(choice) { + case 'v': + version(); + break; case 'f': foreground = 1; break;