zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: zsh/regex and =~
Date: Tue, 1 May 2007 22:59:33 +0100	[thread overview]
Message-ID: <20070501225933.c40ac724.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <20070428075635.GA17419@redoubt.spodhuis.org>

On Sat, 28 Apr 2007 00:56:35 -0700
Phil Pennock <zsh-workers+phil.pennock@spodhuis.org> wrote:
> The attached patch and files, which includes documentation, adds a new
> loadable module, zsh/regex.  I've not examined widechar issues and which
> regex libraries actually do handle these.  I've not looked at linkage
> issues on platforms where regex (the POSIX interface, not regexp) is not
> a part of libc.
> 
> This also includes my previous =~ work, replacing the previous patch.
> I'm not sure that auto-unsetting REMATCH_PCRE is a good idea, so invite
> comments; also as to which should be the default value; I suppose that
> if pcre is not the default, then the warning can be put back in ...

Here's what I've ended up with after putting the patches together and
tweaking them.  The tweaks include (some of these deal with points
above):

I didn't put RE_MATCH_PCRE on by default; it seems to me to be a
user choice and having it depend on the shell emulation is more
confusing than useful.  Similarly, I've made the condition code
behave identically (apart, obviously, from the module =~ uses)
whether or not the option is set; if the module you didn't
ask for is not available, you get an error message rather than
a different sort of regular expression.

I've fixed the doc for =~ and tweaked at least one other minor typo.

I've added the option NO_CASE_MATCH to zsh/regex handling (like bash).
I don't know enough about the PCRE library to decide whether it's
sensible to have the same effect there, but if it is that's fine by me.

I've made regex.mdd only compile regex.c based on locating all
four POSIX functions.  This is the best way of handling conditional
support for modules: if it's not supported, there's nothing there
at all, so anything that tests will find out straight away it's
not supported and the disk isn't cluttered with unusable junk.

I've added some debugging code to test for a bad id passed to
the regex-match handler.  This doesn't do a heck of a lot at
the moment, but the case statement was looking a bit lonely
with just one entry.

regex.c is substantially Phil's work so he's mentioned in the copyright.
(As the licence makes clear, no one has actually transferred their
copyright anyway, so if there's ever any argy-bargy it has to be
sorted out line by line or even character by character---the copyrights
at the top of the files are rather less legally meaningful than they look.)


I'll commit this even if there are quibbles, to establish either a stick
in the ground or a line in the sand.  (I asked what the difference
was and was told one was horizontal and the other vertical.)

Index: configure.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.ac,v
retrieving revision 1.61
diff -u -r1.61 configure.ac
--- configure.ac	5 Jan 2007 13:58:04 -0000	1.61
+++ configure.ac	1 May 2007 21:54:50 -0000
@@ -1135,7 +1135,8 @@
 	       erand48 open_memstream \
 	       wctomb iconv \
 	       grantpt unlockpt ptsname \
-	       htons ntohs)
+	       htons ntohs \
+	       regcomp regexec regerror regfree)
 AC_FUNC_STRCOLL
 
 if test x$enable_cap = xyes; then
Index: Doc/Makefile.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Makefile.in,v
retrieving revision 1.35
diff -u -r1.35 Makefile.in
--- Doc/Makefile.in	17 Dec 2006 16:02:02 -0000	1.35
+++ Doc/Makefile.in	1 May 2007 21:54:52 -0000
@@ -61,7 +61,7 @@
 Zsh/mod_datetime.yo Zsh/mod_deltochar.yo \
 Zsh/mod_example.yo Zsh/mod_files.yo \
 Zsh/mod_mapfile.yo Zsh/mod_mathfunc.yo Zsh/mod_newuser.yo \
-Zsh/mod_parameter.yo Zsh/mod_pcre.yo \
+Zsh/mod_parameter.yo Zsh/mod_pcre.yo Zsh/mod_regex.yo \
 Zsh/mod_sched.yo Zsh/mod_socket.yo \
 Zsh/mod_stat.yo  Zsh/mod_system.yo Zsh/mod_tcp.yo \
 Zsh/mod_termcap.yo Zsh/mod_terminfo.yo \
Index: Doc/Zsh/cond.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/cond.yo,v
retrieving revision 1.3
diff -u -r1.3 cond.yo
--- Doc/Zsh/cond.yo	22 May 2000 15:01:35 -0000	1.3
+++ Doc/Zsh/cond.yo	1 May 2007 21:54:52 -0000
@@ -109,6 +109,20 @@
 item(var(string) tt(!=) var(pattern))(
 true if var(string) does not match var(pattern).
 )
+item(var(string) tt(=~) var(regexp))(
+true if var(string) matches the regular expression
+var(regexp).  If the option tt(RE_MATCH_PCRE) is set
+var(regexp) is tested as a PCRE regular expression using
+the tt(zsh/pcre) module, else it is tested as a POSIX
+regular expression using the tt(zsh/regex) module.
+If the option tt(BASH_REMATCH) is set the array
+tt(BASH_REMATCH) is set to the substring that matched the pattern
+followed by the substrings that matched parenthesised
+subexpressions within the pattern; otherwise, the scalar parameter
+tt(MATCH) is set to the substring that matched the pattern and
+and the array tt(match) to the substrings that matched parenthesised
+subexpressions.
+)
 item(var(string1) tt(<) var(string2))(
 true if var(string1) comes before var(string2)
 based on ASCII value of their characters.
Index: Doc/Zsh/mod_pcre.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_pcre.yo,v
retrieving revision 1.5
diff -u -r1.5 mod_pcre.yo
--- Doc/Zsh/mod_pcre.yo	20 Jun 2004 22:47:18 -0000	1.5
+++ Doc/Zsh/mod_pcre.yo	1 May 2007 21:54:52 -0000
@@ -22,14 +22,17 @@
 matching.
 )
 findex(pcre_match)
-item(tt(pcre_match) [ tt(-a) var(arr) ] var(string))(
+item(tt(pcre_match) [ tt(-v) var(var) ] [ tt(-a) var(arr) ] var(string))(
 Returns successfully if tt(string) matches the previously-compiled
 PCRE.
 
 If the expression captures substrings within parentheses,
 tt(pcre_match) will set the array var($match) to those
 substrings, unless the tt(-a) option is given, in which
-case it will set the array var(arr).
+case it will set the array var(arr).  Similarly, the variable
+var(MATCH) will be set to the entire matched portion of the
+string, unless the tt(-v) option is given, in which case the variable
+var(var) will be set.
 )
 enditem()
 
Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.53
diff -u -r1.53 options.yo
--- Doc/Zsh/options.yo	5 Mar 2007 17:35:18 -0000	1.53
+++ Doc/Zsh/options.yo	1 May 2007 21:54:52 -0000
@@ -319,6 +319,13 @@
 can match the directory tt(CVS) owing to the presence of the globbing flag
 (unless the option tt(BARE_GLOB_QUAL) is unset).
 )
+pindex(CASE_MATCH)
+cindex(case-insensitive regular expression matches, option)
+cindex(regular expressions, case-insensitive matching, option)
+item(tt(CASE_MATCH) <D>)(
+Make regular expressions using the tt(zsh/regex) module (including
+matches with tt(=~)) sensitive to case.
+)
 pindex(CSH_NULL_GLOB)
 cindex(csh, null globbing style)
 cindex(null globbing style, csh)
@@ -478,6 +485,15 @@
 `var(fooabar foobbar foocbar)' instead of the default
 `var(fooa b cbar)'.
 )
