[Nagiosplug-checkins] nagiosplug/plugins check_dig.c,1.41,1.42 check_disk.c,1.59,1.60 check_dns.c,1.48,1.49 check_dummy.c,1.14,1.15 check_fping.c,1.24,1.25 check_game.c,1.25,1.26

Benoit Mortier opensides at users.sourceforge.net
Sun Nov 13 16:51:59 CET 2005


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8014/plugins

Modified Files:
	check_dig.c check_disk.c check_dns.c check_dummy.c 
	check_fping.c check_game.c 
Log Message:

start of the cleaning of the localization



Index: check_dummy.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dummy.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- check_dummy.c	25 Dec 2004 23:17:44 -0000	1.14
+++ check_dummy.c	14 Nov 2005 00:51:44 -0000	1.15
@@ -20,7 +20,7 @@
 
 const char *progname = "check_dummy";
 const char *revision = "$Revision$";
-const char *copyright = "1999-2004";
+const char *copyright = "1999-2005";
 const char *email = "nagiosplug-devel at lists.sourceforge.net";
 
 #include "common.h"
@@ -33,51 +33,51 @@
 int
 main (int argc, char **argv)
 {
-	int result = STATE_UNKNOWN;
+  int result = STATE_UNKNOWN;
 
-	setlocale (LC_ALL, "");
-	bindtextdomain (PACKAGE, LOCALEDIR);
-	textdomain (PACKAGE);
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
 
-	if (argc < 2)
-		usage4 (_("Could not parse arguments"));
-	else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
-		print_revision (progname, revision);
-		exit (STATE_OK);
-	}
-	else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
-		print_help ();
-		exit (STATE_OK);
-	}
-	else if (!is_integer (argv[1]))
-		usage4 (_("Arguments to check_dummy must be an integer"));
-	else
-		result = atoi (argv[1]);
+  if (argc < 2)
+    usage4 (_("Could not parse arguments"));
+  else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
+    print_revision (progname, revision);
+    exit (STATE_OK);
+  }
+  else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
+    print_help ();
+    exit (STATE_OK);
+  }
+  else if (!is_integer (argv[1]))
+    usage4 (_("Arguments to check_dummy must be an integer"));
+  else
+    result = atoi (argv[1]);
 
-	switch (result) {
-	case STATE_OK:
-		printf (_("OK"));
-		break;
-	case STATE_WARNING:
-		printf (_("WARNING"));
-		break;
-	case STATE_CRITICAL:
-		printf (_("CRITICAL"));
-		break;
-	case STATE_UNKNOWN:
-		printf (_("UNKNOWN"));
-		break;
-	default:
-		printf (_("Status %d is not a supported error state\n"), result);
-		break;
-	}
+  switch (result) {
+  case STATE_OK:
+    printf (_("OK"));
+    break;
+  case STATE_WARNING:
+    printf (_("WARNING"));
+    break;
+  case STATE_CRITICAL:
+    printf (_("CRITICAL"));
+    break;
+  case STATE_UNKNOWN:
+    printf (_("UNKNOWN"));
+    break;
+  default:
+    printf (_("Status %d is not a supported error state\n"), result);
+    break;
+  }
 
-	if (argc >= 3) 
-		printf (": %s", argv[2]);
+  if (argc >= 3) 
+    printf (": %s", argv[2]);
 
-	printf("\n");
+  printf("\n");
 
-	return result;
+  return result;
 }
 
 
@@ -85,20 +85,24 @@
 void
 print_help (void)
 {
-	print_revision (progname, revision);
+  print_revision (progname, revision);
 
-	printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>\n");
-	printf (COPYRIGHT, copyright, email);
+  printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>\n");
+  printf (COPYRIGHT, copyright, email);
 
-	printf (_("\
-This plugin will simply return the state corresponding to the numeric value\n\
-of the <state> argument with optional text.\n\n"));
+  printf (_("This plugin will simply return the state corresponding to the numeric value"));
+ 
+  printf ("\n");
+ 
+  printf (_("of the <state> argument with optional text"));
 
-	print_usage ();
+  printf ("\n\n");
+  
+  print_usage ();
 
-	printf (_(UT_HELP_VRSN));
+  printf (_(UT_HELP_VRSN));
 
-	printf (_(UT_SUPPORT));
+  printf (_(UT_SUPPORT));
 }
 
 
@@ -106,5 +110,6 @@
 void
 print_usage (void)
 {
-	printf ("Usage: %s <integer state> [optional text]\n", progname);
+  printf (_("Usage:"));
+  printf (" %s <integer state> [optional text]\n", progname);
 }

Index: check_dig.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- check_dig.c	24 Oct 2005 11:10:29 -0000	1.41
+++ check_dig.c	14 Nov 2005 00:51:44 -0000	1.42
@@ -26,7 +26,7 @@
 
 const char *progname = "check_dig";
 const char *revision = "$Revision$";
-const char *copyright = "2002-2004";
+const char *copyright = "2002-2005";
 const char *email = "nagiosplug-devel at lists.sourceforge.net";
 
 #include "common.h"
