summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/apps.h
diff options
context:
space:
mode:
authorjsing <>2014-08-27 14:59:44 +0000
committerjsing <>2014-08-27 14:59:44 +0000
commit1fbc8b7e3211e362b5507749d1c5b692dcb8c64f (patch)
treed84799ea674d39450c109ebc4c3cb39140e5201e /src/usr.bin/openssl/apps.h
parent10e31157bd2d409218ed09f4b52af2de773a8a0f (diff)
downloadopenbsd-1fbc8b7e3211e362b5507749d1c5b692dcb8c64f.tar.gz
openbsd-1fbc8b7e3211e362b5507749d1c5b692dcb8c64f.tar.bz2
openbsd-1fbc8b7e3211e362b5507749d1c5b692dcb8c64f.zip
Implement table-driven option parsing that allows an application to
specify what its valid options are and where it wants them to be stored. This also allows for usage to be generated, almost for free, ensuring that the options and usage are automatically kept in sync. This will allow for a single option parsing implementation, rather than the current one-hand-rolled-option-parsing-and-random-usage-implementation per application. As a starting point, port the openssl(1) rand application to the new option parsing and usage (along with associated code clean up). With input from doug@. ok bcook@ doug@
Diffstat (limited to 'src/usr.bin/openssl/apps.h')
-rw-r--r--src/usr.bin/openssl/apps.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h
index 38c5f4be8c..64e581b969 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.1 2014/08/26 17:47:24 jsing Exp $ */ 1/* $OpenBSD: apps.h,v 1.2 2014/08/27 14:59:44 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 *
@@ -282,4 +282,24 @@ double app_tminterval (int stop, int usertime);
282 282
283#define OPENSSL_NO_SSL_INTERN 283#define OPENSSL_NO_SSL_INTERN
284 284
285struct option {
286 const char *name;
287 const char *argname;
288 const char *desc;
289 enum {
290 OPTION_ARG,
291 OPTION_FLAG,
292 OPTION_VALUE,
293 } type;
294 union {
295 char **arg;
296 int *flag;
297 int *value;
298 } opt;
299 const int value;
300};
301
302void options_usage(struct option *opts);
303int options_parse(int argc, char **argv, struct option *opts, char **unnamed);
304
285#endif 305#endif