--- utils.c	2006-04-07 15:45:33.000000000 -0600
+++ ../../nagios-2.2/base/utils.c	2006-04-20 13:21:29.000000000 -0600
@@ -2937,6 +2937,7 @@
 	command *temp_command;
 	int x,y;
 	int arg_index;
+	int escape_me;
 
 #ifdef DEBUG0
 	printf("get_raw_command_line() start\n");
@@ -2969,9 +2970,19 @@
 	/* lookup the command... */
 
 	/* get the command name */
-	for(x=0,y=0;y<buffer_length-1;x++){
-		if(cmd[x]=='!' || cmd[x]=='\x0')
-			break;
+	escape_me = 0;
+	for(x=0,y=0;y<buffer_length-1 && cmd[x];x++){
+		if (!escape_me) {
+			if (cmd[x]=='\\') {
+				escape_me = 1;
+				continue;
+			}
+
+			if(cmd[x]=='!')
+				break;
+			}
+		else
+			escape_me = 0;
 		raw_command[y]=cmd[x];
 		y++;
 	        }
@@ -2989,9 +3000,18 @@
 	strip(raw_command);
 
 	/* skip the command name (we're about to get the arguments)... */
-	for(arg_index=0;;arg_index++){
-		if(cmd[arg_index]=='!' || cmd[arg_index]=='\x0')
-			break;
+	escape_me = 0;
+	for(arg_index=0; cmd[arg_index]; arg_index++){
+		if (!escape_me) {
+			if (cmd[arg_index]=='\\') {
+				escape_me = 1;
+				continue;
+			}
+			if(cmd[arg_index]=='!')
+				break;
+		        }
+		else
+			escape_me = 0;
 	        }
 
 	/* get the command arguments */
@@ -3003,9 +3023,18 @@
 
 		/* get the next argument */
 		/* can't use strtok(), as that's used in process_macros... */
-		for(arg_index++,y=0;y<sizeof(temp_arg)-1;arg_index++){
-			if(cmd[arg_index]=='!' || cmd[arg_index]=='\x0')
-				break;
+		escape_me = 0;
+		for(arg_index++,y=0; y<sizeof(temp_arg)-1 && cmd[arg_index]; arg_index++){
+			if (!escape_me) {
+				if (cmd[arg_index]=='\\') {
+					escape_me = 1;
+					continue;
+				}
+				if(cmd[arg_index]=='!')
+					break;
+				}
+			else
+				escape_me = 0;
 			temp_arg[y]=cmd[arg_index];
 			y++;
 		        }
@@ -3017,6 +3046,9 @@
 
 		strip(arg_buffer);
 		macro_argv[x]=strdup(arg_buffer);
+#ifdef DEBUG1
+	printf("\ttempArg[%d]: %s\n",x,temp_arg);
+#endif
 	        }
 
 #ifdef DEBUG1
 
 