[Nagiosplug-checkins] CVS: nagiosplug/plugins check_by_ssh.c,1.14,1.15 check_disk.c,1.30,1.31 check_nt.c,1.14,1.15 netutils.c,1.12,1.13 netutils.h,1.5,1.6 popen.h,1.1,1.2 utils.h,1.10,1.11

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Aug 7 21:34:02 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv10189

Modified Files:
	check_by_ssh.c check_disk.c check_nt.c netutils.c netutils.h 
	popen.h utils.h 
Log Message:
fix a variety of compiler warnings about qualifier discards and other pedantic stuff

Index: check_by_ssh.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_by_ssh.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_by_ssh.c	7 Aug 2003 11:51:11 -0000	1.14
--- check_by_ssh.c	8 Aug 2003 04:33:21 -0000	1.15
***************
*** 1,24 ****
  /******************************************************************************
!  *
!  * This file is part of the Nagios Plugins.
!  *
!  * Copyright (c) 1999, 2000, 2001 Karl DeBisschop <karl at debisschop.net>
!  *
!  * The Nagios Plugins are free software; you can redistribute them
!  * and/or modify them 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$
!  *
   *****************************************************************************/
   
--- 1,18 ----
  /******************************************************************************
! 
!  The Nagios Plugins are free software; you can redistribute them
!  and/or modify them 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.
! 
   *****************************************************************************/
   
***************
*** 28,32 ****
  const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
- #include "config.h"
  #include "common.h"
  #include "netutils.h"
--- 22,25 ----
***************
*** 39,119 ****
  void print_usage (void);
  
- void
- print_help (void)
- {
- 	print_revision (progname, revision);
- 
- 	printf (_(COPYRIGHT), copyright, email);
- 
- 	printf (_("This plugin uses SSH to execute commands on a remote host\n\n"));
- 
- 	print_usage ();
- 
- 	printf (_(UT_HELP_VRSN));
- 
- 	printf (_(UT_HOST_PORT), 'p', "none");
- 
- 	printf (_(UT_IPv46));
- 
- 	printf (_("\
-  -1, --proto1\n\
-     tell ssh to use Protocol 1\n\
-  -2, --proto2\n\
-     tell ssh to use Protocol 2\n\
-  -f\n\
-     tells ssh to fork rather than create a tty\n"));
- 
- 	printf (_("\
-  -C, --command='COMMAND STRING'\n\
-     command to execute on the remote machine\n\
-  -l, --logname=USERNAME\n\
-     SSH user name on remote host [optional]\n\
-  -i, --identity=KEYFILE\n\
-     identity of an authorized key [optional]\n\
-  -O, --output=FILE\n\
-     external command file for nagios [optional]\n\
-  -s, --services=LIST\n\
-     list of nagios service names, separated by ':' [optional]\n\
-  -n, --name=NAME\n\
-     short name of host in nagios configuration [optional]\n"));
- 
- 	printf (_(UT_WARN_CRIT));
- 
- 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
- 
- 	printf (_("\n\
- The most common mode of use is to refer to a local identity file with\n\
- the '-i' option. In this mode, the identity pair should have a null\n\
- passphrase and the public key should be listed in the authorized_keys\n\
- file of the remote host. Usually the key will be restricted to running\n\
- only one command on the remote server. If the remote SSH server tracks\n\
- invocation agruments, the one remote program may be an agent that can\n\
- execute additional commands as proxy\n"));
- 
- 	printf (_("\n\
- To use passive mode, provide multiple '-C' options, and provide\n\
- all of -O, -s, and -n options (servicelist order must match '-C'\n\
- options)\n"));
- }
- 
- 
- 
- 
- 
- void
- print_usage (void)
- {
- 	printf (_("Usage:\n\
- check_by_ssh [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n\
-              [-n name] [-s servicelist] [-O outputfile] [-p port]\n\
- check_by_ssh  -V prints version info\n\
- check_by_ssh  -h prints more detailed help\n"));
- }
- 
- 
  int commands = 0;
  int services = 0;
