diff --git a/server/netget.c b/server/netget.c index 4be093cf36..df3fa3bab0 100644 --- a/server/netget.c +++ b/server/netget.c @@ -167,11 +167,37 @@ static void get_type(nut_ctype_t *client, const char *upsname, const char *var) static void get_var_server(nut_ctype_t *client, const char *upsname, const char *var) { + int pkgurlHasNutOrg = PACKAGE_URL ? (strstr(PACKAGE_URL, "networkupstools.org") != NULL) : 0; + if (!strcasecmp(var, "server.info")) { +#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE +#pragma GCC diagnostic push +#endif +#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE +#pragma GCC diagnostic ignored "-Wunreachable-code" +#endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + /* NOTE: Some compilers deduce that macro-based decisions about + * NUT_VERSION_IS_RELEASE make one of codepaths unreachable in + * a particular build. So we pragmatically handwave this away. + */ sendback(client, "VAR %s server.info " "\"Network UPS Tools upsd %s - " - "https://www.networkupstools.org/\"\n", - upsname, UPS_VERSION); + "%s%s%s\"\n", + upsname, UPS_VERSION, + PACKAGE_URL ? PACKAGE_URL : "", + (PACKAGE_URL && !pkgurlHasNutOrg) ? " or " : "", + pkgurlHasNutOrg ? "" : "https://www.networkupstools.org/" + ); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif +#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE +#pragma GCC diagnostic pop +#endif return; }