+pindex(REMATCH_PCRE)
+cindex(regexp, PCRE)
+cindex(PCRE, regexp)
+item(tt(REMATCH_PCRE) <Z>)(
+If set, regular expression matching with the tt(=~) operator will use
+Perl-Compatible Regular Expressions from the PCRE library, if available.
+If not set, regular expressions will use the extended regexp syntax
+provided by the system libraries.
+)
 pindex(SH_GLOB)
 cindex(sh, globbing style)
 cindex(globbing style, sh)
@@ -1131,6 +1147,20 @@
 
 subsect(Shell Emulation)
 startitem()
+pindex(BASH_REMATCH)
+cindex(bash, BASH_REMATCH variable)
+cindex(regexp, bash BASH_REMATCH variable)
+item(tt(BASH_REMATCH))(
+When set, matches performed with the tt(=~) operator will set the
+tt(BASH_REMATCH) array variable, instead of the default tt(MATCH) and
+tt(match) variables.  The first element of the tt(BASH_REMATCH) array
+will contain the entire matched text and subsequent elements will contain
+extracted substrings.  This option makes more sense when tt(KSH_ARRAYS) is
+also set, so that the entire matched portion is stored at index 0 and the
+first substring is at index 1.  Without this option, the tt(MATCH) variable
+contains the entire matched text and the tt(match) array variable contains
+substrings.
+)
 pindex(BSD_ECHO)
 cindex(echo, BSD compatible)
 item(tt(BSD_ECHO) <S>)(
Index: Src/cond.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/cond.c,v
retrieving revision 1.8
diff -u -r1.8 cond.c
--- Src/cond.c	30 May 2006 22:35:03 -0000	1.8
+++ Src/cond.c	1 May 2007 21:54:52 -0000
@@ -34,7 +34,7 @@
 
 static char *condstr[COND_MOD] = {
     "!", "&&", "||", "==", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq",
-    "-ne", "-lt", "-gt", "-le", "-ge"
+    "-ne", "-lt", "-gt", "-le", "-ge", "=~"
 };
 
 /*
@@ -53,14 +53,14 @@
 evalcond(Estate state, char *fromtest)
 {
     struct stat *st;
-    char *left, *right;
+    char *left, *right, *overridename, overridebuf[13];
     Wordcode pcode;
     wordcode code;
     int ctype, htok = 0, ret;
 
  rec:
 
-    left = right = NULL;
+    left = right = overridename = NULL;
     pcode = state->pc++;
     code = *pcode;
     ctype = WC_COND_TYPE(code);
@@ -92,13 +92,28 @@
 	    state->pc = pcode + (WC_COND_SKIP(code) + 1);
 	    return ret;
 	}
+    case COND_REGEX:
+	{
+	    char *modname = isset(REMATCHPCRE) ? "zsh/pcre" : "zsh/regex";
+	    if (!load_module_silence(modname, 1)) {
+		zwarnnam(fromtest, "%s not available for regex",
+			 modname);
+		return 2;
+	    }
+	    sprintf(overridename = overridebuf, "-%s-match", modname+4);
+	    ctype = COND_MODI;
+	}
+	/*FALLTHROUGH*/
     case COND_MOD:
     case COND_MODI:
 	{
 	    Conddef cd;
-	    char *name = ecgetstr(state, EC_NODUP, NULL), **strs;
+	    char *name = overridename;
+	    char **strs;
 	    int l = WC_COND_SKIP(code);
 
+	    if (name == NULL)
+		name = ecgetstr(state, EC_NODUP, NULL);
 	    if (ctype == COND_MOD)
 		strs = ecgetarr(state, l, EC_DUP, NULL);
 	    else {
@@ -139,7 +154,8 @@
 		    return !cd->handler(strs, cd->condid);
 		} else {
 		    zwarnnam(fromtest,
-			     "unrecognized condition: `%s'", name);
+			     "unrecognized condition: `%s'",
+			     name ? name : "<null>");
 		}
 	    }
 	    /* module not found, error */
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.35
diff -u -r1.35 options.c
--- Src/options.c	15 Mar 2007 15:16:58 -0000	1.35
+++ Src/options.c	1 May 2007 21:54:54 -0000
@@ -88,11 +88,13 @@
 {{NULL, "banghist",	      OPT_NONBOURNE},		 BANGHIST},
 {{NULL, "bareglobqual",       OPT_EMULATE|OPT_ZSH},      BAREGLOBQUAL},
 {{NULL, "bashautolist",	      0},                        BASHAUTOLIST},
+{{NULL, "bashrematch",	      0},			 BASHREMATCH},
 {{NULL, "beep",		      OPT_ALL},			 BEEP},
 {{NULL, "bgnice",	      OPT_EMULATE|OPT_NONBOURNE},BGNICE},
 {{NULL, "braceccl",	      OPT_EMULATE},		 BRACECCL},
 {{NULL, "bsdecho",	      OPT_EMULATE|OPT_SH},	 BSDECHO},
 {{NULL, "caseglob",	      OPT_ALL},			 CASEGLOB},
+{{NULL, "casematch",	      OPT_ALL},			 CASEMATCH},
 {{NULL, "cbases",	      0},			 CBASES},
 {{NULL, "cdablevars",	      OPT_EMULATE},		 CDABLEVARS},
 {{NULL, "chasedots",	      OPT_EMULATE},		 CHASEDOTS},
@@ -201,6 +203,7 @@
 {{NULL, "rcquotes",	      OPT_EMULATE},		 RCQUOTES},
 {{NULL, "rcs",		      OPT_ALL},			 RCS},
 {{NULL, "recexact",	      0},			 RECEXACT},
+{{NULL, "rematchpcre",	      0},			 REMATCHPCRE},
 {{NULL, "restricted",	      OPT_SPECIAL},		 RESTRICTED},
 {{NULL, "rmstarsilent",	      OPT_BOURNE},		 RMSTARSILENT},
 {{NULL, "rmstarwait",	      0},			 RMSTARWAIT},
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.64
diff -u -r1.64 parse.c
--- Src/parse.c	23 Apr 2007 17:24:23 -0000	1.64
+++ Src/parse.c	1 May 2007 21:54:54 -0000
@@ -2124,6 +2124,12 @@
 	ecstr(a);
 	ecstr(c);
 	ecadd(ecnpats++);
