diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-02-28 16:23:26 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-02-28 16:23:26 -0800 |
| commit | 04e5a756ba25f79036aa5e03e7412ed5e5539a12 (patch) | |
| tree | d33d3cf0f48de6103f8ee96d5e7fc1afba0071a5 | |
| parent | 4f2b13b588e4a3dd611aae525e59fa0b46fba263 (diff) | |
| download | nng-04e5a756ba25f79036aa5e03e7412ed5e5539a12.tar.gz nng-04e5a756ba25f79036aa5e03e7412ed5e5539a12.tar.bz2 nng-04e5a756ba25f79036aa5e03e7412ed5e5539a12.zip | |
fixes #250 nngcat may not build if protocols are missing
| -rw-r--r-- | tests/multistress.c | 2 | ||||
| -rw-r--r-- | tests/stubs.h | 4 | ||||
| -rw-r--r-- | tools/nngcat/nngcat.c | 44 |
3 files changed, 50 insertions, 0 deletions
diff --git a/tests/multistress.c b/tests/multistress.c index 556718fa..0a98d5fc 100644 --- a/tests/multistress.c +++ b/tests/multistress.c @@ -31,6 +31,8 @@ #include <string.h> #include <time.h> +#include "stubs.h" + #ifdef NDEBUG #define dprintf(...) #else diff --git a/tests/stubs.h b/tests/stubs.h index 99f92f7d..da3a6d5f 100644 --- a/tests/stubs.h +++ b/tests/stubs.h @@ -94,4 +94,8 @@ nosocket(nng_socket *s) #define nng_respondent0_open nosocket #endif +#ifndef NNG_HAVE_BUS0 +#define nng_bus0_open nosocket +#endif + #endif // STUBS_H diff --git a/tools/nngcat/nngcat.c b/tools/nngcat/nngcat.c index 4e61d41a..728f0c3f 100644 --- a/tools/nngcat/nngcat.c +++ b/tools/nngcat/nngcat.c @@ -787,37 +787,81 @@ main(int ac, const char **av) switch (proto) { case OPT_REQ0: +#ifdef NNG_HAVE_REQ0 rv = nng_req0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_REP0: +#ifdef NNG_HAVE_REP0 rv = nng_rep0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_SUB0: +#ifdef NNG_HAVE_SUB0 rv = nng_sub0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_PUB0: +#ifdef NNG_HAVE_PUB0 rv = nng_pub0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_PAIR0: +#ifdef NNG_HAVE_PAIR0 rv = nng_pair0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_PAIR1: +#ifdef NNG_HAVE_PAIR1 rv = nng_pair1_open(&sock); +#else + fatal("Protocol not supported"); +#endif break; case OPT_BUS0: +#ifdef NNG_HAVE_BUS0 rv = nng_bus0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_PUSH0: +#ifdef NNG_HAVE_PUSH0 rv = nng_push0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_PULL0: +#ifdef NNG_HAVE_PULL0 rv = nng_pull0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_SURVEY0: +#ifdef NNG_HAVE_SURVEYOR0 rv = nng_surveyor0_open(&sock); +#else + fatal("Protocol not supported."); +#endif break; case OPT_RESPOND0: +#ifdef NNG_HAVE_RESPONDENT0 rv = nng_respondent0_open(&sock); +#else + fatal("Protocol not supported"); +#endif break; case 0: default: |