! char *remotecmd = "";
! char *comm = SSH_COMMAND;
  char *hostname = NULL;
  char *outputfile = NULL;
--- 32,39 ----
  void print_usage (void);
  
  int commands = 0;
  int services = 0;
! char *remotecmd = NULL;
! char *comm = NULL;
  char *hostname = NULL;
  char *outputfile = NULL;
***************
*** 124,127 ****
--- 44,51 ----
  
  
+ 
+ 
+ 
+ 
  int
  main (int argc, char **argv)
***************
*** 129,135 ****
  
  	char input_buffer[MAX_INPUT_BUFFER];
! 	char *result_text = "";
  	char *status_text;
! 	char *output = "";
  	char *eol = NULL;
  	int cresult;
--- 53,59 ----
  
  	char input_buffer[MAX_INPUT_BUFFER];
! 	char *result_text;
  	char *status_text;
! 	char *output;
  	char *eol = NULL;
  	int cresult;
***************
*** 138,141 ****
--- 62,67 ----
  	FILE *fp = NULL;
  
+ 	asprintf (&remotecmd, "%s", "");
+ 	asprintf (&comm, "%s", SSH_COMMAND);
  
  	/* process arguments */
***************
*** 236,239 ****
--- 162,166 ----
  
  
+ 
  /* process command-line arguments */
  int
***************
*** 392,394 ****
--- 319,399 ----
  
  	return OK;
+ }
+ 
+ 
+ 
+ 
+ 
+ 
+ void
+ print_help (void)
+ {
+ 	print_revision (progname, revision);
+ 
+ 	printf (_("Copyright (c) 1999 Karl DeBisschop <kdebisschop at users.sourceforge.net>\n"));
+ 	printf (_(COPYRIGHT), copyright, email);
+ 
+ 	printf (_("This plugin uses SSH to execute commands on a remote host\n\n"));
+ 
+ 	print_usage ();
+ 
+ 	printf (_(UT_HELP_VRSN));
+ 
+ 	printf (_(UT_HOST_PORT), 'p', "none");
+ 
+ 	printf (_(UT_IPv46));
+ 
+ 	printf (_("\
+  -1, --proto1\n\
+     tell ssh to use Protocol 1\n\
+  -2, --proto2\n\
+     tell ssh to use Protocol 2\n\
+  -f\n\
+     tells ssh to fork rather than create a tty\n"));
+ 
+ 	printf (_("\
+  -C, --command='COMMAND STRING'\n\
+     command to execute on the remote machine\n\
+  -l, --logname=USERNAME\n\
+     SSH user name on remote host [optional]\n\
+  -i, --identity=KEYFILE\n\
+     identity of an authorized key [optional]\n\
+  -O, --output=FILE\n\
+     external command file for nagios [optional]\n\
+  -s, --services=LIST\n\
+     list of nagios service names, separated by ':' [optional]\n\
+  -n, --name=NAME\n\
+     short name of host in nagios configuration [optional]\n"));
+ 
+ 	printf (_(UT_WARN_CRIT));
+ 
+ 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ 
+ 	printf (_("\n\
+ The most common mode of use is to refer to a local identity file with\n\
+ the '-i' option. In this mode, the identity pair should have a null\n\
+ passphrase and the public key should be listed in the authorized_keys\n\
+ file of the remote host. Usually the key will be restricted to running\n\
+ only one command on the remote server. If the remote SSH server tracks\n\
+ invocation agruments, the one remote program may be an agent that can\n\
+ execute additional commands as proxy\n"));
+ 
+ 	printf (_("\n\
+ To use passive mode, provide multiple '-C' options, and provide\n\
+ all of -O, -s, and -n options (servicelist order must match '-C'\n\
+ options)\n"));
+ }
+ 
+ 
+ 
+ 
+ 
+ void
+ print_usage (void)
+ {
+ 	printf (_("\n\
+ Usage: %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> \n\
+   -C <command> [-n name] [-s servicelist] [-O outputfile] [-p port]\n"),
+ 	        progname);
+ 	printf (_(UT_HLP_VRS), progname, progname);
  }

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** check_disk.c	7 Aug 2003 11:51:11 -0000	1.30
--- check_disk.c	8 Aug 2003 04:33:21 -0000	1.31
***************
*** 36,113 ****
  #endif
  