+    } else if ((b[0] == Equals || b[0] == '=') &&
+               (b[1] == '~' || b[1] == Tilde) && ~b[2]) {
+	ecadd(WCB_COND(COND_REGEX, 0));
+	ecstr(a);
+	ecstr(c);
+	ecadd(ecnpats++);
     } else if (b[0] == '-') {
 	if ((t0 = get_cond_num(b + 1)) > -1) {
 	    ecadd(WCB_COND(t0 + COND_NT, 0));
Index: Src/text.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/text.c,v
retrieving revision 1.19
diff -u -r1.19 text.c
--- Src/text.c	23 Apr 2007 15:24:00 -0000	1.19
+++ Src/text.c	1 May 2007 21:54:54 -0000
@@ -640,7 +640,7 @@
 	    {
 		static char *c1[] = {
 		    "=", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq",
-		    "-ne", "-lt", "-gt", "-le", "-ge"
+		    "-ne", "-lt", "-gt", "-le", "-ge", "=~"
 		};
 
 		int ctype;
@@ -724,7 +724,7 @@
 			}
 			break;
 		    default:
-			if (ctype <= COND_GE) {
+			if (ctype < COND_MOD) {
 			    /* Binary test: `a = b' etc. */
 			    taddstr(ecgetstr(state, EC_NODUP, NULL));
 			    taddstr(" ");
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.112
diff -u -r1.112 zsh.h
--- Src/zsh.h	29 Mar 2007 21:35:39 -0000	1.112
+++ Src/zsh.h	1 May 2007 21:54:57 -0000
@@ -519,8 +519,9 @@
 #define COND_GT    13
 #define COND_LE    14
 #define COND_GE    15
-#define COND_MOD   16
-#define COND_MODI  17
+#define COND_REGEX 16
+#define COND_MOD   17
+#define COND_MODI  18
 
 typedef int (*CondHandler) _((char **, int));
 
@@ -1588,11 +1589,13 @@
     BANGHIST,
     BAREGLOBQUAL,
     BASHAUTOLIST,
+    BASHREMATCH,
     BEEP,
     BGNICE,
     BRACECCL,
     BSDECHO,
     CASEGLOB,
+    CASEMATCH,
     CBASES,
     CDABLEVARS,
     CHASEDOTS,
@@ -1695,6 +1698,7 @@
     RCQUOTES,
     RCS,
     RECEXACT,
+    REMATCHPCRE,
     RESTRICTED,
     RMSTARSILENT,
     RMSTARWAIT,
Index: Src/Modules/pcre.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/pcre.c,v
retrieving revision 1.11
diff -u -r1.11 pcre.c
--- Src/Modules/pcre.c	5 Apr 2007 16:20:15 -0000	1.11
+++ Src/Modules/pcre.c	1 May 2007 21:54:57 -0000
@@ -3,7 +3,7 @@
  *
  * This file is part of zsh, the Z shell.
  *
- * Copyright (c) 2001, 2002, 2003, 2004 Clint Adams
+ * Copyright (c) 2001, 2002, 2003, 2004, 2007 Clint Adams
  * All rights reserved.
  *
  * Permission is hereby granted, without written agreement and without
@@ -42,6 +42,37 @@
 
 /**/
 static int
+zpcre_utf8_enabled(void)
+{
+#if defined(MULTIBYTE_SUPPORT) && defined(HAVE_NL_LANGINFO) && defined(CODESET)
+    static int have_utf8_pcre = -1;
+
+    /* value can toggle based on MULTIBYTE, so don't
+     * be too eager with caching */
+    if (have_utf8_pcre < -1)
+	return 0;
+
+    if (!isset(MULTIBYTE))
+	return 0;
+
+    if ((have_utf8_pcre == -1) &&
+        (!strcmp(nl_langinfo(CODESET), "UTF-8"))) {
+
+	if (pcre_config(PCRE_CONFIG_UTF8, &have_utf8_pcre))
+	    have_utf8_pcre = -2; /* erk, failed to ask */
+    }
+
+    if (have_utf8_pcre < 0)
+	return 0;
+    return have_utf8_pcre;
+
+#else
+    return 0;
+#endif
+}
+
+/**/
+static int
 bin_pcre_compile(char *nam, char **args, Options ops, UNUSED(int func))
 {
     int pcre_opts = 0, pcre_errptr;
@@ -52,8 +83,14 @@
     if(OPT_ISSET(ops,'m')) pcre_opts |= PCRE_MULTILINE;
     if(OPT_ISSET(ops,'x')) pcre_opts |= PCRE_EXTENDED;
     
+    if (zpcre_utf8_enabled())
+	pcre_opts |= PCRE_UTF8;
+
     pcre_hints = NULL;  /* Is this necessary? */
     
+    if (pcre_pattern)
+	pcre_free(pcre_pattern);
+
     pcre_pattern = pcre_compile(*args, pcre_opts, &pcre_error, &pcre_errptr, NULL);
     
     if (pcre_pattern == NULL)
@@ -100,37 +137,52 @@
 
 /**/
 static int
-zpcre_get_substrings(char *arg, int *ovec, int ret, char *receptacle)
+zpcre_get_substrings(char *arg, int *ovec, int ret, char *matchvar, char *substravar, int matchedinarr)
 {
-    char **captures, **matches;
+    char **captures, **match_all, **matches;
+    int capture_start = 1;
 
-	if(!pcre_get_substring_list(arg, ovec, ret, (const char ***)&captures)) {
-	    
-	    matches = zarrdup(&captures[1]); /* first one would be entire string */
-	    if (receptacle == NULL)
-		setaparam("match", matches);
-	    else
-		setaparam(receptacle, matches);
-	    
-	    pcre_free_substring_list((const char **)captures);
-	}
+    if (matchedinarr)
+	capture_start = 0;
+    if (matchvar == NULL)
+	matchvar = "MATCH";
+    if (substravar == NULL)
+	substravar = "match";
+
+    /* captures[0] will be entire matched string, [1] first substring */
+    if(!pcre_get_substring_list(arg, ovec, ret, (const char ***)&captures)) {
+	match_all = ztrdup(captures[0]);
+	setsparam(matchvar, match_all);
+	matches = zarrdup(&captures[capture_start]);
+	setaparam(substravar, matches);
+	pcre_free_substring_list((const char **)captures);
+    }
 
-	return 0;
+    return 0;
 }
 
 /**/
 static int
 bin_pcre_match(char *nam, char **args, Options ops, UNUSED(int func))
 {
-    int ret, capcount, *ovec, ovecsize;
+    int ret, capcount, *ovec, ovecsize, c;
+    char *matched_portion = NULL;
     char *receptacle = NULL;
+    int return_value = 1;
+
+    if (pcre_pattern == NULL) {
+	zwarnnam(nam, "no pattern has been compiled");
+	return 1;
+    }
     
-    if(OPT_ISSET(ops,'a')) {
-	receptacle = *args++;
-	if(!*args) {
-	    zwarnnam(nam, "not enough arguments");
-	    return 1;
-	}
+    if(OPT_HASARG(ops,c='a')) {
+	receptacle = OPT_ARG(ops,c);
+    }
+    if(OPT_HASARG(ops,c='v')) {
+	matched_portion = OPT_ARG(ops,c);
+    }
+    if(!*args) {
+	zwarnnam(nam, "not enough arguments");
     }
     
     if ((ret = pcre_fullinfo(pcre_pattern, pcre_hints, PCRE_INFO_CAPTURECOUNT, &capcount)))
@@ -144,18 +196,20 @@
     
     ret = pcre_exec(pcre_pattern, pcre_hints, *args, strlen(*args), 0, 0, ovec, ovecsize);
     
-    if (ret==0) return 0;
-    else if (ret==PCRE_ERROR_NOMATCH) return 1; /* no match */
+    if (ret==0) return_value = 0;
+    else if (ret==PCRE_ERROR_NOMATCH) /* no match */;
     else if (ret>0) {
-	zpcre_get_substrings(*args, ovec, ret, receptacle);
-	return 0;
+	zpcre_get_substrings(*args, ovec, ret, matched_portion, receptacle, 0);
+	return_value = 0;
     }
     else {
 	zwarnnam(nam, "error in pcre_exec");
-	return 1;
     }
     
-    return 1;
+    if (ovec)
+	zfree(ovec, ovecsize*sizeof(int));
+
+    return return_value;
 }
 
 /**/
@@ -164,33 +218,63 @@
 {
     pcre *pcre_pat;
     const char *pcre_err;
-    char *lhstr, *rhre;
+    char *lhstr, *rhre, *avar=NULL;
     int r = 0, pcre_opts = 0, pcre_errptr, capcnt, *ov, ovsize;
+    int return_value = 0;
+
+    if (zpcre_utf8_enabled())
+	pcre_opts |= PCRE_UTF8;
 
     lhstr = cond_str(a,0,0);
     rhre = cond_str(a,1,0);
+    pcre_pat = ov = NULL;
+
+    if (isset(BASHREMATCH))
+	avar="BASH_REMATCH";
 
     switch(id) {
 	 case CPCRE_PLAIN:
-		 pcre_pat = pcre_compile(rhre, pcre_opts, &pcre_err, &pcre_errptr, NULL);
-                 pcre_fullinfo(pcre_pat, NULL, PCRE_INFO_CAPTURECOUNT, &capcnt);
-    		 ovsize = (capcnt+1)*3;
-		 ov = zalloc(ovsize*sizeof(int));
-    		 r = pcre_exec(pcre_pat, NULL, lhstr, strlen(lhstr), 0, 0, ov, ovsize);
-    		if (r==0) return 1;
+		pcre_pat = pcre_compile(rhre, pcre_opts, &pcre_err, &pcre_errptr, NULL);
+		if (pcre_pat == NULL) {
+		    zwarn("failed to compile regexp /%s/: %s", rhre, pcre_err);
+		    break;
+		}
+                pcre_fullinfo(pcre_pat, NULL, PCRE_INFO_CAPTURECOUNT, &capcnt);
+    		ovsize = (capcnt+1)*3;
+		ov = zalloc(ovsize*sizeof(int));
+    		r = pcre_exec(pcre_pat, NULL, lhstr, strlen(lhstr), 0, 0, ov, ovsize);
+		/* r < 0 => error; r==0 match but not enough size in ov
+		 * r > 0 => (r-1) substrings found; r==1 => no substrings
+		 */
+    		if (r==0) {
+		    zwarn("reportable zsh problem: pcre_exec() returned 0");
+		    return_value = 1;
+		    break;
+		}
 	        else if (r==PCRE_ERROR_NOMATCH) return 0; /* no match */
+		else if (r<0) {
+		    zwarn("pcre_exec() error: %d", r);
+		    break;
+		}
                 else if (r>0) {
-		    zpcre_get_substrings(lhstr, ov, r, NULL);
-		    return 1;
+		    zpcre_get_substrings(lhstr, ov, r, NULL, avar, isset(BASHREMATCH));
+		    return_value = 1;
+		    break;
 		}
 		break;
     }
 
-    return 0;
+    if (pcre_pat)
+	pcre_free(pcre_pat);
+    if (ov)
+	zfree(ov, ovsize*sizeof(int));
+
+    return return_value;
 }
 
 static struct conddef cotab[] = {
     CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN)
+    /* CONDDEF can register =~ but it won't be found */
 };
 
 /**/
@@ -206,7 +290,7 @@
 static struct builtin bintab[] = {
     BUILTIN("pcre_compile", 0, bin_pcre_compile, 1, 1, 0, "aimx",  NULL),
     BUILTIN("pcre_study",   0, bin_pcre_study,   0, 0, 0, NULL,    NULL),
-    BUILTIN("pcre_match",   0, bin_pcre_match,   1, 2, 0, "a",    NULL)
+    BUILTIN("pcre_match",   0, bin_pcre_match,   1, 1, 0, "a:v:",    NULL)
 };
 
 
Index: Src/Modules/regex.c
===================================================================
RCS file: Src/Modules/regex.c
diff -N Src/Modules/regex.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/regex.c	1 May 2007 21:54:57 -0000
@@ -0,0 +1,161 @@
+/*
+ * regex.c
+ *
+ * This file is part of zsh, the Z shell.
+ *
+ * Copyright (c) 2007 Phil Pennock
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and to distribute modified versions of this software for any
+ * purpose, provided that the above copyright notice and the following
+ * two paragraphs appear in all copies of this software.
+ *
+ * In no event shall Phil Pennock or the Zsh Development Group be liable
+ * to any party for direct, indirect, special, incidental, or consequential
+ * damages arising out of the use of this software and its documentation,
+ * even if Phil Pennock and the Zsh Development Group have been advised of
+ * the possibility of such damage.
+ *
+ * Phil Pennock and the Zsh Development Group specifically disclaim any
+ * warranties, including, but not limited to, the implied warranties of
+ * merchantability and fitness for a particular purpose.  The software
+ * provided hereunder is on an "as is" basis, and Phil Pennock and the
+ * Zsh Development Group have no obligation to provide maintenance,
+ * support, updates, enhancements, or modifications.
+ *
+ */
+
+#include "regex.mdh"
+#include "regex.pro"
+
+#include <regex.h>
+
+/* we default to a vaguely modern syntax and set of capabilities */
+#define ZREGEX_EXTENDED 0
+/* if you want Basic syntax, make it an alternative options */
+
+static void
+zregex_regerrwarn(int r, regex_t *re, char *msg)
+{
+    char *errbuf;
+    size_t errbufsz;
+
+    errbufsz = regerror(r, re, NULL, 0);
+    errbuf = zalloc(errbufsz*sizeof(char));
+    regerror(r, re, errbuf, errbufsz);
+    zwarn("%s: %s", msg, errbuf);
+    zfree(errbuf, errbufsz);
+}
+
+/**/
+static int
+zcond_regex_match(char **a, int id)
+{
+    regex_t re;
+    regmatch_t *m, *matches = NULL;
+    size_t matchessz;
+    char *lhstr, *rhre, *s, **arr, **x;
+    int r, n, return_value, rcflags, reflags, nelem, start;
+
+    lhstr = cond_str(a,0,0);
+    rhre = cond_str(a,1,0);
+    rcflags = reflags = 0;
+    return_value = 0; /* 1 => matched successfully */
+
+    switch(id) {
+    case ZREGEX_EXTENDED:
+	rcflags |= REG_EXTENDED;
+	if (!isset(CASEMATCH))
+	    rcflags |= REG_ICASE;
+	r = regcomp(&re, rhre, rcflags);
+	if (r) {
+	    zregex_regerrwarn(r, &re, "failed to compile regex");
+	    break;
+	}
+	/* re.re_nsub is number of parenthesized groups, we also need
+	 * 1 for the 0 offset, which is the entire matched portion
+	 */
+	if (re.re_nsub < 0) {
+	    zwarn("INTERNAL ERROR: regcomp() returned "
+		    "negative subpattern count %d", re.re_nsub);
+	    break;
+	}
+	matchessz = (re.re_nsub + 1) * sizeof(regmatch_t);
+	matches = zalloc(matchessz);
+	r = regexec(&re, lhstr, re.re_nsub+1, matches, reflags);
+	if (r == REG_NOMATCH) /**/;
+	else if (r == 0) {
+	    return_value = 1;
+	    if (isset(BASHREMATCH)) {
+		start = 0;
+		nelem = re.re_nsub + 1;
+	    } else {
+		start = 1;
+		nelem = re.re_nsub;
+	    }
+	    arr = NULL; /* bogus gcc warning of used uninitialised */
+	    /* entire matched portion + re_nsub substrings + NULL */
+	    if (nelem) {
+		arr = x = (char **) zalloc(sizeof(char *) * (nelem + 1));
+		for (m = matches + start, n = start; n <= re.re_nsub; ++n, ++m, ++x) {
+		    *x = ztrduppfx(lhstr + m->rm_so, m->rm_eo - m->rm_so);
+		}
+		*x = NULL;
+	    }
+	    if (isset(BASHREMATCH)) {
+		setaparam("BASH_REMATCH", arr);
+	    } else {
+		m = matches;
+		s = ztrduppfx(lhstr + m->rm_so, m->rm_eo - m->rm_so);
+		setsparam("MATCH", s);
+		if (nelem)
+		    setaparam("match", arr);
+	    }
+	}
+	else zregex_regerrwarn(r, &re, "regex matching error");
+	break;
+    default:
+	DPUTS(1, "bad regex option");
+	break;
+    }
+
+    if (matches)
+	zfree(matches, matchessz);
+    regfree(&re);
+    return return_value;
+}
+
+static struct conddef cotab[] = {
+    CONDDEF("regex-match", CONDF_INFIX, zcond_regex_match, 0, 0, ZREGEX_EXTENDED)
+};
+
+/**/
+int
+setup_(UNUSED(Module m))
+{
+    return 0;
+}
+
+/**/
+int
+boot_(Module m)
+{
+    return !addconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+}
+
+/**/
+int
+cleanup_(Module m)
+{
+    deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab));
+    return 0;
+}
+
+/**/
+int
+finish_(UNUSED(Module m))
+{
+    return 0;
+}
Index: Src/Modules/regex.mdd
===================================================================
RCS file: Src/Modules/regex.mdd
diff -N Src/Modules/regex.mdd
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Src/Modules/regex.mdd	1 May 2007 21:54:57 -0000
@@ -0,0 +1,10 @@
+name=zsh/regex
+link=`if test x$ac_cv_func_regcomp = xyes && \
+         test x$ac_cv_func_regexec = xyes && \
+         test x$ac_cv_func_regerror = xyes && \
+         test x$ac_cv_func_regfree = xyes; then echo dynamic; else echo no; fi`
+load=no
+
+autobins=""
+
+objects="regex.o"

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  parent reply	other threads:[~2007-05-01 22:01 UTC|newest]

Thread overview: 423+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <zsh-workers+phil.pennock@spodhuis.org>
2007-04-28  7:56 ` Phil Pennock
2007-04-28  8:20   ` Phil Pennock
2007-04-29  0:51   ` Phil Pennock
2007-04-29 15:16   ` Peter Stephenson
2007-04-29 15:28     ` Peter Stephenson
2007-04-29 19:17       ` Phil Pennock
2007-05-01 21:59   ` Peter Stephenson [this message]
2007-05-02  0:11     ` Phil Pennock
2007-05-02  2:53       ` Bart Schaefer
2007-05-29  8:56   ` Phil Pennock
2015-11-22 17:52 Possibly excessive WARN_CREATE_GLOBAL Bart Schaefer
2015-11-22 18:27 ` Peter Stephenson
2015-11-22 19:04   ` Bart Schaefer
2015-11-22 19:15     ` Peter Stephenson
2015-11-22 20:30       ` Bart Schaefer
2015-11-23 15:49         ` Peter Stephenson
2015-11-24  4:43           ` Bart Schaefer
2015-11-24 10:41             ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2014-08-01  8:20 Possible bug to RPROMPT Felipe G. Silveira
2014-08-04 19:31 ` Bart Schaefer
2014-08-04 19:50   ` Peter Stephenson
2014-08-04 20:50     ` Bart Schaefer
2014-08-05  7:54       ` Bart Schaefer
2014-08-06  7:57         ` Bart Schaefer
2014-08-07  8:36           ` [PATCH] Better prompt width calculations (Re: Possible bug to RPROMPT) Bart Schaefer
2015-04-02 15:46             ` Jun T.
2015-04-02 16:48               ` Bart Schaefer
2014-07-17 12:58 [PATCH] Fix loading of multi-line history entires from disk Augie Fackler
2014-07-17 18:23 ` Bart Schaefer
2014-07-17 19:58   ` Peter Stephenson
2014-07-17 23:56     ` Augie Fackler
2014-07-18  3:08     ` Bart Schaefer
2014-07-18  6:01       ` Bart Schaefer
2014-07-18 18:21         ` Peter Stephenson
2014-07-18 18:21       ` Peter Stephenson
2014-07-17 19:51 ` Peter Stephenson
2014-02-15 20:45 SUGGESTION: Simplify auto-completion, a little mail
2014-02-15 23:15 ` Bart Schaefer
2014-02-15 23:29   ` Peter Stephenson
2014-02-16  3:06     ` Bart Schaefer
2013-07-15 13:35 bug with eval, proc-subst and pipes Stephane Chazelas
2013-07-15 17:06 ` Bart Schaefer
2013-07-15 19:14   ` Re[2]: " Manuel Presnitz
2013-07-15 21:52     ` Bart Schaefer
2013-07-16 20:55   ` Peter Stephenson
2013-07-17  7:00     ` Bart Schaefer
2013-07-17 19:17       ` Peter Stephenson
2013-07-18  3:50         ` Vin Shelton
2013-07-18  8:57           ` Peter Stephenson
2013-07-18  9:22             ` Peter Stephenson
2013-07-18 11:32               ` Peter Stephenson
2013-07-18 11:47                 ` Peter Stephenson
2013-07-19 20:01                 ` Stephane Chazelas
2013-07-19 20:58                   ` Stephane Chazelas
2013-07-20 17:11                     ` Peter Stephenson
2013-07-20 20:25                       ` Stephane Chazelas
2013-07-20 22:55                         ` Peter Stephenson
2013-07-21  9:45                           ` Stephane Chazelas
2013-07-21 12:23                             ` Stephane Chazelas
2013-07-21 19:51                               ` Stephane Chazelas
2013-07-20 20:57                       ` Bart Schaefer
2013-07-20 22:16                         ` Peter Stephenson
2013-07-24 15:39                       ` Peter Stephenson
2013-07-19 21:36                   ` Bart Schaefer
2013-07-19 22:56                     ` Stephane Chazelas
2013-07-18  9:44         ` Stephane Chazelas
2013-07-18 18:08           ` Bart Schaefer
2013-07-18 18:25             ` Bart Schaefer
2012-12-06 19:44 It's time for 5.0.1 Peter Stephenson
2012-12-08 19:54 ` Bart Schaefer
2012-12-09 19:10   ` Peter Stephenson
2012-12-12  8:14     ` Bart Schaefer
2012-12-12  9:56       ` Peter Stephenson
2012-12-12 19:29         ` Bart Schaefer
2012-12-15 18:16           ` Peter Stephenson
2012-12-15 19:26             ` Bart Schaefer
2012-12-15 19:47               ` Peter Stephenson
2012-12-16 20:03   ` Peter Stephenson
2012-12-17  5:59     ` Bart Schaefer
2012-12-17 21:13     ` Axel Beckert
2012-12-18 16:22     ` S. Cowles
2012-12-18 16:44       ` Peter Stephenson
     [not found] <86aadnwtl2.fsf@gmail.com>
2011-06-12 14:22 ` killing suspended jobs makes zsh hang after 47d1215 Bart Schaefer
2011-06-12 14:59   ` Bart Schaefer
2011-06-12 17:02     ` Peter Stephenson
2011-06-12 22:13       ` Bart Schaefer
2011-06-13  0:02     ` Pan Tsu
2011-06-13  1:53       ` Bart Schaefer
2011-06-13 11:07         ` Peter Stephenson
2011-06-13 14:37           ` Bart Schaefer
2011-06-14 18:54             ` Peter Stephenson
2011-06-15  2:59               ` Bart Schaefer
     [not found] <201008311754.27361.joke@seiken.de>
2010-08-31 19:18 ` environment variables Peter Stephenson
2010-09-01 15:25   ` Bart Schaefer
2010-09-01 18:35     ` Peter Stephenson
     [not found] <p.w.stephenson@ntlworld.com>
2006-12-08 21:23 ` PATCH: _firefox Peter Stephenson
2006-12-08 21:28   ` Peter Stephenson
2006-12-08 21:52     ` Clint Adams
2006-12-17 13:32     ` arno.
2010-05-23 19:58 ` ${(q)...} for newline Peter Stephenson
2010-05-23 20:45   ` Peter Stephenson
2010-05-25 13:25     ` Stephane Chazelas
2010-05-25 14:48       ` Peter Stephenson
2010-05-26 19:54         ` Peter Stephenson
2010-05-25 14:00   ` Bart Schaefer
     [not found] <matthi@infodrom.north.de>
2009-11-08 11:49 ` FEATURES description wrong line Maddi Kopfermann
2009-11-08 17:08   ` Bart Schaefer
2009-11-08 19:48     ` Stephane Chazelas
2009-11-08 18:44   ` Peter Stephenson
2009-11-10 15:07     ` Bart Schaefer
2009-11-10 18:09       ` Peter Stephenson
2009-07-12 20:59 zsh 4.3.10 terminates with SIGINT when one types Ctrl-G in emacs under Mac OS X Vincent Lefevre
2009-07-12 21:50 ` Bart Schaefer
2009-07-13  0:43   ` Vincent Lefevre
2009-07-13  2:36     ` Bart Schaefer
2009-07-13 18:39       ` Peter Stephenson
2009-07-16 16:24         ` Vincent Lefevre
2009-07-18  5:29           ` Bart Schaefer
2009-07-18 10:16             ` Vincent Lefevre
2009-07-18 18:16               ` Bart Schaefer
2009-07-19 18:03                 ` Bart Schaefer
2009-07-19 19:15                   ` Bart Schaefer
2009-07-19 20:14                     ` Bart Schaefer
2009-07-19 20:41                       ` Peter Stephenson
2009-07-18 18:35               ` Bart Schaefer
2009-07-18 23:09                 ` Vincent Lefevre
2009-07-19  9:51                   ` Vincent Lefevre
2009-07-19 16:32                     ` Bart Schaefer
2009-07-19 22:24                       ` Vincent Lefevre
2009-07-19 18:31                   ` Bart Schaefer
2009-07-20  8:31                     ` Vincent Lefevre
2009-07-22  2:58                       ` Eric Blake
2009-07-22  8:16                         ` Vincent Lefevre
2009-07-07 21:08 non-interactive set -m Eric Blake
2009-07-08  8:58 ` Peter Stephenson
2009-07-08 13:26   ` Eric Blake
2009-07-08 13:49     ` Peter Stephenson
2009-07-09 14:03       ` Eric Blake
2009-07-09 14:13         ` Peter Stephenson
2009-07-09 16:25           ` Eric Blake
2009-07-09 18:13       ` Eric Blake
2009-07-09 19:36         ` Peter Stephenson
2009-07-09 19:56         ` Peter Stephenson
2009-07-10  3:40           ` Bart Schaefer
2009-07-09 20:23         ` Peter Stephenson
2009-07-09 21:40           ` Eric Blake
2009-07-10  8:58             ` Peter Stephenson
2009-07-10 10:53               ` Peter Stephenson
2009-07-10  3:25           ` Eric Blake
2009-07-10  3:32             ` Eric Blake
2009-07-11 18:57               ` Peter Stephenson
2009-07-11 19:05                 ` Peter Stephenson
2009-07-11 23:16                   ` Eric Blake
2009-07-12 15:01                     ` Peter Stephenson
2009-07-12 18:28                       ` Bart Schaefer
2009-07-12 19:35                         ` Peter Stephenson
2009-07-12 21:19                           ` Bart Schaefer
2009-07-13  1:48                             ` Eric Blake
2009-07-13 13:20                         ` Eric Blake
2009-07-12 14:42                 ` Peter Stephenson
2009-07-01 13:14 zsh bug in . builtin Eric Blake
2009-07-01 14:24 ` Peter Stephenson
2009-07-02 12:01   ` Eric Blake
2009-07-02 13:40     ` Peter Stephenson
2009-07-06 20:39     ` Peter Stephenson
2009-07-05 19:41   ` Bart Schaefer
2009-07-05 20:04     ` Peter Stephenson
2009-03-08  8:21 Modules/attr.c compile error on Mac OS X Taro M
2009-03-08  9:10 ` François Revol
2009-03-08 19:55 ` Peter Stephenson
2009-03-08 21:33   ` Bart Schaefer
2009-03-08 21:51     ` Peter Stephenson
2009-03-08 23:45       ` Bart Schaefer
     [not found] <BD9D2405-AD6A-4336-9C8A-85149165B6B8@gmail.com>
     [not found] ` <090116075615.ZM21871@torch.brasslantern.com>
     [not found]   ` <200901161939.54651.arvidjaar@newmail.ru>
2009-01-16 18:29     ` sourcing a sh file in zsh Bart Schaefer
2009-01-17  3:59       ` Phil Pennock
2009-01-17  5:00         ` Bart Schaefer
2009-01-17  5:55           ` Phil Pennock
2009-01-17 20:15             ` Bart Schaefer
2009-01-19 21:21               ` Phil Pennock
2009-01-20 19:48               ` Peter Stephenson
2009-01-21  4:48                 ` Bart Schaefer
2009-01-24 15:59       ` Andrey Borzenkov
2009-01-24 17:38         ` Peter Stephenson
2009-01-24 20:47           ` Richard Hartmann
2009-01-24 23:26           ` Bart Schaefer
2009-01-25  8:56             ` Andrey Borzenkov
2009-01-25 10:25               ` Richard Hartmann
2009-01-25 10:41                 ` Andrey Borzenkov
2009-01-25 10:51                   ` Richard Hartmann
2009-01-26 23:07                   ` Phil Pennock
2009-01-27  0:51                     ` Richard Hartmann
2009-01-27 16:28                       ` Bart Schaefer
2009-01-25 12:20               ` Bart Schaefer
2009-01-25 18:26                 ` Andrey Borzenkov
2009-01-26  7:51                   ` Bart Schaefer
2009-01-26  9:24                     ` Richard Hartmann
2009-01-26 16:49                     ` Andrey Borzenkov
2009-01-30  4:25                       ` Bart Schaefer
2009-01-31  8:32                         ` Andrey Borzenkov
2009-01-31 20:40                           ` Bart Schaefer
2009-01-31 21:10                             ` Peter Stephenson
2009-01-31 21:39                               ` Bart Schaefer
2009-01-31 23:23                                 ` Peter Stephenson
2009-02-01 18:03                             ` Andrey Borzenkov
2009-02-01 19:20                               ` Bart Schaefer
2009-02-07 15:45                         ` Andrey Borzenkov
2009-02-07 20:18                           ` Bart Schaefer
2009-01-25 21:39             ` Peter Stephenson
2009-01-26  6:18               ` Phil Pennock
2009-01-26 12:21                 ` Peter Stephenson
2009-01-26 23:16                   ` Phil Pennock
2009-01-27  9:50                     ` Peter Stephenson
2009-01-27 10:16                       ` Peter Stephenson
2009-01-27 15:22                         ` Bart Schaefer
2009-01-24 23:11         ` Bart Schaefer
2009-01-25  8:15           ` Richard Hartmann
2009-01-25  8:40           ` Andrey Borzenkov
2009-01-01 16:24 Bug in executable completion: unable to handle .. it $PATH Richard Hartmann
2009-01-01 17:41 ` Vincent Lefevre
2009-01-07 20:09 ` Peter Stephenson
2009-01-07 20:18   ` Bart Schaefer
2009-01-07 20:49     ` Peter Stephenson
2009-01-07 23:22       ` Richard Hartmann
     [not found] <clint@zsh.org>
     [not found] ` <20071011182853.GA19842@scowler.net>
2007-10-11 19:18   ` ZSH (CVS) configure problem? Peter Stephenson
2007-10-11 20:23     ` Clint Adams
2007-10-12  9:09       ` Peter Stephenson
2007-10-12 10:18         ` Peter Stephenson
2008-11-15  0:39 ` unusable fd in tcp_send Clint Adams
2008-11-15 16:32   ` Peter Stephenson
2008-11-15 16:47     ` Clint Adams
     [not found] <20081106150224.GA10992@apartia.fr>
     [not found] ` <081106082517.ZM27477@torch.brasslantern.com>
     [not found]   ` <20081110082152.GA9563@apartia.fr>
     [not found]     ` <20081110142850.0add2680@news01>
2008-11-12 10:52       ` parse error in process substitution Peter Stephenson
2008-11-13 21:00         ` Peter Stephenson
2008-11-13 21:08           ` Mikael Magnusson
2008-11-16  4:10           ` Bart Schaefer
2008-11-16 21:18             ` Peter Stephenson
2008-11-16 21:51               ` Bart Schaefer
2008-11-17 10:10                 ` Peter Stephenson
2008-11-17 15:51                   ` Bart Schaefer
2008-11-17 16:08                 ` Peter Stephenson
2008-11-17 16:51             ` Peter Stephenson
2008-06-07 20:34 PATCH: rewrite of completion matching Peter Stephenson
2008-06-16  7:17 ` Bart Schaefer
2008-06-16 12:54   ` Peter Stephenson
2008-06-16 15:30     ` Bart Schaefer
2008-06-16 16:52       ` Peter Stephenson
2008-06-16 17:49         ` Bart Schaefer
2008-06-17  9:06           ` Peter Stephenson
2008-03-16 14:40 ${a[(i)pattern]} if a=() Stephane Chazelas
2008-03-16 17:20 ` Bart Schaefer
2008-03-16 17:59   ` Bart Schaefer
2008-03-16 18:47     ` Bart Schaefer
2008-03-16 21:57     ` Peter Stephenson
2008-03-16 23:23       ` Stephane Chazelas
2008-03-17  0:59         ` Bart Schaefer
2008-03-18 12:13           ` Peter Stephenson
2008-03-18 15:47             ` Bart Schaefer
2008-03-25 17:24               ` Peter Stephenson
2008-02-23  0:04 PATCH: completion of glob qualifiers Peter Stephenson
2008-02-23  6:06 ` Bart Schaefer
2008-02-23 17:33   ` Peter Stephenson
2008-02-23 18:09   ` Peter Stephenson
2008-11-07 12:38 ` Oliver Kiddle
2008-11-08 23:28   ` Peter Stephenson
     [not found] <20071205200825.148710@gmx.net>
2007-12-06 15:54 ` Bug#451382: i18n is NOT so easy! Clint Adams
2007-12-06 16:08   ` Ismail Dönmez
2007-12-06 16:10     ` Clint Adams
2007-12-07 10:44       ` Peter Stephenson
2007-12-07 14:11         ` Peter Stephenson
2007-12-07 17:15           ` Clint Adams
2007-12-07 17:26             ` Peter Stephenson
2007-12-09 18:01               ` Peter Stephenson
2007-12-09 22:49                 ` Bart Schaefer
2007-12-10  0:06                   ` Peter Stephenson
     [not found]   ` <20071206165612.292830@gmx.net>
2007-12-06 19:06     ` Clint Adams
2007-12-07 10:29       ` Oliver Kiddle
2007-11-09 15:08 delete-whole-word-match fails on words starting with -, patch Mikael Magnusson
2007-11-09 17:06 ` Peter Stephenson
2007-11-09 19:48   ` Peter Stephenson
2007-11-09 22:38     ` Mikael Magnusson
2007-11-10 14:22       ` Peter Stephenson
     [not found] <DD973F2C-E6A0-4FCA-96F5-6C96701DC677@chemistry.ucsc.edu>
     [not found] ` <20071012215906.GA8935@mastermind>
     [not found]   ` <20071012152257.91edf6d3.wgscott@chemistry.ucsc.edu>
2007-10-13 13:30     ` precmd, preexec, and supplied prompt themes Clint Adams
2007-10-13 17:11       ` Bart Schaefer
2007-10-13 19:10         ` Peter Stephenson
2007-10-13 20:47           ` Bart Schaefer
2007-10-13 17:16       ` Peter Stephenson
     [not found]   ` <071012185005.ZM2921@torch.brasslantern.com>
     [not found]     ` <35490.69.3.191.19.1192241340.squirrel@mail.acg.ucsc.edu>
     [not found]       ` <071012202721.ZM13638@torch.brasslantern.com>
     [not found]         ` <20071013135858.18e842df.wgscott@chemistry.ucsc.edu>
     [not found]           ` <071013144046.ZM15536@torch.brasslantern.com>
     [not found]             ` <42409.66.167.127.82.1192312408.squirrel@mail.acg.ucsc.edu>
     [not found]               ` <071013161113.ZM15656@torch.brasslantern.com>
     [not found]                 ` <43237.69.3.24.27.1192318777.squirrel@mail.acg.ucsc.edu>
     [not found]                   ` <071013194931.ZM15792@torch.brasslantern.com>
2007-10-31 11:07                     ` Oliver Kiddle
2007-10-31 14:49                       ` Bart Schaefer
2007-10-31 15:12                         ` Bart Schaefer
2007-05-02 14:49 PATCH: zsh/regex and =~ Daniel Qarras
2007-05-02 16:36 ` Peter Stephenson
2007-05-02 16:54   ` Bart Schaefer
2007-05-02 17:18     ` Andrey Borzenkov
2007-05-02 17:32       ` Peter Stephenson
2007-05-02 17:12   ` Andrey Borzenkov
2007-01-27 17:07 4.3.2/20061219 -> 4.3.2/20070126 very broken Alexey Tourbin
2007-01-27 17:15 ` Alexey Tourbin
2007-01-27 18:55   ` Peter Stephenson
2007-01-27 23:47     ` Peter Stephenson
2007-01-28 12:04       ` Alexey Tourbin
2007-01-27 19:10   ` Bart Schaefer
2006-12-15 10:04 Is wait not interruptable? Dave Yost
2006-12-15 12:05 ` Peter Stephenson
2006-12-15 21:00   ` Peter Stephenson
2006-12-16 21:37     ` Bart Schaefer
2006-12-17 16:00       ` Peter Stephenson
2006-12-17 17:54         ` Bart Schaefer
2006-12-18 11:39           ` Peter Stephenson
2006-12-18 16:09             ` Bart Schaefer
2006-12-18 16:12             ` Peter Stephenson
2006-12-18 16:37               ` Bart Schaefer
2006-12-18 16:51                 ` Peter Stephenson
     [not found] <schizo@debian.org>
2006-11-18  3:47 ` error code for failure to execute Clint Adams
2006-11-19 19:50   ` Peter Stephenson
2006-11-19 20:02     ` Clint Adams
2006-11-19 21:33       ` Peter Stephenson
2006-10-26 17:39 PATCH: $! on bg Peter Stephenson
2006-10-28 17:51 ` Bart Schaefer
2006-10-29 12:58   ` Peter Stephenson
2006-10-29 17:01     ` Bart Schaefer
2006-10-30 11:38       ` Peter Stephenson
2006-08-19 18:11 zstyle is badly broken as of 20060817 Bart Schaefer
2006-08-20 16:54 ` Peter Stephenson
2006-08-20 20:44   ` Bart Schaefer
2006-08-20 20:53     ` Bart Schaefer
2006-08-20 21:38     ` Peter Stephenson
2006-08-21  5:44       ` Bart Schaefer
2006-08-21 11:39         ` Vincent Lefevre
2006-08-11 20:03 Bug#335481: zsh: zsh/sched waits for next return to prompt even with NOTIFY set Jared K. Sorensen
2006-09-07 19:25 ` Peter Stephenson
2006-09-08  3:18   ` Bart Schaefer
2006-09-08 11:31     ` Peter Stephenson
2006-09-10 15:26       ` Peter Stephenson
2006-07-30 18:00 env -u completion doesn't work when there is a command Vincent Lefevre
2006-07-30 18:36 ` Bart Schaefer
2006-07-30 21:13   ` Peter Stephenson
     [not found] <200607261638.k6QGcE7E010498@news01.csr.com>
     [not found] ` <dc507f4a0607270901r5a4c19f2n20a895b8a831ab3@mail.gmail.com>
     [not found]   ` <060727212432.ZM4920@torch.brasslantern.com>
2006-07-28  9:10     ` Menu-driven version of history-beginning-search-backward Peter Stephenson
2006-07-28 10:08       ` Peter Stephenson
2006-08-01 17:30         ` Peter Stephenson
2006-08-01 20:18           ` Peter Stephenson
2006-08-02  2:49             ` Bart Schaefer
     [not found] <20060529075722.GA28846@sci.fi>
     [not found] ` <200605291532.k4TFWueM011027@pwslaptop.csr.com>
2006-05-30 17:48   ` Vanishing files ? Peter Stephenson
2006-05-30 22:29     ` Peter Stephenson
2006-05-31  1:08       ` Wayne Davison
2006-05-31 14:11       ` Bart Schaefer
     [not found] <EXCHANGE03lhK9atCT1000118c6@exchange03.csr.com>
     [not found] ` <20060228140411.GA2150@prunille.vinc17.org>
2006-02-28 14:19   ` 4.3.1 released Peter Stephenson
2006-02-28 14:30     ` Vincent Lefevre
2006-02-28 14:44       ` Peter Stephenson
2006-03-02 17:59       ` Peter Stephenson
2006-02-28 18:45 ` Bart Schaefer
2006-02-28 23:51   ` Peter Stephenson
2006-03-07 19:48     ` "type punned" warnings Wayne Davison
2006-03-07 20:47       ` Peter Stephenson
2006-03-08 10:27       ` Peter Stephenson
2006-03-08 15:47         ` Peter Stephenson
     [not found] <20050425063521.GA17598@quark.hightek.org>
     [not found] ` <1050425163202.ZM25027@candle.brasslantern.com>
     [not found]   ` <20050426030308.GA21501@quark.hightek.org>
     [not found]     ` <200504261834.j3QIYHSa018951@news01.csr.com>
     [not found]       ` <1050427053638.ZM28743@candle.brasslantern.com>
2005-04-27  9:54         ` localtraps Peter Stephenson
2005-04-27 14:09           ` localtraps Bart Schaefer
2005-05-01 18:54             ` localtraps Vincent Stemen
2005-05-03 10:04               ` localtraps Peter Stephenson
2005-05-03 19:20                 ` yodl and Z shell documentation (was localtraps) Vincent Stemen
     [not found]                   ` <zsh@hightek.org>
2005-05-04  9:26                     ` Peter Stephenson
2005-05-10  9:45                       ` Oliver Kiddle
2005-05-10 14:10                         ` Bart Schaefer
2005-05-10 14:42                           ` Oliver Kiddle
2005-05-10 15:43                             ` Bart Schaefer
2005-05-11  9:59                               ` Oliver Kiddle
2005-05-11 15:09                                 ` Bart Schaefer
2005-05-11 15:21                                   ` Clint Adams
2005-05-04  1:42                 ` localtraps Bart Schaefer
     [not found]           ` <20050507171938.GA51740@quark.hightek.org>
     [not found]             ` <5415.1115631148@csr.com>
2005-05-10 18:46               ` localtraps and signal handling on NetBSD Vincent Stemen
2005-05-13 11:26                 ` Peter Stephenson
2005-05-14  4:33                   ` Vincent Stemen
2005-05-16 10:46                     ` Peter Stephenson
2005-05-17  8:15                       ` Z shell signal handling Vincent Stemen
2005-05-17 15:42                         ` Bart Schaefer
     [not found] <16883.11714.845975.423895@cns-build4.cisco.com>
     [not found] ` <1050123064401.ZM16256@candle.brasslantern.com>
     [not found]   ` <200501241052.j0OAqY3S007966@news01.csr.com>
2005-01-24 16:51     ` Is this a bug for zsh 4.2.3? Bart Schaefer
     [not found]       ` <schaefer@brasslantern.com>
2005-01-24 17:00         ` Peter Stephenson
2005-05-04  9:28         ` localtraps Peter Stephenson
2005-05-04 14:35           ` Compiling without yodl (Re: localtraps) Bart Schaefer
2006-06-17 17:46         ` Recursion error and line numbers Bart Schaefer
2006-06-18 12:38           ` Peter Stephenson
2006-06-18 14:06             ` Bart Schaefer
2006-06-19 10:19               ` Peter Stephenson
2006-07-08 17:58         ` BUG: cmdstack empty Bart Schaefer
2006-07-09 14:44           ` Peter Stephenson
2007-02-10 19:07         ` Quoting problem and crashes with ${(#)var} Bart Schaefer
2007-02-10 22:08           ` Peter Stephenson
2007-02-10 22:10             ` Peter Stephenson
2007-02-13  4:59             ` Bart Schaefer
2007-02-13 21:11               ` Peter Stephenson
2007-02-14  7:48                 ` Bart Schaefer
2007-02-14 10:16                   ` Peter Stephenson
2007-02-14 16:03                     ` Bart Schaefer
2007-02-14 16:19                       ` Peter Stephenson
2007-02-25 23:15                         ` Bart Schaefer
2007-02-26 10:34                           ` Peter Stephenson
2007-02-26 16:13                             ` Bart Schaefer
2007-02-26 16:24                               ` Peter Stephenson
2007-02-26 17:28                                 ` Bart Schaefer
2007-02-26 17:36                                   ` Peter Stephenson
2009-02-06 22:50         ` POSIX and the "&>" operator Bart Schaefer
2009-02-07  0:02           ` Peter Stephenson
2009-02-07  3:51             ` Bart Schaefer
2009-02-07 22:48               ` Peter Stephenson
2009-02-10  2:11           ` Vincent Lefevre
     [not found] <pws@csr.com>
2004-02-25 11:24 ` PATCH: terminfo configuration redux Peter Stephenson
2004-02-25 17:21   ` Bart Schaefer
2004-02-25 17:30     ` Peter Stephenson
2004-02-26 10:37     ` Oliver Kiddle
2004-02-25 18:45   ` peta
2004-02-26 12:52   ` Peter Stephenson
2004-02-27 15:13     ` Felix Rosencrantz
2004-02-27 15:22       ` Peter Stephenson
2004-02-27 16:53         ` Felix Rosencrantz
2004-02-29 19:14           ` Peter Stephenson
2004-03-08 17:29             ` Felix Rosencrantz
2004-03-08 17:39               ` Peter Stephenson
2004-03-09  6:18                 ` Felix Rosencrantz
2004-03-09 12:15                   ` Peter Stephenson
2004-03-10  8:10                     ` Felix Rosencrantz
2004-03-10 11:02                       ` Peter Stephenson
     [not found] ` <200706121751.l5CHpr8D015577@news01.csr.com>
2007-06-12 21:56   ` Calling a zle widget from a function Peter Stephenson
2007-06-12 22:01     ` Peter Stephenson
2007-06-14 13:21       ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070501225933.c40ac724.p.w.stephenson@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).