Code

Fixed segfault in argument processing. Thanks to Christoph Schell (#1742066)
[nagiosplug.git] / plugins / check_dns.c
index 3b94a7abd87f6e8a6e17623c435f5f45c7a3eda6..454f813b30c0bda831874013a4fb30322468abd7 100644 (file)
@@ -1,33 +1,48 @@
 /******************************************************************************
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not 
- be picked up by this plugin
- $Id$
-
+*
+* Nagios check_dns plugin
+*
+* License: GPL
+* Copyright (c) 1999-2006 nagios-plugins team
+*
+* Last Modified: $Date$
+*
+* Description:
+*
+* This file contains the check_dns plugin
+*
+*  LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not 
+*  be picked up by this plugin
+*
+* License Information:
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*
+*
+* $Id$
+*
 ******************************************************************************/
 
 const char *progname = "check_dns";
 const char *revision = "$Revision$";
-const char *copyright = "2000-2005";
+const char *copyright = "2000-2006";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
 #include "utils.h"
+#include "utils_base.h"
 #include "netutils.h"
 #include "runcmd.h"
 
@@ -355,7 +370,7 @@ process_arguments (int argc, char **argv)
       critical = optarg;
       break;
     default: /* args not parsable */
-      usage_va(_("Unknown argument - %s"), optarg);
+      usage5();
     }
   }
 
@@ -398,15 +413,16 @@ print_help (void)
   printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
   printf (COPYRIGHT, copyright, email);
 
-  printf (_("This plugin uses the nslookup program to obtain the IP address for the given host/domain query."));
-  printf ("\n");
-  printf (_("An optional DNS server to use may be specified."));
-  printf ("\n");
-  printf (_("If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used."));
+  printf ("%s\n", _("This plugin uses the nslookup program to obtain the IP address for the given host/domain query."));
+  printf ("%s\n", _("An optional DNS server to use may be specified."));
+  printf ("%s\n", _("If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used."));
+  
   printf ("\n\n");
 
   print_usage ();
+  
   printf (_(UT_HELP_VRSN));
+  
   printf (" -H, --hostname=HOST\n");
   printf ("    %s\n", _("The name or address you want to query"));
   printf (" -s, --server=HOST\n");
@@ -429,6 +445,5 @@ void
 print_usage (void)
 {
   printf (_("Usage:"));
-  
   printf ("%s -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit]\n", progname);
 }