Re: [PATCH] question mark is extended regex for non-GNU grep

Michael Haubenwallner <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
On 11/21/2014 03:06 PM, Eric Blake wrote:
> On 11/21/2014 05:11 AM, Michael Haubenwallner wrote:
>> Accepting \? for at-most-once in basic regex is a GNU grep extension,
>> not accepted by AIX grep for example.
>> * tests/libtool.at: Need EGREP for ? operator, and ? without \ then.
>> With EGREP, need one more \ for $.
> 
> Or, stick with GREP but use \{0,1\} instead of \?.

Possible as well, thanks!
/haubi/
0001-question-mark-is-extended-regex-for-non-GNU-grep.patch (text/x-patch, 1.6 KB)
From d11a1079e84949cb9067f0109e33a82259817fe6 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <[email protected]>
Date: Fri, 21 Nov 2014 15:49:19 +0100
Subject: [PATCH 1/2] question mark is extended regex for non-GNU grep

Accepting \? for at-most-once in basic regex is a GNU grep extension,
not accepted by AIX grep for example.
* tests/libtool.at: Use \{0,1\} instead of ? with GREP.
---
 tests/libtool.at | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/libtool.at b/tests/libtool.at
index a466790..7431820 100755
--- a/tests/libtool.at
+++ b/tests/libtool.at
@@ -116,14 +116,14 @@ for mode in compile link install; do
 	   [0], [stdout])
   # NOTE: we use "..."'"'"..." to insert a literal quote into the expression
   #       because "...\"..." is not expanded consistently by all shells.
-  AT_CHECK([$GREP "$mode:.*$match_preflag"'"\?'"$flag\\\\\\\\:test\\\\\\\\"'"\? ' stdout],
+  AT_CHECK([$GREP "$mode:.*$match_preflag"'"\{0,1\}'"$flag\\\\\\\\:test\\\\\\\\"'"\{0,1\} ' stdout],
 	      [0], [ignore])
 
   # Shell metacharacters that should be backslashified by libtool.
   for mchar in \" \` \$; do
     AT_CHECK([$LIBTOOL -n --mode=$mode $preargs $preflag"$flag$mchar:test$mchar" $postargs],
 	     [0], [stdout])
-    AT_CHECK([$GREP "$mode:.*$match_preflag"'"'"\?$flag\\\\$mchar:test\\\\$mchar"'"'"\? " stdout], [0], [ignore])
+    AT_CHECK([$GREP "$mode:.*$match_preflag"'"'"\{0,1\}$flag\\\\$mchar:test\\\\$mchar"'"'"\{0,1\} " stdout], [0], [ignore])
   done
 
   # Shell metacharacters that should be double quoted by libtool, and need
-- 
1.8.5.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.