Allow reserved substitution strings to be escaped by preceeding them

with a backslash.
This commit is contained in:
Brian Somers 1999-06-10 09:34:57 +00:00
parent 194c225d5c
commit 5dfb9210ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47865

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.200 1999/06/09 08:47:32 brian Exp $
* $Id: command.c,v 1.201 1999/06/09 16:54:02 brian Exp $
*
*/
#include <sys/param.h>
@ -144,7 +144,7 @@
#define NEG_VJCOMP 53
const char Version[] = "2.22";
const char VersionDate[] = "$Date: 1999/06/09 08:47:32 $";
const char VersionDate[] = "$Date: 1999/06/09 16:54:02 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@ -354,10 +354,12 @@ strstrword(char *big, const char *little)
len = strlen(little);
while ((pos = strstr(pos, little)) != NULL)
if ((pos == big || !isinword(pos[-1])) && !isinword(pos[len]))
break;
else
if ((pos != big && isinword(pos[-1])) || isinword(pos[len]))
pos++;
else if (pos != big && pos[-1] == '\\')
memmove(pos - 1, pos, strlen(pos) + 1);
else
break;
return pos;
}