summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/apps.c
diff options
context:
space:
mode:
authorjsing <>2015-07-15 13:54:34 +0000
committerjsing <>2015-07-15 13:54:34 +0000
commit370c300ca14472f9c425a65aae243e3b9a143858 (patch)
treecc2003ab0da4d8c980719e372679ce99c10982a0 /src/usr.bin/openssl/apps.c
parente9032a3c566e9cec4858cc0ef7226c51772d9137 (diff)
downloadopenbsd-370c300ca14472f9c425a65aae243e3b9a143858.tar.gz
openbsd-370c300ca14472f9c425a65aae243e3b9a143858.tar.bz2
openbsd-370c300ca14472f9c425a65aae243e3b9a143858.zip
Add OPTION_ARG_LONG for handling of options with a long type.
ok doug@
Diffstat (limited to 'src/usr.bin/openssl/apps.c')
-rw-r--r--src/usr.bin/openssl/apps.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c
index 2b2c0a9c1c..586b3c624a 100644
--- a/src/usr.bin/openssl/apps.c
+++ b/src/usr.bin/openssl/apps.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.c,v 1.27 2015/06/19 07:18:58 bcook Exp $ */ 1/* $OpenBSD: apps.c,v 1.28 2015/07/15 13:54:34 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -2284,7 +2284,8 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed,
2284 if (opt->type == OPTION_ARG || 2284 if (opt->type == OPTION_ARG ||
2285 opt->type == OPTION_ARG_FORMAT || 2285 opt->type == OPTION_ARG_FORMAT ||
2286 opt->type == OPTION_ARG_FUNC || 2286 opt->type == OPTION_ARG_FUNC ||
2287 opt->type == OPTION_ARG_INT) { 2287 opt->type == OPTION_ARG_INT ||
2288 opt->type == OPTION_ARG_LONG) {
2288 if (++i >= argc) { 2289 if (++i >= argc) {
2289 fprintf(stderr, "missing %s argument for -%s\n", 2290 fprintf(stderr, "missing %s argument for -%s\n",
2290 opt->argname, opt->name); 2291 opt->argname, opt->name);
@@ -2328,6 +2329,16 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed,
2328 *opt->opt.value = (int)val; 2329 *opt->opt.value = (int)val;
2329 break; 2330 break;
2330 2331
2332 case OPTION_ARG_LONG:
2333 val = strtonum(argv[i], 0, LONG_MAX, &errstr);
2334 if (errstr != NULL) {
2335 fprintf(stderr, "%s %s argument for -%s\n",
2336 errstr, opt->argname, opt->name);
2337 return (1);
2338 }
2339 *opt->opt.lvalue = (long)val;
2340 break;
2341
2331 case OPTION_DISCARD: 2342 case OPTION_DISCARD:
2332 break; 2343 break;
2333 2344