diff options
author | jsing <> | 2014-08-28 13:37:41 +0000 |
---|---|---|
committer | jsing <> | 2014-08-28 13:37:41 +0000 |
commit | 1997202bee0a7c4cd631a99cd43a4c761e839090 (patch) | |
tree | 152c14c0294dc0d6c3b9b3265f604e1cae1e8658 /src | |
parent | 472401edb7fab3d9aa5240d5f046ed89cf3b4b98 (diff) | |
download | openbsd-1997202bee0a7c4cd631a99cd43a4c761e839090.tar.gz openbsd-1997202bee0a7c4cd631a99cd43a4c761e839090.tar.bz2 openbsd-1997202bee0a7c4cd631a99cd43a4c761e839090.zip |
Add option handling for input/output formats.
Diffstat (limited to 'src')
-rw-r--r-- | src/usr.bin/openssl/apps.c | 7 | ||||
-rw-r--r-- | src/usr.bin/openssl/apps.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/usr.bin/openssl/apps.c b/src/usr.bin/openssl/apps.c index fc5e2d073a..4ae6f12c18 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.3 2014/08/27 15:51:41 jsing Exp $ */ | 1 | /* $OpenBSD: apps.c,v 1.4 2014/08/28 13:37:41 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
4 | * | 4 | * |
@@ -2277,6 +2277,7 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) | |||
2277 | continue; | 2277 | continue; |
2278 | 2278 | ||
2279 | if (opt->type == OPTION_ARG || | 2279 | if (opt->type == OPTION_ARG || |
2280 | opt->type == OPTION_ARG_FORMAT || | ||
2280 | opt->type == OPTION_ARG_INT) { | 2281 | opt->type == OPTION_ARG_INT) { |
2281 | if (++i >= argc) { | 2282 | if (++i >= argc) { |
2282 | fprintf(stderr, | 2283 | fprintf(stderr, |
@@ -2291,6 +2292,10 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed) | |||
2291 | *opt->opt.arg = argv[i]; | 2292 | *opt->opt.arg = argv[i]; |
2292 | break; | 2293 | break; |
2293 | 2294 | ||
2295 | case OPTION_ARG_FORMAT: | ||
2296 | *opt->opt.value = str2fmt(argv[i]); | ||
2297 | break; | ||
2298 | |||
2294 | case OPTION_ARG_INT: | 2299 | case OPTION_ARG_INT: |
2295 | val = strtonum(argv[i], 0, INT_MAX, &errstr); | 2300 | val = strtonum(argv[i], 0, INT_MAX, &errstr); |
2296 | if (errstr != NULL) { | 2301 | if (errstr != NULL) { |
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h index 43d119500f..fefceb7ddb 100644 --- a/src/usr.bin/openssl/apps.h +++ b/src/usr.bin/openssl/apps.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: apps.h,v 1.3 2014/08/27 15:51:41 jsing Exp $ */ | 1 | /* $OpenBSD: apps.h,v 1.4 2014/08/28 13:37:41 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -288,6 +288,7 @@ struct option { | |||
288 | const char *desc; | 288 | const char *desc; |
289 | enum { | 289 | enum { |
290 | OPTION_ARG, | 290 | OPTION_ARG, |
291 | OPTION_ARG_FORMAT, | ||
291 | OPTION_ARG_INT, | 292 | OPTION_ARG_INT, |
292 | OPTION_FLAG, | 293 | OPTION_FLAG, |
293 | OPTION_VALUE, | 294 | OPTION_VALUE, |