[Nagiosplug-checkins] CVS: nagiosplug/plugins check_nt.c,1.13,1.14 check_smtp.c,1.15,1.16

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Aug 7 20:52:03 CEST 2003


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

Modified Files:
	check_nt.c check_smtp.c 
Log Message:
markup for translation

Index: check_nt.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_nt.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** check_nt.c	7 Aug 2003 11:51:11 -0000	1.13
--- check_nt.c	8 Aug 2003 03:51:02 -0000	1.14
***************
*** 65,71 ****
  
  int process_arguments(int, char **);
- void print_usage(void);
- void print_help(void);
  void preparelist(char *string);
  
  int main(int argc, char **argv){
--- 65,72 ----
  
  int process_arguments(int, char **);
  void preparelist(char *string);
+ int strtoularray(unsigned long *array, char *string, char *delim);
+ void print_help(void);
+ void print_usage(void);
  
  int main(int argc, char **argv){
***************
*** 92,99 ****
  	int upminutes=0;
  
! 	asprintf(&req_password,"None");
  
  	if(process_arguments(argc,argv)==ERROR)
! 		usage("Could not parse arguments\n");
  
  	/* initialize alarm signal handling */
--- 93,100 ----
  	int upminutes=0;
  
! 	asprintf(&req_password, _("None"));
  
  	if(process_arguments(argc,argv)==ERROR)
! 		usage(_("Could not parse arguments\n"));
  
  	/* initialize alarm signal handling */
***************
*** 117,129 ****
  
  		if (check_value_list==TRUE) {																			
! 			if (strtolarray(&lvalue_list,value_list,",")==TRUE) {
  				/* -l parameters is present with only integers */
  				return_code=STATE_OK;
! 				asprintf(&temp_string,"CPU Load");
! 				while (lvalue_list[0+offset]>(unsigned long)0 &&
  				       lvalue_list[0+offset]<=(unsigned long)17280 && 
! 				       lvalue_list[1+offset]>=(unsigned long)0 &&
  				       lvalue_list[1+offset]<=(unsigned long)100 && 
! 				       lvalue_list[2+offset]>=(unsigned long)0 &&
  				       lvalue_list[2+offset]<=(unsigned long)100) {
  					/* loop until one of the parameters is wrong or not present */
--- 118,130 ----
  
  		if (check_value_list==TRUE) {																			
! 			if (strtoularray(&lvalue_list,value_list,",")==TRUE) {
  				/* -l parameters is present with only integers */
  				return_code=STATE_OK;
! 				asprintf(&temp_string,_("CPU Load"));
! 				while (lvalue_list[0+offset]> (unsigned long)0 &&
  				       lvalue_list[0+offset]<=(unsigned long)17280 && 
! 				       lvalue_list[1+offset]> (unsigned long)0 &&
  				       lvalue_list[1+offset]<=(unsigned long)100 && 
! 				       lvalue_list[2+offset]> (unsigned long)0 &&
  				       lvalue_list[2+offset]<=(unsigned long)100) {
  					/* loop until one of the parameters is wrong or not present */
***************
*** 148,152 ****
  						return_code=STATE_WARNING;
  
! 					asprintf(&output_message," %lu%% (%lu min average)", utilization, lvalue_list[0+offset]);
  					asprintf(&temp_string,"%s%s",temp_string,output_message);
  					offset+=3;	/* move across the array */
--- 149,153 ----
  						return_code=STATE_WARNING;
  
! 					asprintf(&output_message,_(" %lu%% (%lu min average)"), utilization, lvalue_list[0+offset]);
  					asprintf(&temp_string,"%s%s",temp_string,output_message);
  					offset+=3;	/* move across the array */
***************
*** 157,167 ****
  				}	
  				else
! 					asprintf(&output_message,"%s","not enough values for -l parameters");
  					
  			} else 
! 				asprintf(&output_message,"wrong -l parameter.");
  
  		} else
! 			asprintf(&output_message,"missing -l parameters");
  	}
  
--- 158,168 ----
  				}	
  				else
! 					asprintf(&output_message,"%s",_("not enough values for -l parameters"));
  					
  			} else 
! 				asprintf(&output_message,_("wrong -l parameter."));
  
  		} else
! 			asprintf(&output_message,_("missing -l parameters"));
  	}
  
