Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BLU0-SMTP110EF914D9B85725DC0224AFDEF0@phx.gbl>
Date: Thu, 5 Jul 2012 21:08:24 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Would supporting ./john --help be a good idea?

Currently, if using a wrong option name, you only get:

$ ./john --helpme
Unknown option: "--helpme"

Many programs print usage information when --help or -h is used.
On the other hand, many programs do something (different than printing
usage information) when invoked without any parameters.

This means, users might be scared to start john without any parameters.
(May be they should be - without reading the documentation ;)

My idea is to keep the current logic for starting john without any
parameters.
Additionally, these commands should also print usage information.

$ ./john --help
$ ./john -h
$ ./john -help

(I don't intend to support --h or -he ..., just the three versions
mentioned above, because I don't intend to invent another flag for this
option.)

If ./john --help is supported, we can even change the error message to
something more meaningful like

Unknown option: "--helpme", see "john --help".

The
fprintf(stderr, "%s: \"%s\"\n", opt_errors[res], *opt);
occurs in opt_process() and in opt_check().


This needs to be changed:

options.c:289:	if (argc < 2)
options.c-290-		print_usage(name);

And this as well:

john.c:558:	if (argc < 2)
john.c-559-		john_register_all(); /* for printing by opt_init() */

But I'd hate to make the same change in two different places.
Would a new global variable be OK, a new parameter for opt_init(), or
should I make john_register_all known in options.c, and call it inside
print_usage()?

To allow bash completion support for --help, I would also add --help to
--list=hidden-options, in order to save valuable space in the usage output.
(If the user already managed to run ./john --help, there is little use
in mentioning that the --help option exists.)


Frank

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.