[PATCH] sed: Document POSIX -E sed flag that selects EREs (as a synonym for -r)

Denys Vlasenko vda.linux at googlemail.com
Wed Oct 30 11:57:06 UTC 2013


On Wed, Oct 30, 2013 at 4:08 AM, David A. Wheeler <dwheeler at dwheeler.com> wrote:
> From e4db14e51aba9e809b92ae4e5859be30363f59e9 Mon Sep 17 00:00:00 2001
> From: David A. Wheeler <dwheeler at dwheeler.com>
> Date: Tue, 29 Oct 2013 23:11:46 -0400
> Subject: [PATCH] sed: Document POSIX -E sed flag that selects EREs (as a synonym for -r)
>
> Document the sed "-E" flag that selects extended regular expressions
> (EREs), e.g., so "--help" will show it.
>
> Busybox already supports the POSIX/BSD sed option "-E" to select
> extended regular expressions (EREs), as described here:
>   http://austingroupbugs.net/view.php?id=528
>
> Signed-off-by: David A. Wheeler <dwheeler at dwheeler.com>
> ---
>  editors/sed.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/editors/sed.c b/editors/sed.c
> index ef46284..0762827 100644
> --- a/editors/sed.c
> +++ b/editors/sed.c
> @@ -56,18 +56,20 @@
>   * Reference
>   * http://www.opengroup.org/onlinepubs/007904975/utilities/sed.html
>   * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html
> + * http://austingroupbugs.net/view.php?id=528
>   */
>
>  //usage:#define sed_trivial_usage
> -//usage:       "[-inr] [-f FILE]... [-e CMD]... [FILE]...\n"
> -//usage:       "or: sed [-inr] CMD [FILE]..."
> +//usage:       "[-inEr] [-f FILE]... [-e CMD]... [FILE]...\n"
> +//usage:       "or: sed [-inEr] CMD [FILE]..."
>  //usage:#define sed_full_usage "\n\n"
>  //usage:       "       -e CMD  Add CMD to sed commands to be executed"
>  //usage:     "\n       -f FILE Add FILE contents to sed commands to be executed"
>  //usage:     "\n       -i[SFX] Edit files in-place (otherwise sends to stdout)"
>  //usage:     "\n               Optionally back files up, appending SFX"
>  //usage:     "\n       -n      Suppress automatic printing of pattern space"
> -//usage:     "\n       -r      Use extended regex syntax"
> +//usage:     "\n       -E      Use extended regex (ERE) syntax (per POSIX)"
> +//usage:     "\n       -r      Use ERE syntax (same as -E for backwards compatibility)"

busybox is about small size.
Is there any use for the consumer of --help output to see
"(same as -E for backwards compatibility)" text?

This is what I'm going to do:

-r,-E   Use extended regex syntax


> -               "regexp-extended\0" No_argument         "r"
> +               "regexp-extended\0" No_argument         "E"

Does it change any visible behavior?


More information about the busybox mailing list