[nagiosplug] check_icmp: Support "--help" and "--version"
"Nagios Plugin Development" <[email protected]> Wed, 4 Sep 2013 20:40:26 +0000
| Newsgroups | gmane.network.nagios.plugins.cvs |
|---|---|
| Message-ID | <[email protected]> |
Module: nagiosplug Branch: master Commit: a480681cb7b86adecac69d4969f94e5a6d302190 Author: Holger Weiss <[email protected]> Date: Wed Sep 4 22:20:26 2013 +0200 URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=a480681 check_icmp: Support "--help" and "--version" Let check_icmp provide "--help" and "--version" flags (in addition to "-h" and "-V"), just as the other plugins do. --- plugins-root/check_icmp.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index fe8fc56..b6804d2 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c @@ -454,6 +454,14 @@ main(int argc, char **argv) /* Parse extra opts if any */ argv=np_extra_opts(&argc, argv, progname); + /* support "--help" and "--version" */ + if(argc == 2) { + if(!strcmp(argv[1], "--help")) + strcpy(argv[1], "-h"); + if(!strcmp(argv[1], "--version")) + strcpy(argv[1], "-V"); + } + /* parse the arguments */ for(i = 1; i < argc; i++) { while((arg = getopt(argc, argv, "vhVw:c:n:p:t:H:s:i:b:I:l:m:")) != EOF) { ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk