-/* $OpenBSD: apps.c,v 1.17 2014/12/28 15:05:38 jsing Exp $ */
+/* $OpenBSD: apps.c,v 1.18 2014/12/28 15:48:52 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
}
int
-options_parse(int argc, char **argv, struct option *opts, char **unnamed)
+options_parse(int argc, char **argv, struct option *opts, char **unnamed,
+ int *argsused)
{
const char *errstr;
struct option *opt;
/* Single unnamed argument (without leading hyphen). */
if (*p++ != '-') {
+ if (argsused != NULL)
+ goto done;
if (unnamed == NULL)
goto unknown;
if (*unnamed != NULL)
}
}
+done:
+ if (argsused != NULL)
+ *argsused = i;
+
return (0);
toomany:
-/* $OpenBSD: apps.h,v 1.10 2014/12/28 14:21:42 jsing Exp $ */
+/* $OpenBSD: apps.h,v 1.11 2014/12/28 15:48:52 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
};
void options_usage(struct option *opts);
-int options_parse(int argc, char **argv, struct option *opts, char **unnamed);
+int options_parse(int argc, char **argv, struct option *opts, char **unnamed,
+ int *argsused);
#endif
-/* $OpenBSD: crl.c,v 1.5 2014/10/13 02:46:14 bcook Exp $ */
+/* $OpenBSD: crl.c,v 1.6 2014/12/28 15:48:52 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
crl_config.informat = FORMAT_PEM;
crl_config.outformat = FORMAT_PEM;
- if (options_parse(argc, argv, crl_options, &digest_name) != 0) {
+ if (options_parse(argc, argv, crl_options, &digest_name, NULL) != 0) {
crl_usage();
goto end;
}
-/* $OpenBSD: ecparam.c,v 1.7 2014/12/28 14:21:42 jsing Exp $ */
+/* $OpenBSD: ecparam.c,v 1.8 2014/12/28 15:48:52 jsing Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
ecparam_config.informat = FORMAT_PEM;
ecparam_config.outformat = FORMAT_PEM;
- if (options_parse(argc, argv, ecparam_options, NULL) != 0) {
+ if (options_parse(argc, argv, ecparam_options, NULL, NULL) != 0) {
ecparam_usage();
goto end;
}
-/* $OpenBSD: prime.c,v 1.3 2014/10/13 02:46:14 bcook Exp $ */
+/* $OpenBSD: prime.c,v 1.4 2014/12/28 15:48:52 jsing Exp $ */
/* ====================================================================
* Copyright (c) 2004 The OpenSSL Project. All rights reserved.
*
/* Default iterations for Miller-Rabin probabilistic primality test. */
prime_config.checks = 20;
- if (options_parse(argc, argv, prime_options, &prime) != 0) {
+ if (options_parse(argc, argv, prime_options, &prime, NULL) != 0) {
prime_usage();
return (1);
}
-/* $OpenBSD: rand.c,v 1.5 2014/10/22 13:54:03 jsing Exp $ */
+/* $OpenBSD: rand.c,v 1.6 2014/12/28 15:48:52 jsing Exp $ */
/* ====================================================================
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
*
memset(&rand_config, 0, sizeof(rand_config));
- if (options_parse(argc, argv, rand_options, &num_bytes) != 0) {
+ if (options_parse(argc, argv, rand_options, &num_bytes, NULL) != 0) {
rand_usage();
return (1);
}
-/* $OpenBSD: version.c,v 1.4 2014/12/28 14:21:42 jsing Exp $ */
+/* $OpenBSD: version.c,v 1.5 2014/12/28 15:48:52 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
{
memset(&version_config, 0, sizeof(version_config));
- if (options_parse(argc, argv, version_options, NULL) != 0) {
+ if (options_parse(argc, argv, version_options, NULL, NULL) != 0) {
version_usage();
return (1);
}