Provide option types for binary AND, binary OR and silently discarding an
authorjsing <jsing@openbsd.org>
Thu, 1 Jan 2015 14:28:00 +0000 (14:28 +0000)
committerjsing <jsing@openbsd.org>
Thu, 1 Jan 2015 14:28:00 +0000 (14:28 +0000)
option.

usr.bin/openssl/apps.c
usr.bin/openssl/apps.h

index d3c3194..5a6bb7a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.c,v 1.22 2014/12/28 16:51:31 jsing Exp $ */
+/* $OpenBSD: apps.c,v 1.23 2015/01/01 14:28:00 jsing Exp $ */
 /*
  * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
  *
@@ -2359,6 +2359,14 @@ options_parse(int argc, char **argv, struct option *opts, char **unnamed,
                        *opt->opt.value = opt->value;
                        break;
 
+               case OPTION_VALUE_AND:
+                       *opt->opt.value &= opt->value;
+                       break;
+
+               case OPTION_VALUE_OR:
+                       *opt->opt.value |= opt->value;
+                       break;
+
                default:
                        fprintf(stderr, "option %s - unknown type %i\n",
                            opt->name, opt->type);
index f057148..dddfeee 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.h,v 1.12 2014/12/28 16:22:37 jsing Exp $ */
+/* $OpenBSD: apps.h,v 1.13 2015/01/01 14:28:00 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -290,10 +290,13 @@ struct option {
                OPTION_ARG_FORMAT,
                OPTION_ARG_FUNC,
                OPTION_ARG_INT,
+               OPTION_DISCARD,
                OPTION_FUNC,
                OPTION_FLAG,
                OPTION_FLAG_ORD,
                OPTION_VALUE,
+               OPTION_VALUE_AND,
+               OPTION_VALUE_OR,
        } type;
        union {
                char **arg;