***************
*** 182,186 ****
  		uphours = (uptime % 86400) / 3600;
  		upminutes = ((uptime % 86400) % 3600) / 60;
! 		asprintf(&output_message,"System Uptime : %u day(s) %u hour(s) %u minute(s)",updays,uphours, upminutes);
  		return_code=STATE_OK;
  	}
--- 183,187 ----
  		uphours = (uptime % 86400) / 3600;
  		upminutes = ((uptime % 86400) % 3600) / 60;
! 		asprintf(&output_message,_("System Uptime : %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
  		return_code=STATE_OK;
  	}
***************
*** 206,210 ****
  
  				if (free_disk_space>=0) {
! 					asprintf(&temp_string,"%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)",
  							value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, percent_used_space,
  							 free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); 
--- 207,211 ----
  
  				if (free_disk_space>=0) {
! 					asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
  							value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824, percent_used_space,
  							 free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100); 
***************
*** 222,233 ****
  				}
  				else {
! 					asprintf(&output_message,"Free disk space : Invalid drive ");
  					return_code=STATE_UNKNOWN;
  				}		
  			}
  			else 
! 				asprintf(&output_message,"wrong -l argument");
  		} else 
! 			asprintf(&output_message,"missing -l parameters");
  			
  	}
--- 223,234 ----
  				}
  				else {
! 					asprintf(&output_message,_("Free disk space : Invalid drive "));
  					return_code=STATE_UNKNOWN;
  				}		
  			}
  			else 
! 				asprintf(&output_message,_("wrong -l argument"));
  		} else 
! 			asprintf(&output_message,_("missing -l parameters"));
  			
  	}
***************
*** 238,242 ****
  			preparelist(value_list);		/* replace , between services with & to send the request */
  			asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
! 				(show_all==TRUE)?"ShowAll":"ShowFail",value_list);
  			result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
  			if(result!=STATE_OK)
--- 239,243 ----
  			preparelist(value_list);		/* replace , between services with & to send the request */
  			asprintf(&send_buffer,"%s&%u&%s&%s", req_password,(vars_to_check==CHECK_SERVICESTATE)?5:6,
! 				(show_all==TRUE)?_("ShowAll"):_("ShowFail"),value_list);
  			result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
  			if(result!=STATE_OK)
***************
*** 252,256 ****
  		}
  		else 
! 			asprintf(&output_message,"No service/process specified");
  	}
  
--- 253,257 ----
  		}
  		else 
! 			asprintf(&output_message,_("No service/process specified"));
  	}
  
***************
*** 270,274 ****
  		mem_commitByte=atof(strtok(NULL,"&"));
  		percent_used_space = (mem_commitByte / mem_commitLimit) * 100;
! 		asprintf(&output_message,"Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)", 
  			mem_commitLimit / 1048576, mem_commitByte / 1048567, percent_used_space,  
  			(mem_commitLimit - mem_commitByte) / 1048576, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
--- 271,275 ----
  		mem_commitByte=atof(strtok(NULL,"&"));
  		percent_used_space = (mem_commitByte / mem_commitLimit) * 100;
! 		asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"), 
  			mem_commitLimit / 1048576, mem_commitByte / 1048567, percent_used_space,  
  			(mem_commitLimit - mem_commitByte) / 1048576, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
***************
*** 326,330 ****
  		}
  		else {
! 			asprintf(&output_message,"No counter specified");
  			result=STATE_UNKNOWN;
  		}
