diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-08-30 15:14:04 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-08-30 15:14:04 +0000 |
commit | 78d49f01d06cf0629a881ad403749530126a53bb (patch) | |
tree | 7a4f2c00ddcbee1522e6798f2d7bd00ade1d6a55 /usr.bin/openssl/apps.c | |
parent | e3e39c7a956e7161a7fbed4d5fc41e0bd29ac6f8 (diff) |
Move the callback function pointer outside the opt union so that the option
values are useable by the function. Also provide an option type that calls
a function without consuming/passing an argument.
Diffstat (limited to 'usr.bin/openssl/apps.c')
-rw-r--r-- | usr.bin/openssl/apps.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index 7a5def5007d..4aac0ff6d2d 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.8 2014/08/28 14:15:28 jsing Exp $ */ +/* $OpenBSD: apps.c,v 1.9 2014/08/30 15:14:03 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -2307,7 +2307,7 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) break; case OPTION_ARG_FUNC: - if (opt->opt.func(opt, argv[i]) != 0) + if (opt->func(opt, argv[i]) != 0) return (1); break; @@ -2322,6 +2322,11 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) *opt->opt.value = (int)val; break; + case OPTION_FUNC: + if (opt->func(opt, NULL) != 0) + return (1); + break; + case OPTION_FLAG: *opt->opt.flag = 1; break; |