bug-coreutils
[Top][All Lists]
Advanced

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

Re: "tr -d string1 string2" POSIXLY_CORRECT simplification


From: Jim Meyering
Subject: Re: "tr -d string1 string2" POSIXLY_CORRECT simplification
Date: Sat, 05 Jun 2004 21:37:25 +0200

Paul Eggert <address@hidden> wrote:
> The coreutils tr source code has an unnecessary special case for
> POSIXLY_CORRECT.  The SYNOPSIS section for tr
> <http://www.opengroup.org/onlinepubs/000095399/utilities/tr.html> says
> this:
>
>     tr [-c | -C][-s] string1 string2
>     tr -s [-c | -C] string1
>     tr -d [-c | -C] string1
>     tr -ds [-c | -C] string1 string2
>
> None of these alternatives allow "tr -d string1 string2",
> so tr is allowed to report an error in that case.
>
> Here is a patch.
>
> 2004-06-05  Paul Eggert  <address@hidden>
>
>       * src/tr.c (main): "tr -d a b" is now a fatal error even if
>       POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
>       option combination.

Thanks.
I'd be happy to apply that patch if it weren't for the part of the extended
description that says string2 is ignored when -d is used without -s:

  When the -d option is specified:

    * ...

    * When the -C option is specified with -d, all characters except those
    specified by string1 shall be deleted. The contents of string2 are
    ignored, unless the -s option is also specified.

    * When the -c option is specified with -d, all values except those
    specified by string1 shall be deleted. The contents of string2 shall be
    ignored, unless the -s option is also specified.

I'll probably apply it anyhow.
I don't think anyone will notice the change.




reply via email to

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