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:
parent
6b435e575c
commit
86ed6de3b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=10660
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user