[lttng-dev] [PATCH] Add --list-options to each command

David Goulet david.goulet at polymtl.ca
Tue Jan 24 13:15:53 EST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 12-01-24 01:05 PM, Thibault, Daniel wrote:
>> 5. Re: [PATCH] Add --list-options to each command (Mathieu Desnoyers)
>> Date: Tue, 24 Jan 2012 09:44:31 -0500
>> From: Mathieu Desnoyers <compudj at krystal.dyndns.org>
>>
>> If we look at the other options (in other files), 0 (instead of '\0')
>> seems to be used as second field. This would keep the style more
>> coherent. Can you change this across the whole patch and resubmit ?
>>
>> e.g. here:
>>>  static struct lttng_handle *handle;
>>> @@ -70,6 +71,7 @@ static struct poptOption long_options[] = {
>>>  	{"num-subbuf",     0,   POPT_ARG_INT, 0, OPT_NUM_SUBBUF, 0, 0},
>>>  	{"switch-timer",   0,   POPT_ARG_INT, 0, OPT_SWITCH_TIMER, 0, 0},
>>>  	{"read-timer",     0,   POPT_ARG_INT, 0, OPT_READ_TIMER, 0, 0},
>>> +	{"list-options",   '\0', POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL},
>>>  	{0, 0, 0, 0, 0, 0, 0}
>>>  };
>>
>> The rest looks fine!
> 
>    Actually, since the struct poptOption is defined in popt.h as { const char *longName; char shortName; unsigned int argInfo; void *arg; int val; const char *descrip; const char *argDescrip; }, it would make more sense (and make the compiler happier) to use '/0' for the second member throughout.  For instance, the {0, 0, 0, 0, 0, 0, 0} line should be simply POPT_TABLEEND, which is { NULL, '\0', 0, NULL, 0, NULL, NULL }.
> 
>    I'm wondering: why is LTTng 2.0 not using the POPT_AUTOHELP facility of popt's?

Well, yes '\0' probably make more sense but between 0 and \0 ... there is not
that much of a difference :P.

char a = 0, b = '\0';

a == b --> 1
strcmp(a,b) --> 0

For POPT_HELP, at the beginning I've decided to not use it to handle "funky"
output like the add-context which is more complex. Maybe it could support it but
for now, it's just not an important issue or on the roadmap to change all this.

Thanks
David

> 
> Daniel U. Thibault
> R & D pour la défense Canada - Valcartier (RDDC Valcartier) / Defence R&D Canada - Valcartier (DRDC Valcartier)
> Système de systèmes (SdS) / System of Systems (SoS)
> Solutions informatiques et expérimentations (SIE) / Computing Solutions and Experimentations (CSE)
> 2459 Boul. Pie XI Nord
> Québec, QC  G3J 1X5
> CANADA
> Vox : (418) 844-4000 x4245
> Fax : (418) 844-4538
> NAC: 918V QSDJ
> Gouvernement du Canada / Government of Canada
> <http://www.valcartier.drdc-rddc.gc.ca/>
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJPHvVZAAoJEELoaioR9I02SMMH/jbRVFsYhOQOzBwcny7pFikI
C0qtqncIHgDcudPFI/ryD/Zhn2AZXZZUM/2FDPSAtM/GBEGkHcvoCarzwsgmOuet
amfkmHbMiDjEg9qaCjXglOT60M0OznK0wtL5kVAre09a54WAb01Nvch+8V8mQOQK
P/W0buxzDrJcKEt0Ed+rIcoCZqfTh/B/CM9Xmw32R8AcWVhl6tyLeJWHyBruRH+E
PQJhQ+NfxVacPnq1waXpgLRRf7/iSvwXw29gp1bs39R4MHY/LUWQe5mCu+AB0jsf
0ib9mrdYMctxG26wwtLeT8YoizVj/q5+s33cnojr2TExes7EA2dpzxYm6EJIX94=
=zFPW
-----END PGP SIGNATURE-----



More information about the lttng-dev mailing list