parent
bfffcce2fe
commit
ca7c70f5be
|
@ -755,29 +755,29 @@ preproc_expr(cell * val, int *tag)
|
||||||
* character that caused the input to be ended.
|
* character that caused the input to be ended.
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
getstring(char *dest, int max, char *line)
|
getstring(char *dest, int max)
|
||||||
{
|
{
|
||||||
assert(dest != NULL && line != NULL);
|
assert(dest != NULL);
|
||||||
*dest = '\0';
|
*dest = '\0';
|
||||||
while (*line <= ' ' && *line != '\0')
|
while (*lptr <= ' ' && *lptr != '\0')
|
||||||
line++; /* skip whitespace */
|
lptr++; /* skip whitespace */
|
||||||
if (*line != '"')
|
if (*lptr != '"')
|
||||||
{
|
{
|
||||||
error(37); /* invalid string */
|
error(37); /* invalid string */
|
||||||
}
|
}
|
||||||
else if (*line == '\0')
|
else
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
line++; /* skip " */
|
lptr++; /* skip " */
|
||||||
while (*line != '"' && *line != '\0')
|
while (*lptr != '"' && *lptr != '\0')
|
||||||
{
|
{
|
||||||
if (len < max - 1)
|
if (len < max - 1)
|
||||||
dest[len++] = *line;
|
dest[len++] = *lptr;
|
||||||
line++;
|
lptr++;
|
||||||
} /* if */
|
} /* if */
|
||||||
dest[len] = '\0';
|
dest[len] = '\0';
|
||||||
if (*line == '"')
|
if (*lptr == '"')
|
||||||
lptr++; /* skip closing " */
|
lptr++; /* skip closing " */
|
||||||
else
|
else
|
||||||
error(37); /* invalid string */
|
error(37); /* invalid string */
|
||||||
|
@ -925,7 +925,7 @@ command(void)
|
||||||
{
|
{
|
||||||
char pathname[PATH_MAX];
|
char pathname[PATH_MAX];
|
||||||
|
|
||||||
lptr = getstring(pathname, sizeof pathname, lptr);
|
lptr = getstring(pathname, sizeof pathname);
|
||||||
if (pathname[0] != '\0')
|
if (pathname[0] != '\0')
|
||||||
{
|
{
|
||||||
free(inpfname);
|
free(inpfname);
|
||||||
|
@ -984,7 +984,7 @@ command(void)
|
||||||
lptr++;
|
lptr++;
|
||||||
if (*lptr == '"')
|
if (*lptr == '"')
|
||||||
{
|
{
|
||||||
lptr = getstring(name, sizeof name, lptr);
|
lptr = getstring(name, sizeof name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue