From owner-freebsd-standards Tue Jul 23 12:20: 8 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7EE4E37B400; Tue, 23 Jul 2002 12:20:00 -0700 (PDT) Received: from numeri.campus.luth.se (numeri.campus.luth.se [130.240.197.103]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C30743E4A; Tue, 23 Jul 2002 12:19:59 -0700 (PDT) (envelope-from k@numeri.campus.luth.se) Received: (from k@localhost) by numeri.campus.luth.se (8.11.6/8.11.6) id g6NJJuk56314; Tue, 23 Jul 2002 21:19:56 +0200 (CEST) (envelope-from k) Date: Tue, 23 Jul 2002 21:19:56 +0200 From: Johan Karlsson To: Jens Schweikhardt Cc: standards@freebsd.org, sheldonh@freebsd.org Subject: Re: repeated options to mean different thing Message-ID: <20020723211956.D50574@numeri.campus.luth.se> References: <20020723194802.C50574@numeri.campus.luth.se> <20020723204225.A38605@schweikhardt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020723204225.A38605@schweikhardt.net>; from schweikh@schweikhardt.net on Tue, Jul 23, 2002 at 08:42:25PM +0200 Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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