Clarify error for unrecognized arguments.
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>
Sat, 23 Dec 2017 00:18:22 +0000 (16:18 -0800)
committerRich Salz <rsalz@openssl.org>
Mon, 8 Jan 2018 17:57:22 +0000 (12:57 -0500)
commitfd6a0f5e525d187d7f1cd030e56d8aba9cafcbbf
tree3ff8b296013d770bc4d28900e9db51ad9df7d385
parent9d828b53978f4cbe24e190795fef86188b5116eb
Clarify error for unrecognized arguments.

Many of the sub-commands under apps/ accept cipher or digest arguments like
"-sha256". These are implemented using a catchall flag that runs the result
through opt_md() or opt_cipher(). That means any unrecognized flag, including
typos, gets sent to those two functions, producing confusing error messages like
below:

    $ ./apps/openssl req -x590
    req: Unrecognized digest x590
    req: Use -help for summary.

This change switches these two functions to say "Unrecognized flag X" instead.
The new message deliberately leaves off the "-" from the flag name, because
there are some cases where opt_md() and opt_cipher() are passed a flag value
instead (for instance, openssl ca -md). I think the new message is generic
enough that it can serve both cases with improved clarity.

CLA: trivial

Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4972)
apps/opt.c