commit cec487585cad1d652dfafd9d41cf1f9dcff265be
parent e96144118e239e99070d7de79a980c777cfa36bc
Author: sin <sin@2f30.org>
Date: Wed, 8 Jan 2014 20:22:10 +0000
Rename pusharg() to deinputstr()
Diffstat:
M | xargs.c | | | 26 | ++++++++++++-------------- |
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/xargs.c b/xargs.c
@@ -19,7 +19,7 @@ static int eatspace(void);
static int parsequote(int);
static int parseescape(void);
static char *poparg(void);
-static void pusharg(char *);
+static void deinputstr(char *);
static void waitchld(void);
static void runcmd(void);
@@ -86,7 +86,7 @@ main(int argc, char *argv[])
i >= NARGS - 1) {
if (strlen(arg) + 1 > argmaxsz)
enprintf(EXIT_FAILURE, "insufficient argument space\n");
- pusharg(arg);
+ deinputstr(arg);
break;
}
cmd[i] = strdup(arg);
@@ -123,6 +123,15 @@ deinputc(int ch)
}
static void
+deinputstr(char *arg)
+{
+ char *p;
+
+ for (p = &arg[strlen(arg) - 1]; p >= arg; p--)
+ deinputc(*p);
+}
+
+static void
fillargbuf(int ch)
{
if (argbpos >= argbsz) {
@@ -157,10 +166,8 @@ parsequote(int q)
int ch;
while ((ch = inputc()) != EOF) {
- if (ch == q) {
- fillargbuf('\0');
+ if (ch == q)
return 0;
- }
if (ch != '\n') {
fillargbuf(ch);
argbpos++;
@@ -226,15 +233,6 @@ out:
}
static void
-pusharg(char *arg)
-{
- char *p;
-
- for (p = &arg[strlen(arg) - 1]; p >= arg; p--)
- deinputc(*p);
-}
-
-static void
waitchld(void)
{
int status;