From: ceriel Date: Mon, 18 Feb 1991 15:25:11 +0000 (+0000) Subject: prevent multiple occurrences of TOKSEP in replace.c X-Git-Tag: release-5-5~1254 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=797441009de464623e766978d35079d4998e29ff;p=ack.git prevent multiple occurrences of TOKSEP in replace.c --- diff --git a/lang/cem/cpp.ansi/Makefile b/lang/cem/cpp.ansi/Makefile index 0a6481b37..4431323d5 100644 --- a/lang/cem/cpp.ansi/Makefile +++ b/lang/cem/cpp.ansi/Makefile @@ -26,7 +26,7 @@ TABGEN = $(EMHOME)/bin/tabgen # What C compiler to use and how CC = cc COPTIONS = -O -LDFLAGS = -i +LDFLAGS = # What parser generator to use and how GEN = $(EMHOME)/bin/LLgen diff --git a/lang/cem/cpp.ansi/replace.c b/lang/cem/cpp.ansi/replace.c index eacbe7295..02fcd697e 100644 --- a/lang/cem/cpp.ansi/replace.c +++ b/lang/cem/cpp.ansi/replace.c @@ -297,10 +297,12 @@ actual(repl) It keeps in account the opening and closing brackets, preprocessor numbers, strings and character constants. */ - register int ch; + register int ch = 0; register int level = 0, nostashraw = 0; + int lastch; while (1) { + lastch = ch; ch = GetChar(); if (Unstacked) { @@ -469,8 +471,10 @@ a_new_line: ch = GetChar(); return ')'; } stash(repl, ch, !nostashraw); - } else + } else { + if (lastch == TOKSEP && ch == TOKSEP) continue; stash(repl, ch, !nostashraw); + } } }