From 04e5a756ba25f79036aa5e03e7412ed5e5539a12 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 28 Feb 2018 16:23:26 -0800 Subject: fixes #250 nngcat may not build if protocols are missing --- tools/nngcat/nngcat.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tools') 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: -- cgit v1.2.3-70-g09d2