A try at printing version

This commit is contained in:
Bjorn Andersson 2006-06-11 13:27:48 +00:00
parent 350aea908b
commit ae5177d320
2 changed files with 30 additions and 6 deletions

View File

@ -117,18 +117,27 @@ extern char *__progname;
static void static void
usage() { 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); exit(2);
} }
static void static void
help() { 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(" -f is to keep running in foreground\n");
printf(" -u name to drop privileges and run as user 'name'\n"); printf(" -u name to drop privileges and run as user 'name'\n");
exit(0); 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 int
main(int argc, char **argv) main(int argc, char **argv)
{ {
@ -147,8 +156,11 @@ main(int argc, char **argv)
usage(); usage();
} }
while ((choice = getopt(argc, argv, "fhu:")) != -1) { while ((choice = getopt(argc, argv, "vfhu:")) != -1) {
switch(choice) { switch(choice) {
case 'v':
version();
break;
case 'f': case 'f':
foreground = 1; foreground = 1;
break; break;

View File

@ -116,18 +116,27 @@ extern char *__progname;
static void static void
usage() { usage() {
printf("Usage: %s [-f] [-u user] topdomain\n", __progname); printf("Usage: %s [-v] [-h] [-f] [-u user] topdomain\n", __progname);
exit(2); exit(2);
} }
static void static void
help() { 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(" -f to keep running in foreground\n");
printf(" -u name to drop privileges and run as user 'name'\n"); printf(" -u name to drop privileges and run as user 'name'\n");
exit(0); 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 int
main(int argc, char **argv) main(int argc, char **argv)
{ {
@ -146,8 +155,11 @@ main(int argc, char **argv)
usage(); usage();
} }
while ((choice = getopt(argc, argv, "fhu:")) != -1) { while ((choice = getopt(argc, argv, "vfhu:")) != -1) {
switch(choice) { switch(choice) {
case 'v':
version();
break;
case 'f': case 'f':
foreground = 1; foreground = 1;
break; break;