--- 327,331 ----
  		}
  		else {
! 			asprintf(&output_message,_("No counter specified"));
  			result=STATE_UNKNOWN;
  		}
***************
*** 369,373 ****
  		}
  		else {
! 			asprintf(&output_message,"No file specified");
  			result=STATE_UNKNOWN;
  		}
--- 370,374 ----
  		}
  		else {
! 			asprintf(&output_message,_("No file specified"));
  			result=STATE_UNKNOWN;
  		}
***************
*** 383,386 ****
--- 384,391 ----
  
  
+ 
+ 
+ 
+ 
  /* process command-line arguments */
  int process_arguments(int argc, char **argv){
***************
*** 449,453 ****
  					server_port=atoi(optarg);
  				else
! 					die(STATE_UNKNOWN,"Server port an integer (seconds)\nType '%s -h' for additional help\n",progname);
  				break;
  			case 'v':
--- 454,458 ----
  					server_port=atoi(optarg);
  				else
! 					die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
  				break;
  			case 'v':
***************
*** 506,524 ****
  
  
! void print_usage(void)
! {
! 	printf("Usage: %s -H host -v variable [-p port] [-w warning] [-c critical] [-l params] [-d SHOWALL] [-t timeout]\n",progname);
  }
  
  
  void print_help(void)
  {
  	print_revision(progname,"$Revision$");
! 	printf ("\
  Copyright (c) 2000 Yves Rubin (rubiyz at yahoo.com)\n\n\
  This plugin collects data from the NSClient service running on a\n\
! Windows NT/2000/XP server.\n\n");
  	print_usage();
!   printf ("\nOptions:\n\
  -H, --hostname=HOST\n\
    Name of the host to check\n\
--- 511,561 ----
  
  
! 
! 
! 
! 
! int strtoularray(unsigned long *array, char *string, char *delim) {
! 	/* split a <delim> delimited string into a long array */
! 	int idx=0;
! 	char *t1;
! 
! 	for (idx=0;idx<MAX_VALUE_LIST;idx++)
! 		array[idx]=0;
! 	
! 	idx=0;
! 	for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
! 		if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
! 			array[idx]=strtoul(t1,NULL,10);
! 			idx++;
! 		} else  
! 			return FALSE;
! 	}		
! 	return TRUE;
  }
  
+ void preparelist(char *string) {
+ 	/* Replace all , with & which is the delimiter for the request */
+ 	int i;
  
+ 	for (i = 0; (size_t)i < strlen(string); i++)
+ 		if (string[i] == ',') {
+ 			string[i]='&';
+ 		}
+ }
+ 
+ 
+ 
+ 
+ 
+ 
  void print_help(void)
  {
  	print_revision(progname,"$Revision$");
! 	printf (_("\
  Copyright (c) 2000 Yves Rubin (rubiyz at yahoo.com)\n\n\
  This plugin collects data from the NSClient service running on a\n\
! Windows NT/2000/XP server.\n\n"));
  	print_usage();
!   printf (_("\nOptions:\n\
  -H, --hostname=HOST\n\
    Name of the host to check\n\
***************
*** 536,547 ****
    Print this help screen\n\
  -V, --version\n\
!   Print version information\n",
  	        PORT, DEFAULT_SOCKET_TIMEOUT);
!   printf ("\
  -v, --variable=STRING\n\
!   Variable to check.  Valid variables are:\n");
!   printf ("\
!    CLIENTVERSION = Get the NSClient version\n");
!   printf ("\
     CPULOAD = Average CPU load on last x minutes.\n\
       Request a -l parameter with the following syntax:\n\
--- 573,584 ----
    Print this help screen\n\
  -V, --version\n\
!   Print version information\n"),
  	        PORT, DEFAULT_SOCKET_TIMEOUT);
!   printf (_("\
  -v, --variable=STRING\n\
!   Variable to check.  Valid variables are:\n"));
!   printf (_("\
!    CLIENTVERSION = Get the NSClient version\n"));
!   printf (_("\
     CPULOAD = Average CPU load on last x minutes.\n\
       Request a -l parameter with the following syntax:\n\
***************
*** 549,573 ****
       <minute range> should be less than 24*60.\n\
       Thresholds are percentage and up to 10 requests can be done in one shot.\n\
!      ie: -l 60,90,95,120,90,95\n");
!   printf ("\
     UPTIME = Get the uptime of the machine.\n\
!      No specific parameters. No warning or critical threshold\n");
!   printf ("\
     USEDDISKSPACE = Size and percentage of disk use.\n\
       Request a -l parameter containing the drive letter only.\n\
!      Warning and critical thresholds can be specified with -w and -c.\n");
!   printf ("\
     MEMUSE = Memory use.\n\
!      Warning and critical thresholds can be specified with -w and -c.\n");
!   printf ("\
     SERVICESTATE = Check the state of one or several services.\n\
       Request a -l parameters with the following syntax:\n\
       -l <service1>,<service2>,<service3>,...\n\
       You can specify -d SHOWALL in case you want to see working services\n\
! 		 in the returned string.\n");
!   printf ("\
     PROCSTATE = Check if one or several process are running.\n\
!      Same syntax as SERVICESTATE.\n");
!   printf ("\
     COUNTER = Check any performance counter of Windows NT/2000.\n\
       Request a -l parameters with the following syntax:\n\
--- 586,610 ----
       <minute range> should be less than 24*60.\n\
       Thresholds are percentage and up to 10 requests can be done in one shot.\n\
!      ie: -l 60,90,95,120,90,95\n"));
!   printf (_("\
     UPTIME = Get the uptime of the machine.\n\
!      No specific parameters. No warning or critical threshold\n"));
!   printf (_("\
     USEDDISKSPACE = Size and percentage of disk use.\n\
       Request a -l parameter containing the drive letter only.\n\
!      Warning and critical thresholds can be specified with -w and -c.\n"));
!   printf (_("\
     MEMUSE = Memory use.\n\
!      Warning and critical thresholds can be specified with -w and -c.\n"));
!   printf (_("\
     SERVICESTATE = Check the state of one or several services.\n\
       Request a -l parameters with the following syntax:\n\
       -l <service1>,<service2>,<service3>,...\n\
       You can specify -d SHOWALL in case you want to see working services\n\
! 		 in the returned string.\n"));
!   printf (_("\
     PROCSTATE = Check if one or several process are running.\n\
!      Same syntax as SERVICESTATE.\n"));
!   printf (_("\
     COUNTER = Check any performance counter of Windows NT/2000.\n\
       Request a -l parameters with the following syntax:\n\
***************
*** 577,614 ****
       Some examples:\n\
         \"Paging file usage is %%.2f %%%%\"\n\
!        \"%%.f %%%% paging file used.\"\n");
! 	printf ("Notes:\n\
   - The NSClient service should be running on the server to get any information\n\
     (http://nsclient.ready2run.nl).\n\
!  - Critical thresholds should be lower than warning thresholds\n");
  }
  
- int strtolarray(unsigned long *array, char *string, char *delim) {
- 	/* split a <delim> delimited string into a long array */
- 	int idx=0;
- 	char *t1;
  
- 	for (idx=0;idx<MAX_VALUE_LIST;idx++)
- 		array[idx]=-1;
- 	
- 	idx=0;
- 	for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
- 		if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
- 			array[idx]=strtoul(t1,NULL,10);
- 			idx++;
- 		} else  
- 			return FALSE;
- 	}		
- 	return TRUE;
- }
  
- void preparelist(char *string) {
- 	/* Replace all , with & which is the delimiter for the request */
- 	int i;
  
! 	for (i = 0; (size_t)i < strlen(string); i++)
! 		if (string[i] == ',') {
! 			string[i]='&';
! 		}
  }
- 
--- 614,632 ----
       Some examples:\n\
         \"Paging file usage is %%.2f %%%%\"\n\
!        \"%%.f %%%% paging file used.\"\n"));
! 	printf (_("Notes:\n\
   - The NSClient service should be running on the server to get any information\n\
     (http://nsclient.ready2run.nl).\n\
!  - Critical thresholds should be lower than warning thresholds\n"));
  }
  
  
  
  
! void print_usage(void)
! {
! 	printf(_("\
! Usage: %s -H host -v variable [-p port] [-w warning] [-c critical]\n\
!   [-l params] [-d SHOWALL] [-t timeout]\n"), progname);
! 	printf (_(UT_HLP_VRS), progname, progname);
  }

Index: check_smtp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_smtp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** check_smtp.c	30 Jun 2003 19:47:21 -0000	1.15
--- check_smtp.c	8 Aug 2003 03:51:02 -0000	1.16
***************
*** 1,69 ****
  /******************************************************************************
! *
! * 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.
! *
! *****************************************************************************/
  
  const char *progname = "check_smtp";
  const char *revision = "$Revision$";
! const char *copyright = "1999-2003";
! const char *authors = "Nagios Plugin Development Team";
  const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
! const char *summary = "\
! This plugin will attempt to open an SMTP connection with the host.\n";
! 
! const char *description = "\
! Successul connects return STATE_OK, refusals and timeouts return\n\
! STATE_CRITICAL, other errors return STATE_UNKNOWN.  Successful\n\
! connects, but incorrect reponse messages from the host result in\n\
! STATE_WARNING return values.\n";
! 
! const char *option_summary = "\
! -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
!          [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]";
! 
! const char *options = "\
!  -H, --hostname=STRING or IPADDRESS\n\
!    Check server on the indicated host\n\
!  -4, --use-ipv4\n\
!    Use IPv4 protocol\n\
!  -6, --use-ipv6\n\
!    Use IPv6 protocol\n\
!  -p, --port=INTEGER\n\
!    Make connection on the indicated port (default: %d)\n\
!  -e, --expect=STRING\n\
!    String to expect in first line of server response (default: '%s')\n\
!  -n, nocommand\n\
!    Suppress SMTP command\n\
!  -C, --command=STRING\n\
!    SMTP command (default: '%s')\n\
!  -f, --from=STRING\n\
!    FROM-address to include in MAIL command, required by Exchange 2000\n\
!    (default: '%s')\n\
!  -w, --warning=INTEGER\n\
!    Seconds necessary to result in a warning status\n\
!  -c, --critical=INTEGER\n\
!    Seconds necessary to result in a critical status\n\
!  -t, --timeout=INTEGER\n\
!    Seconds before connection attempt times out (default: %d)\n\
!  -v, --verbose\n\
!    Print extra information (command-line use only)\n\
!  -h, --help\n\
!    Print detailed help screen\n\
!  -V, --version\n\
!    Print version information\n\n";
  
  enum {
--- 1,28 ----
  /******************************************************************************
! 
!  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.
! 
! ******************************************************************************/
  
  const char *progname = "check_smtp";
  const char *revision = "$Revision$";
! const char *copyright = "2000-2003";
  const char *email = "nagiosplug-devel at lists.sourceforge.net";
  
! #include "common.h"
! #include "netutils.h"
! #include "utils.h"
  
  enum {
***************
*** 74,82 ****
  const char *SMTP_QUIT	= "QUIT\r\n";
  
- #include "config.h"
- #include "common.h"
- #include "netutils.h"
- #include "utils.h"
- 
  int process_arguments (int, char **);
  int validate_arguments (void);
--- 33,36 ----
***************
*** 96,99 ****
--- 50,58 ----
  int verbose = 0;
  
+ 
+ 
+ 
+ 
+ 
  int
  main (int argc, char **argv)
***************
*** 108,112 ****
  
  	if (process_arguments (argc, argv) != OK)
! 		usage ("Invalid command arguments supplied\n");
  
  	/* initialize the HELO command with the localhostname */
--- 67,71 ----
  
  	if (process_arguments (argc, argv) != OK)
! 		usage (_("Invalid command arguments supplied\n"));
  
  	/* initialize the HELO command with the localhostname */
***************
*** 142,146 ****
  		/* return a WARNING status if we couldn't read any data */
  		if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) == -1) {
! 			printf ("recv() failed\n");
  			result = STATE_WARNING;
  		}
--- 101,105 ----
  		/* return a WARNING status if we couldn't read any data */
  		if (recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0) == -1) {
! 			printf (_("recv() failed\n"));
  			result = STATE_WARNING;
  		}