@@ -55,113 +55,113 @@
 int
 main (int argc, char **argv)
 {
-	char *command_line;
-	output chld_out, chld_err;
-	char *msg = NULL;
-	size_t i;
-	char *t;
-	long microsec;
-	double elapsed_time;
-	int result = STATE_UNKNOWN;
+  char *command_line;
+  output chld_out, chld_err;
+  char *msg = NULL;
+  size_t i;
+  char *t;
+  long microsec;
+  double elapsed_time;
+  int result = STATE_UNKNOWN;
 
-	setlocale (LC_ALL, "");
-	bindtextdomain (PACKAGE, LOCALEDIR);
-	textdomain (PACKAGE);
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
 
-	/* Set signal handling and alarm */
-	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
-		usage_va(_("Cannot catch SIGALRM"));
+  /* Set signal handling and alarm */
+  if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
+    usage_va(_("Cannot catch SIGALRM"));
 
-	if (process_arguments (argc, argv) == ERROR)
-		usage_va(_("Could not parse arguments"));
+  if (process_arguments (argc, argv) == ERROR)
+    usage_va(_("Could not parse arguments"));
 
-	/* get the command to run */
-	asprintf (&command_line, "%s @%s -p %d %s -t %s",
-	          PATH_TO_DIG, dns_server, server_port, query_address, record_type);
+  /* get the command to run */
+  asprintf (&command_line, "%s @%s -p %d %s -t %s",
+            PATH_TO_DIG, dns_server, server_port, query_address, record_type);
 
-	alarm (timeout_interval);
-	gettimeofday (&tv, NULL);
+  alarm (timeout_interval);
+  gettimeofday (&tv, NULL);
 
-	if (verbose) {
-		printf ("%s\n", command_line);
-		if(expected_address != NULL) {
-			printf (_("Looking for: '%s'\n"), expected_address);
-		} else {
-			printf (_("Looking for: '%s'\n"), query_address);
-		}
-	}
+  if (verbose) {
+    printf ("%s\n", command_line);
+    if(expected_address != NULL) {
+      printf (_("Looking for: '%s'\n"), expected_address);
+    } else {
+      printf (_("Looking for: '%s'\n"), query_address);
+    }
+  }
 
-	/* run the command */
-	if(np_runcmd(command_line, &chld_out, &chld_err, 0) != 0) {
-		result = STATE_WARNING;
-		msg = (char *)_("dig returned an error status");
-	}
+  /* run the command */
+  if(np_runcmd(command_line, &chld_out, &chld_err, 0) != 0) {
+    result = STATE_WARNING;
+    msg = (char *)_("dig returned an error status");
+  }
 
-	for(i = 0; i < chld_out.lines; i++) {
-		/* the server is responding, we just got the host name... */
-		if (strstr (chld_out.line[i], ";; ANSWER SECTION:")) {
+  for(i = 0; i < chld_out.lines; i++) {
+    /* the server is responding, we just got the host name... */
+    if (strstr (chld_out.line[i], ";; ANSWER SECTION:")) {
 
-			/* loop through the whole 'ANSWER SECTION' */
-			for(; i < chld_out.lines; i++) {
-				/* get the host address */
-				if (verbose)
-					printf ("%s\n", chld_out.line[i]);
+      /* loop through the whole 'ANSWER SECTION' */
+      for(; i < chld_out.lines; i++) {
+        /* get the host address */
+        if (verbose)
+          printf ("%s\n", chld_out.line[i]);
 
-				if (strstr (chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) {
-					msg = chld_out.line[i];
-					result = STATE_OK;
+        if (strstr (chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) {
+          msg = chld_out.line[i];
+          result = STATE_OK;
 
-					/* Translate output TAB -> SPACE */
-					t = msg;
-					while ((t = strchr(t, '\t')) != NULL) *t = ' ';
-					break;
-				}
-			}
+          /* Translate output TAB -> SPACE */
+          t = msg;
+          while ((t = strchr(t, '\t')) != NULL) *t = ' ';
+          break;
+        }
+      }
 
-			if (result == STATE_UNKNOWN) {
-				msg = (char *)_("Server not found in ANSWER SECTION");
-				result = STATE_WARNING;
-			}
+      if (result == STATE_UNKNOWN) {
+        msg = (char *)_("Server not found in ANSWER SECTION");
+        result = STATE_WARNING;
+      }
 
-			/* we found the answer section, so break out of the loop */
-			break;
-		}
-	}
+      /* we found the answer section, so break out of the loop */
+      break;
+    }
+  }
 
-	if (result == STATE_UNKNOWN)
-		msg = (char *)_("No ANSWER SECTION found");
+  if (result == STATE_UNKNOWN)
+    msg = (char *)_("No ANSWER SECTION found");
 
-	/* If we get anything on STDERR, at least set warning */
-	if(chld_err.buflen > 0) {
-		result = max_state(result, STATE_WARNING);
-		if(!msg) for(i = 0; i < chld_err.lines; i++) {
-			msg = strchr(chld_err.line[0], ':');
-			if(msg) {
-				msg++;
-				break;
-			}
-		}
-	}
+  /* If we get anything on STDERR, at least set warning */
+  if(chld_err.buflen > 0) {
+    result = max_state(result, STATE_WARNING);
+    if(!msg) for(i = 0; i < chld_err.lines; i++) {
+      msg = strchr(chld_err.line[0], ':');
+      if(msg) {
+        msg++;
+        break;
+      }
+    }
+  }
 
-	microsec = deltime (tv);
-	elapsed_time = (double)microsec / 1.0e6;
+  microsec = deltime (tv);
+  elapsed_time = (double)microsec / 1.0e6;
 
-	if (critical_interval > UNDEFINED && elapsed_time > critical_interval)
-		result = STATE_CRITICAL;
+  if (critical_interval > UNDEFINED && elapsed_time > critical_interval)
+    result = STATE_CRITICAL;
 
-	else if (warning_interval > UNDEFINED && elapsed_time > warning_interval)
-		result = STATE_WARNING;
+  else if (warning_interval > UNDEFINED && elapsed_time > warning_interval)
+    result = STATE_WARNING;
 
-	printf ("DNS %s - %.3f seconds response time (%s)|%s\n",
-	        state_text (result), elapsed_time,
-	        msg ? msg : _("Probably a non-existent host/domain"),
-	        fperfdata("time", elapsed_time, "s",
-	                  (warning_interval>UNDEFINED?TRUE:FALSE),
-	                  warning_interval,
-	                  (critical_interval>UNDEFINED?TRUE:FALSE),
-					  critical_interval,
-					  TRUE, 0, FALSE, 0));
-	return result;
+  printf ("DNS %s - %.3f seconds response time (%s)|%s\n",
+          state_text (result), elapsed_time,
+          msg ? msg : _("Probably a non-existent host/domain"),
+          fperfdata("time", elapsed_time, "s",
+                    (warning_interval>UNDEFINED?TRUE:FALSE),
+                    warning_interval,
+                    (critical_interval>UNDEFINED?TRUE:FALSE),
+            critical_interval,
+            TRUE, 0, FALSE, 0));
+  return result;
 }
 
 
@@ -170,104 +170,104 @@
 int
 process_arguments (int argc, char **argv)
 {
-	int c;
+  int c;
 
-	int option = 0;
-	static struct option longopts[] = {
-		{"hostname", required_argument, 0, 'H'},
-		{"query_address", required_argument, 0, 'l'},
-		{"warning", required_argument, 0, 'w'},
-		{"critical", required_argument, 0, 'c'},
-		{"timeout", required_argument, 0, 't'},
-		{"verbose", no_argument, 0, 'v'},
-		{"version", no_argument, 0, 'V'},
-		{"help", no_argument, 0, 'h'},
-		{"record_type", required_argument, 0, 'T'},
-		{"expected_address", required_argument, 0, 'a'},
-		{0, 0, 0, 0}
-	};
+  int option = 0;
+  static struct option longopts[] = {
+    {"hostname", required_argument, 0, 'H'},
+    {"query_address", required_argument, 0, 'l'},
+    {"warning", required_argument, 0, 'w'},
+    {"critical", required_argument, 0, 'c'},
+    {"timeout", required_argument, 0, 't'},
+    {"verbose", no_argument, 0, 'v'},
+    {"version", no_argument, 0, 'V'},
+    {"help", no_argument, 0, 'h'},
+    {"record_type", required_argument, 0, 'T'},
+    {"expected_address", required_argument, 0, 'a'},
+    {0, 0, 0, 0}
+  };
 
-	if (argc < 2)
-		return ERROR;
+  if (argc < 2)
+    return ERROR;
 
-	while (1) {
-		c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:a:", longopts, &option);
+  while (1) {
+    c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:a:", longopts, &option);
 
-		if (c == -1 || c == EOF)
-			break;
+    if (c == -1 || c == EOF)
+      break;
 
-		switch (c) {
-		case 'h':									/* help */
-			print_help ();
-			exit (STATE_OK);
-		case 'V':									/* version */
-			print_revision (progname, revision);
-			exit (STATE_OK);
-		case 'H':									/* hostname */
-			host_or_die(optarg);
-			dns_server = optarg;
-			break;
-		case 'p':                 /* server port */
-			if (is_intpos (optarg)) {
-				server_port = atoi (optarg);
-			}
-			else {
-				usage_va(_("Port must be a positive integer - %s"), optarg);
-			}
-			break;
-		case 'l':									/* address to lookup */
-			query_address = optarg;
-			break;
-		case 'w':									/* warning */
-			if (is_nonnegative (optarg)) {
-				warning_interval = strtod (optarg, NULL);
-			}
-			else {
-				usage_va(_("Warning interval must be a positive integer - %s"), optarg);
-			}
-			break;
-		case 'c':									/* critical */
-			if (is_nonnegative (optarg)) {
-				critical_interval = strtod (optarg, NULL);
-			}
-			else {
-				usage_va(_("Critical interval must be a positive integer - %s"), optarg);
-			}
-			break;
-		case 't':									/* timeout */
-			if (is_intnonneg (optarg)) {
-				timeout_interval = atoi (optarg);
-			}
-			else {
-				usage_va(_("Timeout interval must be a positive integer - %s"), optarg);
-			}
-			break;
-		case 'v':									/* verbose */
-			verbose = TRUE;
-			break;
-		case 'T':
-			record_type = optarg;
-			break;
-		case 'a':
-			expected_address = optarg;
-			break;
-		default:									/* usage_va */
-			usage_va(_("Unknown argument - %s"), optarg);
-		}
-	}
+    switch (c) {
+    case 'h':                 /* help */
+      print_help ();
+      exit (STATE_OK);
+    case 'V':                 /* version */
+      print_revision (progname, revision);
+      exit (STATE_OK);
+    case 'H':                 /* hostname */
+      host_or_die(optarg);
+      dns_server = optarg;
+      break;
+    case 'p':                 /* server port */
+      if (is_intpos (optarg)) {
+        server_port = atoi (optarg);
+      }
+      else {
+        usage_va(_("Port must be a positive integer - %s"), optarg);
+      }
+      break;
+    case 'l':                 /* address to lookup */
+      query_address = optarg;
+      break;
+    case 'w':                 /* warning */
+      if (is_nonnegative (optarg)) {
+        warning_interval = strtod (optarg, NULL);
+      }
+      else {
+        usage_va(_("Warning interval must be a positive integer - %s"), optarg);
+      }
+      break;
+    case 'c':                 /* critical */
+      if (is_nonnegative (optarg)) {
+        critical_interval = strtod (optarg, NULL);
+      }
+      else {
+        usage_va(_("Critical interval must be a positive integer - %s"), optarg);
+      }
+      break;
+    case 't':                 /* timeout */
+      if (is_intnonneg (optarg)) {
+        timeout_interval = atoi (optarg);
+      }
+      else {
+        usage_va(_("Timeout interval must be a positive integer - %s"), optarg);
+      }
+      break;
+    case 'v':                 /* verbose */
+      verbose = TRUE;
+      break;
+    case 'T':
+      record_type = optarg;
+      break;
+    case 'a':
+      expected_address = optarg;
+      break;
+    default:                  /* usage_va */
+      usage_va(_("Unknown argument - %s"), optarg);
+    }
+  }
 
-	c = optind;
-	if (dns_server == NULL) {
-		if (c < argc) {
-			host_or_die(argv[c]);
-			dns_server = argv[c];
-		}
-		else {
-			dns_server = strdup ("127.0.0.1");
-		}
-	}
+  c = optind;
+  if (dns_server == NULL) {
+    if (c < argc) {
+      host_or_die(argv[c]);
+      dns_server = argv[c];
+    }
+    else {
+      dns_server = strdup ("127.0.0.1");
+    }
+  }
 
-	return validate_arguments ();
+  return validate_arguments ();
 }
 
 
@@ -275,7 +275,7 @@
 int
 validate_arguments (void)
 {
-	return OK;
+  return OK;
 }
 
 
@@ -283,43 +283,56 @@
 void
 print_help (void)
 {
-	char *myport;
+  char *myport;
 
-	asprintf (&myport, "%d", DEFAULT_PORT);
+  asprintf (&myport, "%d", DEFAULT_PORT);
 
-	print_revision (progname, revision);
+  print_revision (progname, revision);
 
-	printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop at users.sourceforge.net>\n");
-	printf (COPYRIGHT, copyright, email);
+  printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop at users.sourceforge.net>\n");
+  printf (COPYRIGHT, copyright, email);
 
-	printf (_("Test the DNS service on the specified host using dig\n\n"));
+  printf (_("This plugin test the DNS service on the specified host using dig"));
 
-	print_usage ();
+  printf ("\n\n");
 
-	printf (_(UT_HELP_VRSN));
+  print_usage ();
 
-	printf (_(UT_HOST_PORT), 'P', myport);
+  printf (_(UT_HELP_VRSN));
 
-	printf (_("\
- -l, --lookup=STRING\n\
-   machine name to lookup\n"));
+  printf (_(UT_HOST_PORT), 'P', myport);
 
-        printf (_("\
- -T, --record_type=STRING\n\
-   record type to lookup (default: A)\n"));
+  printf ("-l, --lookup=STRING");
+    
+  printf ("\n");
 
-        printf (_("\
- -a, --expected_address=STRING\n\
-   an address expected to be in the answer section.\n\
-   if not set, uses whatever was in -l\n"));
+  printf (_("machine name to lookup"));
 
-	printf (_(UT_WARN_CRIT));
+  printf ("\n");
 
-	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+  printf ("-T, --record_type=STRING");
 
-	printf (_(UT_VERBOSE));
+  printf ("\n");
 
-	printf (_(UT_SUPPORT));
+  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_WARN_CRIT));
+
+  printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+  printf (_(UT_VERBOSE));
+
+  printf (_(UT_SUPPORT));
 }
 
 
@@ -327,8 +340,8 @@
 void
 print_usage (void)
 {
-	printf ("\
-Usage: %s -H host -l lookup [-p <server port>] [-T <query type>]\n\
-              [-w <warning interval>] [-c <critical interval>] [-t <timeout>]\n\
-              [-a <expected answer address>] [-v]\n", progname);
+  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");
 }

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- check_disk.c	2 Nov 2005 08:59:33 -0000	1.59
+++ check_disk.c	14 Nov 2005 00:51:44 -0000	1.60
@@ -19,9 +19,9 @@
 *****************************************************************************/
 
 const char *progname = "check_disk";
-const char *program_name = "check_disk";	/* Required for coreutils libs */
+const char *program_name = "check_disk";  /* Required for coreutils libs */
 const char *revision = "$Revision$";
