[Nagiosplug-checkins] CVS: nagiosplug/plugins check_by_ssh.c,1.15,1.16 check_dig.c,1.14,1.15 check_disk.c,1.31,1.32 check_snmp.c,1.32,1.33 utils.c,1.27,1.28 utils.h,1.11,1.12

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Aug 7 22:10:03 CEST 2003


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

Modified Files:
	check_by_ssh.c check_dig.c check_disk.c check_snmp.c utils.c 
	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.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** check_by_ssh.c	8 Aug 2003 04:33:21 -0000	1.15
--- check_by_ssh.c	8 Aug 2003 05:09:39 -0000	1.16
***************
*** 292,296 ****
  
  	if (commands > 1)
! 		remotecmd = strscat (remotecmd, ";echo STATUS CODE: $?;");
  
  	if (remotecmd == NULL || strlen (remotecmd) <= 1)
--- 292,296 ----
  
  	if (commands > 1)
! 		asprintf (&remotecmd, "%s;echo STATUS CODE: $?;", remotecmd);
  
  	if (remotecmd == NULL || strlen (remotecmd) <= 1)

Index: check_dig.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** check_dig.c	2 Aug 2003 16:42:57 -0000	1.14
--- check_dig.c	8 Aug 2003 05:09:40 -0000	1.15
***************
*** 1,21 ****
  /*****************************************************************************
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU General Public License as published by
! * the Free Software Foundation; either version 2 of the License, or
! * (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! * GNU General Public License for more details.
! *
! * You should have received a copy of the GNU General Public License
! * along with this program; if not, write to the Free Software
! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! *
  *****************************************************************************/
  
- #include "config.h"
  #include "common.h"
  #include "netutils.h"
--- 1,20 ----
  /*****************************************************************************
! 
!  This program is free software; you can redistribute it and/or modify
!  it under the terms of the GNU General Public License as published by
!  the Free Software Foundation; either version 2 of the License, or
!  (at your option) any later version.
! 
!  This program is distributed in the hope that it will be useful,
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  GNU General Public License for more details.
! 
!  You should have received a copy of the GNU General Public License
!  along with this program; if not, write to the Free Software
!  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! 
  *****************************************************************************/
  
  #include "common.h"
  #include "netutils.h"
***************
*** 37,84 ****
  };
  
- void
- print_usage (void)
- {
- 	printf (_("\
- Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\
-          [-c <critical interval>] [-t <timeout>] [-v]\n"),
- 	        progname);
- 	printf ("       %s (-h|--help)\n", progname);
- 	printf ("       %s (-V|--version)\n", progname);
- }
- 
- void
- print_help (void)
- {
- 	char *myport;
- 
- 	asprintf (&myport, "%d", DEFAULT_PORT);
- 
- 	print_revision (progname, revision);
- 
- 	printf (_(COPYRIGHT), copyright, email);
- 
- 	printf (_("Test the DNS service on the specified host using dig\n\n"));
- 
- 	print_usage ();
- 
- 	printf (_(UT_HELP_VRSN));
- 
- 	printf (_(UT_HOST_PORT), 'P', myport);
- 
- 	printf (_("\
-  -l, --lookup=STRING\n\
-    machine name to lookup\n"));
- 
- 	printf (_(UT_WARN_CRIT));
- 
- 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
- 
- 	printf (_(UT_VERBOSE));
- 
- 	support ();
- }
- 
- 
  char *query_address = NULL;
  char *dns_server = NULL;
--- 36,39 ----
***************
*** 89,100 ****
  
  
  int
  main (int argc, char **argv)
  {
  	char input_buffer[MAX_INPUT_BUFFER];
! 	char *command_line = NULL;
! 	char *output = "";
  	int result = STATE_UNKNOWN;
  
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
--- 44,61 ----
  
  
+ 
+ 
+ 
+ 
  int
  main (int argc, char **argv)
  {
  	char input_buffer[MAX_INPUT_BUFFER];
! 	char *command_line;
! 	char *output;
  	int result = STATE_UNKNOWN;
  
+ 	output = strdup ("");
+ 
  	/* Set signal handling and alarm */
  	if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
***************
*** 189,192 ****
--- 150,158 ----
  }
  
+ 
+ 
+ 
+ 
+ 
  /* process command-line arguments */
  int
***************
*** 299,301 ****
--- 265,318 ----
  	return OK;
  }
