examples/: add -@ and -# flags to client and server, printing libwolfssl_configure_args() and libwolfssl_global_cflags() respectively.

This commit is contained in:
Daniel Pouzzner
2020-10-23 00:31:13 -05:00
parent 8be2d7690a
commit b918e1fd4c
3 changed files with 34 additions and 2 deletions

View File

@ -1655,7 +1655,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
while ((ch = mygetopt(argc, argv, "?:"
"ab:c:defgh:i;jk:l:mnop:q:rstuv:wxyz"
"A:B:CDE:F:GH:IJKL:M:NO:PQRS:TUVW:XYZ:"
"01:23:458")) != -1) {
"01:23:458"
"@#")) != -1) {
switch (ch) {
case '?' :
if(myoptarg!=NULL) {
@ -2122,6 +2123,20 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
#endif
break;
case '@' :
{
const char *conf_args = libwolfssl_configure_args();
printf("%s\n", conf_args ? conf_args : "configure args not compiled in");
XEXIT_T(EXIT_SUCCESS);
}
case '#' :
{
const char *cflags = libwolfssl_global_cflags();
printf("%s\n", cflags ? cflags : "CFLAGS not compiled in");
XEXIT_T(EXIT_SUCCESS);
}
default:
Usage();
XEXIT_T(MY_EX_USAGE);

View File

@ -1152,7 +1152,8 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
while ((ch = mygetopt(argc, argv, "?:"
"abc:defgijk:l:mnop:q:rstuv:wxy"
"A:B:C:D:E:FGH:IJKL:MNO:PQR:S:TUVYZ:"
"01:23:4:58")) != -1) {
"01:23:4:58"
"@#")) != -1) {
switch (ch) {
case '?' :
if(myoptarg!=NULL) {
@ -1552,6 +1553,20 @@ THREAD_RETURN WOLFSSL_THREAD server_test(void* args)
#endif
break;
case '@' :
{
const char *conf_args = libwolfssl_configure_args();
printf("%s\n", conf_args ? conf_args : "configure args not compiled in");
XEXIT_T(EXIT_SUCCESS);
}
case '#' :
{
const char *cflags = libwolfssl_global_cflags();
printf("%s\n", cflags ? cflags : "CFLAGS not compiled in");
XEXIT_T(EXIT_SUCCESS);
}
default:
Usage();
XEXIT_T(MY_EX_USAGE);

View File

@ -31,6 +31,7 @@
WOLFSSL_API const char *libwolfssl_configure_args(void) {
#ifdef LIBWOLFSSL_CONFIGURE_ARGS
/* the spaces on either side are to make matching simple and efficient. */
return " " LIBWOLFSSL_CONFIGURE_ARGS " ";
#else
return NULL;
@ -39,6 +40,7 @@ WOLFSSL_API const char *libwolfssl_configure_args(void) {
WOLFSSL_API const char *libwolfssl_global_cflags(void) {
#ifdef LIBWOLFSSL_GLOBAL_CFLAGS
/* the spaces on either side are to make matching simple and efficient. */
return " " LIBWOLFSSL_GLOBAL_CFLAGS " ";
#else
return NULL;