From: Adam Heath Date: Sat, 21 Apr 2001 23:01:13 +0000 (+0000) Subject: reworked \\ parsing in commandfd. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a07ea601993559e25f46f73dba9eae1e726b61ce;p=dpkg reworked \\ parsing in commandfd. --- diff --git a/ChangeLog b/ChangeLog index c6ffde49..1e20e0c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sat Apr 21 18:00:31 CDT 2001 Adam Heath + + * main/main.c: reworked \\ parsing in commandfd. + Sun Apr 22 00:48:18 CEST 2001 Wichert Akkerman * main/main.c: fixed some bizar pointer usage diff --git a/main/main.c b/main/main.c index 7f107dfe..08a10728 100644 --- a/main/main.c +++ b/main/main.c @@ -429,7 +429,7 @@ void commandfd(const char *const *argv) { const char **newargs; char *ptr, *endptr; FILE *in; - int c, lno, infd, i; + int c, lno, infd, i, skipchar; static void (*actionfunction)(const char *const *argv); if ((pipein= *argv++) == NULL) badusage(_("--command-fd takes 1 argument, not 0")); @@ -470,9 +470,14 @@ printf("line=`%*s'\n",linevb.used,linevb.buf); argc= 1; ptr= linevb.buf; endptr= ptr + linevb.used; + skipchar= 0; while(ptr < endptr) { - if (*ptr == '\\') { + if (skipchar) { + skipchar= 0; + } else if (*ptr == '\\') { memmove(ptr, (ptr+1), (linevb.used-(linevb.buf - ptr)-1)); + endptr--; + skipchar= 1; continue; } else if (isspace(*ptr)) { if (mode == 1) {