[Nagiosplug-checkins] CVS: nagiosplug/plugins check_hpjd.c,1.7,1.8

Subhendu Ghosh sghosh at users.sourceforge.net
Sun Feb 2 21:08:16 CET 2003


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

Modified Files:
	check_hpjd.c 
Log Message:
added default community [bug-patch #600349 jbaumgartner] 

Index: check_hpjd.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_hpjd.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_hpjd.c	16 Jan 2003 06:10:50 -0000	1.7
--- check_hpjd.c	3 Feb 2003 05:07:26 -0000	1.8
***************
*** 86,89 ****
--- 86,91 ----
  #define OFFLINE		1
  
+ #define DEFAULT_COMMUNITY "public"
+ 
  int process_arguments (int, char **);
  int validate_arguments (void);
***************
*** 91,96 ****
  void print_usage (void);
  
! char *community = NULL;
! char *address = "127.0.0.1";
  
  
--- 93,98 ----
  void print_usage (void);
  
! char *community = DEFAULT_COMMUNITY;
! char *address = NULL;
  
  
***************
*** 393,401 ****
  	static struct option long_options[] = {
  		{"hostname", required_argument, 0, 'H'},
! 		{"expect", required_argument, 0, 'e'},
  /*  		{"critical",       required_argument,0,'c'}, */
  /*  		{"warning",        required_argument,0,'w'}, */
  /*  		{"port",           required_argument,0,'P'}, */
- 		{"verbose", no_argument, 0, 'v'},
  		{"version", no_argument, 0, 'V'},
  		{"help", no_argument, 0, 'h'},
--- 395,402 ----
  	static struct option long_options[] = {
  		{"hostname", required_argument, 0, 'H'},
! 		{"community", required_argument, 0, 'C'},
  /*  		{"critical",       required_argument,0,'c'}, */
  /*  		{"warning",        required_argument,0,'w'}, */
  /*  		{"port",           required_argument,0,'P'}, */
  		{"version", no_argument, 0, 'V'},
  		{"help", no_argument, 0, 'h'},
***************
*** 407,419 ****
  		return ERROR;
  
! 	for (c = 1; c < argc; c++) {
! 		if (strcmp ("-to", argv[c]) == 0)
! 			strcpy (argv[c], "-t");
! 		else if (strcmp ("-wt", argv[c]) == 0)
! 			strcpy (argv[c], "-w");
! 		else if (strcmp ("-ct", argv[c]) == 0)
! 			strcpy (argv[c], "-c");
! 	}
! 
  	while (1) {
  #ifdef HAVE_GETOPT_H
--- 408,412 ----
  		return ERROR;
  
! 	
  	while (1) {
  #ifdef HAVE_GETOPT_H
***************
*** 429,433 ****
  		case 'H':									/* hostname */
  			if (is_host (optarg)) {
! 				address = optarg;
  			}
  			else {
--- 422,426 ----
  		case 'H':									/* hostname */
  			if (is_host (optarg)) {
! 				address = strscpy(address, optarg) ;
  			}
  			else {
***************
*** 436,440 ****
  			break;
  		case 'C':									/* community */
! 			community = optarg;
  			break;
  		case 'V':									/* version */
--- 429,433 ----
  			break;
  		case 'C':									/* community */
! 			community = strscpy (community, optarg);
  			break;
  		case 'V':									/* version */
***************
*** 458,464 ****
  		}
  	}
! 
! 	if (community == NULL) {
! 		community = argv[c++];
  	}
  
--- 451,457 ----
  		}
  	}
! 	
! 	if (argv[c] != NULL ) {
! 		community = argv[c];
  	}
  
***************
*** 494,501 ****
  		 "   Check server on the indicated host\n"
  		 " -C, --community=STRING\n"
! 		 "   The SNMP community name\n"
  		 " -h, --help\n"
  		 "   Print detailed help screen\n"
! 		 " -V, --version\n" "   Print version information\n\n");
  	support ();
  }
--- 487,494 ----
  		 "   Check server on the indicated host\n"
  		 " -C, --community=STRING\n"
! 		 "   The SNMP community name (default=%s)\n"
  		 " -h, --help\n"
  		 "   Print detailed help screen\n"
! 		 " -V, --version\n" "   Print version information\n\n",DEFAULT_COMMUNITY);
  	support ();
  }





More information about the Commits mailing list