Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2A4EA431FD0 for ; Sat, 22 Oct 2011 10:09:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9fTrmI1dbc7t for ; Sat, 22 Oct 2011 10:08:59 -0700 (PDT) Received: from smtprelay03.ispgateway.de (smtprelay03.ispgateway.de [80.67.31.30]) by olra.theworths.org (Postfix) with ESMTP id 2C209431FB6 for ; Sat, 22 Oct 2011 10:08:59 -0700 (PDT) Received: from [87.180.87.168] (helo=stokes.schwinge.homeip.net) by smtprelay03.ispgateway.de with esmtpa (Exim 4.68) (envelope-from ) id 1RHf43-0004iY-WC for notmuch@notmuchmail.org; Sat, 22 Oct 2011 19:08:56 +0200 Received: (qmail 22365 invoked from network); 22 Oct 2011 17:08:51 -0000 Received: from kepler.schwinge.homeip.net (192.168.111.7) by stokes.schwinge.homeip.net with QMQP; 22 Oct 2011 17:08:51 -0000 Received: (nullmailer pid 32381 invoked by uid 1000); Sat, 22 Oct 2011 17:08:51 -0000 From: Thomas Schwinge To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [PATCH] cli: change argument parsing convention for subcommands In-Reply-To: <1319199557-16888-1-git-send-email-david@tethera.net> References: <1319199557-16888-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (i486-pc-linux-gnu) Date: Sat, 22 Oct 2011 19:08:50 +0200 Message-ID: <87sjmlgdi5.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Df-Sender: dGhvbWFzQHNjaHdpbmdlLm5hbWU= Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Oct 2011 17:09:01 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! On Fri, 21 Oct 2011 09:19:17 -0300, david@tethera.net wrote: > previously we deleted the subcommand name from argv before passing to > the subcommand. In this version, the deletion is done in the actual > subcommands. Although this causes some duplication of code, it allows > us to be more flexible about how we parse command line arguments in > the subcommand, including possibly using off-the-shelf routines like > getopt_long that expect the name of the command in argv[0]. Ack. Like when the C library startup passes control to the main function, where argv[0] is the invoked executable. It seems that notmuch.c:notmuch_help_command also needs to be adapted? notmuch-setup.c:notmuch_setup_command does not need to be adapted (and hasn't been) for it doesn't look at its argv. (It should bail out if there are any arguments passed, but that's for another patch.) Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAEBAgAGBQJOoviiAAoJEGe3hdm9kOii/gsH/Aoa6g23Cw85HKbVIjWSfn3W oIgqzcImpJgHilKXV/XayUjqkWualIhUuPPFz6qq1dwuJYbZw+02vit7uXYemSai m53ObfnOlFxsMjmm0gccnd4rqcLRdGgOJlWcxaSOqqdSCJJPy4E1sEHbNzUbZvDs s4Z6cUnCauWxCUJEDY7cwZB4P1CUxH04gl4Fh2nmTCqobX6AFgYA/Pvn63NFtxcl c75200SRnWFd99uDqkpaHN9ca/q/HQfWleCziaDVkz4+jnUj3+cfEW3oNVeVwvgy WegS+h95oLbPx7gAMMYODOQj0e79pwzZNTT1D1sHbWODnmJaoidlX+x37I6vPzQ= =rg5Z -----END PGP SIGNATURE----- --=-=-=--