bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] dfa: new option DFA_STRAY_BACKSLASH_WARN


From: Paul Eggert
Subject: Re: [PATCH 2/3] dfa: new option DFA_STRAY_BACKSLASH_WARN
Date: Sat, 4 Jun 2022 17:34:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 6/3/22 20:18, Bruno Haible wrote:
This warning punishes a traditional habit, namely to backslash-escape
a leading ASCII '-' character, so as to avoid it from being interpreted
as an option.

That's the first I've heard of that habit. Even 7th Edition Unix supported 'grep -e PAT FILE', but I guess some nonstandard grep implementations removed -e. These days, although I would think 'grep -- PAT FILE' would work everywhere, there may be scripts that still use that old habit.

If we want to support "grep '\-PAT' FILE", we can do so in grep rather than in dfa.c; it might not be wise to treat \- as - everywhere, as that would preclude future extensions such as A\-B meaning r.e. subtraction. We could add something like the attached to GNU grep, if you and Jim think it's a good idea (I hope Jim doesn't get tired of these "just one more thing" changes before a release...).

Attachment: 0001-grep-don-t-diagnose-grep-c.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]