-const char *copyright = "1999-2004";
+const char *copyright = "1999-2005";
 const char *email = "nagiosplug-devel at lists.sourceforge.net";
 
  /*
[...1119 lines suppressed...]
+
+  printf (_("checks /tmp and /var at 10% and 5% and / at 100MB, 50MB"));
+  
+  printf ("\n");
+
+  printf (_(UT_SUPPORT));
 }
 
 
@@ -752,7 +847,7 @@
 void
 print_usage (void)
 {
-	printf ("\
-Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [-W limit] [-K limit]\n\
-                  [-v] [-q]\n", progname);
+  printf (_("Usage:"));
+  printf (" %s -w limit -c limit [-p path | -x device] [-t timeout]", progname);
+  printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q]\n");
 }

Index: check_game.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_game.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- check_game.c	31 Oct 2005 20:03:19 -0000	1.25
+++ check_game.c	14 Nov 2005 00:51:44 -0000	1.26
@@ -19,7 +19,7 @@
 
 const char *progname = "check_game";
 const char *revision = "$Revision$";
-const char *copyright = "2002-2004";
+const char *copyright = "2002-2005";
 const char *email = "nagiosplug-devel at lists.sourceforge.net";
 
 #include "common.h"
@@ -31,12 +31,12 @@
 void print_help (void);
 void print_usage (void);
 
-#define QSTAT_DATA_DELIMITER 	","
+#define QSTAT_DATA_DELIMITER  ","
 
-#define QSTAT_HOST_ERROR	"ERROR"
-#define QSTAT_HOST_DOWN		"DOWN"
-#define QSTAT_HOST_TIMEOUT	"TIMEOUT"
-#define QSTAT_MAX_RETURN_ARGS	12
+#define QSTAT_HOST_ERROR  "ERROR"
+#define QSTAT_HOST_DOWN   "DOWN"
+#define QSTAT_HOST_TIMEOUT  "TIMEOUT"
+#define QSTAT_MAX_RETURN_ARGS 12
 
 char *server_ip;
 char *game_type;
@@ -54,239 +54,241 @@
 int
 main (int argc, char **argv)
 {
-	char *command_line;
-	int result = STATE_UNKNOWN;
-	char *p, *ret[QSTAT_MAX_RETURN_ARGS];
-	size_t i = 0;
-	output chld_out;
+  char *command_line;
+  int result = STATE_UNKNOWN;
+  char *p, *ret[QSTAT_MAX_RETURN_ARGS];
+  size_t i = 0;
+  output chld_out;
 
-	setlocale (LC_ALL, "");
-	bindtextdomain (PACKAGE, LOCALEDIR);
-	textdomain (PACKAGE);
-	
-	if (process_arguments (argc, argv) == ERROR)
-		usage_va(_("Could not parse arguments"));
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
+  
+  if (process_arguments (argc, argv) == ERROR)
+    usage_va(_("Could not parse arguments"));
 
-	result = STATE_OK;
+  result = STATE_OK;
 
-	/* create the command line to execute */
-	asprintf (&command_line, "%s -raw %s -%s %s",
-						PATH_TO_QSTAT, QSTAT_DATA_DELIMITER, game_type, server_ip);
-	
-	if (port)
-		asprintf (&command_line, "%s:%-d", command_line, port);
+  /* create the command line to execute */
+  asprintf (&command_line, "%s -raw %s -%s %s",
+            PATH_TO_QSTAT, QSTAT_DATA_DELIMITER, game_type, server_ip);
+  
+  if (port)
+    asprintf (&command_line, "%s:%-d", command_line, port);
 
-	if (verbose > 0)
-		printf ("%s\n", command_line);
+  if (verbose > 0)
+    printf ("%s\n", command_line);
 
-	/* run the command. historically, this plugin ignores output on stderr,
-	 * as well as return status of the qstat program */
-	(void)np_runcmd(command_line, &chld_out, NULL, 0);
+  /* run the command. historically, this plugin ignores output on stderr,
+   * as well as return status of the qstat program */
+  (void)np_runcmd(command_line, &chld_out, NULL, 0);
 
-	/* sanity check */
-	/* was thinking about running qstat without any options, capturing the
-	   -default line, parsing it & making an array of all know server types
-	   but thought this would be too much hassle considering this is a tool
-	   for intelligent sysadmins (ha). Could put a static array of known 
-	   server types in a header file but then we'd be limiting ourselves
+  /* sanity check */
+  /* was thinking about running qstat without any options, capturing the
+     -default line, parsing it & making an array of all know server types
+     but thought this would be too much hassle considering this is a tool
+     for intelligent sysadmins (ha). Could put a static array of known 
+     server types in a header file but then we'd be limiting ourselves
 
-	   In the end, I figured I'd simply let an error occur & then trap it
-	 */
+     In the end, I figured I'd simply let an error occur & then trap it
+   */
 
-	if (!strncmp (chld_out.line[0], "unknown option", 14)) {
-		printf (_("CRITICAL - Host type parameter incorrect!\n"));
-		result = STATE_CRITICAL;
-		return result;
-	}
+  if (!strncmp (chld_out.line[0], "unknown option", 14)) {
+    printf (_("CRITICAL - Host type parameter incorrect!\n"));
+    result = STATE_CRITICAL;
+    return result;
+  }
 
-	p = (char *) strtok (chld_out.line[0], QSTAT_DATA_DELIMITER);
-	while (p != NULL) {
-		ret[i] = p;
-		p = (char *) strtok (NULL, QSTAT_DATA_DELIMITER);
-		i++;
-		if (i >= QSTAT_MAX_RETURN_ARGS)
-			break;
-	}
+  p = (char *) strtok (chld_out.line[0], QSTAT_DATA_DELIMITER);
+  while (p != NULL) {
+    ret[i] = p;
+    p = (char *) strtok (NULL, QSTAT_DATA_DELIMITER);
+    i++;
+    if (i >= QSTAT_MAX_RETURN_ARGS)
+      break;
+  }
 
-	if (strstr (ret[2], QSTAT_HOST_ERROR)) {
-		printf (_("CRITICAL - Host not found\n"));
-		result = STATE_CRITICAL;
-	}
-	else if (strstr (ret[2], QSTAT_HOST_DOWN)) {
-		printf (_("CRITICAL - Game server down or unavailable\n"));
-		result = STATE_CRITICAL;
-	}
-	else if (strstr (ret[2], QSTAT_HOST_TIMEOUT)) {
-		printf (_("CRITICAL - Game server timeout\n"));
-		result = STATE_CRITICAL;
-	}
-	else {
-		printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n", 
-		        ret[qstat_game_players],
-		        ret[qstat_game_players_max],
-		        ret[qstat_game_field], 
-		        ret[qstat_map_field],
-		        ret[qstat_ping_field],
-		        perfdata ("players", atol(ret[qstat_game_players]), "",
-		                  FALSE, 0, FALSE, 0,
-		                  TRUE, 0, TRUE, atol(ret[qstat_game_players_max])),
-		        fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "",
-		                  FALSE, 0, FALSE, 0,
-		                  TRUE, 0, FALSE, 0));
-	}
+  if (strstr (ret[2], QSTAT_HOST_ERROR)) {
+    printf (_("CRITICAL - Host not found\n"));
+    result = STATE_CRITICAL;
+  }
+  else if (strstr (ret[2], QSTAT_HOST_DOWN)) {
+    printf (_("CRITICAL - Game server down or unavailable\n"));
+    result = STATE_CRITICAL;
+  }
+  else if (strstr (ret[2], QSTAT_HOST_TIMEOUT)) {
+    printf (_("CRITICAL - Game server timeout\n"));
+    result = STATE_CRITICAL;
+  }
+  else {
+    printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n", 
+            ret[qstat_game_players],
+            ret[qstat_game_players_max],
+            ret[qstat_game_field], 
+            ret[qstat_map_field],
+            ret[qstat_ping_field],
+            perfdata ("players", atol(ret[qstat_game_players]), "",
+                      FALSE, 0, FALSE, 0,
+                      TRUE, 0, TRUE, atol(ret[qstat_game_players_max])),
+            fperfdata ("ping", strtod(ret[qstat_ping_field], NULL), "",
+                      FALSE, 0, FALSE, 0,
+                      TRUE, 0, FALSE, 0));
+  }
 
