Implement simple quoting for command args.

Previously "abc xyz" became 2 args split at the space.
This commit is contained in:
Adam David 1995-10-30 14:03:00 +00:00
parent 904890f6c0
commit 32b505b222
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11933

View File

@ -40,7 +40,7 @@ static char copyright[] =
#ifndef lint
/* from: @(#)inetd.c 8.4 (Berkeley) 4/13/94"; */
static char inetd_c_rcsid[] =
"$Id: inetd.c,v 1.6 1995/06/11 19:32:39 rgrimes Exp $";
"$Id: inetd.c,v 1.7 1995/10/12 16:43:26 wollman Exp $";
#endif /* not lint */
/*
@ -1006,6 +1006,7 @@ skip(cpp)
{
char *cp = *cpp;
char *start;
char quote = '\0';
again:
while (*cp == ' ' || *cp == '\t')
@ -1021,9 +1022,15 @@ again:
*cpp = (char *)0;
return ((char *)0);
}
if (*cp == '"' || *cp == '\'')
quote = *cp++;
start = cp;
while (*cp && *cp != ' ' && *cp != '\t')
cp++;
if (quote)
while (*cp && *cp != quote)
cp++;
else
while (*cp && *cp != ' ' && *cp != '\t')
cp++;
if (*cp != '\0')
*cp++ = '\0';
*cpp = cp;