summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-06-11 20:18:15 +0000
committerJim Meyering <jim@meyering.net>1997-06-11 20:18:15 +0000
commit8406b91aba3da0a5ce5f73ff6b7841b1b0a9cc98 (patch)
tree3f9338a38f7e7301a9069deb925ef35169c413f1 /src
parent2078f2391e20d1d1ad1d1539658a0ac46df27f05 (diff)
downloadcoreutils-8406b91aba3da0a5ce5f73ff6b7841b1b0a9cc98.tar.xz
(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'.
Diffstat (limited to 'src')
-rw-r--r--src/expr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/expr.c b/src/expr.c
index 8675438f4..44905b091 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);