-	return result;
+  return result;
 }
 
 
 int
 process_arguments (int argc, char **argv)
 {
-	int c;
+  int c;
 
-	int opt_index = 0;
-	static struct option long_opts[] = {
-		{"help", no_argument, 0, 'h'},
-		{"version", no_argument, 0, 'V'},
-		{"verbose", no_argument, 0, 'v'},
-		{"timeout", required_argument, 0, 't'},
-		{"hostname", required_argument, 0, 'H'},
-		{"port", required_argument, 0, 'P'},
-		{"game-type", required_argument, 0, 'G'},
-		{"map-field", required_argument, 0, 'm'},
-		{"ping-field", required_argument, 0, 'p'},
-		{"game-field", required_argument, 0, 'g'},
-		{"players-field", required_argument, 0, 129},
-		{"max-players-field", required_argument, 0, 130},
-		{0, 0, 0, 0}
-	};
+  int opt_index = 0;
+  static struct option long_opts[] = {
+    {"help", no_argument, 0, 'h'},
+    {"version", no_argument, 0, 'V'},
+    {"verbose", no_argument, 0, 'v'},
+    {"timeout", required_argument, 0, 't'},
+    {"hostname", required_argument, 0, 'H'},
+    {"port", required_argument, 0, 'P'},
+    {"game-type", required_argument, 0, 'G'},
+    {"map-field", required_argument, 0, 'm'},
+    {"ping-field", required_argument, 0, 'p'},
+    {"game-field", required_argument, 0, 'g'},
+    {"players-field", required_argument, 0, 129},
+    {"max-players-field", required_argument, 0, 130},
+    {0, 0, 0, 0}
+  };
 
-	if (argc < 2)
-		return ERROR;
+  if (argc < 2)
+    return ERROR;
 
-	for (c = 1; c < argc; c++) {
-		if (strcmp ("-mf", argv[c]) == 0)
-			strcpy (argv[c], "-m");
-		else if (strcmp ("-pf", argv[c]) == 0)
-			strcpy (argv[c], "-p");
-		else if (strcmp ("-gf", argv[c]) == 0)
-			strcpy (argv[c], "-g");
-	}
+  for (c = 1; c < argc; c++) {
+    if (strcmp ("-mf", argv[c]) == 0)
+      strcpy (argv[c], "-m");
+    else if (strcmp ("-pf", argv[c]) == 0)
+      strcpy (argv[c], "-p");
+    else if (strcmp ("-gf", argv[c]) == 0)
+      strcpy (argv[c], "-g");
+  }
 
-	while (1) {
-		c = getopt_long (argc, argv, "hVvt:H:P:G:g:p:m:", long_opts, &opt_index);
+  while (1) {
+    c = getopt_long (argc, argv, "hVvt:H:P:G:g:p:m:", long_opts, &opt_index);
 
-		if (c == -1 || c == EOF)
-			break;
+    if (c == -1 || c == EOF)
+      break;
 
-		switch (c) {
-		case 'h': /* help */
-			print_help ();
-			exit (STATE_OK);
-		case 'V': /* version */
-			print_revision (progname, revision);
-			exit (STATE_OK);
-		case 'v': /* version */
-			verbose = TRUE;
-			break;
-		case 't': /* timeout period */
-			timeout_interval = atoi (optarg);
-			break;
-		case 'H': /* hostname */
-			if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			server_ip = optarg;
-			break;
-		case 'P': /* port */
-			port = atoi (optarg);
-			break;
-		case 'G': /* hostname */
-			if (strlen (optarg) >= MAX_INPUT_BUFFER)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			game_type = optarg;
-			break;
-		case 'p': /* index of ping field */
-			qstat_ping_field = atoi (optarg);
-			if (qstat_ping_field < 0 || qstat_ping_field > QSTAT_MAX_RETURN_ARGS)
-				return ERROR;
-			break;
-		case 'm': /* index on map field */
-			qstat_map_field = atoi (optarg);
-			if (qstat_map_field < 0 || qstat_map_field > QSTAT_MAX_RETURN_ARGS)
-				return ERROR;
-			break;
-		case 'g': /* index of game field */
-			qstat_game_field = atoi (optarg);
-			if (qstat_game_field < 0 || qstat_game_field > QSTAT_MAX_RETURN_ARGS)
-				return ERROR;
-			break;
-		case 129: /* index of player count field */
-			qstat_game_players = atoi (optarg);
-			if (qstat_game_players_max == 0)
-				qstat_game_players_max = qstat_game_players - 1;
-			if (qstat_game_players < 0 || qstat_game_players > QSTAT_MAX_RETURN_ARGS)
-				return ERROR;
-			break;
-		case 130: /* index of max players field */
-			qstat_game_players_max = atoi (optarg);
-			if (qstat_game_players_max < 0 || qstat_game_players_max > QSTAT_MAX_RETURN_ARGS)
-				return ERROR;
-			break;
-		default: /* args not parsable */
-			usage_va(_("Unknown argument - %s"), optarg);
-		}
-	}
+    switch (c) {
+    case 'h': /* help */
+      print_help ();
+      exit (STATE_OK);
+    case 'V': /* version */
+      print_revision (progname, revision);
+      exit (STATE_OK);
+    case 'v': /* version */
+      verbose = TRUE;
+      break;
+    case 't': /* timeout period */
+      timeout_interval = atoi (optarg);
+      break;
+    case 'H': /* hostname */
+      if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      server_ip = optarg;
+      break;
+    case 'P': /* port */
+      port = atoi (optarg);
+      break;
+    case 'G': /* hostname */
+      if (strlen (optarg) >= MAX_INPUT_BUFFER)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      game_type = optarg;
+      break;
+    case 'p': /* index of ping field */
+      qstat_ping_field = atoi (optarg);
+      if (qstat_ping_field < 0 || qstat_ping_field > QSTAT_MAX_RETURN_ARGS)
+        return ERROR;
+      break;
+    case 'm': /* index on map field */
+      qstat_map_field = atoi (optarg);
+      if (qstat_map_field < 0 || qstat_map_field > QSTAT_MAX_RETURN_ARGS)
+        return ERROR;
+      break;
+    case 'g': /* index of game field */
+      qstat_game_field = atoi (optarg);
+      if (qstat_game_field < 0 || qstat_game_field > QSTAT_MAX_RETURN_ARGS)
+        return ERROR;
+      break;
+    case 129: /* index of player count field */
+      qstat_game_players = atoi (optarg);
+      if (qstat_game_players_max == 0)
+        qstat_game_players_max = qstat_game_players - 1;
+      if (qstat_game_players < 0 || qstat_game_players > QSTAT_MAX_RETURN_ARGS)
+        return ERROR;
+      break;
+    case 130: /* index of max players field */
+      qstat_game_players_max = atoi (optarg);
+      if (qstat_game_players_max < 0 || qstat_game_players_max > QSTAT_MAX_RETURN_ARGS)
+        return ERROR;
+      break;
+    default: /* args not parsable */
+      usage_va(_("Unknown argument - %s"), optarg);
+    }
+  }
 
-	c = optind;
-	/* first option is the game type */
-	if (!game_type && c<argc)
-		game_type = strdup (argv[c++]);
+  c = optind;
+  /* first option is the game type */
+  if (!game_type && c<argc)
+    game_type = strdup (argv[c++]);
 
-	/* Second option is the server name */
-	if (!server_ip && c<argc)
-		server_ip = strdup (argv[c++]);
+  /* Second option is the server name */
+  if (!server_ip && c<argc)
+    server_ip = strdup (argv[c++]);
 
-	return validate_arguments ();
+  return validate_arguments ();
 }
 
 
 int
 validate_arguments (void)
 {
-	if (qstat_game_players_max < 0)
-		qstat_game_players_max = 4;
+  if (qstat_game_players_max < 0)
+    qstat_game_players_max = 4;
 
-	if (qstat_game_players < 0)
-		qstat_game_players = 5;
+  if (qstat_game_players < 0)
+    qstat_game_players = 5;
 
-	if (qstat_game_field < 0)
-		qstat_game_field = 2;
+  if (qstat_game_field < 0)
+    qstat_game_field = 2;
 
-	if (qstat_map_field < 0)
-		qstat_map_field = 3;
+  if (qstat_map_field < 0)
+    qstat_map_field = 3;
 
-	if (qstat_ping_field < 0)
-		qstat_ping_field = 5;
+  if (qstat_ping_field < 0)
+    qstat_ping_field = 5;
 
-	return OK;
+  return OK;
 }
 
 
 void
 print_help (void)
 {
-	print_revision (progname, revision);
+  print_revision (progname, revision);
 
-	printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
-	printf (COPYRIGHT, copyright, email);
+  printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
+  printf (COPYRIGHT, copyright, email);
 
-	printf (_("This plugin tests game server connections with the specified host."));
+  printf (_("This plugin tests game server connections with the specified host."));
 
-	print_usage ();
+ printf ("\n\n");
+ 
+  print_usage ();
 
-	printf (_(UT_HELP_VRSN));
+  printf (_(UT_HELP_VRSN));
 
-	printf (_("\
+  printf (_("\
 <game>        = Game type that is recognised by qstat (without the leading dash)\n\
 <ip_address>  = The IP address of the device you wish to query\n\
  [port]        = Optional port of which to connect\n\
@@ -294,15 +296,25 @@
  [map_field]   = Field number in raw qstat output that contains map name\n\
  [ping_field]  = Field number in raw qstat output that contains ping time\n"));
 
-	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+  printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
 
-	printf (_("\n\
-Notes:\n\
-- This plugin uses the 'qstat' command, the popular game server status query tool .\n\
-  If you don't have the package installed, you will need to download it from\n\
-  http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"));
+  printf (_("Notes:"));
+  
+  printf ("\n");
 
-	printf (_(UT_SUPPORT));
+  printf (_("This plugin uses the 'qstat' command, the popular game server status query tool ."));
+  
+  printf ("\n");
+
+  printf (_("If you don't have the package installed, you will need to download it from"));
+  
+  printf ("\n");
+
+  printf (_("http://www.activesw.com/people/steve/qstat.html before you can use this plugin."));
+
+  printf ("\n");
+
+  printf (_(UT_SUPPORT));
 }
 
 
@@ -310,9 +322,8 @@
 void
 print_usage (void)
 {
-	printf ("\
-Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
-                  [-pf ping_field]\n", progname);
+  printf (_("Usage:"));
+  printf (" %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n", progname);
 }
 
 /******************************************************************************

Index: check_fping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_fping.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- check_fping.c	25 Dec 2004 23:17:44 -0000	1.24
+++ check_fping.c	14 Nov 2005 00:51:44 -0000	1.25
@@ -29,10 +29,10 @@
 #include "utils.h"
 
 enum {
-	PACKET_COUNT = 1,
-	PACKET_SIZE = 56,
-	PL = 0,
-	RTA = 1
+  PACKET_COUNT = 1,
+  PACKET_SIZE = 56,
+  PL = 0,
+  RTA = 1
 };
 
 int textscan (char *buf);
@@ -57,65 +57,65 @@
 int
 main (int argc, char **argv)
 {
-/* normaly should be 	int result = STATE_UNKNOWN; */
+/* normaly should be  int result = STATE_UNKNOWN; */
 
-	int status = STATE_UNKNOWN;
-	char *server = NULL;
-	char *command_line = NULL;
-	char *input_buffer = NULL;
-	input_buffer = malloc (MAX_INPUT_BUFFER);
+  int status = STATE_UNKNOWN;
+  char *server = NULL;
+  char *command_line = NULL;
+  char *input_buffer = NULL;
+  input_buffer = malloc (MAX_INPUT_BUFFER);
 
-	setlocale (LC_ALL, "");
-	bindtextdomain (PACKAGE, LOCALEDIR);
-	textdomain (PACKAGE);
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
 
-	if (process_arguments (argc, argv) == ERROR)
-		usage4 (_("Could not parse arguments"));
+  if (process_arguments (argc, argv) == ERROR)
+    usage4 (_("Could not parse arguments"));
 
-	server = strscpy (server, server_name);
+  server = strscpy (server, server_name);
 
-	/* compose the command */
-	asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING,
-	          packet_size, packet_count, server);
+  /* compose the command */
+  asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING,
+            packet_size, packet_count, server);
 
-	if (verbose)
-		printf ("%s\n", command_line);
+  if (verbose)
+    printf ("%s\n", command_line);
 
-	/* run the command */
-	child_process = spopen (command_line);
-	if (child_process == NULL) {
-		printf (_("Could not open pipe: %s\n"), command_line);
-		return STATE_UNKNOWN;
-	}
+  /* run the command */
+  child_process = spopen (command_line);
+  if (child_process == NULL) {
+    printf (_("Could not open pipe: %s\n"), command_line);
+    return STATE_UNKNOWN;
+  }
 
-	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
-	if (child_stderr == NULL) {
-		printf (_("Could not open stderr for %s\n"), command_line);
-	}
+  child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
+  if (child_stderr == NULL) {
+    printf (_("Could not open stderr for %s\n"), command_line);
+  }
 
-	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
-		if (verbose)
-			printf ("%s", input_buffer);
-		status = max_state (status, textscan (input_buffer));
-	}
+  while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
+    if (verbose)
+      printf ("%s", input_buffer);
+    status = max_state (status, textscan (input_buffer));
+  }
 
