From a07ea601993559e25f46f73dba9eae1e726b61ce Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Sat, 21 Apr 2001 23:01:13 +0000 Subject: [PATCH] reworked \\ parsing in commandfd. --- ChangeLog | 4 ++++ main/main.c | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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) { -- 2.39.5