***************
*** 151,157 ****
  			if (!strstr (buffer, server_expect)) {
  				if (server_port == SMTP_PORT)
! 					printf ("Invalid SMTP response received from host\n");
  				else
! 					printf ("Invalid SMTP response received from host on port %d\n",
  									server_port);
  				result = STATE_WARNING;
--- 110,116 ----
  			if (!strstr (buffer, server_expect)) {
  				if (server_port == SMTP_PORT)
! 					printf (_("Invalid SMTP response received from host\n"));
  				else
! 					printf (_("Invalid SMTP response received from host on port %d\n"),
  									server_port);
  				result = STATE_WARNING;
***************
*** 183,187 ****
  
  			if (verbose) 
! 				printf("DUMMYCMD: %s\n%s\n",from_str,buffer);
  
  		} /* smtp_use_dummycmd */
--- 142,146 ----
  
  			if (verbose) 
! 				printf(_("DUMMYCMD: %s\n%s\n"),from_str,buffer);
  
  		} /* smtp_use_dummycmd */
***************
*** 205,212 ****
  
  	if (verbose)
! 		printf ("SMTP %s - %.3f sec. response time, %s|time=%.3f\n",
  		        state_text (result), elapsed_time, buffer, elapsed_time);
  	else
! 		printf ("SMTP %s - %.3f second response time|time=%.3f\n",
  		        state_text (result), elapsed_time, elapsed_time);
  
