Code

Fix regression in 1.4.10 where following redirects to relative URLs on
[nagiosplug.git] / plugins / check_dig.c
index c9fce613b9266b792d9ed4482042577bcd8e86ee..e850337b59405bdaa741253459e1611aca28e32e 100644 (file)
@@ -1,21 +1,34 @@
 /*****************************************************************************
-
- 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$
+*
+* Nagios check_dig plugin
+*
+* License: GPL
+* Copyright (c) 1999-2006 nagios-plugins team
+*
+* Last Modified: $Date$
+*
+* Description:
+*
+* This file contains the check_dig 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$
+*
 *****************************************************************************/
 
 /* Hackers note:
@@ -26,7 +39,7 @@
 
 const char *progname = "check_dig";
 const char *revision = "$Revision$";
-const char *copyright = "2002-2005";
+const char *copyright = "2002-2006";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
@@ -184,6 +197,7 @@ process_arguments (int argc, char **argv)
     {"help", no_argument, 0, 'h'},
     {"record_type", required_argument, 0, 'T'},
     {"expected_address", required_argument, 0, 'a'},
+    {"port", required_argument, 0, 'p'},
     {0, 0, 0, 0}
   };
 
@@ -191,7 +205,7 @@ process_arguments (int argc, char **argv)
     return ERROR;
 
   while (1) {
-    c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:a:", longopts, &option);
+    c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:", longopts, &option);
 
     if (c == -1 || c == EOF)
       break;
@@ -251,8 +265,8 @@ process_arguments (int argc, char **argv)
     case 'a':
       expected_address = optarg;
       break;
-    default:                  /* usage_va */
-      usage_va(_("Unknown argument - %s"), optarg);
+    default:                  /* usage5 */
+      usage5();
     }
   }
 
@@ -300,38 +314,17 @@ print_help (void)
 
   printf (_(UT_HELP_VRSN));
 
-  printf (_(UT_HOST_PORT), 'P', myport);
-
-  printf ("-l, --lookup=STRING");
-    
-  printf ("\n");
-
-  printf (_("machine name to lookup"));
-
-  printf ("\n");
-
-  printf ("-T, --record_type=STRING");
-
-  printf ("\n");
-
-  printf (_("record type to lookup (default: A)"));
-
-  printf ("\n");
-
-  printf ("-a, --expected_address=STRING");
-
-  printf ("\n");
-
-  printf (_("an address expected to be in the answer section.if not set, uses whatever was in -l"));
-
-  printf ("\n");
+  printf (_(UT_HOST_PORT), 'p', myport);
 
+  printf (" %s\n","-l, --lookup=STRING");
+  printf ("    %s\n",_("machine name to lookup"));
+  printf (" %s\n","-T, --record_type=STRING");
+  printf ("    %s\n",_("record type to lookup (default: A)"));
+  printf (" %s\n","-a, --expected_address=STRING");
+  printf ("    %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l"));
   printf (_(UT_WARN_CRIT));
-
   printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
-
   printf (_(UT_VERBOSE));
-
   printf (_(UT_SUPPORT));
 }
 
@@ -342,6 +335,6 @@ print_usage (void)
 {
   printf (_("Usage:"));
   printf ("%s -H host -l lookup [-p <server port>] [-T <query type>]", progname);
-  printf ("          [-w <warning interval>] [-c <critical interval>] [-t <timeout>]");
-  printf ("          [-a <expected answer address>] [-v]\n");
+  printf (" [-w <warning interval>] [-c <critical interval>] [-t <timeout>]");
+  printf (" [-a <expected answer address>] [-v]\n");
 }