[Top][All Lists]

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

Re: suggestion: "+ FOO" rather than "quote FOO" for GNU sh-utils 'expr'

From: Jim Meyering
Subject: Re: suggestion: "+ FOO" rather than "quote FOO" for GNU sh-utils 'expr'
Date: Fri, 24 Aug 2001 10:00:15 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.105

I've applied this.

Paul Eggert <address@hidden> wrote:
> GNU 'expr' has an incompatibility with POSIX: it uses the "quote"
> keyword to quote operands, and POSIX does not allow the implementation
> to add keywords to 'expr'.
> Here is an idea to remove this incompatibility: use "+" instead of
> "quote" to quote keywords.  Using "+" is upward compatible with POSIX,
> since POSIX says that "+" is reserved.  Also, "+" is shorter and
> easier to read.
> This fix won't affect any portable shell scripts, since portable code
> cannot use "quote".  I don't know of any GNU shell scripts that use
> "quote" so I think it's OK to make this change.  It's more likely that
> a future POSIX revision will accept an upward-compatible extension
> like "+" than the incompatible extension "quote", so I think the
> change is worthwhile.
> This patch is relative to the latest test version of GNU sh-utils that
> I have and assumes earlier patches that I've sent privately, but I'm
> sending this patch via address@hidden because I want to hear
> from people (if anybody) who are using "quote".
> Also, GNU 'expr --help' does not work as expected if POSIXLY_CORRECT
> is set.  This behavior isn't required by POSIX, since POSIX allows
> expr to have implementation-defined options.  The following patch
> removes this glitch as well.
> 2001-06-21  Paul Eggert  <address@hidden>
>       * NEWS, doc/coreutils.texi: 'expr' now requires '+' rather
>       than 'quote' to quote tokens.
>       * src/expr.c (posixly_correct): Remove; no longer needed.
>       (main): Do not worry about POSIXLY_CORRECT, as it's OK for
>       expr to have options (so long as they do not begin with digits).
>       (eval6, usage): Use "+" rather than "quote" to quote tokens.
> ===================================================================
> RCS file: NEWS,v
> retrieving revision
> retrieving revision
> diff -pu -r1.144.0.1 -r1.144.0.2
> --- NEWS      2001/06/20 02:13:31
> +++ NEWS      2001/06/21 18:43:31
> @@ -1,4 +1,6 @@
>  Changes in release 2.1
> +* 'expr' now requires '+' rather than 'quote' to quote tokens;
> +  this removes an incompatibility with POSIX.
>  * 'expr' now uses the LC_COLLATE locale for string comparison, as per POSIX.
>   [2.0.12]
>  * date -d 'last friday' would print a date/time that was one hour off

reply via email to

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