--- 164,171 ----
  
  	if (verbose)
! 		printf (_("SMTP %s - %.3f sec. response time, %s|time=%.3f\n"),
  		        state_text (result), elapsed_time, buffer, elapsed_time);
  	else
! 		printf (_("SMTP %s - %.3f second response time|time=%.3f\n"),
  		        state_text (result), elapsed_time, elapsed_time);
  
***************
*** 218,222 ****
  
  
! 
  /* process command-line arguments */
  int
--- 177,181 ----
  
  
! 
  /* process command-line arguments */
  int
***************
*** 269,282 ****
  			}
  			else {
! 				usage ("Invalid host name\n");
  			}
  			break;
  		case 'p':									/* port */
! 			if (is_intpos (optarg)) {
  				server_port = atoi (optarg);
! 			}
! 			else {
! 				usage ("Server port must be a positive integer\n");
! 			}
  			break;
  		case 'f':									/* from argument */
--- 228,239 ----
  			}
  			else {
! 				usage (_("Invalid host name\n"));
  			}
  			break;
  		case 'p':									/* port */
! 			if (is_intpos (optarg))
  				server_port = atoi (optarg);
! 			else
! 				usage (_("Server port must be a positive integer\n"));
  			break;
  		case 'f':									/* from argument */
***************
*** 299,303 ****
  			}
  			else {
! 				usage ("Critical time must be a nonnegative integer\n");
  			}
  			break;
