Index: base/checks.c
===================================================================
RCS file: /cvsroot/nagios/nagios/base/checks.c,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 checks.c
--- base/checks.c	5 Dec 2003 02:01:44 -0000	1.12.2.1
+++ base/checks.c	6 Dec 2003 11:24:34 -0000
@@ -216,7 +216,7 @@
 	grab_service_macros(svc);
 
 	/* get the raw command line */
-	get_raw_command_line(svc->service_check_command,raw_command,sizeof(raw_command));
+	get_raw_command_line(svc->service_check_command,svc->service_check_args, raw_command,sizeof(raw_command));
 	strip(raw_command);
 
 	/* process any macros contained in the argument */
@@ -1673,6 +1673,7 @@
 	char *temp_ptr;
 	int early_timeout=FALSE;
 	char temp_plugin_output[MAX_PLUGINOUTPUT_LENGTH];
+    int command_len=0;
 		
 
 #ifdef DEBUG0
@@ -1717,6 +1718,14 @@
 	/* get the raw command line */
 	strncpy(raw_check_command,temp_command->command_line,sizeof(raw_check_command));
 	raw_check_command[sizeof(raw_check_command)-1]='\x0';
+    if ( hst->host_check_args != NULL ) {
+        command_len =strlen(raw_check_command);
+        raw_check_command[command_len] = '\x0';
+
+        if (command_len <= sizeof(raw_check_command)) {
+            strncat(raw_check_command, hst->host_check_args, sizeof(raw_check_command) - command_len );
+        }
+    }
 
 	/* process any macros in the check command */
 	process_macros(raw_check_command,&processed_check_command[0],(int)sizeof(processed_check_command),0);
@@ -1724,6 +1733,10 @@
 			
 #ifdef DEBUG3
 	printf("\t\tRaw Command: %s\n",hst->host_check_command);
+    if (hst->host_check_args != NULL ) 
+        printf("\t\tRaw Args : %s\n",hst->host_check_args);
+    else 
+        printf("\t\tRaw Args : null\n");
 	printf("\t\tProcessed Command: %s\n",processed_check_command);
 #endif
 
@@ -1741,7 +1754,11 @@
 		hst->plugin_output[MAX_PLUGINOUTPUT_LENGTH-1]='\x0';
 
 		/* log the timeout */
-		snprintf(temp_buffer,sizeof(temp_buffer)-1,"Warning: Host check command '%s' for host '%s' timed out after %d seconds\n",hst->host_check_command,hst->name,host_check_timeout);
+        if (hst->host_check_args != NULL )
+            snprintf(temp_buffer,sizeof(temp_buffer)-1,"Warning: Host check command '%s%s' for host '%s' timed out after %d seconds\n",
+                hst->host_check_command,hst->host_check_args,hst->name,host_check_timeout);
+        else 
+            snprintf(temp_buffer,sizeof(temp_buffer)-1,"Warning: Host check command '%s' for host '%s' timed out after %d seconds\n",hst->host_check_command,hst->name,host_check_timeout);
 		temp_buffer[sizeof(temp_buffer)-1]='\x0';
 		write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_WARNING,TRUE);
 	        }
Index: base/nagios.h.in
===================================================================
RCS file: /cvsroot/nagios/nagios/base/Attic/nagios.h.in,v
retrieving revision 1.4
diff -u -r1.4 nagios.h.in
--- base/nagios.h.in	8 Aug 2002 05:00:51 -0000	1.4
+++ base/nagios.h.in	6 Dec 2003 11:24:35 -0000
@@ -414,7 +414,7 @@
 char *my_strsep(char **,const char *);		     	/* Solaris doesn't have strsep(), so I took this from the glibc source code */
 int contains_illegal_object_chars(char *);		/* tests whether or not an object name (host, service, etc.) contains illegal characters */
 int my_rename(char *,char *);                           /* renames a file - works across filesystems */
-void get_raw_command_line(char *,char *,int);        	/* given a raw command line, determine the actual command to run */
+void get_raw_command_line(char *, char *,char *,int);        	/* given a raw command line, determine the actual command to run */
 int check_time_against_period(time_t,char *);		/* check to see if a specific time is covered by a time period */
 void get_next_valid_time(time_t, time_t *,char *);	/* get the next valid time in a time period */
 void get_datetime_string(time_t *,char *,int,int);	/* get a date/time string for use in output */