-	/* If we get anything on STDERR, at least set warning */
-	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
-		status = max_state (status, STATE_WARNING);
-		if (verbose)
-			printf ("%s", input_buffer);
-		status = max_state (status, textscan (input_buffer));
-	}
-	(void) fclose (child_stderr);
+  /* If we get anything on STDERR, at least set warning */
+  while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
+    status = max_state (status, STATE_WARNING);
+    if (verbose)
+      printf ("%s", input_buffer);
+    status = max_state (status, textscan (input_buffer));
+  }
+  (void) fclose (child_stderr);
 
-	/* close the pipe */
-	if (spclose (child_process))
-		/* need to use max_state not max */
-		status = max_state (status, STATE_WARNING);
+  /* close the pipe */
+  if (spclose (child_process))
+    /* need to use max_state not max */
+    status = max_state (status, STATE_WARNING);
 
-	printf ("FPING %s - %s\n", state_text (status), server_name);
+  printf ("FPING %s - %s\n", state_text (status), server_name);
 
-	return status;
+  return status;
 }
 
 
@@ -123,80 +123,80 @@
 int
 textscan (char *buf)
 {
-	char *rtastr = NULL;
-	char *losstr = NULL;
-	double loss;
-	double rta;
-	int status = STATE_UNKNOWN;
+  char *rtastr = NULL;
+  char *losstr = NULL;
+  double loss;
+  double rta;
+  int status = STATE_UNKNOWN;
 
-	if (strstr (buf, "not found")) {
-		die (STATE_CRITICAL, _("FPING UNKNOW - %s not found\n"), server_name);
+  if (strstr (buf, "not found")) {
+    die (STATE_CRITICAL, _("FPING UNKNOW - %s not found\n"), server_name);
 
-	}
-	else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
-		die (STATE_CRITICAL, _("FPING CRITICAL - %s is unreachable\n"),
-							 "host");
+  }
+  else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
+    die (STATE_CRITICAL, _("FPING CRITICAL - %s is unreachable\n"),
+               "host");
 
-	}
-	else if (strstr (buf, "is down")) {
-		die (STATE_CRITICAL, _("FPING CRITICAL - %s is down\n"), server_name);
+  }
+  else if (strstr (buf, "is down")) {
+    die (STATE_CRITICAL, _("FPING CRITICAL - %s is down\n"), server_name);
 
-	}
-	else if (strstr (buf, "is alive")) {
-		status = STATE_OK;
+  }
+  else if (strstr (buf, "is alive")) {
+    status = STATE_OK;
 
-	}
-	else if (strstr (buf, "xmt/rcv/%loss") && strstr (buf, "min/avg/max")) {
-		losstr = strstr (buf, "=");
-		losstr = 1 + strstr (losstr, "/");
-		losstr = 1 + strstr (losstr, "/");
-		rtastr = strstr (buf, "min/avg/max");
-		rtastr = strstr (rtastr, "=");
-		rtastr = 1 + index (rtastr, '/');
-		loss = strtod (losstr, NULL);
-		rta = strtod (rtastr, NULL);
-		if (cpl_p == TRUE && loss > cpl)
-			status = STATE_CRITICAL;
-		else if (crta_p == TRUE  && rta > crta)
-			status = STATE_CRITICAL;
-		else if (wpl_p == TRUE && loss > wpl)
-			status = STATE_WARNING;
-		else if (wrta_p == TRUE && rta > wrta)
-			status = STATE_WARNING;
-		else
-			status = STATE_OK;
-		die (status,
-		      _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"),
-				 state_text (status), server_name, loss, rta,
-		     perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100),
-		     fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0));
+  }
+  else if (strstr (buf, "xmt/rcv/%loss") && strstr (buf, "min/avg/max")) {
+    losstr = strstr (buf, "=");
+    losstr = 1 + strstr (losstr, "/");
+    losstr = 1 + strstr (losstr, "/");
+    rtastr = strstr (buf, "min/avg/max");
+    rtastr = strstr (rtastr, "=");
+    rtastr = 1 + index (rtastr, '/');
+    loss = strtod (losstr, NULL);
+    rta = strtod (rtastr, NULL);
+    if (cpl_p == TRUE && loss > cpl)
+      status = STATE_CRITICAL;
+    else if (crta_p == TRUE  && rta > crta)
+      status = STATE_CRITICAL;
+    else if (wpl_p == TRUE && loss > wpl)
+      status = STATE_WARNING;
+    else if (wrta_p == TRUE && rta > wrta)
+      status = STATE_WARNING;
+    else
+      status = STATE_OK;
+    die (status,
+          _("FPING %s - %s (loss=%.0f%%, rta=%f ms)|%s %s\n"),
+         state_text (status), server_name, loss, rta,
+         perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100),
+         fperfdata ("rta", rta/1.0e3, "s", wrta_p, wrta/1.0e3, crta_p, crta/1.0e3, TRUE, 0, FALSE, 0));
 
-	}
-	else if(strstr (buf, "xmt/rcv/%loss") ) {
-		/* no min/max/avg if host was unreachable in fping v2.2.b1 */
-		losstr = strstr (buf, "=");
-		losstr = 1 + strstr (losstr, "/");
-		losstr = 1 + strstr (losstr, "/");
-		loss = strtod (losstr, NULL);
-		if (atoi(losstr) == 100)
-			status = STATE_CRITICAL;
-		else if (cpl_p == TRUE && loss > cpl)
-			status = STATE_CRITICAL;
-		else if (wpl_p == TRUE && loss > wpl)
-			status = STATE_WARNING;
-		else
-			status = STATE_OK;
-		/* loss=%.0f%%;%d;%d;0;100 */
-		die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"),
-		     state_text (status), server_name, loss ,
-		     perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100));
-	
-	}
-	else {
-		status = max_state (status, STATE_WARNING);
-	}
+  }
+  else if(strstr (buf, "xmt/rcv/%loss") ) {
+    /* no min/max/avg if host was unreachable in fping v2.2.b1 */
+    losstr = strstr (buf, "=");
+    losstr = 1 + strstr (losstr, "/");
+    losstr = 1 + strstr (losstr, "/");
+    loss = strtod (losstr, NULL);
+    if (atoi(losstr) == 100)
+      status = STATE_CRITICAL;
+    else if (cpl_p == TRUE && loss > cpl)
+      status = STATE_CRITICAL;
+    else if (wpl_p == TRUE && loss > wpl)
+      status = STATE_WARNING;
+    else
+      status = STATE_OK;
+    /* loss=%.0f%%;%d;%d;0;100 */
+    die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"),
+         state_text (status), server_name, loss ,
+         perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100));
+  
+  }
+  else {
+    status = max_state (status, STATE_WARNING);
+  }
 
-	return status;
+  return status;
 }
 
 
@@ -205,145 +205,145 @@
 int
 process_arguments (int argc, char **argv)
 {
-	int c;
-	char *rv[2];
+  int c;
+  char *rv[2];
 
-	int option = 0;
-	static struct option longopts[] = {
-		{"hostname", required_argument, 0, 'H'},
-		{"critical", required_argument, 0, 'c'},
-		{"warning", required_argument, 0, 'w'},
-		{"bytes", required_argument, 0, 'b'},
-		{"number", required_argument, 0, 'n'},
-		{"verbose", no_argument, 0, 'v'},
-		{"version", no_argument, 0, 'V'},
-		{"help", no_argument, 0, 'h'},
-		{0, 0, 0, 0}
-	};
+  int option = 0;
+  static struct option longopts[] = {
+    {"hostname", required_argument, 0, 'H'},
+    {"critical", required_argument, 0, 'c'},
+    {"warning", required_argument, 0, 'w'},
+    {"bytes", required_argument, 0, 'b'},
+    {"number", required_argument, 0, 'n'},
+    {"verbose", no_argument, 0, 'v'},
+    {"version", no_argument, 0, 'V'},
+    {"help", no_argument, 0, 'h'},
+    {0, 0, 0, 0}
+  };
 
-	rv[PL] = NULL;
-	rv[RTA] = NULL;
+  rv[PL] = NULL;
+  rv[RTA] = NULL;
 
-	if (argc < 2)
-		return ERROR;
+  if (argc < 2)
+    return ERROR;
 
-	if (!is_option (argv[1])) {
-		server_name = argv[1];
-		argv[1] = argv[0];
-		argv = &argv[1];
-		argc--;
-	}
+  if (!is_option (argv[1])) {
+    server_name = argv[1];
+    argv[1] = argv[0];
+    argv = &argv[1];
+    argc--;
+  }
 
-	while (1) {
-		c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option);
+  while (1) {
+    c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option);
 
-		if (c == -1 || c == EOF || c == 1)
-			break;
+    if (c == -1 || c == EOF || c == 1)
+      break;
 
-		switch (c) {
-		case '?':									/* print short usage statement if args not parsable */
-			usage2 (_("Unknown argument"), optarg);
-		case 'h':									/* help */
-			print_help ();
-			exit (STATE_OK);
-		case 'V':									/* version */
-			print_revision (progname, revision);
-			exit (STATE_OK);
-		case 'v':									/* verbose mode */
-			verbose = TRUE;
-			break;
-		case 'H':									/* hostname */
-			if (is_host (optarg) == FALSE) {
-				usage2 (_("Invalid hostname/address"), optarg);
-			}
-			server_name = strscpy (server_name, optarg);
-			break;
-		case 'c':
-			get_threshold (optarg, rv);
-			if (rv[RTA]) {
-				crta = strtod (rv[RTA], NULL);
-				crta_p = TRUE;
-				rv[RTA] = NULL;
-			}
-			if (rv[PL]) {
-				cpl = atoi (rv[PL]);
-				cpl_p = TRUE;
-				rv[PL] = NULL;
-			}
-			break;
-		case 'w':
-			get_threshold (optarg, rv);
-			if (rv[RTA]) {
-				wrta = strtod (rv[RTA], NULL);
-				wrta_p = TRUE;
-				rv[RTA] = NULL;
-			}
-			if (rv[PL]) {
-				wpl = atoi (rv[PL]);
-				wpl_p = TRUE;
-				rv[PL] = NULL;
-			}
-			break;
-		case 'b':									/* bytes per packet */
-			if (is_intpos (optarg))
-				packet_size = atoi (optarg);
-			else
-				usage (_("Packet size must be a positive integer"));
-			break;
-		case 'n':									/* number of packets */
-			if (is_intpos (optarg))
-				packet_count = atoi (optarg);
-			else
-				usage (_("Packet count must be a positive integer"));
-			break;
-		}
-	}
+    switch (c) {
+    case '?':                 /* print short usage statement if args not parsable */
+      usage2 (_("Unknown argument"), optarg);
+    case 'h':                 /* help */
+      print_help ();
+      exit (STATE_OK);
+    case 'V':                 /* version */
+      print_revision (progname, revision);
+      exit (STATE_OK);
+    case 'v':                 /* verbose mode */
+      verbose = TRUE;
+      break;
+    case 'H':                 /* hostname */
+      if (is_host (optarg) == FALSE) {
+        usage2 (_("Invalid hostname/address"), optarg);
+      }
+      server_name = strscpy (server_name, optarg);
+      break;
+    case 'c':
+      get_threshold (optarg, rv);
+      if (rv[RTA]) {
+        crta = strtod (rv[RTA], NULL);
+        crta_p = TRUE;
+        rv[RTA] = NULL;
+      }
+      if (rv[PL]) {
+        cpl = atoi (rv[PL]);
+        cpl_p = TRUE;
+        rv[PL] = NULL;
+      }
+      break;
+    case 'w':
+      get_threshold (optarg, rv);
+      if (rv[RTA]) {
+        wrta = strtod (rv[RTA], NULL);
+        wrta_p = TRUE;
+        rv[RTA] = NULL;
+      }
+      if (rv[PL]) {
+        wpl = atoi (rv[PL]);
+        wpl_p = TRUE;
+        rv[PL] = NULL;
+      }
+      break;
+    case 'b':                 /* bytes per packet */
+      if (is_intpos (optarg))
+        packet_size = atoi (optarg);
+      else
+        usage (_("Packet size must be a positive integer"));
+      break;
+    case 'n':                 /* number of packets */
+      if (is_intpos (optarg))
+        packet_count = atoi (optarg);
+      else
+        usage (_("Packet count must be a positive integer"));
+      break;
+    }
+  }
 
-	if (server_name == NULL)
-		usage4 (_("Hostname was not supplied"));
+  if (server_name == NULL)
+    usage4 (_("Hostname was not supplied"));
 
-	return OK;
+  return OK;
 }
 
 
 int
 get_threshold (char *arg, char *rv[2])
 {
-	char *arg1 = NULL;
-	char *arg2 = NULL;
+  char *arg1 = NULL;
+  char *arg2 = NULL;
 
-	arg1 = strscpy (arg1, arg);
-	if (strpbrk (arg1, ",:"))
-		arg2 = 1 + strpbrk (arg1, ",:");
+  arg1 = strscpy (arg1, arg);
+  if (strpbrk (arg1, ",:"))
+    arg2 = 1 + strpbrk (arg1, ",:");
 
-	if (arg2) {
-		arg1[strcspn (arg1, ",:")] = 0;
-		if (strstr (arg1, "%") && strstr (arg2, "%"))
-			die (STATE_UNKNOWN,
-								 _("%s: Only one threshold may be packet loss (%s)\n"), progname,
-								 arg);
-		if (!strstr (arg1, "%") && !strstr (arg2, "%"))
-			die (STATE_UNKNOWN,
-								 _("%s: Only one threshold must be packet loss (%s)\n"),
-								 progname, arg);
-	}
+  if (arg2) {
+    arg1[strcspn (arg1, ",:")] = 0;
+    if (strstr (arg1, "%") && strstr (arg2, "%"))
+      die (STATE_UNKNOWN,
+                 _("%s: Only one threshold may be packet loss (%s)\n"), progname,
+                 arg);
+    if (!strstr (arg1, "%") && !strstr (arg2, "%"))
+      die (STATE_UNKNOWN,
+                 _("%s: Only one threshold must be packet loss (%s)\n"),
+                 progname, arg);
+  }
 
-	if (arg2 && strstr (arg2, "%")) {
-		rv[PL] = arg2;
-		rv[RTA] = arg1;
-	}
-	else if (arg2) {
-		rv[PL] = arg1;
-		rv[RTA] = arg2;
-	}
-	else if (strstr (arg1, "%")) {
-		rv[PL] = arg1;
-	}
-	else {
-		rv[RTA] = arg1;
-	}
+  if (arg2 && strstr (arg2, "%")) {
+    rv[PL] = arg2;
+    rv[RTA] = arg1;
+  }
+  else if (arg2) {
+    rv[PL] = arg1;
+    rv[RTA] = arg2;
+  }
+  else if (strstr (arg1, "%")) {
+    rv[PL] = arg1;
+  }
+  else {
+    rv[RTA] = arg1;
+  }
 
-	return OK;
+  return OK;
 }
 
 
@@ -351,47 +351,82 @@
 print_help (void)
 {
 
-	print_revision (progname, revision);
+  print_revision (progname, revision);
 
-	printf ("Copyright (c) 1999 Didi Rieder <adrieder at sbox.tu-graz.ac.at>\n");
-	printf (COPYRIGHT, copyright, email);
+  printf ("Copyright (c) 1999 Didi Rieder <adrieder at sbox.tu-graz.ac.at>\n");
+  printf (COPYRIGHT, copyright, email);
 
-	printf (_("\
-This plugin will use the /bin/fping command to ping the specified host\n\
-for a fast check if the host is alive.\n\
-Note that it is necessary to set the suid flag on fping.\n\n"));
+  printf (_("This plugin will use the fping command to ping the specified host for a fast check"));
+  
+  printf ("\n");
+  
+  printf (_("Note that it is necessary to set the suid flag on fping."));
 
-	print_usage ();
+  printf ("\n\n");
+  
+  print_usage ();
 
-	printf (_(UT_HELP_VRSN));
+  printf (_(UT_HELP_VRSN));
 
-	printf (_("\
- -H, --hostname=HOST\n\
-    Name or IP Address of host to ping (IP Address bypasses name lookup,\n\
-    reducing system load)\n\
- -w, --warning=THRESHOLD\n\
-    warning threshold pair\n\
- -c, --critical=THRESHOLD\n\
-    critical threshold pair\n\
- -b, --bytes=INTEGER\n\
-    Size of ICMP packet (default: %d)\n\
- -n, --number=INTEGER\n\
-    Number of ICMP packets to send (default: %d)\n"),
-	        PACKET_SIZE, PACKET_COUNT);
+  printf ("  -H, --hostname=HOST");
+  
+  printf (_("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
+  
+  printf ("\n");
+  
+  printf ("-w, --warning=THRESHOLD");
+  
+  printf ("\n");
+  
+  printf (_("warning threshold pair"));
+  
+  printf ("\n");
 
-	printf (_(UT_VERBOSE));
+  printf ("  -c, --critical=THRESHOLD");
+  
+  printf ("\n");
 
-	printf (_("\n\
-THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel\n\
-time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the\n\
-percentage of packet loss to trigger an alarm state.\n"));
+  printf (_("critical threshold pair"));
+  
+  printf ("\n");
 
-	printf (_(UT_SUPPORT));
+  printf ("  -b, --bytes=INTEGER");
+  
+  printf (_("size of ICMP packet (default: %d)"),PACKET_SIZE);
+  
+  printf ("\n");
+
+  printf ("  -n, --number=INTEGER");
+  
+  printf ("\n");
+
+  printf (_("number of ICMP packets to send (default: %d)"),PACKET_COUNT);
+
+  printf ("\n");
+
+  printf (_(UT_VERBOSE));
+
+  printf ("\n");
+
+  printf (_("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));
+  
+  printf ("\n");
+
+  printf (_("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
+  
+  printf ("\n");
+
+  printf (_("packet loss to trigger an alarm state."));
+
+  printf ("\n");
+  
+  printf (_(UT_SUPPORT));
 }
 
 
 void
 print_usage (void)
 {
-	printf ("Usage: %s <host_address>\n", progname);
+  printf (_("Usage:"));
+  printf (" %s <host_address>\n", progname);
 }

Index: check_dns.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dns.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- check_dns.c	24 Oct 2005 11:10:29 -0000	1.48
+++ check_dns.c	14 Nov 2005 00:51:44 -0000	1.49
@@ -23,7 +23,7 @@
 
 const char *progname = "check_dns";
 const char *revision = "$Revision$";
-const char *copyright = "2000-2004";
+const char *copyright = "2000-2005";
 const char *email = "nagiosplug-devel at lists.sourceforge.net";
 
 #include "common.h"
@@ -49,156 +49,156 @@
 int
 main (int argc, char **argv)
 {
-	char *command_line = NULL;
-	char input_buffer[MAX_INPUT_BUFFER];
-	char *address = NULL;
-	char *msg = NULL;
-	char *temp_buffer = NULL;
-	int non_authoritative = FALSE;
-	int result = STATE_UNKNOWN;
-	double elapsed_time;
-	long microsec;
-	struct timeval tv;
-	int multi_address;
-	int parse_address = FALSE; /* This flag scans for Address: but only after Name: */
-	output chld_out, chld_err;
-	size_t i;
+  char *command_line = NULL;
+  char input_buffer[MAX_INPUT_BUFFER];
+  char *address = NULL;
+  char *msg = NULL;
+  char *temp_buffer = NULL;
+  int non_authoritative = FALSE;
+  int result = STATE_UNKNOWN;
+  double elapsed_time;
+  long microsec;
+  struct timeval tv;
+  int multi_address;
+  int parse_address = FALSE; /* This flag scans for Address: but only after Name: */
+  output chld_out, chld_err;
+  size_t i;
 
-	setlocale (LC_ALL, "");
-	bindtextdomain (PACKAGE, LOCALEDIR);
-	textdomain (PACKAGE);
+  setlocale (LC_ALL, "");
+  bindtextdomain (PACKAGE, LOCALEDIR);
+  textdomain (PACKAGE);
 
-	/* Set signal handling and alarm */
-	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
-		usage_va(_("Cannot catch SIGALRM"));
-	}
+  /* Set signal handling and alarm */
+  if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
+    usage_va(_("Cannot catch SIGALRM"));
+  }
 
-	if (process_arguments (argc, argv) == ERROR) {
-		usage_va(_("Could not parse arguments"));
-	}
+  if (process_arguments (argc, argv) == ERROR) {
+    usage_va(_("Could not parse arguments"));
+  }
 
-	/* get the command to run */
-	asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server);
+  /* get the command to run */
+  asprintf (&command_line, "%s %s %s", NSLOOKUP_COMMAND, query_address, dns_server);
 
-	alarm (timeout_interval);
-	gettimeofday (&tv, NULL);
+  alarm (timeout_interval);
+  gettimeofday (&tv, NULL);
 
-	if (verbose)
-		printf ("%s\n", command_line);
+  if (verbose)
+    printf ("%s\n", command_line);
 
-	/* run the command */
-	if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) {
-		msg = (char *)_("nslookup returned error status");
-		result = STATE_WARNING;
-	}
+  /* run the command */
+  if((np_runcmd(command_line, &chld_out, &chld_err, 0)) != 0) {
+    msg = (char *)_("nslookup returned an error status");
+    result = STATE_WARNING;
+  }
 
-	/* scan stdout */
-	for(i = 0; i < chld_out.lines; i++) {
-		if (verbose)
-			puts(chld_out.line[i]);
+  /* scan stdout */
+  for(i = 0; i < chld_out.lines; i++) {
+    if (verbose)
+      puts(chld_out.line[i]);
 
-		if (strstr (chld_out.line[i], ".in-addr.arpa")) {
-			if ((temp_buffer = strstr (chld_out.line[i], "name = ")))
-				address = strdup (temp_buffer + 7);
-			else {
-				msg = (char *)_("Warning plugin error");
-				result = STATE_WARNING;
-			}
-		}
+    if (strstr (chld_out.line[i], ".in-addr.arpa")) {
+      if ((temp_buffer = strstr (chld_out.line[i], "name = ")))
+        address = strdup (temp_buffer + 7);
+      else {
+        msg = (char *)_("Warning plugin error");
+        result = STATE_WARNING;
+      }
+    }
 
-		/* the server is responding, we just got the host name... */
-		if (strstr (chld_out.line[i], "Name:"))
-			parse_address = TRUE;
-		else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") ||
-		         strstr (chld_out.line[i], "Addresses:"))) {
-			temp_buffer = index (chld_out.line[i], ':');
-			temp_buffer++;
+    /* the server is responding, we just got the host name... */
+    if (strstr (chld_out.line[i], "Name:"))
+      parse_address = TRUE;
+    else if (parse_address == TRUE && (strstr (chld_out.line[i], "Address:") ||
+             strstr (chld_out.line[i], "Addresses:"))) {
+      temp_buffer = index (chld_out.line[i], ':');
+      temp_buffer++;
 
-			/* Strip leading spaces */
-			for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
-				/* NOOP */;
-			
-			strip(temp_buffer);
-			if (temp_buffer==NULL || strlen(temp_buffer)==0) {
-				die (STATE_CRITICAL,
-				     _("DNS CRITICAL - '%s' returned empty host name string\n"),
-				     NSLOOKUP_COMMAND);
-			}
+      /* Strip leading spaces */
+      for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
+        /* NOOP */;
+      
+      strip(temp_buffer);
+      if (temp_buffer==NULL || strlen(temp_buffer)==0) {
+        die (STATE_CRITICAL,
+             _("DNS CRITICAL - '%s' returned empty host name string\n"),
+             NSLOOKUP_COMMAND);
+      }
 
-			if (address == NULL)
-				address = strdup (temp_buffer);
-			else
-				asprintf(&address, "%s,%s", address, temp_buffer);
-		}
+      if (address == NULL)
+        address = strdup (temp_buffer);
+      else
+        asprintf(&address, "%s,%s", address, temp_buffer);
+    }
 
-		else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) {
-			non_authoritative = TRUE;
-		}
+    else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) {
+      non_authoritative = TRUE;
+    }
 
-		result = error_scan (chld_out.line[i]);
-		if (result != STATE_OK) {
-			msg = strchr (chld_out.line[i], ':');
-			if(msg) msg++;
-			break;
-		}
-	}
+    result = error_scan (chld_out.line[i]);
+    if (result != STATE_OK) {
+      msg = strchr (chld_out.line[i], ':');
+      if(msg) msg++;
+      break;
+    }
+  }
 