--- 256,260 ----
  			}
  			else {
! 				usage (_("Critical time must be a nonnegative integer\n"));
  			}
  			break;
***************
*** 308,312 ****
  			}
  			else {
! 				usage ("Warning time must be a nonnegative integer\n");
  			}
  			break;
--- 265,269 ----
  			}
  			else {
! 				usage (_("Warning time must be a nonnegative integer\n"));
  			}
  			break;
***************
*** 319,323 ****
  			}
  			else {
! 				usage ("Time interval must be a nonnegative integer\n");
  			}
  			break;
--- 276,280 ----
  			}
  			else {
! 				usage (_("Time interval must be a nonnegative integer\n"));
  			}
  			break;
***************
*** 329,333 ****
  			address_family = AF_INET6;
  #else
! 			usage ("IPv6 support not available\n");
  #endif
  			break;
--- 286,290 ----
  			address_family = AF_INET6;
  #else
! 			usage (_("IPv6 support not available\n"));
  #endif
  			break;
***************
*** 339,343 ****
  			exit (STATE_OK);
  		case '?':									/* help */
! 			usage ("Invalid argument\n");
  		}
  	}
--- 296,300 ----
  			exit (STATE_OK);
  		case '?':									/* help */
! 			usage (_("Invalid argument\n"));
  		}
  	}