+ 
+ 
+ 
+ 
+ 
+ 
  
+ void
+ print_help (void)
+ {
+ 	char *myport;
+ 
+ 	asprintf (&myport, "%d", DEFAULT_PORT);
+ 
+ 	print_revision (progname, revision);
+ 
+ 	printf (_(COPYRIGHT), copyright, email);
+ 
+ 	printf (_("Test the DNS service on the specified host using dig\n\n"));
+ 
+ 	print_usage ();
+ 
+ 	printf (_(UT_HELP_VRSN));
+ 
+ 	printf (_(UT_HOST_PORT), 'P', myport);
+ 
+ 	printf (_("\
+  -l, --lookup=STRING\n\
+    machine name to lookup\n"));
+ 
+ 	printf (_(UT_WARN_CRIT));
+ 
+ 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+ 
+ 	printf (_(UT_VERBOSE));
+ 
+ 	support ();
+ }
+ 
+ 
+ 
+ 
+ void
+ print_usage (void)
+ {
+ 	printf (_("\
+ Usage: %s -H host -l lookup [-p <server port>] [-w <warning interval>]\n\
+          [-c <critical interval>] [-t <timeout>] [-v]\n"),
+ 	        progname);
+ 	printf ("       %s (-h|--help)\n", progname);
+ 	printf ("       %s (-V|--version)\n", progname);
+ }

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** check_disk.c	8 Aug 2003 04:33:21 -0000	1.31
--- check_disk.c	8 Aug 2003 05:09:40 -0000	1.32
***************
*** 1,18 ****
  /******************************************************************************
! *
! * This program is free software; you can redistribute it and/or modify
! * it under the terms of the GNU General Public License as published by
! * the Free Software Foundation; either version 2 of the License, or
! * (at your option) any later version.
! *
! * This program is distributed in the hope that it will be useful,
! * but WITHOUT ANY WARRANTY; without even the implied warranty of
! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
! * GNU General Public License for more details.
! *
! * You should have received a copy of the GNU General Public License
! * along with this program; if not, write to the Free Software
! * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! *
  *****************************************************************************/
  
--- 1,18 ----
  /******************************************************************************
! 
!  This program is free software; you can redistribute it and/or modify
!  it under the terms of the GNU General Public License as published by
!  the Free Software Foundation; either version 2 of the License, or
!  (at your option) any later version.
! 
!  This program is distributed in the hope that it will be useful,
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  GNU General Public License for more details.
! 
!  You should have received a copy of the GNU General Public License
!  along with this program; if not, write to the Free Software
!  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! 
  *****************************************************************************/
  
***************
*** 112,116 ****
  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);
--- 112,116 ----
  void print_path (char *mypath);
  int validate_arguments (uintmax_t, uintmax_t, double, double, char *);
! int check_disk (double usp, uintmax_t free_disk);
  int walk_name_list (struct name_list *list, const char *name);
  void print_help (void);
***************
*** 121,127 ****
  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;
--- 121,127 ----
  double w_dfp = -1.0;
  double c_dfp = -1.0;
! char *path;
! char *exclude_device;
! char *units;
  uintmax_t mult = 1024 * 1024;
  int verbose = 0;
***************
*** 141,146 ****
  	int disk_result = STATE_UNKNOWN;
  	char file_system[MAX_INPUT_BUFFER];
! 	char *output = "";
! 	char *details = "";
  	float free_space, free_space_pct, total_space;
  
--- 141,146 ----
  	int disk_result = STATE_UNKNOWN;
  	char file_system[MAX_INPUT_BUFFER];
! 	char *output;
! 	char *details;
  	float free_space, free_space_pct, total_space;
  
***************
*** 149,152 ****
--- 149,155 ----
  	struct name_list *temp_list;
  
+ 	output = strdup ("");
+ 	details = strdup ("");
+ 
  	mount_list = read_filesystem_list (0);
  
***************
*** 415,419 ****
  		c_dfp = (100.0 - atof (argv[c++]));
  
