]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/testutil/options.c
2 * Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include "../testutil.h"
11 #include "internal/nelem.h"
16 static int used
[100] = { 0 };
18 int test_skip_common_options(void)
20 OPTION_CHOICE_DEFAULT o
;
22 while ((o
= (OPTION_CHOICE_DEFAULT
)opt_next()) != OPT_EOF
) {
34 size_t test_get_argument_count(void)
36 return opt_num_rest();
39 char *test_get_argument(size_t n
)
41 char **argv
= opt_rest();
43 OPENSSL_assert(n
< sizeof(used
));
44 if ((int)n
>= opt_num_rest() || argv
== NULL
)
50 void opt_check_usage(void)
53 char **argv
= opt_rest();
54 int n
, arg_count
= opt_num_rest();
56 if (arg_count
> (int)OSSL_NELEM(used
))
57 n
= (int)OSSL_NELEM(used
);
60 for (i
= 0; i
< n
; i
++) {
62 test_printf_stderr("Warning ignored command-line argument %d: %s\n",
66 test_printf_stderr("Warning arguments %d and later unchecked\n", i
);
69 int opt_printf_stderr(const char *fmt
, ...)
75 ret
= test_vprintf_stderr(fmt
, ap
);