[Nagiosplug-checkins] CVS: nagiosplug/plugins check_swap.c,1.1.1.1,1.2

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Oct 17 23:42:03 CEST 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv8236/plugins

Modified Files:
	check_swap.c 
Log Message:
remove old call_getopt

Index: check_swap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_swap.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** check_swap.c	28 Feb 2002 06:42:59 -0000	1.1.1.1
--- check_swap.c	18 Oct 2002 06:41:22 -0000	1.2
***************
*** 151,184 ****
  process_arguments (int argc, char **argv)
  {
- 	int c;
- 
- 	if (argc < 2)
- 		return ERROR;
- 
- 	c = 0;
- 	while (c += (call_getopt (argc - c, &argv[c]))) {
- 		if (argc <= c)
- 			break;
- 
- 		if (warn_percent > 100 && is_intnonneg (argv[c]))
- 			warn_percent = atoi (argv[c]);
- 		else if (crit_percent > 100 && is_intnonneg (argv[c]))
- 			crit_percent = atoi (argv[c]);
- 		else if (warn_size < 0 && is_intnonneg (argv[c]))
- 			warn_size = atoi (argv[c]);
- 		else if (crit_size < 0 && is_intnonneg (argv[c]))
- 			crit_size = atoi (argv[c]);
- 	}
- 
- 	return validate_arguments ();
- }
- 
- 
- 
- 
- 
- int
- call_getopt (int argc, char **argv)
- {
  	int c, i = 0;
  
--- 151,154 ----
***************
*** 195,198 ****
--- 165,171 ----
  #endif
  
+ 	if (argc < 2)
+ 		return ERROR;
+ 
  	while (1) {
  #ifdef HAVE_GETOPT_H
***************
*** 202,217 ****
  #endif
  
- 		i++;
- 
  		if (c == -1 || c == EOF)
  			break;
  
  		switch (c) {
- 		case 'c':
- 		case 'w':
- 			i++;
- 		}
- 
- 		switch (c) {
  		case 'w':									/* warning time threshold */
  			if (is_intnonneg (optarg)) {
--- 175,182 ----
***************
*** 258,262 ****
  		}
  	}
! 	return i;
  }
  
--- 223,249 ----
  		}
  	}
! 
! 	c = optind;
! 	if (c == argc)
! 		return validate_arguments ();
! 	if (warn_percent > 100 && is_intnonneg (argv[c]))
! 		warn_percent = atoi (argv[c++]);
! 
! 	if (c == argc)
! 		return validate_arguments ();
! 	if (crit_percent > 100 && is_intnonneg (argv[c]))
! 		crit_percent = atoi (argv[c++]);
! 
! 	if (c == argc)
! 		return validate_arguments ();
! 	if (warn_size < 0 && is_intnonneg (argv[c]))
! 		warn_size = atoi (argv[c++]);
! 
! 	if (c == argc)
! 		return validate_arguments ();
! 	if (crit_size < 0 && is_intnonneg (argv[c]))
! 		crit_size = atoi (argv[c++]);
! 
! 	return validate_arguments ();
  }
  





More information about the Commits mailing list