! 	if (argc > c && strlen (path) == 0) {
  		se = (struct name_list *) malloc (sizeof (struct name_list));
  		se->name = strdup (argv[c++]);
--- 418,422 ----
  		c_dfp = (100.0 - atof (argv[c++]));
  
! 	if (argc > c && path == NULL) {
  		se = (struct name_list *) malloc (sizeof (struct name_list));
  		se->name = strdup (argv[c++]);
***************
*** 483,487 ****
  
  int
! check_disk (int usp, uintmax_t free_disk)
  {
  	int result = STATE_UNKNOWN;
--- 486,490 ----
  
  int
! check_disk (double usp, uintmax_t free_disk)
  {
  	int result = STATE_UNKNOWN;

Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** check_snmp.c	7 Aug 2003 12:00:18 -0000	1.32
--- check_snmp.c	8 Aug 2003 05:09:40 -0000	1.33
***************
*** 202,206 ****
  			}
  			if (ptr && strstr (ptr, delimiter) == NULL) {
! 				response = strscat (response, ptr);
  				ptr = NULL;
  			}
--- 202,206 ----
  			}
  			if (ptr && strstr (ptr, delimiter) == NULL) {
! 				asprintf (&response, "%s%s", response, ptr);
  				ptr = NULL;
  			}

Index: utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** utils.c	7 Aug 2003 11:51:12 -0000	1.27
--- utils.c	8 Aug 2003 05:09:40 -0000	1.28
***************
*** 68,72 ****
  
  void
! usage3 (char *msg, char arg)
  {
  	printf ("%s: %s - %c\n", progname, msg, arg);
--- 68,72 ----
  
  void
! usage3 (char *msg, int arg)
  {
  	printf ("%s: %s - %c\n", progname, msg, arg);
***************
*** 112,116 ****
  }
  
! char *
  state_text (int result)
  {
--- 112,116 ----
  }
  
! const char *
  state_text (int result)
  {
***************
*** 329,366 ****
  
  	asprintf (&dest, "%s", src);
- 
- 	return dest;
- }
- 
- 
- 
- 
- 
- /******************************************************************************
-  *
-  * Concatenates one string to the end of another
-  *
-  * Given a pointer destination string, which may or may not already
-  * hold some text, and a source string with additional text (possibly
-  * NULL or empty), returns a pointer to a string that is the first
-  * string with the second concatenated to it. Uses realloc to free 
-  * memory held by the dest argument if new storage space is required.
-  *
-  * Example:
-  *
-  * char *str=NULL;
-  * str = strscpy("This is a line of text with no trailing newline");
-  * str = strscat(str,"\n");
-  *
-  *****************************************************************************/
- 
- char *
- strscat (char *dest, const char *src)
- {
- 
- 	if (dest == NULL)
- 		return src;
- 	if (src != NULL)
- 		asprintf (&dest, "%s%s", dest, src);
  
  	return dest;
--- 329,332 ----

Index: utils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** utils.h	8 Aug 2003 04:33:21 -0000	1.11
--- utils.h	8 Aug 2003 05:09:40 -0000	1.12
***************
*** 23,30 ****
  #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
  
--- 23,30 ----
  #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
  extern unsigned int timeout_interval;
! RETSIGTYPE timeout_alarm_handler (int);
  #else
  unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
! extern RETSIGTYPE timeout_alarm_handler (int);
  #endif
  
***************
*** 65,71 ****
  void strip (char *buffer);
  char *strscpy (char *dest, const char *src);
- char *strscat (char *dest, const char *src);
  char *strnl (char *str);
- char *ssprintf (char *str, const char *fmt, ...); /* deprecate for asprintf */
  char *strpcpy (char *dest, const char *src, const char *str);
  char *strpcat (char *dest, const char *src, const char *str);
--- 65,69 ----
***************
*** 75,81 ****
  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);
  
  #define max(a,b) (((a)>(b))?(a):(b))
--- 73,79 ----
  void usage (char *msg) __attribute__((noreturn));
  void usage2(char *msg, char *arg) __attribute__((noreturn));
! void usage3(char *msg, int arg) __attribute__((noreturn));
  
! const char *state_text (int result);
  
  #define max(a,b) (((a)>(b))?(a):(b))





More information about the Commits mailing list