***************
*** 349,353 ****
  				server_address = argv[c];
  			else
! 				usage ("Invalid host name");
  		}
  		else {
--- 306,310 ----
  				server_address = argv[c];
  			else
! 				usage (_("Invalid host name"));
  		}
  		else {
***************
*** 376,390 ****
  
  
  void
  print_help (void)
  {
  	print_revision (progname, revision);
! 	printf ("Copyright (c) %s %s\n\t<%s>\n\n%s\n",
! 	         copyright, authors, email, summary);
  	print_usage ();
! 	printf ("\nOptions:\n");
! 	printf (options, SMTP_PORT, SMTP_EXPECT, mail_command, from_arg,
! 	        DEFAULT_SOCKET_TIMEOUT);
! 	support ();
  }
  
--- 333,383 ----
  
  
+ 
  void
  print_help (void)
  {
+ 	char *myport;
+ 	asprintf (&myport, "%d", SMTP_PORT);
+ 
  	print_revision (progname, revision);
! 
! 	printf (_("Copyright (c) 1999-2001 Ethan Galstad <nagios at nagios.org>\n"));
! 	printf (_(COPYRIGHT), copyright, email);
! 
! 	printf(_("\
! This plugin will attempt to open an SMTP connection with the host.\n\n"));
! 
  	print_usage ();
! 
! 	printf (_(UT_HELP_VRSN));
! 
! 	printf (_(UT_HOST_PORT), 'p', myport);
! 
! 	printf (_(UT_IPv46));
! 
! 	printf (_("\
!  -e, --expect=STRING\n\
!    String to expect in first line of server response (default: '%s')\n\
!  -n, nocommand\n\
!    Suppress SMTP command\n\
!  -C, --command=STRING\n\
!    SMTP command (default: '%s')\n\
!  -f, --from=STRING\n\
!    FROM-address to include in MAIL command, required by Exchange 2000\n\
!    (default: '%s')\n"), SMTP_EXPECT, mail_command, from_arg);
! 
! 	printf (_(UT_WARN_CRIT));
! 
! 	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
! 
! 	printf (_(UT_VERBOSE));
! 
! 	printf(_("\n\
! Successul connects return STATE_OK, refusals and timeouts return\n\
! STATE_CRITICAL, other errors return STATE_UNKNOWN.  Successful\n\
! connects, but incorrect reponse messages from the host result in\n\
! STATE_WARNING return values.\n"));
! 
! 	printf (_(UT_SUPPORT));
  }
  
***************
*** 396,402 ****
  print_usage (void)
  {
! 	printf ("Usage: %s %s\n"
! 	        "       %s --help\n"
! 	        "       %s --version\n",
! 	        progname, option_summary, progname, progname);
  }
--- 389,398 ----
  print_usage (void)
  {
! 	printf ("\
! Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
!   [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname);
! 	printf (_(UT_HLP_VRS), progname, progname);
  }
+ 
+  
+ 





More information about the Commits mailing list