Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 2002 21:19:56 +0200
From:      Johan Karlsson <johan@freebsd.org>
To:        Jens Schweikhardt <schweikh@schweikhardt.net>
Cc:        standards@freebsd.org, sheldonh@freebsd.org
Subject:   Re: repeated options to mean different thing
Message-ID:  <20020723211956.D50574@numeri.campus.luth.se>
In-Reply-To: <20020723204225.A38605@schweikhardt.net>; from schweikh@schweikhardt.net on Tue, Jul 23, 2002 at 08:42:25PM %2B0200
References:  <20020723194802.C50574@numeri.campus.luth.se> <20020723204225.A38605@schweikhardt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Jens,

On Tue, Jul 23, 2002 at 20:42 (+0200) +0000, Jens Schweikhardt wrote:
> On Tue, Jul 23, 2002 at 07:48:02PM +0200, Johan Karlsson wrote:
> # In PR 40709 I suggested to use to use -v to mean
> # be verbose (current behaivour) and repeated -v 
> # (e.g chmod -v -v 777 file, or chmod -vv 777 file) 
> # to mean be very verbose.
> # 
> # So, is the use of repeated options prohibited by POSIX?
> 
> You can find the gory details in the POSIX Utility Syntax Guidelines,
> http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap12.html#tag_12_02

As far as I can tell from the guidelines, POSIX does not mind
using repeated options to mean different things.

According to item 2 on 
http://www.opengroup.org/onlinepubs/007904975/basedefs/xbd_chap12.html#tag_12_01
"If an option that does not have option-arguments is repeated, 
the results are undefined, unless otherwise stated."
    
This sentence makes me think it is ok to have repeated options.

Thanks for the link.

> 
> # Or is this a stupid idea from some other standards point of 
> # view?
> 
> I'd say multiple -v becomes clumsy once you have more than three levels
> of verbosity. Why not use -v level or even -v bitmask in cases where you
> don't have to be backwards compatible (i.e. if a utility has had -v as a
> single letter option it's a bad idea to turn it into an option taking a
> level arg. Breaks older scripts.)

In this case, where I want to use it, -v already exists and 
therefore we should not change that. Also, in this case there would 
only be two levels of verbosity and hence according to your 
reasoning it would be ok to use -v -v.

Thanks for the info.

/Johan

-- 
Johan Karlsson		mailto:johan@FreeBSD.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020723211956.D50574>