Use a return value to signal an invalid backslash
Just for consistency with the rest of the code.
This commit is contained in:
parent
bb4d7a0e7e
commit
3aec0ac2a4
11
xargs.c
11
xargs.c
|
@ -17,7 +17,7 @@ static void deinputc(int);
|
||||||
static void fillbuf(int);
|
static void fillbuf(int);
|
||||||
static int eatspace(void);
|
static int eatspace(void);
|
||||||
static int parsequote(int);
|
static int parsequote(int);
|
||||||
static void parseescape(void);
|
static int parseescape(void);
|
||||||
static char *poparg(void);
|
static char *poparg(void);
|
||||||
static void pusharg(char *);
|
static void pusharg(char *);
|
||||||
static void runcmd(void);
|
static void runcmd(void);
|
||||||
|
@ -160,7 +160,7 @@ parsequote(int q)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
parseescape(void)
|
parseescape(void)
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
@ -168,9 +168,9 @@ parseescape(void)
|
||||||
if ((ch = inputc()) != EOF) {
|
if ((ch = inputc()) != EOF) {
|
||||||
fillbuf(ch);
|
fillbuf(ch);
|
||||||
argbpos++;
|
argbpos++;
|
||||||
return;
|
return ch;
|
||||||
}
|
}
|
||||||
enprintf(EXIT_FAILURE, "backslash at EOF\n");
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -198,7 +198,8 @@ poparg(void)
|
||||||
"unterminated double quote\n");
|
"unterminated double quote\n");
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
parseescape();
|
if (parseescape() == -1)
|
||||||
|
enprintf(EXIT_FAILURE, "backslash at EOF\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fillbuf(ch);
|
fillbuf(ch);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user