-	/* scan stderr */
-	for(i = 0; i < chld_err.lines; i++) {
-		if (verbose)
-			puts(chld_err.line[i]);
+  /* scan stderr */
+  for(i = 0; i < chld_err.lines; i++) {
+    if (verbose)
+      puts(chld_err.line[i]);
 
-		if (error_scan (chld_err.line[i]) != STATE_OK) {
-			result = max_state (result, error_scan (chld_err.line[i]));
-			msg = strchr(input_buffer, ':');
-			if(msg) msg++;
-		}
-	}
+    if (error_scan (chld_err.line[i]) != STATE_OK) {
+      result = max_state (result, error_scan (chld_err.line[i]));
+      msg = strchr(input_buffer, ':');
+      if(msg) msg++;
+    }
+  }
 
-	/* If we got here, we should have an address string,
-	 * and we can segfault if we do not */
-	if (address==NULL || strlen(address)==0)
-		die (STATE_CRITICAL,
-		     _("DNS CRITICAL - '%s' msg parsing exited with no address\n"),
-		     NSLOOKUP_COMMAND);
+  /* If we got here, we should have an address string,
+   * and we can segfault if we do not */
+  if (address==NULL || strlen(address)==0)
+    die (STATE_CRITICAL,
+         _("DNS CRITICAL - '%s' msg parsing exited with no address\n"),
+         NSLOOKUP_COMMAND);
 
-	/* compare to expected address */
-	if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
-		result = STATE_CRITICAL;
-		asprintf(&msg, _("expected %s but got %s"), expected_address, address);
-	}
+  /* compare to expected address */
+  if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
+    result = STATE_CRITICAL;
+    asprintf(&msg, _("expected %s but got %s"), expected_address, address);
+  }
 
-	/* check if authoritative */
-	if (result == STATE_OK && expect_authority && non_authoritative) {
-		result = STATE_CRITICAL;
-		asprintf(&msg, _("server %s is not authoritative for %s"), dns_server, query_address);
-	}
+  /* check if authoritative */
+  if (result == STATE_OK && expect_authority && non_authoritative) {
+    result = STATE_CRITICAL;
+    asprintf(&msg, _("server %s is not authoritative for %s"), dns_server, query_address);
+  }
 
-	microsec = deltime (tv);
-	elapsed_time = (double)microsec / 1.0e6;
+  microsec = deltime (tv);
+  elapsed_time = (double)microsec / 1.0e6;
 
