heirloom-ed

changeset 4:4165f1b57d18 tip

Become SUSv3 compatible and thus remove own regexp code The Heirloom tools can be compiled to comply to several standards. This version does not need this flexibility. We can omit the regexp code and use the system's, by using the SU3 variant of ed. This is the latest of the supported standards.
author markus schnalke <meillo@marmaro.de>
date Mon, 13 Apr 2015 17:26:51 +0200
parents ac52712b2b5e
children
files ed.c makefile regexp.h regexpr.c regexpr.h
diffstat 5 files changed, 5 insertions(+), 1421 deletions(-) [+]
line diff
     1.1 --- a/ed.c	Sun Apr 12 21:45:34 2015 +0200
     1.2 +++ b/ed.c	Mon Apr 13 17:26:51 2015 +0200
     1.3 @@ -47,15 +47,7 @@
     1.4  #else
     1.5  #define	USED
     1.6  #endif
     1.7 -#if defined (SU3)
     1.8  static const char sccsid[] USED = "@(#)ed_su3.sl	1.99 (gritter) 7/27/06";
     1.9 -#elif defined (SUS)
    1.10 -static const char sccsid[] USED = "@(#)ed_sus.sl	1.99 (gritter) 7/27/06";
    1.11 -#elif defined (S42)
    1.12 -static const char sccsid[] USED = "@(#)ed_s42.sl	1.99 (gritter) 7/27/06";
    1.13 -#else	/* !SU3, !SUS, !S42 */
    1.14 -static const char sccsid[] USED = "@(#)ed.sl	1.99 (gritter) 7/27/06";
    1.15 -#endif	/* !SU3, !SUS, !S42 */
    1.16  
    1.17  #include <sys/types.h>
    1.18  #include <sys/stat.h>
    1.19 @@ -238,8 +230,6 @@
    1.20  #define	ERROR(c)	cmplerr(c)
    1.21  static wint_t	GETWC(char *);
    1.22  
    1.23 -#if defined (SUS) || defined (S42) || defined (SU3)
    1.24 -
    1.25  #include <regex.h>
    1.26  
    1.27  #define	NBRA	9
    1.28 @@ -254,12 +244,6 @@
    1.29  static char	*compile(char *, char *, const char *, int);
    1.30  static int	step(const char *, const char *);
    1.31  
    1.32 -#else	/* !SUS, !S42, !SU3 */
    1.33 -
    1.34 -#include <regexp.h>
    1.35 -
    1.36 -#endif	/* !SUS, !S42, !SU3 */
    1.37 -
    1.38  int
    1.39  main(int argc, char **argv)
    1.40  {
    1.41 @@ -267,9 +251,7 @@
    1.42  	void (*oldintr)(int);
    1.43  
    1.44  	progname = basename(argv[0]);
    1.45 -#if defined (SUS) || defined (S42) || defined (SU3)
    1.46  	setlocale(LC_COLLATE, "");
    1.47 -#endif
    1.48  	setlocale(LC_CTYPE, "");
    1.49  	mb_cur_max = MB_CUR_MAX;
    1.50  	myuid = getuid();
    1.51 @@ -397,19 +379,15 @@
    1.52  		continue;
    1.53  
    1.54  	case 'c':
    1.55 -#if defined (SU3)
    1.56  		if (addr1 == zero && addr1+1 <= dol) {
    1.57  			if (addr1 == addr2)
    1.58  				addr2++;
    1.59  			addr1++;
    1.60  		}
    1.61 -#endif	/* SU3 */
    1.62  		delete();
    1.63  		append(gettty, addr1-1);
    1.64 -#if defined (SUS) || defined (SU3)
    1.65  		if (dot == addr1-1 && addr1 <= dol)
    1.66  			dot = addr1;
    1.67 -#endif	/* SUS || SU3 */
    1.68  		continue;
    1.69  
    1.70  	case 'd':
    1.71 @@ -466,7 +444,6 @@
    1.72  
    1.73  	case 'i':
    1.74  		setdot();
    1.75 -#if defined (SU3)
    1.76  		if (addr1 == zero) {
    1.77  			if (addr1 == addr2)
    1.78  				addr2++;
    1.79 @@ -474,7 +451,6 @@
    1.80  			if (dol != zero)
    1.81  				nonzero();
    1.82  		} else
    1.83 -#endif	/* SU3 */
    1.84  			nonzero();
    1.85  		newline();
    1.86  		checkpoint();
    1.87 @@ -1055,10 +1031,6 @@
    1.88  	linebuf[i++] = 0;
    1.89  	if (linebuf[0]=='.' && linebuf[1]==0)
    1.90  		return(EOF);
    1.91 -#if !defined (SUS) && !defined (SU3)
    1.92 -	if (linebuf[0]=='\\' && linebuf[1]=='.' && linebuf[2]==0)
    1.93 -		linebuf[0]='.', linebuf[1]=0;
    1.94 -#endif
    1.95  	return(0);
    1.96  }
    1.97  
    1.98 @@ -1730,7 +1702,6 @@
    1.99  	}
   1.100  	i = loc2 - linebuf;
   1.101  	loc2 = j + linebuf;
   1.102 -#if defined (SUS) || defined (SU3) || defined (S42)
   1.103  	if (loc1 == &linebuf[i]) {
   1.104  		int	n;
   1.105  		wchar_t	wc;
   1.106 @@ -1739,7 +1710,6 @@
   1.107  		else
   1.108  			loc2++;
   1.109  	}
   1.110 -#endif	/* SUS || SU3 || S42 */
   1.111  	while (genbuf[j++] = linebuf[i++])
   1.112  		if (j >= LBSIZE)
   1.113  			growlb("line too long");
   1.114 @@ -1867,9 +1837,6 @@
   1.115  {
   1.116  	const char	*msg;
   1.117  
   1.118 -#if !defined (SUS) && !defined (S42) && !defined (SU3)
   1.119 -	expbuf[0] = 0;
   1.120 -#endif
   1.121  	switch (c) {
   1.122  	case 11:
   1.123  		msg = "Range endpoint too large";
   1.124 @@ -1987,10 +1954,7 @@
   1.125  			putchr('\\');
   1.126  			putchr('\n');
   1.127  		}
   1.128 -		if (n<0 ||
   1.129 -#if defined (SUS) || defined (S42) || defined (SU3)
   1.130 -				c == '\\' ||
   1.131 -#endif	/* SUS || S42 || SU3 */
   1.132 +		if (n<0 || c == '\\' ||
   1.133  				!(mb_cur_max>1 ? iswprint(c) : isprint(c))) {
   1.134  			if (n<0)
   1.135  				n = 1;
   1.136 @@ -2005,9 +1969,7 @@
   1.137  			col++;
   1.138  		}
   1.139  	}
   1.140 -#if defined (SUS) || defined (S42) || defined (SU3)
   1.141  	putchr('$');
   1.142 -#endif
   1.143  	putchr('\n');
   1.144  }
   1.145  
   1.146 @@ -2016,24 +1978,6 @@
   1.147  {
   1.148  	int	cad = 1, d;
   1.149  
   1.150 -#if !defined (SUS) && !defined (S42) && !defined (SU3)
   1.151 -	if (c=='\t') {
   1.152 -		c = '>';
   1.153 -		goto esc;
   1.154 -	}
   1.155 -	if (c=='\b') {
   1.156 -		c = '<';
   1.157 -	esc:
   1.158 -		putchr('-');
   1.159 -		putchr('\b');
   1.160 -		putchr(c);
   1.161 -	} else if (c == '\n') {
   1.162 -		putchr('\\');
   1.163 -		putchr('0');
   1.164 -		putchr('0');
   1.165 -		putchr('0');
   1.166 -		cad = 4;
   1.167 -#else	/* !SUS, !S42, !SU3 */
   1.168  	if (c == '\n')
   1.169  		c = '\0';
   1.170  	if (c == '\\') {
   1.171 @@ -2064,7 +2008,6 @@
   1.172  		putchr('\\');
   1.173  		putchr('v');
   1.174  		cad = 2;
   1.175 -#endif	/* !SUS, !S42, !SU3 */
   1.176  	} else {
   1.177  		putchr('\\');
   1.178  		putchr(((c&~077)>>6)+'0');
   1.179 @@ -2281,7 +2224,6 @@
   1.180  		file[0] = savedfile[0] = 0;
   1.181  }
   1.182  
   1.183 -#if defined (SUS) || defined (S42) || defined (SU3)
   1.184  union	ptrstore {
   1.185  	void	*vp;
   1.186  	char	bp[sizeof (void *)];
   1.187 @@ -2385,7 +2327,7 @@
   1.188  #ifdef	REG_ANGLES
   1.189  		reflags |= REG_ANGLES;
   1.190  #endif
   1.191 -#if defined (SU3) && defined (REG_AVOIDNULL)
   1.192 +#ifdef	REG_AVOIDNULL
   1.193  		reflags |= REG_AVOIDNULL;
   1.194  #endif
   1.195  		if (op[0])
   1.196 @@ -2453,7 +2395,6 @@
   1.197  	}
   1.198  	return res == 0;
   1.199  }
   1.200 -#endif	/* SUS || S42 || SU3 */
   1.201  
   1.202  static void
   1.203  help(void)
     2.1 --- a/makefile	Sun Apr 12 21:45:34 2015 +0200
     2.2 +++ b/makefile	Mon Apr 13 17:26:51 2015 +0200
     2.3 @@ -88,15 +88,12 @@
     2.4  
     2.5  all: ed
     2.6  
     2.7 -ed: ed.o regexpr.o sigset.o sigrelse.o
     2.8 +ed: ed.o sigset.o sigrelse.o
     2.9  	$(LD) $(LDFLAGS) ed.o -o ed
    2.10  
    2.11 -ed.o: ed.c regexp.h
    2.12 +ed.o: ed.c
    2.13  	$(CC) $(CFLAGS) $(CPPFLAGS) $(IWCHAR) -DSHELL='"$(SHELL)"' -I. -c ed.c
    2.14  
    2.15 -regexpr.o: regexpr.c regexpr.h regexp.h
    2.16 -	$(CC) $(CFLAGS) $(CPPFLAGS) $(IWCHAR) -I. -c regexpr.c
    2.17 -
    2.18  sigset.o: sigset.c sigset.h
    2.19  	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -c sigset.c
    2.20  
    2.21 @@ -114,7 +111,7 @@
    2.22  	chmod 644 $(ROOT)$(MANDIR)/man1/ed.1
    2.23  
    2.24  clean:
    2.25 -	rm -f ed.o regexpr.o sigset.o sigrelse.o core log *~
    2.26 +	rm -f ed.o sigset.o sigrelse.o core log *~
    2.27  
    2.28  mrproper: clean
    2.29  	rm -f ed
     3.1 --- a/regexp.h	Sun Apr 12 21:45:34 2015 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,1211 +0,0 @@
     3.4 -/*
     3.5 - * Simple Regular Expression functions. Derived from Unix 7th Edition,
     3.6 - * /usr/src/cmd/expr.y
     3.7 - *
     3.8 - * Modified by Gunnar Ritter, Freiburg i. Br., Germany, February 2002.
     3.9 - *
    3.10 - * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
    3.11 - *
    3.12 - * Redistribution and use in source and binary forms, with or without
    3.13 - * modification, are permitted provided that the following conditions
    3.14 - * are met:
    3.15 - *   Redistributions of source code and documentation must retain the
    3.16 - *    above copyright notice, this list of conditions and the following
    3.17 - *    disclaimer.
    3.18 - *   Redistributions in binary form must reproduce the above copyright
    3.19 - *    notice, this list of conditions and the following disclaimer in the
    3.20 - *    documentation and/or other materials provided with the distribution.
    3.21 - *   All advertising materials mentioning features or use of this software
    3.22 - *    must display the following acknowledgement:
    3.23 - *      This product includes software developed or owned by Caldera
    3.24 - *      International, Inc.
    3.25 - *   Neither the name of Caldera International, Inc. nor the names of
    3.26 - *    other contributors may be used to endorse or promote products
    3.27 - *    derived from this software without specific prior written permission.
    3.28 - *
    3.29 - * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
    3.30 - * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
    3.31 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    3.32 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    3.33 - * ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
    3.34 - * LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
    3.35 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    3.36 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    3.37 - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    3.38 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    3.39 - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    3.40 - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3.41 - */
    3.42 -
    3.43 -#if __GNUC__ >= 3 && __GNUC_MINOR__ >= 4 || __GNUC__ >= 4
    3.44 -#define	REGEXP_H_USED	__attribute__ ((used))
    3.45 -#elif defined __GNUC__
    3.46 -#define	REGEXP_H_USED	__attribute__ ((unused))
    3.47 -#else
    3.48 -#define	REGEXP_H_USED
    3.49 -#endif
    3.50 -static const char regexp_h_sccsid[] REGEXP_H_USED =
    3.51 -	"@(#)regexp.sl	1.56 (gritter) 5/29/05";
    3.52 -
    3.53 -#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__)
    3.54 -#define	REGEXP_H_WCHARS
    3.55 -#endif
    3.56 -
    3.57 -#define	CBRA	2
    3.58 -#define	CCHR	4
    3.59 -#define	CDOT	8
    3.60 -#define	CCL	12
    3.61 -/*	CLNUM	14	used in sed */
    3.62 -/*	CEND	16	used in sed */
    3.63 -#define	CDOL	20
    3.64 -#define	CCEOF	22
    3.65 -#define	CKET	24
    3.66 -#define	CBACK	36
    3.67 -#define	CNCL	40
    3.68 -#define	CBRC	44
    3.69 -#define	CLET	48
    3.70 -#define	CCH1	52
    3.71 -#define	CCH2	56
    3.72 -#define	CCH3	60
    3.73 -
    3.74 -#define	STAR	01
    3.75 -#define RNGE	03
    3.76 -#define	REGEXP_H_LEAST	0100
    3.77 -
    3.78 -#ifdef	REGEXP_H_WCHARS
    3.79 -#define	CMB	0200
    3.80 -#else	/* !REGEXP_H_WCHARS */
    3.81 -#define	CMB	0
    3.82 -#endif	/* !REGEXP_H_WCHARS */
    3.83 -
    3.84 -#define	NBRA	9
    3.85 -
    3.86 -#define PLACE(c)	ep[c >> 3] |= bittab[c & 07]
    3.87 -#define ISTHERE(c)	(ep[c >> 3] & bittab[c & 07])
    3.88 -
    3.89 -#ifdef	REGEXP_H_WCHARS
    3.90 -#define	REGEXP_H_IS_THERE(ep, c)	((ep)[c >> 3] & bittab[c & 07])
    3.91 -#endif
    3.92 -
    3.93 -#include	<ctype.h>
    3.94 -#include	<string.h>
    3.95 -#include	<limits.h>
    3.96 -#ifdef	REGEXP_H_WCHARS
    3.97 -#include	<stdlib.h>
    3.98 -#include	<wchar.h>
    3.99 -#include	<wctype.h>
   3.100 -#endif	/* REGEXP_H_WCHARS */
   3.101 -
   3.102 -#define	regexp_h_uletter(c)	(isalpha(c) || (c) == '_')
   3.103 -#ifdef	REGEXP_H_WCHARS
   3.104 -#define	regexp_h_wuletter(c)	(iswalpha(c) || (c) == L'_')
   3.105 -
   3.106 -/*
   3.107 - * Used to allocate memory for the multibyte star algorithm.
   3.108 - */
   3.109 -#ifndef	regexp_h_malloc
   3.110 -#define	regexp_h_malloc(n)	malloc(n)
   3.111 -#endif
   3.112 -#ifndef	regexp_h_free
   3.113 -#define	regexp_h_free(p)	free(p)
   3.114 -#endif
   3.115 -
   3.116 -/*
   3.117 - * Can be predefined to 'inline' to inline some multibyte functions;
   3.118 - * may improve performance for files that contain many multibyte
   3.119 - * sequences.
   3.120 - */
   3.121 -#ifndef	regexp_h_inline
   3.122 -#define	regexp_h_inline
   3.123 -#endif
   3.124 -
   3.125 -/*
   3.126 - * Mask to determine whether the first byte of a sequence possibly
   3.127 - * starts a multibyte character. Set to 0377 to force mbtowc() for
   3.128 - * any byte sequence (except 0).
   3.129 - */
   3.130 -#ifndef	REGEXP_H_MASK
   3.131 -#define	REGEXP_H_MASK	0200
   3.132 -#endif
   3.133 -#endif	/* REGEXP_H_WCHARS */
   3.134 -
   3.135 -/*
   3.136 - * For regexpr.h.
   3.137 - */
   3.138 -#ifndef	regexp_h_static
   3.139 -#define	regexp_h_static
   3.140 -#endif
   3.141 -#ifndef	REGEXP_H_STEP_INIT
   3.142 -#define	REGEXP_H_STEP_INIT
   3.143 -#endif
   3.144 -#ifndef	REGEXP_H_ADVANCE_INIT
   3.145 -#define	REGEXP_H_ADVANCE_INIT
   3.146 -#endif
   3.147 -
   3.148 -char	*braslist[NBRA];
   3.149 -char	*braelist[NBRA];
   3.150 -int	nbra;
   3.151 -char	*loc1, *loc2, *locs;
   3.152 -int	sed;
   3.153 -int	nodelim;
   3.154 -
   3.155 -regexp_h_static int	circf;
   3.156 -regexp_h_static int	low;
   3.157 -regexp_h_static int	size;
   3.158 -
   3.159 -regexp_h_static unsigned char	bittab[] = {
   3.160 -	1,
   3.161 -	2,
   3.162 -	4,
   3.163 -	8,
   3.164 -	16,
   3.165 -	32,
   3.166 -	64,
   3.167 -	128
   3.168 -};
   3.169 -static int	regexp_h_advance(register const char *lp,
   3.170 -			register const char *ep);
   3.171 -static void	regexp_h_getrnge(register const char *str, int least);
   3.172 -
   3.173 -static const char	*regexp_h_bol;	/* beginning of input line (for \<) */
   3.174 -
   3.175 -#ifdef	REGEXP_H_WCHARS
   3.176 -static int	regexp_h_wchars;
   3.177 -static int	regexp_h_mbcurmax;
   3.178 -
   3.179 -static const char	*regexp_h_firstwc;	/* location of first
   3.180 -						   multibyte character
   3.181 -						   on input line */
   3.182 -
   3.183 -#define	regexp_h_getwc(c)	{ \
   3.184 -	if (regexp_h_wchars) { \
   3.185 -		char mbbuf[MB_LEN_MAX + 1], *mbptr; \
   3.186 -		wchar_t wcbuf; \
   3.187 -		int mb, len; \
   3.188 -		mbptr = mbbuf; \
   3.189 -		do { \
   3.190 -			mb = GETC(); \
   3.191 -			*mbptr++ = mb; \
   3.192 -			*mbptr = '\0'; \
   3.193 -		} while ((len = mbtowc(&wcbuf, mbbuf, regexp_h_mbcurmax)) < 0 \
   3.194 -			&& mb != eof && mbptr < mbbuf + MB_LEN_MAX); \
   3.195 -		if (len == -1) \
   3.196 -			ERROR(67); \
   3.197 -		c = wcbuf; \
   3.198 -	} else { \
   3.199 -		c = GETC(); \
   3.200 -	} \
   3.201 -}
   3.202 -
   3.203 -#define	regexp_h_store(wc, mb, me)	{ \
   3.204 -	int len; \
   3.205 -	if (wc == WEOF) \
   3.206 -		ERROR(67); \
   3.207 -	if ((len = me - mb) <= regexp_h_mbcurmax) { \
   3.208 -		char mt[MB_LEN_MAX]; \
   3.209 -		if (wctomb(mt, wc) >= len) \
   3.210 -			ERROR(50); \
   3.211 -	} \
   3.212 -	switch (len = wctomb(mb, wc)) { \
   3.213 -	case -1: \
   3.214 -		 ERROR(67); \
   3.215 -	case 0: \
   3.216 -		mb++; \
   3.217 -		break; \
   3.218 -	default: \
   3.219 -		mb += len; \
   3.220 -	} \
   3.221 -}
   3.222 -
   3.223 -static regexp_h_inline wint_t
   3.224 -regexp_h_fetchwc(const char **mb, int islp)
   3.225 -{
   3.226 -	wchar_t wc;
   3.227 -	int len;
   3.228 -
   3.229 -	if ((len = mbtowc(&wc, *mb, regexp_h_mbcurmax)) < 0) {
   3.230 -		(*mb)++;
   3.231 -		return WEOF;
   3.232 -	}
   3.233 -	if (islp && regexp_h_firstwc == NULL)
   3.234 -		regexp_h_firstwc = *mb;
   3.235 -	/*if (len == 0) {
   3.236 -		(*mb)++;
   3.237 -		return L'\0';
   3.238 -	} handled in singlebyte code */
   3.239 -	*mb += len;
   3.240 -	return wc;
   3.241 -}
   3.242 -
   3.243 -#define	regexp_h_fetch(mb, islp)	((*(mb) & REGEXP_H_MASK) == 0 ? \
   3.244 -						(*(mb)++&0377): \
   3.245 -						regexp_h_fetchwc(&(mb), islp))
   3.246 -
   3.247 -static regexp_h_inline wint_t
   3.248 -regexp_h_showwc(const char *mb)
   3.249 -{
   3.250 -	wchar_t wc;
   3.251 -
   3.252 -	if (mbtowc(&wc, mb, regexp_h_mbcurmax) < 0)
   3.253 -		return WEOF;
   3.254 -	return wc;
   3.255 -}
   3.256 -
   3.257 -#define	regexp_h_show(mb)	((*(mb) & REGEXP_H_MASK) == 0 ? (*(mb)&0377): \
   3.258 -					regexp_h_showwc(mb))
   3.259 -
   3.260 -/*
   3.261 - * Return the character immediately preceding mb. Since no byte is
   3.262 - * required to be the first byte of a character, the longest multibyte
   3.263 - * character ending at &[mb-1] is searched.
   3.264 - */
   3.265 -static regexp_h_inline wint_t
   3.266 -regexp_h_previous(const char *mb)
   3.267 -{
   3.268 -	const char *p = mb;
   3.269 -	wchar_t wc, lastwc = WEOF;
   3.270 -	int len, max = 0;
   3.271 -
   3.272 -	if (regexp_h_firstwc == NULL || mb <= regexp_h_firstwc)
   3.273 -		return (mb > regexp_h_bol ? (mb[-1] & 0377) : WEOF);
   3.274 -	while (p-- > regexp_h_bol) {
   3.275 -		mbtowc(NULL, NULL, 0);
   3.276 -		if ((len = mbtowc(&wc, p, mb - p)) >= 0) {
   3.277 -			if (len < max || len < mb - p)
   3.278 -				break;
   3.279 -			max = len;
   3.280 -			lastwc = wc;
   3.281 -		} else if (len < 0 && max > 0)
   3.282 -			break;
   3.283 -	}
   3.284 -	return lastwc;
   3.285 -}
   3.286 -
   3.287 -#define	regexp_h_cclass(set, c, af)	\
   3.288 -	((c) == 0 || (c) == WEOF ? 0 : ( \
   3.289 -		((c) > 0177) ? \
   3.290 -			regexp_h_cclass_wc(set, c, af) : ( \
   3.291 -				REGEXP_H_IS_THERE((set)+1, (c)) ? (af) : !(af) \
   3.292 -			) \
   3.293 -		) \
   3.294 -	)
   3.295 -
   3.296 -static regexp_h_inline int
   3.297 -regexp_h_cclass_wc(const char *set, register wint_t c, int af)
   3.298 -{
   3.299 -	register wint_t wc, wl = WEOF;
   3.300 -	const char *end;
   3.301 -
   3.302 -	end = &set[18] + set[0] - 1;
   3.303 -	set += 17;
   3.304 -	while (set < end) {
   3.305 -		wc = regexp_h_fetch(set, 0);
   3.306 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.307 -		if (wc == '\\' && set < end &&
   3.308 -				(*set == ']' || *set == '-' ||
   3.309 -				 *set == '^' || *set == '\\')) {
   3.310 -			wc = regexp_h_fetch(set, 0);
   3.311 -		} else
   3.312 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.313 -		if (wc == '-' && wl != WEOF && set < end) {
   3.314 -			wc = regexp_h_fetch(set, 0);
   3.315 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.316 -			if (wc == '\\' && set < end &&
   3.317 -					(*set == ']' || *set == '-' ||
   3.318 -					 *set == '^' || *set == '\\')) {
   3.319 -				wc = regexp_h_fetch(set, 0);
   3.320 -			}
   3.321 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.322 -			if (c > wl && c < wc)
   3.323 -				return af;
   3.324 -		}
   3.325 -		if (c == wc)
   3.326 -			return af;
   3.327 -		wl = wc;
   3.328 -	}
   3.329 -	return !af;
   3.330 -}
   3.331 -#else	/* !REGEXP_H_WCHARS */
   3.332 -#define	regexp_h_wchars		0
   3.333 -#define	regexp_h_getwc(c)	{ c = GETC(); }
   3.334 -#endif	/* !REGEXP_H_WCHARS */
   3.335 -
   3.336 -regexp_h_static char *
   3.337 -compile(char *instring, char *ep, const char *endbuf, int seof)
   3.338 -{
   3.339 -	INIT	/* Dependent declarations and initializations */
   3.340 -	register int c;
   3.341 -	register int eof = seof;
   3.342 -	char *lastep = instring;
   3.343 -	int cclcnt;
   3.344 -	char bracket[NBRA], *bracketp;
   3.345 -	int closed;
   3.346 -	char neg;
   3.347 -	int lc;
   3.348 -	int i, cflg;
   3.349 -
   3.350 -#ifdef	REGEXP_H_WCHARS
   3.351 -	char *eq;
   3.352 -	regexp_h_mbcurmax = MB_CUR_MAX;
   3.353 -	regexp_h_wchars = regexp_h_mbcurmax > 1 ? CMB : 0;
   3.354 -#endif
   3.355 -	lastep = 0;
   3.356 -	bracketp = bracket;
   3.357 -	if((c = GETC()) == eof || c == '\n') {
   3.358 -		if (c == '\n') {
   3.359 -			UNGETC(c);
   3.360 -			nodelim = 1;
   3.361 -		}
   3.362 -		if(*ep == 0 && !sed)
   3.363 -			ERROR(41);
   3.364 -		if (bracketp > bracket)
   3.365 -			ERROR(42);
   3.366 -		RETURN(ep);
   3.367 -	}
   3.368 -	circf = closed = nbra = 0;
   3.369 -	if (c == '^')
   3.370 -		circf++;
   3.371 -	else
   3.372 -		UNGETC(c);
   3.373 -	for (;;) {
   3.374 -		if (ep >= endbuf)
   3.375 -			ERROR(50);
   3.376 -		regexp_h_getwc(c);
   3.377 -		if(c != '*' && ((c != '\\') || (PEEKC() != '{')))
   3.378 -			lastep = ep;
   3.379 -		if (c == eof) {
   3.380 -			*ep++ = CCEOF;
   3.381 -			if (bracketp > bracket)
   3.382 -				ERROR(42);
   3.383 -			RETURN(ep);
   3.384 -		}
   3.385 -		switch (c) {
   3.386 -
   3.387 -		case '.':
   3.388 -			*ep++ = CDOT|regexp_h_wchars;
   3.389 -			continue;
   3.390 -
   3.391 -		case '\n':
   3.392 -			if (sed == 0) {
   3.393 -				UNGETC(c);
   3.394 -				*ep++ = CCEOF;
   3.395 -				nodelim = 1;
   3.396 -				RETURN(ep);
   3.397 -			}
   3.398 -			ERROR(36);
   3.399 -		case '*':
   3.400 -			if (lastep==0 || *lastep==CBRA || *lastep==CKET ||
   3.401 -					*lastep==(CBRC|regexp_h_wchars) ||
   3.402 -					*lastep==(CLET|regexp_h_wchars))
   3.403 -				goto defchar;
   3.404 -			*lastep |= STAR;
   3.405 -			continue;
   3.406 -
   3.407 -		case '$':
   3.408 -			if(PEEKC() != eof)
   3.409 -				goto defchar;
   3.410 -			*ep++ = CDOL;
   3.411 -			continue;
   3.412 -
   3.413 -		case '[':
   3.414 -#ifdef	REGEXP_H_WCHARS
   3.415 -			if (regexp_h_wchars == 0) {
   3.416 -#endif
   3.417 -				if(&ep[33] >= endbuf)
   3.418 -					ERROR(50);
   3.419 -
   3.420 -				*ep++ = CCL;
   3.421 -				lc = 0;
   3.422 -				for(i = 0; i < 32; i++)
   3.423 -					ep[i] = 0;
   3.424 -
   3.425 -				neg = 0;
   3.426 -				if((c = GETC()) == '^') {
   3.427 -					neg = 1;
   3.428 -					c = GETC();
   3.429 -				}
   3.430 -
   3.431 -				do {
   3.432 -					c &= 0377;
   3.433 -					if(c == '\0' || c == '\n')
   3.434 -						ERROR(49);
   3.435 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.436 -					if(c == '\\' && ((c = PEEKC()) == ']' ||
   3.437 -							c == '-' || c == '^' ||
   3.438 -							c == '\\')) {
   3.439 -						c = GETC();
   3.440 -						c &= 0377;
   3.441 -					} else
   3.442 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.443 -					if(c == '-' && lc != 0) {
   3.444 -						if ((c = GETC()) == ']') {
   3.445 -							PLACE('-');
   3.446 -							break;
   3.447 -						}
   3.448 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.449 -						if(c == '\\' &&
   3.450 -							((c = PEEKC()) == ']' ||
   3.451 -								c == '-' ||
   3.452 -								c == '^' ||
   3.453 -								c == '\\'))
   3.454 -							c = GETC();
   3.455 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.456 -						c &= 0377;
   3.457 -						while(lc < c) {
   3.458 -							PLACE(lc);
   3.459 -							lc++;
   3.460 -						}
   3.461 -					}
   3.462 -					lc = c;
   3.463 -					PLACE(c);
   3.464 -				} while((c = GETC()) != ']');
   3.465 -				if(neg) {
   3.466 -					for(cclcnt = 0; cclcnt < 32; cclcnt++)
   3.467 -						ep[cclcnt] ^= 0377;
   3.468 -					ep[0] &= 0376;
   3.469 -				}
   3.470 -
   3.471 -				ep += 32;
   3.472 -#ifdef	REGEXP_H_WCHARS
   3.473 -			} else {
   3.474 -				if (&ep[18] >= endbuf)
   3.475 -					ERROR(50);
   3.476 -				*ep++ = CCL|CMB;
   3.477 -				*ep++ = 0;
   3.478 -				lc = 0;
   3.479 -				for (i = 0; i < 16; i++)
   3.480 -					ep[i] = 0;
   3.481 -				eq = &ep[16];
   3.482 -				regexp_h_getwc(c);
   3.483 -				if (c == L'^') {
   3.484 -					regexp_h_getwc(c);
   3.485 -					ep[-2] = CNCL|CMB;
   3.486 -				}
   3.487 -				do {
   3.488 -					if (c == '\0' || c == '\n')
   3.489 -						ERROR(49);
   3.490 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.491 -					if(c == '\\' && ((c = PEEKC()) == ']' ||
   3.492 -							c == '-' || c == '^' ||
   3.493 -							c == '\\')) {
   3.494 -						regexp_h_store(c, eq, endbuf);
   3.495 -						regexp_h_getwc(c);
   3.496 -					} else
   3.497 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.498 -					if (c == '-' && lc != 0 && lc <= 0177) {
   3.499 -						regexp_h_store(c, eq, endbuf);
   3.500 -						regexp_h_getwc(c);
   3.501 -						if (c == ']') {
   3.502 -							PLACE('-');
   3.503 -							break;
   3.504 -						}
   3.505 -#ifdef	REGEXP_H_VI_BACKSLASH
   3.506 -						if(c == '\\' &&
   3.507 -							((c = PEEKC()) == ']' ||
   3.508 -								c == '-' ||
   3.509 -								c == '^' ||
   3.510 -								c == '\\')) {
   3.511 -							regexp_h_store(c, eq,
   3.512 -								endbuf);
   3.513 -							regexp_h_getwc(c);
   3.514 -						}
   3.515 -#endif	/* REGEXP_H_VI_BACKSLASH */
   3.516 -						while (lc < (c & 0177)) {
   3.517 -							PLACE(lc);
   3.518 -							lc++;
   3.519 -						}
   3.520 -					}
   3.521 -					lc = c;
   3.522 -					if (c <= 0177)
   3.523 -						PLACE(c);
   3.524 -					regexp_h_store(c, eq, endbuf);
   3.525 -					regexp_h_getwc(c);
   3.526 -				} while (c != L']');
   3.527 -				if ((i = eq - &ep[16]) > 255)
   3.528 -					ERROR(50);
   3.529 -				lastep[1] = i;
   3.530 -				ep = eq;
   3.531 -			}
   3.532 -#endif	/* REGEXP_H_WCHARS */
   3.533 -
   3.534 -			continue;
   3.535 -
   3.536 -		case '\\':
   3.537 -			regexp_h_getwc(c);
   3.538 -			switch(c) {
   3.539 -
   3.540 -			case '(':
   3.541 -				if(nbra >= NBRA)
   3.542 -					ERROR(43);
   3.543 -				*bracketp++ = nbra;
   3.544 -				*ep++ = CBRA;
   3.545 -				*ep++ = nbra++;
   3.546 -				continue;
   3.547 -
   3.548 -			case ')':
   3.549 -				if(bracketp <= bracket)
   3.550 -					ERROR(42);
   3.551 -				*ep++ = CKET;
   3.552 -				*ep++ = *--bracketp;
   3.553 -				closed++;
   3.554 -				continue;
   3.555 -
   3.556 -			case '<':
   3.557 -				*ep++ = CBRC|regexp_h_wchars;
   3.558 -				continue;
   3.559 -
   3.560 -			case '>':
   3.561 -				*ep++ = CLET|regexp_h_wchars;
   3.562 -				continue;
   3.563 -
   3.564 -			case '{':
   3.565 -				if(lastep == (char *) (0))
   3.566 -					goto defchar;
   3.567 -				*lastep |= RNGE;
   3.568 -				cflg = 0;
   3.569 -			nlim:
   3.570 -				c = GETC();
   3.571 -				i = 0;
   3.572 -				do {
   3.573 -					if ('0' <= c && c <= '9')
   3.574 -						i = 10 * i + c - '0';
   3.575 -					else
   3.576 -						ERROR(16);
   3.577 -				} while(((c = GETC()) != '\\') && (c != ','));
   3.578 -				if (i > 255)
   3.579 -					ERROR(11);
   3.580 -				*ep++ = i;
   3.581 -				if (c == ',') {
   3.582 -					if(cflg++)
   3.583 -						ERROR(44);
   3.584 -					if((c = GETC()) == '\\') {
   3.585 -						*ep++ = (char)255;
   3.586 -						*lastep |= REGEXP_H_LEAST;
   3.587 -					} else {
   3.588 -						UNGETC(c);
   3.589 -						goto nlim; /* get 2'nd number */
   3.590 -					}
   3.591 -				}
   3.592 -				if(GETC() != '}')
   3.593 -					ERROR(45);
   3.594 -				if(!cflg)	/* one number */
   3.595 -					*ep++ = i;
   3.596 -				else if((ep[-1] & 0377) < (ep[-2] & 0377))
   3.597 -					ERROR(46);
   3.598 -				continue;
   3.599 -
   3.600 -			case '\n':
   3.601 -				ERROR(36);
   3.602 -
   3.603 -			case 'n':
   3.604 -				c = '\n';
   3.605 -				goto defchar;
   3.606 -
   3.607 -			default:
   3.608 -				if(c >= '1' && c <= '9') {
   3.609 -					if((c -= '1') >= closed)
   3.610 -						ERROR(25);
   3.611 -					*ep++ = CBACK;
   3.612 -					*ep++ = c;
   3.613 -					continue;
   3.614 -				}
   3.615 -			}
   3.616 -			/* Drop through to default to use \ to turn off special chars */
   3.617 -
   3.618 -		defchar:
   3.619 -		default:
   3.620 -			lastep = ep;
   3.621 -#ifdef	REGEXP_H_WCHARS
   3.622 -			if (regexp_h_wchars == 0) {
   3.623 -#endif
   3.624 -				*ep++ = CCHR;
   3.625 -				*ep++ = c;
   3.626 -#ifdef	REGEXP_H_WCHARS
   3.627 -			} else {
   3.628 -				char	mbbuf[MB_LEN_MAX];
   3.629 -
   3.630 -				switch (wctomb(mbbuf, c)) {
   3.631 -				case 1: *ep++ = CCH1;
   3.632 -					break;
   3.633 -				case 2:	*ep++ = CCH2;
   3.634 -					break;
   3.635 -				case 3:	*ep++ = CCH3;
   3.636 -					break;
   3.637 -				default:
   3.638 -					*ep++ = CCHR|CMB;
   3.639 -				}
   3.640 -				regexp_h_store(c, ep, endbuf);
   3.641 -			}
   3.642 -#endif	/* REGEXP_H_WCHARS */
   3.643 -		}
   3.644 -	}
   3.645 -}
   3.646 -
   3.647 -int
   3.648 -step(const char *p1, const char *p2)
   3.649 -{
   3.650 -	register int c;
   3.651 -#ifdef	REGEXP_H_WCHARS
   3.652 -	register int d;
   3.653 -#endif	/* REGEXP_H_WCHARS */
   3.654 -
   3.655 -	REGEXP_H_STEP_INIT	/* get circf */
   3.656 -	regexp_h_bol = p1;
   3.657 -#ifdef	REGEXP_H_WCHARS
   3.658 -	regexp_h_firstwc = NULL;
   3.659 -#endif	/* REGEXP_H_WCHARS */
   3.660 -	if (circf) {
   3.661 -		loc1 = (char *)p1;
   3.662 -		return(regexp_h_advance(p1, p2));
   3.663 -	}
   3.664 -	/* fast check for first character */
   3.665 -	if (*p2==CCHR) {
   3.666 -		c = p2[1] & 0377;
   3.667 -		do {
   3.668 -			if ((*p1 & 0377) != c)
   3.669 -				continue;
   3.670 -			if (regexp_h_advance(p1, p2)) {
   3.671 -				loc1 = (char *)p1;
   3.672 -				return(1);
   3.673 -			}
   3.674 -		} while (*p1++);
   3.675 -		return(0);
   3.676 -	}
   3.677 -#ifdef	REGEXP_H_WCHARS
   3.678 -	else if (*p2==CCH1) {
   3.679 -		do {
   3.680 -			if (p1[0] == p2[1] && regexp_h_advance(p1, p2)) {
   3.681 -				loc1 = (char *)p1;
   3.682 -				return(1);
   3.683 -			}
   3.684 -			c = regexp_h_fetch(p1, 1);
   3.685 -		} while (c);
   3.686 -		return(0);
   3.687 -	} else if (*p2==CCH2) {
   3.688 -		do {
   3.689 -			if (p1[0] == p2[1] && p1[1] == p2[2] &&
   3.690 -					regexp_h_advance(p1, p2)) {
   3.691 -				loc1 = (char *)p1;
   3.692 -				return(1);
   3.693 -			}
   3.694 -			c = regexp_h_fetch(p1, 1);
   3.695 -		} while (c);
   3.696 -		return(0);
   3.697 -	} else if (*p2==CCH3) {
   3.698 -		do {
   3.699 -			if (p1[0] == p2[1] && p1[1] == p2[2] && p1[2] == p2[3]&&
   3.700 -					regexp_h_advance(p1, p2)) {
   3.701 -				loc1 = (char *)p1;
   3.702 -				return(1);
   3.703 -			}
   3.704 -			c = regexp_h_fetch(p1, 1);
   3.705 -		} while (c);
   3.706 -		return(0);
   3.707 -	} else if ((*p2&0377)==(CCHR|CMB)) {
   3.708 -		d = regexp_h_fetch(p2, 0);
   3.709 -		do {
   3.710 -			c = regexp_h_fetch(p1, 1);
   3.711 -			if (c == d && regexp_h_advance(p1, p2)) {
   3.712 -				loc1 = (char *)p1;
   3.713 -				return(1);
   3.714 -			}
   3.715 -		} while(c);
   3.716 -		return(0);
   3.717 -	}
   3.718 -		/* regular algorithm */
   3.719 -	if (regexp_h_wchars)
   3.720 -		do {
   3.721 -			if (regexp_h_advance(p1, p2)) {
   3.722 -				loc1 = (char *)p1;
   3.723 -				return(1);
   3.724 -			}
   3.725 -			c = regexp_h_fetch(p1, 1);
   3.726 -		} while (c);
   3.727 -	else
   3.728 -#endif	/* REGEXP_H_WCHARS */
   3.729 -		do {
   3.730 -			if (regexp_h_advance(p1, p2)) {
   3.731 -				loc1 = (char *)p1;
   3.732 -				return(1);
   3.733 -			}
   3.734 -		} while (*p1++);
   3.735 -	return(0);
   3.736 -}
   3.737 -
   3.738 -#ifdef	REGEXP_H_WCHARS
   3.739 -/*
   3.740 - * It is painfully slow to read character-wise backwards in a
   3.741 - * multibyte string (see regexp_h_previous() above). For the star
   3.742 - * algorithm, we therefore keep track of every character as it is
   3.743 - * read in forward direction.
   3.744 - *
   3.745 - * Don't use alloca() for stack blocks since there is no measurable
   3.746 - * speedup and huge amounts of memory are used up for long input
   3.747 - * lines.
   3.748 - */
   3.749 -#ifndef	REGEXP_H_STAKBLOK
   3.750 -#define	REGEXP_H_STAKBLOK	1000
   3.751 -#endif
   3.752 -
   3.753 -struct	regexp_h_stack {
   3.754 -	struct regexp_h_stack	*s_nxt;
   3.755 -	struct regexp_h_stack	*s_prv;
   3.756 -	const char	*s_ptr[REGEXP_H_STAKBLOK];
   3.757 -};
   3.758 -
   3.759 -#define	regexp_h_push(sb, sp, sc, lp)	(regexp_h_wchars ? \
   3.760 -			regexp_h_pushwc(sb, sp, sc, lp) : (void)0)
   3.761 -
   3.762 -static regexp_h_inline void
   3.763 -regexp_h_pushwc(struct regexp_h_stack **sb,
   3.764 -		struct regexp_h_stack **sp,
   3.765 -		const char ***sc, const char *lp)
   3.766 -{
   3.767 -	if (regexp_h_firstwc == NULL || lp < regexp_h_firstwc)
   3.768 -		return;
   3.769 -	if (*sb == NULL) {
   3.770 -		if ((*sb = regexp_h_malloc(sizeof **sb)) == NULL)
   3.771 -			return;
   3.772 -		(*sb)->s_nxt = (*sb)->s_prv = NULL;
   3.773 -		*sp = *sb;
   3.774 -		*sc = &(*sb)->s_ptr[0];
   3.775 -	} else if (*sc >= &(*sp)->s_ptr[REGEXP_H_STAKBLOK]) {
   3.776 -		if ((*sp)->s_nxt == NULL) {
   3.777 -			struct regexp_h_stack	*bq;
   3.778 -
   3.779 -			if ((bq = regexp_h_malloc(sizeof *bq)) == NULL)
   3.780 -				return;
   3.781 -			bq->s_nxt = NULL;
   3.782 -			bq->s_prv = *sp;
   3.783 -			(*sp)->s_nxt = bq;
   3.784 -			*sp = bq;
   3.785 -		} else
   3.786 -			*sp = (*sp)->s_nxt;
   3.787 -		*sc = &(*sp)->s_ptr[0];
   3.788 -	}
   3.789 -	*(*sc)++ = lp;
   3.790 -}
   3.791 -
   3.792 -static regexp_h_inline const char *
   3.793 -regexp_h_pop(struct regexp_h_stack **sb, struct regexp_h_stack **sp,
   3.794 -		const char ***sc, const char *lp)
   3.795 -{
   3.796 -	if (regexp_h_firstwc == NULL || lp <= regexp_h_firstwc)
   3.797 -		return &lp[-1];
   3.798 -	if (*sp == NULL)
   3.799 -		return regexp_h_firstwc;
   3.800 -	if (*sc == &(*sp)->s_ptr[0]) {
   3.801 -		if ((*sp)->s_prv == NULL) {
   3.802 -			regexp_h_free(*sp);
   3.803 -			*sp = NULL;
   3.804 -			*sb = NULL;
   3.805 -			return regexp_h_firstwc;
   3.806 -		}
   3.807 -		*sp = (*sp)->s_prv;
   3.808 -		regexp_h_free((*sp)->s_nxt);
   3.809 -		(*sp)->s_nxt = NULL ;
   3.810 -		*sc = &(*sp)->s_ptr[REGEXP_H_STAKBLOK];
   3.811 -	}
   3.812 -	return *(--(*sc));
   3.813 -}
   3.814 -
   3.815 -static void
   3.816 -regexp_h_zerostak(struct regexp_h_stack **sb, struct regexp_h_stack **sp)
   3.817 -{
   3.818 -	for (*sp = *sb; *sp && (*sp)->s_nxt; *sp = (*sp)->s_nxt)
   3.819 -		if ((*sp)->s_prv)
   3.820 -			regexp_h_free((*sp)->s_prv);
   3.821 -	if (*sp) {
   3.822 -		if ((*sp)->s_prv)
   3.823 -			regexp_h_free((*sp)->s_prv);
   3.824 -		regexp_h_free(*sp);
   3.825 -	}
   3.826 -	*sp = *sb = NULL;
   3.827 -}
   3.828 -#else	/* !REGEXP_H_WCHARS */
   3.829 -#define	regexp_h_push(sb, sp, sc, lp)
   3.830 -#endif	/* !REGEXP_H_WCHARS */
   3.831 -
   3.832 -static int
   3.833 -regexp_h_advance(const char *lp, const char *ep)
   3.834 -{
   3.835 -	register const char *curlp;
   3.836 -	int c, least;
   3.837 -#ifdef	REGEXP_H_WCHARS
   3.838 -	int d;
   3.839 -	struct regexp_h_stack	*sb = NULL, *sp = NULL;
   3.840 -	const char	**sc;
   3.841 -#endif	/* REGEXP_H_WCHARS */
   3.842 -	char *bbeg;
   3.843 -	int ct;
   3.844 -
   3.845 -	for (;;) switch (least = *ep++ & 0377, least & ~REGEXP_H_LEAST) {
   3.846 -
   3.847 -	case CCHR:
   3.848 -#ifdef	REGEXP_H_WCHARS
   3.849 -	case CCH1:
   3.850 -#endif
   3.851 -		if (*ep++ == *lp++)
   3.852 -			continue;
   3.853 -		return(0);
   3.854 -
   3.855 -#ifdef	REGEXP_H_WCHARS
   3.856 -	case CCHR|CMB:
   3.857 -		if (regexp_h_fetch(ep, 0) == regexp_h_fetch(lp, 1))
   3.858 -			continue;
   3.859 -		return(0);
   3.860 -
   3.861 -	case CCH2:
   3.862 -		if (ep[0] == lp[0] && ep[1] == lp[1]) {
   3.863 -			ep += 2, lp += 2;
   3.864 -			continue;
   3.865 -		}
   3.866 -		return(0);
   3.867 -
   3.868 -	case CCH3:
   3.869 -		if (ep[0] == lp[0] && ep[1] == lp[1] && ep[2] == lp[2]) {
   3.870 -			ep += 3, lp += 3;
   3.871 -			continue;
   3.872 -		}
   3.873 -		return(0);
   3.874 -#endif	/* REGEXP_H_WCHARS */
   3.875 -
   3.876 -	case CDOT:
   3.877 -		if (*lp++)
   3.878 -			continue;
   3.879 -		return(0);
   3.880 -#ifdef	REGEXP_H_WCHARS
   3.881 -	case CDOT|CMB:
   3.882 -		if ((c = regexp_h_fetch(lp, 1)) != L'\0' && c != WEOF)
   3.883 -			continue;
   3.884 -		return(0);
   3.885 -#endif	/* REGEXP_H_WCHARS */
   3.886 -
   3.887 -	case CDOL:
   3.888 -		if (*lp==0)
   3.889 -			continue;
   3.890 -		return(0);
   3.891 -
   3.892 -	case CCEOF:
   3.893 -		loc2 = (char *)lp;
   3.894 -		return(1);
   3.895 -
   3.896 -	case CCL:
   3.897 -		c = *lp++ & 0377;
   3.898 -		if(ISTHERE(c)) {
   3.899 -			ep += 32;
   3.900 -			continue;
   3.901 -		}
   3.902 -		return(0);
   3.903 -
   3.904 -#ifdef	REGEXP_H_WCHARS
   3.905 -	case CCL|CMB:
   3.906 -	case CNCL|CMB:
   3.907 -		c = regexp_h_fetch(lp, 1);
   3.908 -		if (regexp_h_cclass(ep, c, (ep[-1] & 0377) == (CCL|CMB))) {
   3.909 -			ep += (*ep & 0377) + 17;
   3.910 -			continue;
   3.911 -		}
   3.912 -		return 0;
   3.913 -#endif	/* REGEXP_H_WCHARS */
   3.914 -
   3.915 -	case CBRA:
   3.916 -		braslist[*ep++ & 0377] = (char *)lp;
   3.917 -		continue;
   3.918 -
   3.919 -	case CKET:
   3.920 -		braelist[*ep++ & 0377] = (char *)lp;
   3.921 -		continue;
   3.922 -
   3.923 -	case CBRC:
   3.924 -		if (lp == regexp_h_bol && locs == NULL)
   3.925 -			continue;
   3.926 -		if ((isdigit(lp[0] & 0377) || regexp_h_uletter(lp[0] & 0377))
   3.927 -				&& !regexp_h_uletter(lp[-1] & 0377)
   3.928 -				&& !isdigit(lp[-1] & 0377))
   3.929 -			continue;
   3.930 -		return(0);
   3.931 -
   3.932 -#ifdef	REGEXP_H_WCHARS
   3.933 -	case CBRC|CMB:
   3.934 -		c = regexp_h_show(lp);
   3.935 -		d = regexp_h_previous(lp);
   3.936 -		if ((iswdigit(c) || regexp_h_wuletter(c))
   3.937 -				&& !regexp_h_wuletter(d)
   3.938 -				&& !iswdigit(d))
   3.939 -			continue;
   3.940 -		return(0);
   3.941 -#endif	/* REGEXP_H_WCHARS */
   3.942 -
   3.943 -	case CLET:
   3.944 -		if (!regexp_h_uletter(lp[0] & 0377) && !isdigit(lp[0] & 0377))
   3.945 -			continue;
   3.946 -		return(0);
   3.947 -
   3.948 -#ifdef	REGEXP_H_WCHARS
   3.949 -	case CLET|CMB:
   3.950 -		c = regexp_h_show(lp);
   3.951 -		if (!regexp_h_wuletter(c) && !iswdigit(c))
   3.952 -			continue;
   3.953 -		return(0);
   3.954 -#endif	/* REGEXP_H_WCHARS */
   3.955 -
   3.956 -	case CCHR|RNGE:
   3.957 -		c = *ep++;
   3.958 -		regexp_h_getrnge(ep, least);
   3.959 -		while(low--)
   3.960 -			if(*lp++ != c)
   3.961 -				return(0);
   3.962 -		curlp = lp;
   3.963 -		while(size--) {
   3.964 -			regexp_h_push(&sb, &sp, &sc, lp);
   3.965 -			if(*lp++ != c)
   3.966 -				break;
   3.967 -		}
   3.968 -		if(size < 0) {
   3.969 -			regexp_h_push(&sb, &sp, &sc, lp);
   3.970 -			lp++;
   3.971 -		}
   3.972 -		ep += 2;
   3.973 -		goto star;
   3.974 -
   3.975 -#ifdef	REGEXP_H_WCHARS
   3.976 -	case CCHR|RNGE|CMB:
   3.977 -	case CCH1|RNGE:
   3.978 -	case CCH2|RNGE:
   3.979 -	case CCH3|RNGE:
   3.980 -		c = regexp_h_fetch(ep, 0);
   3.981 -		regexp_h_getrnge(ep, least);
   3.982 -		while (low--)
   3.983 -			if (regexp_h_fetch(lp, 1) != c)
   3.984 -				return 0;
   3.985 -		curlp = lp;
   3.986 -		while (size--) {
   3.987 -			regexp_h_push(&sb, &sp, &sc, lp);
   3.988 -			if (regexp_h_fetch(lp, 1) != c)
   3.989 -				break;
   3.990 -		}
   3.991 -		if(size < 0) {
   3.992 -			regexp_h_push(&sb, &sp, &sc, lp);
   3.993 -			regexp_h_fetch(lp, 1);
   3.994 -		}
   3.995 -		ep += 2;
   3.996 -		goto star;
   3.997 -#endif	/* REGEXP_H_WCHARS */
   3.998 -
   3.999 -	case CDOT|RNGE:
  3.1000 -		regexp_h_getrnge(ep, least);
  3.1001 -		while(low--)
  3.1002 -			if(*lp++ == '\0')
  3.1003 -				return(0);
  3.1004 -		curlp = lp;
  3.1005 -		while(size--) {
  3.1006 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1007 -			if(*lp++ == '\0')
  3.1008 -				break;
  3.1009 -		}
  3.1010 -		if(size < 0) {
  3.1011 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1012 -			lp++;
  3.1013 -		}
  3.1014 -		ep += 2;
  3.1015 -		goto star;
  3.1016 -
  3.1017 -#ifdef	REGEXP_H_WCHARS
  3.1018 -	case CDOT|RNGE|CMB:
  3.1019 -		regexp_h_getrnge(ep, least);
  3.1020 -		while (low--)
  3.1021 -			if ((c = regexp_h_fetch(lp, 1)) == L'\0' || c == WEOF)
  3.1022 -				return 0;
  3.1023 -		curlp = lp;
  3.1024 -		while (size--) {
  3.1025 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1026 -			if ((c = regexp_h_fetch(lp, 1)) == L'\0' || c == WEOF)
  3.1027 -				break;
  3.1028 -		}
  3.1029 -		if (size < 0) {
  3.1030 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1031 -			regexp_h_fetch(lp, 1);
  3.1032 -		}
  3.1033 -		ep += 2;
  3.1034 -		goto star;
  3.1035 -#endif	/* REGEXP_H_WCHARS */
  3.1036 -
  3.1037 -	case CCL|RNGE:
  3.1038 -		regexp_h_getrnge(ep + 32, least);
  3.1039 -		while(low--) {
  3.1040 -			c = *lp++ & 0377;
  3.1041 -			if(!ISTHERE(c))
  3.1042 -				return(0);
  3.1043 -		}
  3.1044 -		curlp = lp;
  3.1045 -		while(size--) {
  3.1046 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1047 -			c = *lp++ & 0377;
  3.1048 -			if(!ISTHERE(c))
  3.1049 -				break;
  3.1050 -		}
  3.1051 -		if(size < 0) {
  3.1052 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1053 -			lp++;
  3.1054 -		}
  3.1055 -		ep += 34;		/* 32 + 2 */
  3.1056 -		goto star;
  3.1057 -
  3.1058 -#ifdef	REGEXP_H_WCHARS
  3.1059 -	case CCL|RNGE|CMB:
  3.1060 -	case CNCL|RNGE|CMB:
  3.1061 -		regexp_h_getrnge(ep + (*ep & 0377) + 17, least);
  3.1062 -		while (low--) {
  3.1063 -			c = regexp_h_fetch(lp, 1);
  3.1064 -			if (!regexp_h_cclass(ep, c,
  3.1065 -					(ep[-1] & 0377 & ~REGEXP_H_LEAST)
  3.1066 -					== (CCL|RNGE|CMB)))
  3.1067 -				return 0;
  3.1068 -		}
  3.1069 -		curlp = lp;
  3.1070 -		while (size--) {
  3.1071 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1072 -			c = regexp_h_fetch(lp, 1);
  3.1073 -			if (!regexp_h_cclass(ep, c,
  3.1074 -					(ep[-1] & 0377 & ~REGEXP_H_LEAST)
  3.1075 -					== (CCL|RNGE|CMB)))
  3.1076 -				break;
  3.1077 -		}
  3.1078 -		if (size < 0) {
  3.1079 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1080 -			regexp_h_fetch(lp, 1);
  3.1081 -		}
  3.1082 -		ep += (*ep & 0377) + 19;
  3.1083 -		goto star;
  3.1084 -#endif	/* REGEXP_H_WCHARS */
  3.1085 -
  3.1086 -	case CBACK:
  3.1087 -		bbeg = braslist[*ep & 0377];
  3.1088 -		ct = braelist[*ep++ & 0377] - bbeg;
  3.1089 -
  3.1090 -		if(strncmp(bbeg, lp, ct) == 0) {
  3.1091 -			lp += ct;
  3.1092 -			continue;
  3.1093 -		}
  3.1094 -		return(0);
  3.1095 -
  3.1096 -	case CBACK|STAR:
  3.1097 -		bbeg = braslist[*ep & 0377];
  3.1098 -		ct = braelist[*ep++ & 0377] - bbeg;
  3.1099 -		curlp = lp;
  3.1100 -		while(strncmp(bbeg, lp, ct) == 0)
  3.1101 -			lp += ct;
  3.1102 -
  3.1103 -		while(lp >= curlp) {
  3.1104 -			if(regexp_h_advance(lp, ep))	return(1);
  3.1105 -			lp -= ct;
  3.1106 -		}
  3.1107 -		return(0);
  3.1108 -
  3.1109 -
  3.1110 -	case CDOT|STAR:
  3.1111 -		curlp = lp;
  3.1112 -		do
  3.1113 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1114 -		while (*lp++);
  3.1115 -		goto star;
  3.1116 -
  3.1117 -#ifdef	REGEXP_H_WCHARS
  3.1118 -	case CDOT|STAR|CMB:
  3.1119 -		curlp = lp;
  3.1120 -		do
  3.1121 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1122 -		while ((c = regexp_h_fetch(lp, 1)) != L'\0' && c != WEOF);
  3.1123 -		goto star;
  3.1124 -#endif	/* REGEXP_H_WCHARS */
  3.1125 -
  3.1126 -	case CCHR|STAR:
  3.1127 -		curlp = lp;
  3.1128 -		do
  3.1129 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1130 -		while (*lp++ == *ep);
  3.1131 -		ep++;
  3.1132 -		goto star;
  3.1133 -
  3.1134 -#ifdef	REGEXP_H_WCHARS
  3.1135 -	case CCHR|STAR|CMB:
  3.1136 -	case CCH1|STAR:
  3.1137 -	case CCH2|STAR:
  3.1138 -	case CCH3|STAR:
  3.1139 -		curlp = lp;
  3.1140 -		d = regexp_h_fetch(ep, 0);
  3.1141 -		do
  3.1142 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1143 -		while (regexp_h_fetch(lp, 1) == d);
  3.1144 -		goto star;
  3.1145 -#endif	/* REGEXP_H_WCHARS */
  3.1146 -
  3.1147 -	case CCL|STAR:
  3.1148 -		curlp = lp;
  3.1149 -		do {
  3.1150 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1151 -			c = *lp++ & 0377;
  3.1152 -		} while(ISTHERE(c));
  3.1153 -		ep += 32;
  3.1154 -		goto star;
  3.1155 -
  3.1156 -#ifdef	REGEXP_H_WCHARS
  3.1157 -	case CCL|STAR|CMB:
  3.1158 -	case CNCL|STAR|CMB:
  3.1159 -		curlp = lp;
  3.1160 -		do {
  3.1161 -			regexp_h_push(&sb, &sp, &sc, lp);
  3.1162 -			c = regexp_h_fetch(lp, 1);
  3.1163 -		} while (regexp_h_cclass(ep, c, (ep[-1] & 0377)
  3.1164 -					== (CCL|STAR|CMB)));
  3.1165 -		ep += (*ep & 0377) + 17;
  3.1166 -		goto star;
  3.1167 -#endif	/* REGEXP_H_WCHARS */
  3.1168 -
  3.1169 -	star:
  3.1170 -#ifdef	REGEXP_H_WCHARS
  3.1171 -		if (regexp_h_wchars == 0) {
  3.1172 -#endif
  3.1173 -			do {
  3.1174 -				if(--lp == locs)
  3.1175 -					break;
  3.1176 -				if (regexp_h_advance(lp, ep))
  3.1177 -					return(1);
  3.1178 -			} while (lp > curlp);
  3.1179 -#ifdef	REGEXP_H_WCHARS
  3.1180 -		} else {
  3.1181 -			do {
  3.1182 -				lp = regexp_h_pop(&sb, &sp, &sc, lp);
  3.1183 -				if (lp <= locs)
  3.1184 -					break;
  3.1185 -				if (regexp_h_advance(lp, ep)) {
  3.1186 -					regexp_h_zerostak(&sb, &sp);
  3.1187 -					return(1);
  3.1188 -				}
  3.1189 -			} while (lp > curlp);
  3.1190 -			regexp_h_zerostak(&sb, &sp);
  3.1191 -		}
  3.1192 -#endif	/* REGEXP_H_WCHARS */
  3.1193 -		return(0);
  3.1194 -
  3.1195 -	}
  3.1196 -}
  3.1197 -
  3.1198 -static void
  3.1199 -regexp_h_getrnge(register const char *str, int least)
  3.1200 -{
  3.1201 -	low = *str++ & 0377;
  3.1202 -	size = least & REGEXP_H_LEAST ? /*20000*/INT_MAX : (*str & 0377) - low;
  3.1203 -}
  3.1204 -
  3.1205 -int
  3.1206 -advance(const char *lp, const char *ep)
  3.1207 -{
  3.1208 -	REGEXP_H_ADVANCE_INIT	/* skip past circf */
  3.1209 -	regexp_h_bol = lp;
  3.1210 -#ifdef	REGEXP_H_WCHARS
  3.1211 -	regexp_h_firstwc = NULL;
  3.1212 -#endif	/* REGEXP_H_WCHARS */
  3.1213 -	return regexp_h_advance(lp, ep);
  3.1214 -}
     4.1 --- a/regexpr.c	Sun Apr 12 21:45:34 2015 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,90 +0,0 @@
     4.4 -/*
     4.5 - * Simple Regular Expression functions. Derived from Unix 7th Edition,
     4.6 - * /usr/src/cmd/expr.y
     4.7 - *
     4.8 - * Modified by Gunnar Ritter, Freiburg i. Br., Germany, January 2003.
     4.9 - *
    4.10 - * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
    4.11 - *
    4.12 - * Redistribution and use in source and binary forms, with or without
    4.13 - * modification, are permitted provided that the following conditions
    4.14 - * are met:
    4.15 - *   Redistributions of source code and documentation must retain the
    4.16 - *    above copyright notice, this list of conditions and the following
    4.17 - *    disclaimer.
    4.18 - *   Redistributions in binary form must reproduce the above copyright
    4.19 - *    notice, this list of conditions and the following disclaimer in the
    4.20 - *    documentation and/or other materials provided with the distribution.
    4.21 - *   All advertising materials mentioning features or use of this software
    4.22 - *    must display the following acknowledgement:
    4.23 - *      This product includes software developed or owned by Caldera
    4.24 - *      International, Inc.
    4.25 - *   Neither the name of Caldera International, Inc. nor the names of
    4.26 - *    other contributors may be used to endorse or promote products
    4.27 - *    derived from this software without specific prior written permission.
    4.28 - *
    4.29 - * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
    4.30 - * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
    4.31 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    4.32 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    4.33 - * ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
    4.34 - * LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
    4.35 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    4.36 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    4.37 - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    4.38 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    4.39 - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    4.40 - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    4.41 - */
    4.42 -
    4.43 -/*	Sccsid @(#)regexpr.c	1.8 (gritter) 10/13/04	*/
    4.44 -
    4.45 -#include	<stdlib.h>
    4.46 -#include	"regexpr.h"
    4.47 -
    4.48 -int	regerrno, reglength;
    4.49 -static int	circf;
    4.50 -
    4.51 -static char	*regexpr_compile(char *, char *, const char *, int);
    4.52 -
    4.53 -char *
    4.54 -compile(const char *instring, char *ep, char *endbuf)
    4.55 -{
    4.56 -	char	*cp;
    4.57 -	int	sz = 0;
    4.58 -
    4.59 -	if (ep == 0) {
    4.60 -		for (cp = (char *)instring; *cp != '\0'; cp++)
    4.61 -			if (*cp == '[')
    4.62 -				sz += 32;
    4.63 -		sz += 2 * (cp - instring) + 5;
    4.64 -		if ((ep = malloc(sz)) == 0) {
    4.65 -			regerrno = 11;
    4.66 -			return 0;
    4.67 -		}
    4.68 -		endbuf = &ep[sz];
    4.69 -		ep[1] = '\0';
    4.70 -	}
    4.71 -	if ((cp=regexpr_compile((char *)instring, &ep[1], endbuf, '\0')) == 0) {
    4.72 -		if (sz)
    4.73 -			free(ep);
    4.74 -		return 0;
    4.75 -	}
    4.76 -	ep[0] = circf;
    4.77 -	reglength = cp - ep;
    4.78 -	return sz ? ep : cp;
    4.79 -}
    4.80 -
    4.81 -#define	INIT			register char *sp = instring;
    4.82 -#define	GETC()			(*sp++)
    4.83 -#define	PEEKC()			(*sp)
    4.84 -#define	UNGETC(c)		(--sp)
    4.85 -#define	RETURN(c)		return (c);
    4.86 -#define	ERROR(c)		{ regerrno = c; return 0; }
    4.87 -
    4.88 -#define	compile(a, b, c, d)	regexpr_compile(a, b, c, d)
    4.89 -#define	regexp_h_static		static
    4.90 -#define	REGEXP_H_STEP_INIT	circf = *p2++;
    4.91 -#define	REGEXP_H_ADVANCE_INIT	circf = *ep++;
    4.92 -
    4.93 -#include	"regexp.h"
     5.1 --- a/regexpr.h	Sun Apr 12 21:45:34 2015 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,53 +0,0 @@
     5.4 -/*
     5.5 - * Simple Regular Expression functions. Derived from Unix 7th Edition,
     5.6 - * /usr/src/cmd/expr.y
     5.7 - *
     5.8 - * Modified by Gunnar Ritter, Freiburg i. Br., Germany, January 2003.
     5.9 - *
    5.10 - * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
    5.11 - *
    5.12 - * Redistribution and use in source and binary forms, with or without
    5.13 - * modification, are permitted provided that the following conditions
    5.14 - * are met:
    5.15 - *   Redistributions of source code and documentation must retain the
    5.16 - *    above copyright notice, this list of conditions and the following
    5.17 - *    disclaimer.
    5.18 - *   Redistributions in binary form must reproduce the above copyright
    5.19 - *    notice, this list of conditions and the following disclaimer in the
    5.20 - *    documentation and/or other materials provided with the distribution.
    5.21 - *   All advertising materials mentioning features or use of this software
    5.22 - *    must display the following acknowledgement:
    5.23 - *      This product includes software developed or owned by Caldera
    5.24 - *      International, Inc.
    5.25 - *   Neither the name of Caldera International, Inc. nor the names of
    5.26 - *    other contributors may be used to endorse or promote products
    5.27 - *    derived from this software without specific prior written permission.
    5.28 - *
    5.29 - * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
    5.30 - * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
    5.31 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    5.32 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    5.33 - * ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
    5.34 - * LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
    5.35 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    5.36 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    5.37 - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    5.38 - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    5.39 - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    5.40 - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    5.41 - */
    5.42 -
    5.43 -/*	Sccsid @(#)regexpr.h	1.2 (gritter) 1/11/03	*/
    5.44 -
    5.45 -#define	NBRA	9
    5.46 -
    5.47 -extern char	*braslist[NBRA];
    5.48 -extern char	*braelist[NBRA];
    5.49 -extern int	nbra;
    5.50 -extern int	regerrno, reglength;
    5.51 -extern char	*loc1, *loc2, *locs;
    5.52 -extern int	sed;
    5.53 -
    5.54 -extern char	*compile(const char *, char *, char *);
    5.55 -extern int	step(const char *, const char *);
    5.56 -extern int	advance(const char *, const char *);