+---
+* [Bug 3674] ntpq command 'execute only' using '~' prefix <perlinger@ntp.org>
+ - idea+patch by Gerry Garvey
+
---
(4.2.8p15) 2020/06/23 Released by Harlan Stenn <stenn@ntp.org>
#endif
#ifdef SYS_WINNT
# include <mswsock.h>
+# define PATH_DEVNULL "NUL:"
+#else
+# define PATH_DEVNULL "/dev/null"
#endif
#include <isc/net.h>
#include <isc/result.h>
int ntok;
static int i;
struct xcmd *xcmd;
+ int executeonly = 0;
/*
* Tokenize the command line. If nothing on it, return.
if (ntok == 0)
return;
+ /*
+ * If command prefixed by '~', then quiet output
+ */
+ if (*tokens[0] == '~') {
+ executeonly++;
+ tokens[0]++;
+ }
+
/*
* Find the appropriate command description.
*/
perror("");
return;
}
+ } else if (executeonly) { /* Redirect all output to null */
+ current_output = fopen(PATH_DEVNULL, "w");
+ if (current_output == NULL) {
+ (void) fprintf(stderr, "***Error redirecting output to /dev/null: ");
+ perror("");
+ return;
+ }
} else {
current_output = stdout;
}