-	if (result == STATE_OK) {
-		if (strchr (address, ',') == NULL)
-			multi_address = FALSE;
-		else
-			multi_address = TRUE;
+  if (result == STATE_OK) {
+    if (strchr (address, ',') == NULL)
+      multi_address = FALSE;
+    else
+      multi_address = TRUE;
 
-		printf ("DNS %s: ", _("OK"));
-		printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time);
-		printf (_(". %s returns %s"), query_address, address);
-		printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
-	}
-	else if (result == STATE_WARNING)
-		printf (_("DNS WARNING - %s\n"),
-		        !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
-	else if (result == STATE_CRITICAL)
-		printf (_("DNS CRITICAL - %s\n"),
-		        !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
-	else
-		printf (_("DNS UNKNOW - %s\n"),
-		        !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
+    printf ("DNS %s: ", _("OK"));
+    printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time);
+    printf (_(". %s returns %s"), query_address, address);
+    printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
+  }
+  else if (result == STATE_WARNING)
+    printf (_("DNS WARNING - %s\n"),
+            !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
+  else if (result == STATE_CRITICAL)
+    printf (_("DNS CRITICAL - %s\n"),
+            !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
+  else
+    printf (_("DNS UNKNOW - %s\n"),
+            !strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
 
-	return result;
+  return result;
 }
 
 
@@ -207,56 +207,56 @@
 error_scan (char *input_buffer)
 {
 
-	/* the DNS lookup timed out */
-	if (strstr (input_buffer, _("Note: nslookup is deprecated and may be removed from future releases.")) ||
-	    strstr (input_buffer, _("Consider using the `dig' or `host' programs instead.  Run nslookup with")) ||
-	    strstr (input_buffer, _("the `-sil[ent]' option to prevent this message from appearing.")))
-		return STATE_OK;
+  /* the DNS lookup timed out */
+  if (strstr (input_buffer, _("Note: nslookup is deprecated and may be removed from future releases.")) ||
+      strstr (input_buffer, _("Consider using the `dig' or `host' programs instead.  Run nslookup with")) ||
+      strstr (input_buffer, _("the `-sil[ent]' option to prevent this message from appearing.")))
+    return STATE_OK;
 
-	/* DNS server is not running... */
-	else if (strstr (input_buffer, "No response from server"))
-		die (STATE_CRITICAL, _("No response from DNS %s\n"), dns_server);
+  /* DNS server is not running... */
+  else if (strstr (input_buffer, "No response from server"))
+    die (STATE_CRITICAL, _("No response from DNS %s\n"), dns_server);
 
-	/* Host name is valid, but server doesn't have records... */
-	else if (strstr (input_buffer, "No records"))
-		die (STATE_CRITICAL, _("DNS %s has no records\n"), dns_server);
+  /* Host name is valid, but server doesn't have records... */
+  else if (strstr (input_buffer, "No records"))
+    die (STATE_CRITICAL, _("DNS %s has no records\n"), dns_server);
 
-	/* Connection was refused */
-	else if (strstr (input_buffer, "Connection refused") ||
-		 strstr (input_buffer, "Couldn't find server") ||
-	         strstr (input_buffer, "Refused") ||
-	         (strstr (input_buffer, "** server can't find") &&
-	          strstr (input_buffer, ": REFUSED")))
-		die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
+  /* Connection was refused */
+  else if (strstr (input_buffer, "Connection refused") ||
+     strstr (input_buffer, "Couldn't find server") ||
+           strstr (input_buffer, "Refused") ||
+           (strstr (input_buffer, "** server can't find") &&
+            strstr (input_buffer, ": REFUSED")))
+    die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
 
-	/* Query refused (usually by an ACL in the namserver) */ 
-	else if (strstr (input_buffer, "Query refused"))
-		die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
+  /* Query refused (usually by an ACL in the namserver) */ 
+  else if (strstr (input_buffer, "Query refused"))
+    die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
 
-	/* No information (e.g. nameserver IP has two PTR records) */
-	else if (strstr (input_buffer, "No information"))
-		die (STATE_CRITICAL, _("No information returned by DNS server at %s\n"), dns_server);
+  /* No information (e.g. nameserver IP has two PTR records) */
+  else if (strstr (input_buffer, "No information"))
+    die (STATE_CRITICAL, _("No information returned by DNS server at %s\n"), dns_server);
 
-	/* Host or domain name does not exist */
-	else if (strstr (input_buffer, "Non-existent") ||
-	         strstr (input_buffer, "** server can't find") ||
-		 strstr (input_buffer,"NXDOMAIN"))
-		die (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
+  /* Host or domain name does not exist */
+  else if (strstr (input_buffer, "Non-existent") ||
+           strstr (input_buffer, "** server can't find") ||
+     strstr (input_buffer,"NXDOMAIN"))
+    die (STATE_CRITICAL, _("Domain %s was not found by the server\n"), query_address);
 
-	/* Network is unreachable */
-	else if (strstr (input_buffer, "Network is unreachable"))
-		die (STATE_CRITICAL, _("Network is unreachable\n"));
+  /* Network is unreachable */
+  else if (strstr (input_buffer, "Network is unreachable"))
+    die (STATE_CRITICAL, _("Network is unreachable\n"));
 
-	/* Internal server failure */
-	else if (strstr (input_buffer, "Server failure"))
-		die (STATE_CRITICAL, _("DNS failure for %s\n"), dns_server);
+  /* Internal server failure */
+  else if (strstr (input_buffer, "Server failure"))
+    die (STATE_CRITICAL, _("DNS failure for %s\n"), dns_server);
 
-	/* Request error or the DNS lookup timed out */
-	else if (strstr (input_buffer, "Format error") ||
-	         strstr (input_buffer, "Timed out"))
-		return STATE_WARNING;
+  /* Request error or the DNS lookup timed out */
+  else if (strstr (input_buffer, "Format error") ||
+           strstr (input_buffer, "Timed out"))
+    return STATE_WARNING;
 
-	return STATE_OK;
+  return STATE_OK;
 
 }
 
@@ -265,148 +265,177 @@
 int
 process_arguments (int argc, char **argv)
 {
-	int c;
+  int c;
 
-	int opt_index = 0;
-	static struct option long_opts[] = {
-		{"help", no_argument, 0, 'h'},
-		{"version", no_argument, 0, 'V'},
-		{"verbose", no_argument, 0, 'v'},
-		{"timeout", required_argument, 0, 't'},
-		{"hostname", required_argument, 0, 'H'},
-		{"server", required_argument, 0, 's'},
-		{"reverse-server", required_argument, 0, 'r'},
-		{"expected-address", required_argument, 0, 'a'},
-		{"expect-authority", no_argument, 0, 'A'},
-		{0, 0, 0, 0}
-	};
+  int opt_index = 0;
+  static struct option long_opts[] = {
+    {"help", no_argument, 0, 'h'},
+    {"version", no_argument, 0, 'V'},
+    {"verbose", no_argument, 0, 'v'},
+    {"timeout", required_argument, 0, 't'},
+    {"hostname", required_argument, 0, 'H'},
+    {"server", required_argument, 0, 's'},
+    {"reverse-server", required_argument, 0, 'r'},
+    {"expected-address", required_argument, 0, 'a'},
+    {"expect-authority", no_argument, 0, 'A'},
+    {0, 0, 0, 0}
+  };
 
-	if (argc < 2)
-		return ERROR;
+  if (argc < 2)
+    return ERROR;
 
-	for (c = 1; c < argc; c++)
-		if (strcmp ("-to", argv[c]) == 0)
-			strcpy (argv[c], "-t");
+  for (c = 1; c < argc; c++)
+    if (strcmp ("-to", argv[c]) == 0)
+      strcpy (argv[c], "-t");
 
-	while (1) {
-		c = getopt_long (argc, argv, "hVvAt:H:s:r:a:", long_opts, &opt_index);
+  while (1) {
+    c = getopt_long (argc, argv, "hVvAt:H:s:r:a:", long_opts, &opt_index);
 
-		if (c == -1 || c == EOF)
-			break;
+    if (c == -1 || c == EOF)
+      break;
 
-		switch (c) {
-		case 'h': /* help */
-			print_help ();
-			exit (STATE_OK);
-		case 'V': /* version */
-			print_revision (progname, revision);
-			exit (STATE_OK);
-		case 'v': /* version */
-			verbose = TRUE;
-			break;
-		case 't': /* timeout period */
-			timeout_interval = atoi (optarg);
-			break;
-		case 'H': /* hostname */
-			if (strlen (optarg) >= ADDRESS_LENGTH)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			strcpy (query_address, optarg);
-			break;
-		case 's': /* server name */
-			/* TODO: this host_or_die check is probably unnecessary.
-			 * Better to confirm nslookup response matches */
-			host_or_die(optarg);
-			if (strlen (optarg) >= ADDRESS_LENGTH)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			strcpy (dns_server, optarg);
-			break;
-		case 'r': /* reverse server name */
-			/* TODO: Is this host_or_die necessary? */
-			host_or_die(optarg);
-			if (strlen (optarg) >= ADDRESS_LENGTH)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			strcpy (ptr_server, optarg);
-			break;
-		case 'a': /* expected address */
-			if (strlen (optarg) >= ADDRESS_LENGTH)
-				die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-			strcpy (expected_address, optarg);
-			match_expected_address = TRUE;
-			break;
-		case 'A': /* expect authority */
-			expect_authority = TRUE;
-			break;
-		default: /* args not parsable */
-			usage_va(_("Unknown argument - %s"), optarg);
-		}
-	}
+    switch (c) {
+    case 'h': /* help */
+      print_help ();
+      exit (STATE_OK);
+    case 'V': /* version */
+      print_revision (progname, revision);
+      exit (STATE_OK);
+    case 'v': /* version */
+      verbose = TRUE;
+      break;
+    case 't': /* timeout period */
+      timeout_interval = atoi (optarg);
+      break;
+    case 'H': /* hostname */
+      if (strlen (optarg) >= ADDRESS_LENGTH)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      strcpy (query_address, optarg);
+      break;
+    case 's': /* server name */
+      /* TODO: this host_or_die check is probably unnecessary.
+       * Better to confirm nslookup response matches */
+      host_or_die(optarg);
+      if (strlen (optarg) >= ADDRESS_LENGTH)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      strcpy (dns_server, optarg);
+      break;
+    case 'r': /* reverse server name */
+      /* TODO: Is this host_or_die necessary? */
+      host_or_die(optarg);
+      if (strlen (optarg) >= ADDRESS_LENGTH)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      strcpy (ptr_server, optarg);
+      break;
+    case 'a': /* expected address */
+      if (strlen (optarg) >= ADDRESS_LENGTH)
+        die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+      strcpy (expected_address, optarg);
+      match_expected_address = TRUE;
+      break;
+    case 'A': /* expect authority */
+      expect_authority = TRUE;
+      break;
+    default: /* args not parsable */
+      usage_va(_("Unknown argument - %s"), optarg);
+    }
+  }
 
-	c = optind;
-	if (strlen(query_address)==0 && c<argc) {
-		if (strlen(argv[c])>=ADDRESS_LENGTH)
-			die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-		strcpy (query_address, argv[c++]);
-	}
+  c = optind;
+  if (strlen(query_address)==0 && c<argc) {
+    if (strlen(argv[c])>=ADDRESS_LENGTH)
+      die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+    strcpy (query_address, argv[c++]);
+  }
 
-	if (strlen(dns_server)==0 && c<argc) {
-		/* TODO: See -s option */
-		host_or_die(argv[c]);
-		if (strlen(argv[c]) >= ADDRESS_LENGTH)
-			die (STATE_UNKNOWN, _("Input buffer overflow\n"));
-		strcpy (dns_server, argv[c++]);
-	}
+  if (strlen(dns_server)==0 && c<argc) {
+    /* TODO: See -s option */
+    host_or_die(argv[c]);
+    if (strlen(argv[c]) >= ADDRESS_LENGTH)
+      die (STATE_UNKNOWN, _("Input buffer overflow\n"));
+    strcpy (dns_server, argv[c++]);
+  }
 
-	return validate_arguments ();
+  return validate_arguments ();
 }
 
 
 int
 validate_arguments ()
 {
-	if (query_address[0] == 0)
-		return ERROR;
+  if (query_address[0] == 0)
+    return ERROR;
 
-	return OK;
+  return OK;
 }
 
 
 void
 print_help (void)
 {
-	print_revision (progname, revision);
+  print_revision (progname, revision);
 
-	printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>\n");
-	printf (COPYRIGHT, copyright, email);
+  printf ("Copyright (c) 1999 Ethan Galstad <nagios at nagios.org>\n");
+  printf (COPYRIGHT, copyright, email);
 
-	printf (_("\
-This plugin uses the nslookup program to obtain the IP address\n\
-for the given host/domain query.  A optional DNS server to use may\n\
-be specified.  If no DNS server is specified, the default server(s)\n\
-specified in /etc/resolv.conf will be used.\n\n"));
+  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");
 
-	print_usage ();
+  printf (_("If no DNS server is specified, the default server(s)specified in /etc/resolv.conf will be used."));
 
-	printf (_(UT_HELP_VRSN));
+  printf ("\n\n");
 
-	printf (_("\
--H, --hostname=HOST\n\
-   The name or address you want to query\n\
--s, --server=HOST\n\
-   Optional DNS server you want to use for the lookup\n\
--a, --expected-address=IP-ADDRESS\n\
-   Optional IP address you expect the DNS server to return\n\
--A, --expect-authority\n\
-   Optionally expect the DNS server to be authoritative for the lookup\n"));
+  print_usage ();
 
-	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+  printf (_(UT_HELP_VRSN));
 
-	printf (_(UT_SUPPORT));
+  printf ("  -H, --hostname=HOST");
+ 
+  printf ("\n");
+
+  printf (_("the name or address you want to query"));
+  
+  printf ("\n");
+
+  printf ("  -s, --server=HOST");
+  
+  printf ("\n");
+
+  printf (_("optional DNS server you want to use for the lookup"));
+  
+  printf ("\n");
+
+  printf ("  -a, --expected-address=IP-ADDRESS");
+  
+  printf ("\n");
+
+  printf (_("optional IP address you expect the DNS server to return"));
+  
+  printf ("\n");
+
+  printf ("  -A, --expect-authority");
+  
+  printf ("\n");
+
+  printf (_("optionally expect the DNS server to be authoritative for the lookup"));
+
+  printf ("\n");
+
+  printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+  printf (_(UT_SUPPORT));
 }
 
 
 void
 print_usage (void)
 {
-	printf ("\
-Usage: %s -H host [-s server] [-a expected-address] [-A] [-t timeout]\n", progname);
+  printf (_("Usage:"));
+  
+  printf ("%s -H host [-s server] [-a expected-address] [-A] [-t timeout]\n", progname);
 }





More information about the Commits mailing list