diff options
Diffstat (limited to 'contrib/tcsh/tw.parse.c')
-rw-r--r-- | contrib/tcsh/tw.parse.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/contrib/tcsh/tw.parse.c b/contrib/tcsh/tw.parse.c index 90b4ae8..af3f133 100644 --- a/contrib/tcsh/tw.parse.c +++ b/contrib/tcsh/tw.parse.c @@ -1,4 +1,4 @@ -/* $Header: /src/pub/tcsh/tw.parse.c,v 3.86 1998/10/25 15:10:52 christos Exp $ */ +/* $Header: /src/pub/tcsh/tw.parse.c,v 3.87 2000/01/14 22:57:30 christos Exp $ */ /* * tw.parse.c: Everyone has taken a shot in this futile effort to * lexically analyze a csh line... Well we cannot good @@ -39,7 +39,7 @@ */ #include "sh.h" -RCSID("$Id: tw.parse.c,v 3.86 1998/10/25 15:10:52 christos Exp $") +RCSID("$Id: tw.parse.c,v 3.87 2000/01/14 22:57:30 christos Exp $") #include "tw.h" #include "ed.h" @@ -529,6 +529,9 @@ insert_meta(cp, cpend, word, closequotes) int qu = 0; int ndel = (int) (cp ? cpend - cp : 0); Char w, wq; +#ifdef DSPMBYTE + int mbytepos = 1; +#endif /* DSPMBYTE */ for (bptr = buffer, wptr = word;;) { if (bptr > buffer + 2 * FILSIZ - 5) @@ -536,6 +539,9 @@ insert_meta(cp, cpend, word, closequotes) if (cp >= cpend) in_sync = 0; +#ifdef DSPMBYTE + if (mbytepos == 1) +#endif /* DSPMBYTE */ if (in_sync && !cmap(qu, _ESC) && cmap(*cp, _QF|_ESC)) if (qu == 0 || qu == *cp) { qu ^= *cp; @@ -549,6 +555,10 @@ insert_meta(cp, cpend, word, closequotes) wq = w & QUOTE; w &= ~QUOTE; +#ifdef DSPMBYTE + if (mbytepos == 2) + goto mbyteskip; +#endif /* DSPMBYTE */ if (cmap(w, _ESC | _QF)) wq = QUOTE; /* quotes are always quoted */ @@ -590,9 +600,18 @@ insert_meta(cp, cpend, word, closequotes) *bptr++ = '\\'; *bptr++ = w; } else { +#ifdef DSPMBYTE + mbyteskip: +#endif /* DSPMBYTE */ if (in_sync && *cp++ != w) in_sync = 0; *bptr++ = w; +#ifdef DSPMBYTE + if (mbytepos == 1 && Ismbyte1(w)) + mbytepos = 2; + else + mbytepos = 1; +#endif /* DSPMBYTE */ } wptr++; if (cmap(qu, _ESC)) |