From: Jim Meyering Date: Wed, 11 Jun 1997 20:18:15 +0000 (+0000) Subject: (docolon): Test (re_buffer.re_nsub > 0) rather than X-Git-Tag: SH-UTILS-1_16a~46 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=8406b91aba3da0a5ce5f73ff6b7841b1b0a9cc98;p=thirdparty%2Fcoreutils.git (docolon): Test (re_buffer.re_nsub > 0) rather than searching for `\(' to determine whether to return 0 or the empty string. Before it would improperly return '' if the pattern contained a substring like this: `\\('. From Karl Heuer. For example, running expr c : '\\(' should print `0'. --- diff --git a/src/expr.c b/src/expr.c index 8675438f43..44905b091f 100644 --- a/src/expr.c +++ b/src/expr.c @@ -456,7 +456,7 @@ of the basic regular expression is not portable; it is being ignored"), else { /* Match failed -- return the right kind of null. */ - if (strstr (pv->u.s, "\\(")) + if (re_buffer.re_nsub > 0) v = str_value (""); else v = int_value (0);