- void
- print_usage (void)
- {
- 	printf (_("\
- Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
-         [-v] [-q]\n\
-        %s (-h|--help)\n\
-        %s (-V|--version)\n"),
- 	        progname,  progname, progname);
- }
- 
- void
- print_help (void)
- {
- 	print_revision (progname, revision);
- 
- 	printf (_(COPYRIGHT), copyright, email);
- 
- 	printf (_("\
- This plugin checks the amount of used disk space on a mounted file system\n\
- and generates an alert if free space is less than one of the threshold values."));
- 
- 	print_usage ();
- 
- 	printf (_(UT_HELP_VRSN));
- 
- 	printf (_("\
-  -w, --warning=INTEGER\n\
-    Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\
-  -w, --warning=PERCENT%%\n\
-    Exit with WARNING status if less than PERCENT of disk space is free\n\
-  -c, --critical=INTEGER\n\
-    Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\
-  -c, --critical=PERCENT%%\n\
-    Exit with CRITCAL status if less than PERCENT of disk space is free\n\
-  -C, --clear\n\
-     Clear thresholds\n"));
- 
- 	printf (_("\
-  -u, --units=STRING\n\
-     Choose bytes, kB, MB, GB, TB (default: MB)\n\
-  -k, --kilobytes\n\
-     Same as '--units kB'\n\
-  -m, --megabytes\n\
-     Same as '--units MB'\n"));
- 
- 	printf (_("\
-  -l, --local\n\
-     Only check local filesystems\n\
-  -p, --path=PATH, --partition=PARTITION\n\
-     Path or partition (may be repeated)\n\
-  -x, --exclude_device=PATH <STRING>\n\
-     Ignore device (only works if -p unspecified)\n\
-  -X, --exclude-type=TYPE <STRING>\n\
-     Ignore all filesystems of indicated type (may be repeated)\n\
-  -M, --mountpoint\n\
-     Display the mountpoint instead of the partition\n\
-  -e, --errors-only\n\
-     Display only devices/mountpoints with errors\n"));
- 
- 	printf (_(UT_WARN_CRIT));
- 
- 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
- 
- 	printf (_(UT_VERBOSE));
- 
- 	printf ("%s", _("Examples:\n\
-  check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\
-    Checks /tmp and /var at 10%,5% and / at 100MB, 50MB\n"));
- 
- 	support ();
- }
- 
- 
  /* If nonzero, show inode information. */
  /* static int inode_format; */
--- 36,39 ----
***************
*** 136,141 ****
    char *name;
    int found;
!   int w_df;
!   int c_df;
    double w_dfp;
    double c_dfp;
--- 62,67 ----
    char *name;
    int found;
!   uintmax_t w_df;
!   uintmax_t c_df;
    double w_dfp;
    double c_dfp;
***************
*** 184,199 ****
  
  int process_arguments (int, char **);
! int validate_arguments (int, int, double, double, char *);
! int check_disk (int usp, int free_disk);
  int walk_name_list (struct name_list *list, const char *name);
  
! int w_df = -1;
! int c_df = -1;
  double w_dfp = -1.0;
  double c_dfp = -1.0;
  char *path = "";
  char *exclude_device = "";
! char *units = "MB";
! unsigned long mult = 1024 * 1024;
  int verbose = 0;
  int erronly = FALSE;
--- 110,128 ----
  
  int process_arguments (int, char **);
! void print_path (char *mypath);
! int validate_arguments (uintmax_t, uintmax_t, double, double, char *);
! int check_disk (int usp, uintmax_t free_disk);
  int walk_name_list (struct name_list *list, const char *name);
+ void print_help (void);
+ void print_usage (void);
  
! uintmax_t w_df = 0;
! uintmax_t c_df = 0;
  double w_dfp = -1.0;
  double c_dfp = -1.0;
  char *path = "";
  char *exclude_device = "";
! char *units = NULL;
! uintmax_t mult = 1024 * 1024;
  int verbose = 0;
  int erronly = FALSE;
***************
*** 203,210 ****
  static struct mount_entry *mount_list;
  
  int
  main (int argc, char **argv)
  {
! 	int usp = -1;
  	int result = STATE_UNKNOWN;
  	int disk_result = STATE_UNKNOWN;
--- 132,141 ----
  static struct mount_entry *mount_list;
  
+ 
+ 
  int
  main (int argc, char **argv)
  {
! 	double usp = -1.0;
  	int result = STATE_UNKNOWN;
  	int disk_result = STATE_UNKNOWN;
***************
*** 245,249 ****
  
  		if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
! 			usp = (fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
  			disk_result = check_disk (usp, fsp.fsu_bavail);
  			result = max_state (disk_result, result);
--- 176,180 ----
  
  		if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
! 			usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
  			disk_result = check_disk (usp, fsp.fsu_bavail);
  			result = max_state (disk_result, result);
***************
*** 365,369 ****
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%d%*[:,]%lf%%", &w_df, &w_dfp) == 2) {
  				break;
  			}
--- 296,300 ----
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%ul%*[:,]%lf%%", &w_df, &w_dfp) == 2) {
  				break;
  			}
***************
*** 381,385 ****
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%d%*[,:]%lf%%", &c_df, &c_dfp) == 2) {
  				break;
  			}
--- 312,316 ----
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%ul%*[,:]%lf%%", &c_df, &c_dfp) == 2) {
  				break;
  			}
