From e325c7791533df551575343d30938dd86a9df121 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 21 Feb 2011 19:06:31 +0000 Subject: ethtool: Add --version option Signed-off-by: Ben Hutchings --- ethtool.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ethtool.c') diff --git a/ethtool.c b/ethtool.c index 32a97f6..e9cb2c9 100644 --- a/ethtool.c +++ b/ethtool.c @@ -115,6 +115,7 @@ static int do_permaddr(int fd, struct ifreq *ifr); static int send_ioctl(int fd, struct ifreq *ifr); static enum { + MODE_VERSION = -2, MODE_HELP = -1, MODE_GSET=0, MODE_SSET, @@ -264,6 +265,7 @@ static struct option { { "-P", "--show-permaddr", MODE_PERMADDR, "Show permanent hardware address" }, { "-h", "--help", MODE_HELP, "Show this help" }, + { NULL, "--version", MODE_VERSION, "Show version number" }, {} }; @@ -816,6 +818,10 @@ static void parse_cmdline(int argc, char **argp) if (mode == MODE_HELP) { show_usage(); exit(0); + } else if (mode == MODE_VERSION) { + fprintf(stdout, + PACKAGE " version " VERSION "\n"); + exit(0); } else if (!args[k].lng && argp[i][0] == '-') { exit_bad_args(); } else { -- cgit v1.2.1