diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-08-28 13:37:42 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-08-28 13:37:42 +0000 |
commit | b8c8d8939c63274e3bc008ff6bacb0502fba0743 (patch) | |
tree | 10ddfd16f2efe1787eba7b34accf0ad08b4e6ee5 | |
parent | 2320d1fc469bf61427542270ac19c23c60ba4f81 (diff) |
Add option handling for input/output formats.
-rw-r--r-- | usr.bin/openssl/apps.c | 7 | ||||
-rw-r--r-- | usr.bin/openssl/apps.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/openssl/apps.c b/usr.bin/openssl/apps.c index fc5e2d073ae..4ae6f12c18c 100644 --- a/usr.bin/openssl/apps.c +++ b/usr.bin/openssl/apps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.c,v 1.3 2014/08/27 15:51:41 jsing Exp $ */ +/* $OpenBSD: apps.c,v 1.4 2014/08/28 13:37:41 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -2277,6 +2277,7 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) continue; if (opt->type == OPTION_ARG || + opt->type == OPTION_ARG_FORMAT || opt->type == OPTION_ARG_INT) { if (++i >= argc) { fprintf(stderr, @@ -2291,6 +2292,10 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) *opt->opt.arg = argv[i]; break; + case OPTION_ARG_FORMAT: + *opt->opt.value = str2fmt(argv[i]); + break; + case OPTION_ARG_INT: val = strtonum(argv[i], 0, INT_MAX, &errstr); if (errstr != NULL) { diff --git a/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h index 43d119500f2..fefceb7ddb0 100644 --- a/usr.bin/openssl/apps.h +++ b/usr.bin/openssl/apps.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apps.h,v 1.3 2014/08/27 15:51:41 jsing Exp $ */ +/* $OpenBSD: apps.h,v 1.4 2014/08/28 13:37:41 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -288,6 +288,7 @@ struct option { const char *desc; enum { OPTION_ARG, + OPTION_ARG_FORMAT, OPTION_ARG_INT, OPTION_FLAG, OPTION_VALUE, |