***************
*** 392,408 ****
  		case 'u':
  			if (! strcmp (optarg, "bytes")) {
! 				mult = 1;
  				units = "B";
  			} else if (! strcmp (optarg, "kB")) {
! 				mult = 1024;
  				units = "kB";
  			} else if (! strcmp (optarg, "MB")) {
! 				mult = 1024 * 1024;
  				units = "MB";
  			} else if (! strcmp (optarg, "GB")) {
! 				mult = 1024 * 1024 * 1024;
  				units = "GB";
  			} else if (! strcmp (optarg, "TB")) {
! 				mult = (unsigned long)1024 * 1024 * 1024 * 1024;
  				units = "TB";
  			} else {
--- 323,339 ----
  		case 'u':
  			if (! strcmp (optarg, "bytes")) {
! 				mult = (uintmax_t)1;
  				units = "B";
  			} else if (! strcmp (optarg, "kB")) {
! 				mult = (uintmax_t)1024;
  				units = "kB";
  			} else if (! strcmp (optarg, "MB")) {
! 				mult = (uintmax_t)1024 * 1024;
  				units = "MB";
  			} else if (! strcmp (optarg, "GB")) {
! 				mult = (uintmax_t)1024 * 1024 * 1024;
  				units = "GB";
  			} else if (! strcmp (optarg, "TB")) {
! 				mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
  				units = "TB";
  			} else {
***************
*** 459,464 ****
  			break;
  		case 'C':
! 			w_df = -1;
! 			c_df = -1;
  			w_dfp = -1.0;
  			c_dfp = -1.0;
--- 390,395 ----
  			break;
  		case 'C':
! 			w_df = 0;
! 			c_df = 0;
  			w_dfp = -1.0;
  			c_dfp = -1.0;
***************
*** 478,485 ****
  	/* Support for "check_disk warn crit [fs]" with thresholds at used level */
  	c = optind;
! 	if (w_dfp == -1 && argc > c && is_intnonneg (argv[c]))
  		w_dfp = (100.0 - atof (argv[c++]));
  
! 	if (c_dfp == -1 && argc > c && is_intnonneg (argv[c]))
  		c_dfp = (100.0 - atof (argv[c++]));
  
--- 409,416 ----
  	/* Support for "check_disk warn crit [fs]" with thresholds at used level */
  	c = optind;
! 	if (w_dfp < 0 && argc > c && is_intnonneg (argv[c]))
  		w_dfp = (100.0 - atof (argv[c++]));
  
! 	if (c_dfp < 0 && argc > c && is_intnonneg (argv[c]))
  		c_dfp = (100.0 - atof (argv[c++]));
  
***************
*** 521,527 ****
  
  int
! validate_arguments (int w, int c, double wp, double cp, char *mypath)
  {
! 	if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
  		printf (_("INPUT ERROR: No thresholds specified"));
  		print_path (mypath);
--- 452,458 ----
  
  int
! validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath)
  {
! 	if (w == 0 && c == 0 && wp < 0.0 && cp < 0.0) {
  		printf (_("INPUT ERROR: No thresholds specified"));
  		print_path (mypath);
***************
*** 536,543 ****
  		return ERROR;
  	}
! 	else if ((w > 0 || c > 0) && (w < 0 || c < 0 || c > w)) {
  		printf (_("\
! INPUT ERROR: C_DF (%d) should be less than W_DF (%d) and both should be greater than zero"),
! 		        c, w);
  		print_path (path);
  		return ERROR;
--- 467,474 ----
  		return ERROR;
  	}
! 	else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
  		printf (_("\
! INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
! 		        (unsigned long)c, (unsigned long)w);
  		print_path (path);
  		return ERROR;
***************
*** 552,566 ****
  
  int
! check_disk (int usp, int free_disk)
  {
  	int result = STATE_UNKNOWN;
  	/* check the percent used space against thresholds */
! 	if (usp >= 0 && usp >= (100.0 - c_dfp))
  		result = STATE_CRITICAL;
! 	else if (c_df >= 0 && free_disk <= c_df)
  		result = STATE_CRITICAL;
! 	else if (usp >= 0 && usp >= (100.0 - w_dfp))
  		result = STATE_WARNING;
! 	else if (w_df >= 0 && free_disk <= w_df)
  		result = STATE_WARNING;
  	else if (usp >= 0.0)
--- 483,497 ----
  
  int
! check_disk (int usp, uintmax_t free_disk)
  {
  	int result = STATE_UNKNOWN;
  	/* check the percent used space against thresholds */
! 	if (usp >= 0.0 && usp >= (100.0 - c_dfp))
  		result = STATE_CRITICAL;
! 	else if (c_df > 0 && free_disk <= c_df)
  		result = STATE_CRITICAL;
! 	else if (usp >= 0.0 && usp >= (100.0 - w_dfp))
  		result = STATE_WARNING;
! 	else if (w_df > 0 && free_disk <= w_df)
  		result = STATE_WARNING;
  	else if (usp >= 0.0)
***************
*** 580,585 ****
  			if (list->w_df) w_df = list->w_df;
  			if (list->c_df) c_df = list->c_df;
! 			if (list->w_dfp) w_dfp = list->w_dfp;
! 			if (list->c_dfp) c_dfp = list->c_dfp;
  			return TRUE;
  		}
--- 511,516 ----
  			if (list->w_df) w_df = list->w_df;
  			if (list->c_df) c_df = list->c_df;
! 			if (list->w_dfp>=0.0) w_dfp = list->w_dfp;
! 			if (list->c_dfp>=0.0) c_dfp = list->c_dfp;
  			return TRUE;
  		}
***************
*** 587,589 ****
--- 518,601 ----
  	}
  	return FALSE;
+ }
+ 
+ 
+ 
+ 
+ 
+ 
+ void
+ print_help (void)
+ {
+ 	print_revision (progname, revision);
+ 
+ 	printf (_(COPYRIGHT), copyright, email);
+ 
+ 	printf (_("\
+ This plugin checks the amount of used disk space on a mounted file system\n\
+ and generates an alert if free space is less than one of the threshold values."));
+ 
+ 	print_usage ();
+ 
+ 	printf (_(UT_HELP_VRSN));
+ 
+ 	printf (_("\
+  -w, --warning=INTEGER\n\
+    Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\
+  -w, --warning=PERCENT%%\n\
+    Exit with WARNING status if less than PERCENT of disk space is free\n\
+  -c, --critical=INTEGER\n\
+    Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\
+  -c, --critical=PERCENT%%\n\
+    Exit with CRITCAL status if less than PERCENT of disk space is free\n\
+  -C, --clear\n\
+     Clear thresholds\n"));
+ 
+ 	printf (_("\
+  -u, --units=STRING\n\
+     Choose bytes, kB, MB, GB, TB (default: MB)\n\
+  -k, --kilobytes\n\
+     Same as '--units kB'\n\
+  -m, --megabytes\n\
+     Same as '--units MB'\n"));
+ 
+ 	printf (_("\
+  -l, --local\n\
+     Only check local filesystems\n\
+  -p, --path=PATH, --partition=PARTITION\n\
+     Path or partition (may be repeated)\n\
+  -x, --exclude_device=PATH <STRING>\n\
+     Ignore device (only works if -p unspecified)\n\
+  -X, --exclude-type=TYPE <STRING>\n\
+     Ignore all filesystems of indicated type (may be repeated)\n\
+  -M, --mountpoint\n\
+     Display the mountpoint instead of the partition\n\
+  -e, --errors-only\n\
+     Display only devices/mountpoints with errors\n"));
+ 
+ 	printf (_(UT_WARN_CRIT));
+ 
+ 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ 
+ 	printf (_(UT_VERBOSE));
+ 
+ 	printf ("%s", _("Examples:\n\
+  check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\
+    Checks /tmp and /var at 10%,5% and / at 100MB, 50MB\n"));
+ 
+ 	support ();
+ }
+ 
+ 
+ 
+ 
+ void
+ print_usage (void)
+ {
+ 	printf (_("\
+ Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
+         [-v] [-q]\n\
+        %s (-h|--help)\n\
+        %s (-V|--version)\n"),
+ 	        progname,  progname, progname);
  }

Index: check_nt.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nt.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_nt.c	8 Aug 2003 03:51:02 -0000	1.14
--- check_nt.c	8 Aug 2003 04:33:21 -0000	1.15
***************
*** 66,70 ****
  int process_arguments(int, char **);
  void preparelist(char *string);
! int strtoularray(unsigned long *array, char *string, char *delim);
  void print_help(void);
  void print_usage(void);
--- 66,70 ----
  int process_arguments(int, char **);
  void preparelist(char *string);
! int strtoularray(unsigned long *array, char *string, const char *delim);
  void print_help(void);
  void print_usage(void);
***************
*** 118,122 ****
  
  		if (check_value_list==TRUE) {																			
! 			if (strtoularray(&lvalue_list,value_list,",")==TRUE) {
  				/* -l parameters is present with only integers */
  				return_code=STATE_OK;
--- 118,122 ----
  
  		if (check_value_list==TRUE) {																			
! 			if (strtoularray(lvalue_list,value_list,",")==TRUE) {
  				/* -l parameters is present with only integers */
  				return_code=STATE_OK;
***************
*** 515,519 ****
  
  
! int strtoularray(unsigned long *array, char *string, char *delim) {
  	/* split a <delim> delimited string into a long array */
  	int idx=0;
--- 515,519 ----
  
  
! int strtoularray(unsigned long *array, char *string, const char *delim) {
  	/* split a <delim> delimited string into a long array */
  	int idx=0;

Index: netutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** netutils.c	7 Aug 2003 11:51:12 -0000	1.12
--- netutils.c	8 Aug 2003 04:33:21 -0000	1.13
***************
*** 33,37 ****
  #include "netutils.h"
  
! int socket_timeout = DEFAULT_SOCKET_TIMEOUT; 
  int econn_refuse_state = STATE_CRITICAL;
  int was_refused = FALSE;
--- 33,37 ----
  #include "netutils.h"
  
! unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; 
  int econn_refuse_state = STATE_CRITICAL;
  int was_refused = FALSE;
***************
*** 132,136 ****
  			recv_result =
  				recv (sd, recv_buffer + recv_length, 
! 					recv_size - recv_length - 1, 0);
  			if (recv_result == -1) {
  				/* recv failed, bail out */
--- 132,136 ----
  			recv_result =
  				recv (sd, recv_buffer + recv_length, 
! 					(size_t)recv_size - recv_length - 1, 0);
  			if (recv_result == -1) {
  				/* recv failed, bail out */
***************
*** 202,206 ****
  
  	else {
! 		recv_result = recv (sd, recv_buffer, recv_size - 1, 0);
  		if (recv_result == -1) {
  			strcpy (recv_buffer, "");
--- 202,206 ----
  
  	else {
! 		recv_result = recv (sd, recv_buffer, (size_t)recv_size - 1, 0);
  		if (recv_result == -1) {
  			strcpy (recv_buffer, "");

Index: netutils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** netutils.h	29 Jun 2003 06:36:55 -0000	1.5
--- netutils.h	8 Aug 2003 04:33:21 -0000	1.6
***************
*** 35,39 ****
  #include <arpa/inet.h>
  
! RETSIGTYPE socket_timeout_alarm_handler (int);
  
  int process_tcp_request2 (char *address, int port, char *sbuffer,
--- 35,39 ----
  #include <arpa/inet.h>
  
! RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
  
  int process_tcp_request2 (char *address, int port, char *sbuffer,
***************
*** 59,63 ****
  int is_hostname (char *);
  
! extern int socket_timeout;
  extern int econn_refuse_state;
  extern int was_refused;
--- 59,63 ----
  int is_hostname (char *);
  
! extern unsigned int socket_timeout;
  extern int econn_refuse_state;
  extern int was_refused;

Index: popen.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** popen.h	13 Mar 2003 06:51:18 -0000	1.1
--- popen.h	8 Aug 2003 04:33:21 -0000	1.2
***************
*** 3,7 ****
  RETSIGTYPE popen_timeout_alarm_handler (int);
  
! extern int timeout_interval;
  pid_t *childpid;
  int *child_stderr_array;
--- 3,7 ----
  RETSIGTYPE popen_timeout_alarm_handler (int);
  
! extern unsigned int timeout_interval;
  pid_t *childpid;
  int *child_stderr_array;

Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** utils.h	7 Aug 2003 11:51:12 -0000	1.10
--- utils.h	8 Aug 2003 04:33:21 -0000	1.11
***************
*** 17,30 ****
  char *clean_revstring (const char *revstring);
  void print_revision (const char *, const char *);
! void die (int result, const char *fmt, ...);
  
  /* Handle timeouts */
  
  #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
! extern int timeout_interval;
! RETSIGTYPE timeout_alarm_handler (int);
  #else
! int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
! extern RETSIGTYPE timeout_alarm_handler (int);
  #endif
  
--- 17,30 ----
  char *clean_revstring (const char *revstring);
  void print_revision (const char *, const char *);
! void die (int result, const char *fmt, ...) __attribute__((noreturn));
  
  /* Handle timeouts */
  
  #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
! extern unsigned int timeout_interval;
! RETSIGTYPE timeout_alarm_handler (int) __attribute__((noreturn));
  #else
! unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
! extern RETSIGTYPE timeout_alarm_handler (int) __attribute__((noreturn));
  #endif
  
***************
*** 73,79 ****
  int max_state (int a, int b);
  
! void usage (char *msg);
! void usage2(char *msg, char *arg);
! void usage3(char *msg, char arg);
  
  char *state_text (int result);
--- 73,79 ----
  int max_state (int a, int b);
  
! void usage (char *msg) __attribute__((noreturn));
! void usage2(char *msg, char *arg) __attribute__((noreturn));
! void usage3(char *msg, char arg) __attribute__((noreturn));
  
  char *state_text (int result);





More information about the Commits mailing list