Fix a bug that prevented %'s and \'s from being passed to the program

invoked.

Submitted by:	fenner@parc.xerox.com (Bill Fenner)
This commit is contained in:
joerg 1995-09-10 13:02:56 +00:00
parent 167f3fbb04
commit b4e6cbbd8a

View File

@ -16,7 +16,7 @@
*/
#if !defined(lint) && !defined(LINT)
static char rcsid[] = "$Id: do_command.c,v 1.4 1995/04/14 21:54:18 ache Exp $";
static char rcsid[] = "$Id: do_command.c,v 1.5 1995/05/30 03:47:00 rgrimes Exp $";
#endif
@ -122,13 +122,21 @@ child_process(e, u)
* command, and subsequent characters are the additional input to
* the command. Subsequent %'s will be transformed into newlines,
* but that happens later.
*
* If there are escaped %'s, remove the escape character.
*/
/*local*/{
register int escaped = FALSE;
register int ch;
register char *p;
for (input_data = e->cmd; ch = *input_data; input_data++) {
for (input_data = p = e->cmd; ch = *input_data;
input_data++, p++) {
if (p != input_data)
*p = ch;
if (escaped) {
if (ch == '%' || ch == '\\')
*--p = ch;
escaped = FALSE;
continue;
}
@ -141,6 +149,7 @@ child_process(e, u)
break;
}
}
*p = '\0';
}
/* fork again, this time so we can exec the user's command.