[Nagiosplug-checkins] CVS: nagiosplug/plugins check_procs.c,1.23,1.24

Karl DeBisschop kdebisschop at users.sourceforge.net
Sun Nov 30 18:47:01 CET 2003


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

Modified Files:
	check_procs.c 
Log Message:
use usage2 function


Index: check_procs.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_procs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** check_procs.c	28 Nov 2003 14:18:22 -0000	1.23
--- check_procs.c	1 Dec 2003 02:46:01 -0000	1.24
***************
*** 261,265 ****
  		}
  	} 
! 	printf (ngettext ("%d process", "%d processes", procs), procs);
  	
  	if (strcmp(fmt,"") != 0) {
--- 261,265 ----
  		}
  	} 
! 	printf (ngettext ("%d process", "%d processes", (unsigned long) procs), procs);
  	
  	if (strcmp(fmt,"") != 0) {
***************
*** 362,369 ****
  				break;
  			}
! 			printf (_("%s: Parent Process ID must be an integer!\n\n"),
! 			        progname);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);
  		case 's':									/* status */
  			if (statopts)
--- 362,366 ----
  				break;
  			}
! 			usage2 (_("%s: Parent Process ID must be an integer!\n\n"),  progname);
  		case 's':									/* status */
  			if (statopts)
***************
*** 379,396 ****
  				pw = getpwuid ((uid_t) uid);
  				/*  check to be sure user exists */
! 				if (pw == NULL) {
! 					printf (_("UID %d was not found\n"), uid);
! 					print_usage ();
! 					exit (STATE_UNKNOWN);
! 				}
  			}
  			else {
  				pw = getpwnam (optarg);
  				/*  check to be sure user exists */
! 				if (pw == NULL) {
! 					printf (_("User name %s was not found\n"), optarg);
! 					print_usage ();
! 					exit (STATE_UNKNOWN);
! 				}
  				/*  then get uid */
  				uid = pw->pw_uid;
--- 376,387 ----
  				pw = getpwuid ((uid_t) uid);
  				/*  check to be sure user exists */
! 				if (pw == NULL)
! 					usage2 (_("UID %d was not found\n"), uid);
  			}
  			else {
  				pw = getpwnam (optarg);
  				/*  check to be sure user exists */
! 				if (pw == NULL)
! 					usage2 (_("User name %s was not found\n"), optarg);
  				/*  then get uid */
  				uid = pw->pw_uid;
***************
*** 424,431 ****
  				break;
  			}
! 			printf (_("%s: RSS must be an integer!\n\n"),
! 			        progname);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);
  		case 'z':					/* VSZ */
  			if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
--- 415,419 ----
  				break;
  			}
! 			usage2 (_("%s: RSS must be an integer!\n\n"), progname);
  		case 'z':					/* VSZ */
  			if (sscanf (optarg, "%d%[^0-9]", &vsz, tmp) == 1) {
***************
*** 434,441 ****
  				break;
  			}
! 			printf (_("%s: VSZ must be an integer!\n\n"),
! 			        progname);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);
  		case 'P':					/* PCPU */
  			/* TODO: -P 1.5.5 is accepted */
--- 422,426 ----
  				break;
  			}
! 			usage2 (_("%s: VSZ must be an integer!\n\n"), progname);
  		case 'P':					/* PCPU */
  			/* TODO: -P 1.5.5 is accepted */
***************
*** 445,452 ****
  				break;
  			}
! 			printf (_("%s: PCPU must be a float!\n\n"),
! 			        progname);
! 			print_usage ();
! 			exit (STATE_UNKNOWN);
  		case 'm':
  			asprintf (&metric_name, "%s", optarg);
--- 430,434 ----
  				break;
  			}
! 			usage2 (_("%s: PCPU must be a float!\n\n"), progname);
  		case 'm':
  			asprintf (&metric_name, "%s", optarg);





More information about the Commits mailing list