Index: base/notifications.c
===================================================================
RCS file: /cvsroot/nagios/nagios/base/notifications.c,v
retrieving revision 1.4.2.1
diff -u -r1.4.2.1 notifications.c
--- base/notifications.c	5 Dec 2003 02:01:44 -0000	1.4.2.1
+++ base/notifications.c	6 Dec 2003 11:24:35 -0000
@@ -502,7 +502,7 @@
 		/* get the raw command line */
 		strncpy(temp_command_line,temp_commandsmember->command,sizeof(temp_command_line)-1);
 		temp_command_line[sizeof(temp_command_line)-1]='\x0';
-		get_raw_command_line(temp_command_line,&raw_command_line[0],(int)sizeof(raw_command_line));
+		get_raw_command_line(temp_command_line,NULL, &raw_command_line[0],(int)sizeof(raw_command_line));
 
 		/* run the notification command */
 		if(strcmp(raw_command_line,"")){
@@ -1097,7 +1097,7 @@
 		/* get the raw command line */
 		strncpy(temp_command_line,temp_commandsmember->command,sizeof(temp_command_line)-1);
 		temp_command_line[sizeof(temp_command_line)-1]='\x0';
-		get_raw_command_line(temp_command_line,&raw_command_line[0],(int)sizeof(raw_command_line));
+		get_raw_command_line(temp_command_line, NULL, &raw_command_line[0],(int)sizeof(raw_command_line));
 
 		/* run the notification command */
 		if(strcmp(raw_command_line,"")){
Index: base/utils.c
===================================================================
RCS file: /cvsroot/nagios/nagios/base/utils.c,v
retrieving revision 1.12.2.1
diff -u -r1.12.2.1 utils.c
--- base/utils.c	22 Jun 2003 19:11:35 -0000	1.12.2.1
+++ base/utils.c	6 Dec 2003 11:24:37 -0000
@@ -1216,7 +1216,7 @@
 
 
 /* given a "raw" command, return the "expanded" or "whole" command line */
-void get_raw_command_line(char *cmd,char *raw_command,int buffer_length){
+void get_raw_command_line(char *cmd, char* args, char *raw_command,int buffer_length){
 	char temp_buffer[MAX_INPUT_BUFFER];
 	char *buffer;
 	command *temp_command;
@@ -1226,7 +1226,7 @@
 	printf("get_raw_command_line() start\n");
 #endif
 #ifdef DEBUG1
-	printf("\tInput: %s\n",cmd);
+	printf("\tInput: %s\n\t%s\n",cmd,args);
 #endif
 
 	/* initialize the command */
@@ -1264,6 +1264,8 @@
 	else{
 
 		strcpy(temp_buffer,cmd);
+        if (args != NULL) 
+            strcat(temp_buffer,args);
 
 		/* get the command name */
 		buffer=my_strtok(temp_buffer,"!");
Index: cgi/cgiutils.c
===================================================================
RCS file: /cvsroot/nagios/nagios/cgi/cgiutils.c,v
retrieving revision 1.17
diff -u -r1.17 cgiutils.c
--- cgi/cgiutils.c	11 Nov 2002 03:52:13 -0000	1.17
+++ cgi/cgiutils.c	6 Dec 2003 11:24:39 -0000
@@ -75,14 +75,16 @@
 extern int      enable_failure_prediction;
 extern int      process_performance_data;
 
-time_t          last_command_check=0L;
+//time_t          last_command_check=0L;
+extern time_t          last_command_check;
 
 int             check_external_commands=0;
 
 int             date_format=DATE_FORMAT_US;
 
 int             log_rotation_method=LOG_ROTATION_NONE;
-time_t          last_log_rotation=0L;
+//time_t          last_log_rotation=0L;
+extern time_t          last_log_rotation;
 
 time_t          this_scheduled_log_rotation=0L;
 time_t          last_scheduled_log_rotation=0L;
Index: cgi/config.c
===================================================================
RCS file: /cvsroot/nagios/nagios/cgi/config.c,v
retrieving revision 1.8
diff -u -r1.8 config.c
--- cgi/config.c	11 Nov 2002 01:13:09 -0000	1.8
+++ cgi/config.c	6 Dec 2003 11:24:39 -0000
@@ -502,8 +502,14 @@
 		printf("<TD CLASS='%s'>",bg_class);
 		if(temp_host->host_check_command==NULL)
 			printf("&nbsp;");
-		else
-		printf("<a href='%s?type=commands#%s'>%s</a></TD>\n",CONFIG_CGI,url_encode(temp_host->host_check_command),temp_host->host_check_command);
+		else {
+            if (temp_host->host_check_args == NULL )
+            printf("<a href='%s?type=commands#%s'>%s</a></TD>\n",CONFIG_CGI,url_encode(temp_host->host_check_command),temp_host->host_check_command);
+            else 
+            printf("<a href='%s?type=commands#%s%s'>%s%s</a></TD>\n",CONFIG_CGI,
+                    url_encode(temp_host->host_check_command),url_encode(temp_host->host_check_args),
+                    temp_host->host_check_command,temp_host->host_check_args);
+        }
 		printf("</TD>\n");
 
 		printf("<TD CLASS='%s'>",bg_class);
@@ -980,7 +986,13 @@
 		strncpy(command_line,temp_service->service_check_command,sizeof(command_line));
 		command_line[sizeof(command_line)-1]='\x0';
 		command_name=strtok(command_line,"!");
-		printf("<TD CLASS='%s'><A HREF='%s?type=commands#%s'>%s</A></TD>\n",bg_class,CONFIG_CGI,url_encode(command_name),temp_service->service_check_command);
+		printf("<TD CLASS='%s'><A HREF='%s?type=commands#%s'>", bg_class,CONFIG_CGI,url_encode(command_name));
+        if (temp_service->service_check_args != NULL)  {
+            printf("%s</A></TD>\n", temp_service->service_check_command);
+        } else {
+            printf("%s%s</A></TD>\n", temp_service->service_check_command,temp_service->service_check_args);
+        }
+        
 
 		printf("<TD CLASS='%s'>",bg_class);
 		if(temp_service->check_period==NULL)
Index: cgi/statuswrl.c
===================================================================
RCS file: /cvsroot/nagios/nagios/cgi/statuswrl.c,v
retrieving revision 1.7
diff -u -r1.7 statuswrl.c
--- cgi/statuswrl.c	23 Oct 2002 00:01:40 -0000	1.7
+++ cgi/statuswrl.c	6 Dec 2003 11:24:40 -0000
@@ -89,7 +89,7 @@
 void calculate_circular_coords(void);
 void calculate_circular_layer_coords(host *,double,double,int,int);
 
-char url_logo_images_path[MAX_FILENAME_LENGTH];
+extern char url_logo_images_path[MAX_FILENAME_LENGTH];
 
 authdata current_authdata;
 
Index: common/objects.c
===================================================================
RCS file: /cvsroot/nagios/nagios/common/objects.c,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 objects.c
--- common/objects.c	23 Nov 2003 01:37:22 -0000	1.5.2.2
+++ common/objects.c	6 Dec 2003 11:24:42 -0000
@@ -293,7 +293,12 @@
 
 
 /* add a new host definition */
-host *add_host(char *name, char *alias, char *address, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notification_interval, char *notification_period, int notifications_enabled, char *check_command, int checks_enabled, char *event_handler, int event_handler_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int stalk_up, int stalk_down, int stalk_unreachable, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int retain_status_information, int retain_nonstatus_information){
+host *add_host(char *name, char *alias, char *address, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notification_interval, 
+               char *notification_period, int notifications_enabled, 
+               char *check_command, char *check_args, int checks_enabled, char *event_handler, int event_handler_enabled, 
+               int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, 
+               int stalk_up, int stalk_down, int stalk_unreachable, int process_perfdata, 
+               int failure_prediction_enabled, char *failure_prediction_options, int retain_status_information, int retain_nonstatus_information){
 	host *temp_host;
 	host *new_host;
 	host *last_host;
@@ -320,6 +325,7 @@
 	strip(alias);
 	strip(address);
 	strip(check_command);
+	strip(check_args);
 	strip(event_handler);
 	strip(notification_period);
 
@@ -544,6 +550,7 @@
 	        }
 	else
 		new_host->notification_period=NULL;
+
 	if(check_command!=NULL && strcmp(check_command,"")){
 		new_host->host_check_command=strdup(check_command);
 		if(new_host->host_check_command==NULL){
@@ -563,6 +570,31 @@
 	        }
 	else
 		new_host->host_check_command=NULL;
+
+	if(check_args!=NULL && strcmp(check_args,"")){
+		new_host->host_check_args=strdup(check_args);
+		if(new_host->host_check_args==NULL){
+#ifdef NSCORE
+			snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not allocate memory for host '%s' check args\n",name);
+			temp_buffer[sizeof(temp_buffer)-1]='\x0';
+			write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE);
+#endif
+			if(new_host->notification_period!=NULL)
+				free(new_host->notification_period);
+
+			if(new_host->host_check_command !=NULL)
+				free(new_host->host_check_command);
+			free(new_host->address);
+			free(new_host->alias);
+			free(new_host->name);
+			free(new_host);
+			return NULL;
+		        }
+	        }
+	else
+		new_host->host_check_args=NULL;
+
+
 	if(event_handler!=NULL && strcmp(event_handler,"")){
 		new_host->event_handler=strdup(event_handler);
 		if(new_host->event_handler==NULL){
@@ -573,6 +605,9 @@
 #endif
 			if(new_host->host_check_command!=NULL)
 				free(new_host->host_check_command);
+
+			if(new_host->host_check_args!=NULL)
+				free(new_host->host_check_args);
 			if(new_host->notification_period!=NULL)
 				free(new_host->notification_period);
 			free(new_host->address);
@@ -596,6 +631,9 @@
 				free(new_host->event_handler);
 			if(new_host->host_check_command!=NULL)
 				free(new_host->host_check_command);
+
+			if(new_host->host_check_args!=NULL)
+				free(new_host->host_check_args);
 			if(new_host->notification_period!=NULL)
 				free(new_host->notification_period);
 			free(new_host->address);
@@ -673,6 +711,8 @@
 			free(new_host->event_handler);
 		if(new_host->host_check_command!=NULL)
 			free(new_host->host_check_command);
+		if(new_host->host_check_args!=NULL)
+			free(new_host->host_check_args);
 		if(new_host->notification_period!=NULL)
 			free(new_host->notification_period);
 		free(new_host->address);
@@ -697,6 +737,8 @@
 			free(new_host->event_handler);
 		if(new_host->host_check_command!=NULL)
 			free(new_host->host_check_command);
+		if(new_host->host_check_args!=NULL)
+			free(new_host->host_check_args);
 		if(new_host->notification_period!=NULL)
 			free(new_host->notification_period);
 		free(new_host->address);
@@ -739,6 +781,7 @@
 	printf("\tHost Alias:               %s\n",new_host->alias);
         printf("\tHost Address:             %s\n",new_host->address);
 	printf("\tHost Check Command:       %s\n",new_host->host_check_command);
+	printf("\tHost Check Args:          %s\n",new_host->host_check_args);
 	printf("\tMax. Check Attempts:      %d\n",new_host->max_attempts);
 	printf("\tHost Event Handler:       %s\n",(new_host->event_handler==NULL)?"N/A":new_host->event_handler);
 	printf("\tNotify On Down:           %s\n",(new_host->notify_on_down==1)?"yes":"no");
@@ -1678,7 +1721,14 @@
 
 
 /* add a new service to the list in memory */
-service *add_service(char *host_name, char *description, char *check_period, int max_attempts, int parallelize, int accept_passive_checks, int check_interval, int retry_interval, int notification_interval, char *notification_period, int notify_recovery, int notify_unknown, int notify_warning, int notify_critical, int notifications_enabled, int is_volatile, char *event_handler, int event_handler_enabled, char *check_command, int checks_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int stalk_ok, int stalk_warning, int stalk_unknown, int stalk_critical, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, int retain_status_information, int retain_nonstatus_information, int obsess_over_service){
+service *add_service(char *host_name, char *description, char *check_period, 
+                     int max_attempts, int parallelize, int accept_passive_checks, int check_interval, int retry_interval, int notification_interval, 
+                     char *notification_period, int notify_recovery, int notify_unknown, int notify_warning, int notify_critical, int notifications_enabled, int is_volatile, 
+                     char *event_handler, int event_handler_enabled, 
+                     char *check_command, char *check_args, int checks_enabled, int flap_detection_enabled, 
+                     double low_flap_threshold, double high_flap_threshold, int stalk_ok, int stalk_warning, int stalk_unknown, int stalk_critical, 
+                     int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, 
+                     int retain_status_information, int retain_nonstatus_information, int obsess_over_service){
 	service *temp_service;
 	service *new_service;
 	service *last_service;
@@ -1704,6 +1754,7 @@
 	strip(host_name);
 	strip(description);
 	strip(check_command);
+	strip(check_args);
 	strip(event_handler);
 	strip(notification_period);
 	strip(check_period);
@@ -1974,6 +2025,26 @@
 		free(new_service);
 		return NULL;
 	        }
+
+	if(check_args !=NULL && strcmp(check_args,"")){
+        new_service->service_check_args=strdup(check_args);
+        if(new_service->service_check_args==NULL){
+    #ifdef NSCORE
+            snprintf(temp_buffer,sizeof(temp_buffer)-1,"Error: Could not allocate memory for service '%s' on host '%s' check args\n",description,host_name);
+            temp_buffer[sizeof(temp_buffer)-1]='\x0';
+            write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE);
+    #endif
+			free(new_service->service_check_args);
+            free(new_service->description);
+            free(new_service->host_name);
+            free(new_service);
+            return NULL;
+                }
+    }
+    else 
+        new_service->service_check_args = NULL;
+
+
 	if(event_handler!=NULL && strcmp(event_handler,"")){
 		new_service->event_handler=strdup(event_handler);
 		if(new_service->event_handler==NULL){
@@ -1983,6 +2054,8 @@
 			write_to_logs_and_console(temp_buffer,NSLOG_CONFIG_ERROR,TRUE);
 #endif
 			free(new_service->service_check_command);
+            if (new_service->service_check_args != NULL );
+                free(new_service->service_check_args);
 			free(new_service->description);
 			free(new_service->host_name);
 			free(new_service);
@@ -2001,6 +2074,9 @@
 #endif
 			if(new_service->event_handler!=NULL)
 				free(new_service->event_handler);
+
+			if(new_service->service_check_args!=NULL)
+				free(new_service->service_check_args);
 			free(new_service->service_check_command);
 			free(new_service->description);
 			free(new_service->host_name);
@@ -2022,6 +2098,9 @@
 				free(new_service->notification_period);
 			if(new_service->event_handler!=NULL)
 				free(new_service->event_handler);
+
+			if(new_service->service_check_args!=NULL)
+				free(new_service->service_check_args);
 			free(new_service->service_check_command);
 			free(new_service->description);
 			free(new_service->host_name);
@@ -2045,6 +2124,9 @@
 				free(new_service->notification_period);
 			if(new_service->event_handler!=NULL)
 				free(new_service->event_handler);
+
+			if(new_service->service_check_args!=NULL)
+				free(new_service->service_check_args);
 			free(new_service->service_check_command);
 			free(new_service->description);
 			free(new_service->host_name);
@@ -2141,6 +2223,9 @@
 			free(new_service->notification_period);
 		if(new_service->event_handler!=NULL)
 			free(new_service->event_handler);
+
+		if(new_service->service_check_args!=NULL)
+			free(new_service->service_check_args);
 		free(new_service->service_check_command);
 		free(new_service->description);
 		free(new_service->host_name);
@@ -2163,6 +2248,9 @@
 			free(new_service->notification_period);
 		if(new_service->event_handler!=NULL)
 			free(new_service->event_handler);
+
+		if(new_service->service_check_args!=NULL)
+			free(new_service->service_check_args);
 		free(new_service->service_check_command);
 		free(new_service->description);
 		free(new_service->host_name);
@@ -2211,6 +2299,7 @@
 	printf("\tHost:                     %s\n",new_service->host_name);
 	printf("\tDescription:              %s\n",new_service->description);
 	printf("\tCommand:                  %s\n",new_service->service_check_command);
+	printf("\tArgs:                     %s\n",new_service->service_check_args);
 	printf("\tCheck Interval:           %d\n",new_service->check_interval);
 	printf("\tRetry Interval:           %d\n",new_service->retry_interval);
 	printf("\tMax attempts:             %d\n",new_service->max_attempts);
@@ -4024,6 +4113,8 @@
 		free(this_host->perf_data);
 #endif
 		free(this_host->host_check_command);
+        if (this_host->host_check_args != NULL) 
+            free(this_host->host_check_args);
 		free(this_host->event_handler);
 		free(this_host->failure_prediction_options);
 		free(this_host->notification_period);
@@ -4156,6 +4247,8 @@
 		free(this_service->host_name);
 		free(this_service->description);
 		free(this_service->service_check_command);
+        if (this_service->service_check_args != NULL) 
+            free(this_service->service_check_args);
 #ifdef NSCORE
 		free(this_service->plugin_output);
 		free(this_service->perf_data);
Index: common/objects.h
===================================================================
RCS file: /cvsroot/nagios/nagios/common/Attic/objects.h,v
retrieving revision 1.2
diff -u -r1.2 objects.h
--- common/objects.h	20 Apr 2002 22:20:43 -0000	1.2
+++ common/objects.h	6 Dec 2003 11:24:42 -0000
@@ -96,6 +96,8 @@
 	char    *address;
         hostsmember *parent_hosts;
 	char    *host_check_command;
+    /* IANH: allow to template the check_command and not the args */
+	char    *host_check_args;
 	int     max_attempts;
 	char    *event_handler;
 	int     notification_interval;
@@ -204,6 +206,8 @@
 	char	*host_name;
 	char	*description;
         char    *service_check_command;
+    /* IANH: allow to template the check_command and not the args */
+	char    *service_check_args;
 	char    *event_handler;
 	int	check_interval;
 	int     retry_interval;
@@ -389,7 +393,7 @@
 contact *add_contact(char *,char *,char *,char *,char *,char *,int,int,int,int,int,int,int);		/* adds a contact definition */
 commandsmember *add_service_notification_command_to_contact(contact *,char *);				/* adds a service notification command to a contact definition */
 commandsmember *add_host_notification_command_to_contact(contact *,char *);				/* adds a host notification command to a contact definition */
-host *add_host(char *,char *,char *,int,int,int,int,int,char *,int,char *,int,char *,int,int,double,double,int,int,int,int,int,char *,int,int);	/* adds a host definition */
+host *add_host(char *,char *,char *,int,int,int,int,int,char *,int,char *, char*, int,char *,int,int,double,double,int,int,int,int,int,char *,int,int);	/* adds a host definition */
 hostsmember *add_parent_host_to_host(host *,char *);							/* adds a parent host to a host definition */
 timeperiod *add_timeperiod(char *,char *);								/* adds a timeperiod definition */
 timerange *add_timerange_to_timeperiod(timeperiod *,int,unsigned long,unsigned long);			/* adds a timerange to a timeperiod definition */
@@ -399,7 +403,7 @@
 contactgroup *add_contactgroup(char *,char *);								/* adds a contactgroup definition */
 contactgroupmember *add_contact_to_contactgroup(contactgroup *,char *);					/* adds a contact to a contact group defintion */
 command *add_command(char *,char *);									/* adds a command definition */
-service *add_service(char *,char *,char *,int,int,int,int,int,int,char *,int,int,int,int,int,int,char *,int,char *,int,int,double,double,int,int,int,int,int,int,char *,int,int,int,int,int);	/* adds a service definition */
+service *add_service(char *,char *,char *,int,int,int,int,int,int,char *,int,int,int,int,int,int,char *,int,char *, char*, int,int,double,double,int,int,int,int,int,int,char *,int,int,int,int,int);	/* adds a service definition */
 contactgroupsmember *add_contactgroup_to_service(service *,char *);					/* adds a contact group to a service definition */
 serviceescalation *add_serviceescalation(char *,char *,int,int,int);                                    /* adds a service escalation definition */
 contactgroupsmember *add_contactgroup_to_serviceescalation(serviceescalation *,char *);                 /* adds a contact group to a service escalation definition */
Index: xdata/xodtemplate.c
===================================================================
RCS file: /cvsroot/nagios/nagios/xdata/xodtemplate.c,v
retrieving revision 1.20.2.2
diff -u -r1.20.2.2 xodtemplate.c
--- xdata/xodtemplate.c	23 Nov 2003 01:37:22 -0000	1.20.2.2
+++ xdata/xodtemplate.c	6 Dec 2003 11:24:46 -0000
@@ -928,6 +928,7 @@
 		new_host->address=NULL;
 		new_host->parents=NULL;
 		new_host->check_command=NULL;
+		new_host->check_args=NULL;
 		new_host->event_handler=NULL;
 		new_host->notification_period=NULL;
 
@@ -994,6 +995,7 @@
 		new_service->host_name=NULL;
 		new_service->service_description=NULL;
 		new_service->check_command=NULL;
+		new_service->check_args=NULL;
 		new_service->check_period=NULL;
 		new_service->event_handler=NULL;
 		new_service->notification_period=NULL;
@@ -2085,6 +2087,15 @@
 				return ERROR;
 			        }
 		        }
+		else if(!strcmp(variable,"check_args")){
+			temp_host->check_args=strdup(value);
+			if(temp_host->check_args==NULL){
+#ifdef DEBUG1
+				printf("Error: Could not allocate memory for host check_args.\n");
+#endif
+				return ERROR;
+			        }
+		        }
 		else if(!strcmp(variable,"event_handler")){
 			temp_host->event_handler=strdup(value);
 			if(temp_host->event_handler==NULL){
@@ -2265,6 +2276,15 @@
 				return ERROR;
 			        }
 		        }
+		else if(!strcmp(variable,"check_args")){
+			temp_service->check_args=strdup(value);
+			if(temp_service->check_args==NULL){
+#ifdef DEBUG1
+				printf("Error: Could not allocate memory for service check_args.\n");
+#endif
+				return ERROR;
+			        }
+		        }
 		else if(!strcmp(variable,"check_period")){
 			temp_service->check_period=strdup(value);
 			if(temp_service->check_period==NULL){
@@ -3210,6 +3230,7 @@
 	new_service->host_name=NULL;
 	new_service->service_description=NULL;
 	new_service->check_command=NULL;
+	new_service->check_args=NULL;
 	new_service->check_period=NULL;
 	new_service->event_handler=NULL;
 	new_service->notification_period=NULL;
@@ -3336,6 +3357,23 @@
 			return ERROR;
 		        }
 	        } 
+	if(temp_service->check_args!=NULL){
+		new_service->check_args=strdup(temp_service->check_args);
+		if(new_service->check_args==NULL){
+#ifdef DEBUG1
+			printf("Error: Could not allocate memory for duplicate definition of service.\n");
+#endif
+			free(new_service->check_command);
+			free(new_service->host_name);
+			free(new_service->template);
+			free(new_service->name);
+			free(new_service->service_description);
+			free(new_service);
+			return ERROR;
+		        }
+	        } 
+
+
 	if(temp_service->check_period!=NULL){
 		new_service->check_period=strdup(temp_service->check_period);
 		if(new_service->check_period==NULL){
@@ -3347,6 +3385,7 @@
 			free(new_service->name);
 			free(new_service->service_description);
 			free(new_service->check_command);
+			free(new_service->check_args);
 			free(new_service);
 			return ERROR;
 		        }
@@ -3362,6 +3401,7 @@
 			free(new_service->name);
 			free(new_service->service_description);
 			free(new_service->check_command);
+			free(new_service->check_args);
 			free(new_service->check_period);
 			free(new_service);
 			return ERROR;
@@ -3378,6 +3418,7 @@
 			free(new_service->name);
 			free(new_service->service_description);
 			free(new_service->check_command);
+			free(new_service->check_args);
 			free(new_service->check_period);
 			free(new_service->event_handler);
 			free(new_service);
@@ -3395,6 +3436,7 @@
 			free(new_service->name);
 			free(new_service->service_description);
 			free(new_service->check_command);
+			free(new_service->check_args);
 			free(new_service->check_period);
 			free(new_service->event_handler);
 			free(new_service->notification_period);
@@ -3413,6 +3455,7 @@
 			free(new_service->name);
 			free(new_service->service_description);
 			free(new_service->check_command);
+			free(new_service->check_args);
 			free(new_service->check_period);
 			free(new_service->event_handler);
 			free(new_service->notification_period);
@@ -4622,6 +4665,8 @@
 		this_host->parents=strdup(template_host->parents);
 	if(this_host->check_command==NULL && template_host->check_command!=NULL)
 		this_host->check_command=strdup(template_host->check_command);
+	if(this_host->check_args==NULL && template_host->check_args!=NULL)
+		this_host->check_args=strdup(template_host->check_args);
 	if(this_host->event_handler==NULL && template_host->event_handler!=NULL)
 		this_host->event_handler=strdup(template_host->event_handler);
 	if(this_host->notification_period==NULL && template_host->notification_period!=NULL)
@@ -4742,6 +4787,8 @@
 		this_service->service_description=strdup(template_service->service_description);
 	if(this_service->check_command==NULL && template_service->check_command!=NULL)
 		this_service->check_command=strdup(template_service->check_command);
+	if(this_service->check_args==NULL && template_service->check_args!=NULL)
+		this_service->check_args=strdup(template_service->check_args);
 	if(this_service->check_period==NULL && template_service->check_period!=NULL)
 		this_service->check_period=strdup(template_service->check_period);
 	if(this_service->event_handler==NULL && template_service->event_handler!=NULL)
@@ -5939,7 +5986,7 @@
 		return OK;
 
 	/* add the host definition */
-	new_host=add_host(this_host->host_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notification_interval,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->retain_status_information,this_host->retain_nonstatus_information);
+	new_host=add_host(this_host->host_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notification_interval,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->check_args, this_host->checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->retain_status_information,this_host->retain_nonstatus_information);
 
 	/* return with an error if we couldn't add the host */
 	if(new_host==NULL){
@@ -5995,7 +6042,7 @@
 		return OK;
 
 	/* add the service */
-	new_service=add_service(this_service->host_name,this_service->service_description,this_service->check_period,this_service->max_check_attempts,this_service->parallelize_check,this_service->passive_checks_enabled,this_service->normal_check_interval,this_service->retry_check_interval,this_service->notification_interval,this_service->notification_period,this_service->notify_on_recovery,this_service->notify_on_unknown,this_service->notify_on_warning,this_service->notify_on_critical,this_service->notifications_enabled,this_service->is_volatile,this_service->event_handler,this_service->event_handler_enabled,this_service->check_command,this_service->active_checks_enabled,this_service->flap_detection_enabled,this_service->low_flap_threshold,this_service->high_flap_threshold,this_service->stalk_on_ok,this_service->stalk_on_warning,this_service->stalk_on_unknown,this_service->stalk_on_critical,this_service->process_perf_data,this_service->failure_prediction_enabled,this_service->failure_prediction_options,this_service->check_freshness,this_service->freshness_threshold,this_service->retain_status_information,this_service->retain_nonstatus_information,this_service->obsess_over_service);
+	new_service=add_service(this_service->host_name,this_service->service_description,this_service->check_period,this_service->max_check_attempts,this_service->parallelize_check,this_service->passive_checks_enabled,this_service->normal_check_interval,this_service->retry_check_interval,this_service->notification_interval,this_service->notification_period,this_service->notify_on_recovery,this_service->notify_on_unknown,this_service->notify_on_warning,this_service->notify_on_critical,this_service->notifications_enabled,this_service->is_volatile,this_service->event_handler,this_service->event_handler_enabled,this_service->check_command,this_service->check_args, this_service->active_checks_enabled,this_service->flap_detection_enabled,this_service->low_flap_threshold,this_service->high_flap_threshold,this_service->stalk_on_ok,this_service->stalk_on_warning,this_service->stalk_on_unknown,this_service->stalk_on_critical,this_service->process_perf_data,this_service->failure_prediction_enabled,this_service->failure_prediction_options,this_service->check_freshness,this_service->freshness_threshold,this_service->retain_status_information,this_service->retain_nonstatus_information,this_service->obsess_over_service);
 
 	/* return with an error if we couldn't add the service */
 	if(new_service==NULL){
@@ -6281,6 +6328,7 @@
 		free(this_host->address);
 		free(this_host->parents);
 		free(this_host->check_command);
+		free(this_host->check_args);
 		free(this_host->event_handler);
 		free(this_host->notification_period);
 		free(this_host->failure_prediction_options);
@@ -6296,6 +6344,7 @@
 		free(this_service->host_name);
 		free(this_service->service_description);
 		free(this_service->check_command);
+		free(this_service->check_args);
 		free(this_service->check_period);
 		free(this_service->event_handler);
 		free(this_service->notification_period);
Index: xdata/xodtemplate.h
===================================================================
RCS file: /cvsroot/nagios/nagios/xdata/xodtemplate.h,v
retrieving revision 1.7
diff -u -r1.7 xodtemplate.h
--- xdata/xodtemplate.h	20 Aug 2002 02:43:19 -0000	1.7
+++ xdata/xodtemplate.h	6 Dec 2003 11:24:47 -0000
@@ -146,6 +146,7 @@
 	char      *address;
 	char      *parents;
 	char      *check_command;
+	char      *check_args;
 	int       max_check_attempts;
 	int       checks_enabled;
 	char      *event_handler;
@@ -241,6 +242,7 @@
 	char       *host_name;
 	char       *service_description;
 	char       *check_command;
+	char       *check_args;
 	int        max_check_attempts;
         int        normal_check_interval;
         int        retry_check_interval;
