static void version(void)
{
- printf("%s\n%s\n%s\n", Release, Version, Signature);
- exit(E_VERSION);
+ printf("%s\n%s\n%s\n", Release, Version, Signature);
+ exit(E_VERSION);
}
static void usage(void) __attribute__((noreturn));
{
fprintf(stderr, _("Usage: ipmaddr [ add | del ] MULTIADDR dev STRING\n"));
fprintf(stderr, _(" ipmaddr show [ dev STRING ] [ ipv4 | ipv6 | link | all ]\n"));
+ fprintf(stderr, _(" ipmaddr -V | -version\n"));
exit(-1);
}
++show_stats;
} else if (matches(argv[1], "-resolve") == 0) {
++resolve_hosts;
- } else if (matches(argv[1], "-V") == 0) {
+ } else if ((matches(argv[1], "-V") == 0) || matches(argv[1], "--version") == 0) {
version();
} else
usage();
#include <linux/if_tunnel.h>
#include "intl.h"
+#include "net-support.h"
+#include "version.h"
#undef GRE_CSUM
#define GRE_CSUM htons(0x8000)
#include "utils.h"
+char *Release = RELEASE,
+ *Version = "iptunnel 1.0",
+ *Signature = "Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>";
+
+static void version(void)
+{
+ printf("%s\n%s\n%s\n", Release, Version, Signature);
+ exit(E_VERSION);
+}
+
static void usage(void) __attribute__((noreturn));
static void usage(void)
fprintf(stderr, _("Usage: iptunnel { add | change | del | show } [ NAME ]\n"));
fprintf(stderr, _(" [ mode { ipip | gre | sit } ] [ remote ADDR ] [ local ADDR ]\n"));
fprintf(stderr, _(" [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n"));
- fprintf(stderr, _(" [ ttl TTL ] [ tos TOS ] [ nopmtudisc ] [ dev PHYS_DEV ]\n\n"));
+ fprintf(stderr, _(" [ ttl TTL ] [ tos TOS ] [ nopmtudisc ] [ dev PHYS_DEV ]\n"));
+ fprintf(stderr, _(" iptunnel -V | --version\n\n"));
fprintf(stderr, _("Where: NAME := STRING\n"));
fprintf(stderr, _(" ADDR := { IP_ADDRESS | any }\n"));
fprintf(stderr, _(" TOS := { NUMBER | inherit }\n"));
++show_stats;
} else if (matches(argv[1], "-resolve") == 0) {
++resolve_hosts;
+ } else if ((matches(argv[1], "-V") == 0) || (matches(argv[1], "--version") == 0)) {
+ version();
} else
usage();
argc--; argv++;
{
fprintf(stderr, _("Usage: plipconfig [-a] [-i] [-v] interface\n"));
fprintf(stderr, _(" [nibble NN] [trigger NN]\n"));
- fprintf(stderr, _(" plipconfig -V\n"));
+ fprintf(stderr, _(" plipconfig -V | --version\n"));
exit(-1);
}
opt_a = 1;
if (!strcmp(*argv, "-v"))
opt_v = 1;
- if (!strcmp(*argv, "-V"))
+ if (!strcmp(*argv, "-V") || !strcmp(*argv, "--version"))
version();
argv++;
argc--;
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <getopt.h>
#include <linux/if_slip.h>
#if defined(__GLIBC__)
"[-o outfill] "
#endif
"[-c cmd] [-s speed] [-p protocol] tty | -\n"
- " slattach -V\n";
+ " slattach -V | --version\n";
fprintf(stderr, usage_msg);
exit(1);
struct hwtype *ht;
char *sp;
int s;
+ static struct option longopts[] = {
+ { "version", 0, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
strcpy(path, "");
/* Scan command line for any arguments. */
opterr = 0;
- while ((s = getopt(argc, argv, "c:ehlLmnp:qs:vdV"
-#ifdef SIOCSKEEPALIVE
- "k:"
-#endif
-#ifdef SIOCSOUTFILL
- "o:"
-#endif
- )) != EOF) switch(s) {
+ while ((s = getopt_long(argc, argv, "c:ehlLmnp:qs:vdVk:o:", longopts, NULL)) != EOF) switch(s) {
case 'c':
extcmd = optarg;
break;