mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Backport of the new option parser from 2.3
* configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define. * common/argparse.c, common/argparse.h: Rewrite. * tests/gpgscm/main.c: Switch to the new option parser. * g10/gpg.c: Switch to the new option parser and enable a global conf file. * g10/gpgv.c: Ditto. * agent/gpg-agent.c: Ditto. * agent/preset-passphrase.c: Ditto. * agent/protect-tool.c: Ditto. * scd/scdaemon.c: Ditto. * dirmngr/dirmngr.c: Ditto. * dirmngr/dirmngr_ldap.c: Ditto * dirmngr/dirmngr-client.c: Ditto. * kbx/kbxutil.c: Ditto. * tools/gpg-card.c: Ditto. * tools/gpg-check-pattern.c: Ditto. * tools/gpg-connect-agent.c: Ditto. * tools/gpg-pair-tool.c: Ditto. * tools/gpg-wks-client.c: Ditto. * tools/gpg-wks-server.c: Ditto. * tools/gpgconf.c: Ditto. * tools/gpgsplit.c: Ditto. * tools/gpgtar.c: Ditto. * g13/g13.c: Ditto. * g13/g13-syshelp.c: Ditto. Do not force verbose mode. * sm/gpgsm.c: Ditto. Add option --no-options. -- This is backport from master commitcdbe10b762
commitba463128ce
commit3bc004decd
commit2c823bd878
commit0e8f6e2aa9
but without changing all functions names to gpgrt. Instead we use wrapper functions which, when building against old Libgpg-error versions, are implemented in argparse.c using code from the current libgpg-error. This allows to keep the dependency requirement at libgpg-error 1.27 to support older distributions. Tested builds against 1.27 and 1.40-beta. Note that g13-syshelp does not anymore default to --verbose because that can now be enabled in /etc/gnupg/g13-syshelp.conf. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
7d7a50ba72
commit
a028f24136
25 changed files with 2590 additions and 1463 deletions
|
@ -16,6 +16,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -78,9 +79,8 @@ size_t scmpath_len = 0;
|
|||
static void
|
||||
parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts)
|
||||
{
|
||||
int no_more_options = 0;
|
||||
|
||||
while (!no_more_options && optfile_parse (NULL, NULL, NULL, pargs, popts))
|
||||
while (gnupg_argparse (NULL, pargs, popts))
|
||||
{
|
||||
switch (pargs->r_opt)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ parse_arguments (ARGPARSE_ARGS *pargs, ARGPARSE_OPTS *popts)
|
|||
break;
|
||||
|
||||
default:
|
||||
pargs->err = 2;
|
||||
pargs->err = ARGPARSE_PRINT_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,11 @@ my_strusage( int level )
|
|||
|
||||
switch (level)
|
||||
{
|
||||
case 9: p = "GPL-3.0-or-later"; break;
|
||||
case 11: p = "gpgscm (@GNUPG@)";
|
||||
break;
|
||||
case 13: p = VERSION; break;
|
||||
case 14: p = GNUPG_DEF_COPYRIGHT_LINE; break;
|
||||
case 17: p = PRINTABLE_OS_NAME; break;
|
||||
case 19: p = _("Please report bugs to <@EMAIL@>.\n"); break;
|
||||
|
||||
|
@ -297,6 +299,7 @@ main (int argc, char **argv)
|
|||
pargs.argv = &argv;
|
||||
pargs.flags = 0;
|
||||
parse_arguments (&pargs, opts);
|
||||
gnupg_argparse (NULL, &pargs, NULL);
|
||||
|
||||
if (log_get_errorcount (0))
|
||||
exit (2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue