[Nagiosplug-checkins] CVS: nagiosplug/plugins check_disk.c,1.32,1.33

Karl DeBisschop kdebisschop at users.sourceforge.net
Fri Aug 8 05:15:03 CEST 2003


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

Modified Files:
	check_disk.c 
Log Message:
fix a variety of compiler warnings about qualifier discards and other pedantic stuff

Index: check_disk.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** check_disk.c	8 Aug 2003 05:09:40 -0000	1.32
--- check_disk.c	8 Aug 2003 12:14:10 -0000	1.33
***************
*** 195,208 ****
  				          free_space_pct,
  				          (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
! 			asprintf (&details, _("%s\n%.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%d crit:%d warn%%:%.0f%% crit%%:%.0f%%"),
! 			          details,
! 			          free_space,
! 			          total_space,
! 			          units,
! 			          free_space_pct,
! 			          me->me_devname,
! 			          me->me_type,
! 			          me->me_mountdir,
! 				  w_df, c_df, w_dfp, c_dfp);
  		}
  
--- 195,203 ----
  				          free_space_pct,
  				          (!strcmp(file_system, "none") || display_mntp) ? me->me_devname : me->me_mountdir);
! 			asprintf (&details, _("%s\n\
! %.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
! 			          details, free_space, total_space, units, free_space_pct,
! 			          me->me_devname, me->me_type, me->me_mountdir,
! 			          (unsigned long)w_df, (unsigned long)c_df, w_dfp, c_dfp);
  		}
  
***************
*** 239,242 ****
--- 234,238 ----
  	struct name_list **dptail = &dp_exclude_list;
  	struct name_list *temp_list;
+ 	unsigned long l;
  	int result = OK;
  
***************
*** 299,303 ****
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%ul%*[:,]%lf%%", &w_df, &w_dfp) == 2) {
  				break;
  			}
--- 295,300 ----
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%lu%*[:,]%lf%%", &l, &w_dfp) == 2) {
! 				w_df = (uintmax_t)l;
  				break;
  			}
***************
*** 315,319 ****
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%ul%*[,:]%lf%%", &c_df, &c_dfp) == 2) {
  				break;
  			}
--- 312,317 ----
  			else if (strpbrk (optarg, ",:") &&
  							 strstr (optarg, "%") &&
! 							 sscanf (optarg, "%lu%*[,:]%lf%%", &l, &c_dfp) == 2) {
! 				c_df = (uintmax_t)l;
  				break;
  			}
***************
*** 327,343 ****
  			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 {
  				die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
--- 325,341 ----
  			if (! strcmp (optarg, "bytes")) {
  				mult = (uintmax_t)1;
! 				units = strdup ("B");
  			} else if (! strcmp (optarg, "kB")) {
  				mult = (uintmax_t)1024;
! 				units = strdup ("kB");
  			} else if (! strcmp (optarg, "MB")) {
  				mult = (uintmax_t)1024 * 1024;
! 				units = strdup ("MB");
  			} else if (! strcmp (optarg, "GB")) {
  				mult = (uintmax_t)1024 * 1024 * 1024;
! 				units = strdup ("GB");
  			} else if (! strcmp (optarg, "TB")) {
  				mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
! 				units = strdup ("TB");
  			} else {
  				die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
***************
*** 346,354 ****
  		case 'k': /* display mountpoint */
  			mult = 1024;
! 			units = "kB";
  			break;
  		case 'm': /* display mountpoint */
  			mult = 1024 * 1024;
! 			units = "MB";
  			break;
  		case 'l':
--- 344,352 ----
  		case 'k': /* display mountpoint */
  			mult = 1024;
! 			units = strdup ("kB");
  			break;
  		case 'm': /* display mountpoint */
  			mult = 1024 * 1024;
! 			units = strdup ("kB");
  			break;
  		case 'l':
***************
*** 477,483 ****
  		return ERROR;
  	}
! 	else {
! 		return OK;
! 	}
  }
  
--- 475,482 ----
  		return ERROR;
  	}
! 	
! 	if (units == NULL)
! 		units = strdup ("MB");
! 	return OK;
  }
  





More information about the Commits mailing list