index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Rikard Falkeborn <rikard.falkeborn@gmail.com> | 2015-12-31 14:19:30 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-01-04 14:05:28 +1000 |
commit | 88f348f2b15fed8a7b92085d01ffeced117f3599 (patch) | |
tree | 76624059ea37befbf7b5dc3638b1d995463a7e12 /src | |
parent | 875c017e4d74bd29bc7424c2c7ff2050f90b7767 (diff) |
-rw-r--r-- | src/util/pacsort.c | 11 |
diff --git a/src/util/pacsort.c b/src/util/pacsort.c index f4992d49..c69ae2f0 100644 --- a/src/util/pacsort.c +++ b/src/util/pacsort.c @@ -28,6 +28,7 @@ #include "util-common.h" #define DELIM ' ' +#define INVALD_ESCAPE_CHAR ((char)-1) #ifndef MIN #define MIN(a, b) \ @@ -385,13 +386,13 @@ static int vercmp(const void *p1, const void *p2) static char escape_char(const char *string) { if(!string) { - return -1; + return INVALD_ESCAPE_CHAR; } const size_t len = strlen(string); if(len > 2) { - return -1; + return INVALD_ESCAPE_CHAR; } if(len == 1) { @@ -399,7 +400,7 @@ static char escape_char(const char *string) } if(*string != '\\') { - return -1; + return INVALD_ESCAPE_CHAR; } switch(string[1]) { @@ -412,7 +413,7 @@ static char escape_char(const char *string) case '0': return '\0'; default: - return -1; + return INVALD_ESCAPE_CHAR; } } @@ -463,7 +464,7 @@ static int parse_options(int argc, char **argv) break; case 't': opts.delim = escape_char(optarg); - if(opts.delim == -1) { + if(opts.delim == INVALD_ESCAPE_CHAR) { fprintf(stderr, "error: invalid field separator -- `%s'\n", optarg); return 1; } |