[hackers] [sbase] Use a return value to signal an invalid backslash || sin

From: <git_AT_suckless.org>
Date: Mon, 06 Jan 2014 19:22:05 +0100

commit 3aec0ac2a4a95b4a1b04eca2502495568f0aa7c4
Author: sin <sin_AT_2f30.org>
Date: Mon Jan 6 18:20:26 2014 +0000

    Use a return value to signal an invalid backslash
    
    Just for consistency with the rest of the code.

diff --git a/xargs.c b/xargs.c
index 800d4e8..9a0b74c 100644
--- a/xargs.c
+++ b/xargs.c
_AT_@ -17,7 +17,7 @@ static void deinputc(int);
 static void fillbuf(int);
 static int eatspace(void);
 static int parsequote(int);
-static void parseescape(void);
+static int parseescape(void);
 static char *poparg(void);
 static void pusharg(char *);
 static void runcmd(void);
_AT_@ -160,7 +160,7 @@ parsequote(int q)
         return -1;
 }
 
-static void
+static int
 parseescape(void)
 {
         int ch;
_AT_@ -168,9 +168,9 @@ parseescape(void)
         if ((ch = inputc()) != EOF) {
                 fillbuf(ch);
                 argbpos++;
- return;
+ return ch;
         }
- enprintf(EXIT_FAILURE, "backslash at EOF
");
+ return -1;
 }
 
 static char *
_AT_@ -198,7 +198,8 @@ poparg(void)
                                          "unterminated double quote
");
                         break;
                 case '\':
- parseescape();
+ if (parseescape() == -1)
+ enprintf(EXIT_FAILURE, "backslash at EOF
");
                         break;
                 default:
                         fillbuf(ch);
Received on Mon Jan 06 2014 - 19:22:05 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 06 2014 - 19:24:13 CET