27 September 2012: Wouter
- include: directive in config file accepts wildcards. Patch from
Paul Wouters. Suggested use: include: "/etc/unbound.d/conf.d/*"
+ - unbound-control -q option is quiet, patch from Mariano Absatz.
21 September 2012: Wouter
- chdir to / after chroot call (suggested by Camiel Dobbelaar).
printf("Options:\n");
printf(" -c file config file, default is %s\n", CONFIGFILE);
printf(" -s ip[@port] server address, if omitted config is used.\n");
+ printf(" -q quiet (don't print anything if it works ok).\n");
printf(" -h show this usage help.\n");
printf("Commands:\n");
printf(" start start server; runs unbound(8)\n");
/** send command and display result */
static int
-go_cmd(SSL* ssl, int argc, char* argv[])
+go_cmd(SSL* ssl, int quiet, int argc, char* argv[])
{
char pre[10];
const char* space=" ";
ssl_err("could not SSL_read");
}
buf[r] = 0;
- printf("%s", buf);
- if(first_line && strncmp(buf, "error", 5) == 0)
+ if(first_line && strncmp(buf, "error", 5) == 0) {
+ printf("%s", buf);
was_error = 1;
+ } else if (!quiet)
+ printf("%s", buf);
+
first_line = 0;
}
return was_error;
/** go ahead and read config, contact server and perform command and display */
static int
-go(const char* cfgfile, char* svr, int argc, char* argv[])
+go(const char* cfgfile, char* svr, int quiet, int argc, char* argv[])
{
struct config_file* cfg;
int fd, ret;
ssl = setup_ssl(ctx, fd);
/* send command */
- ret = go_cmd(ssl, argc, argv);
+ ret = go_cmd(ssl, quiet, argc, argv);
SSL_free(ssl);
#ifndef USE_WINSOCK
int main(int argc, char* argv[])
{
int c, ret;
+ int quiet = 0;
const char* cfgfile = CONFIGFILE;
char* svr = NULL;
#ifdef USE_WINSOCK
}
/* parse the options */
- while( (c=getopt(argc, argv, "c:s:h")) != -1) {
+ while( (c=getopt(argc, argv, "c:s:qh")) != -1) {
switch(c) {
case 'c':
cfgfile = optarg;
case 's':
svr = optarg;
break;
+ case 'q':
+ quiet = 1;
+ break;
case '?':
case 'h':
default:
}
}
- ret = go(cfgfile, svr, argc, argv);
+ ret = go(cfgfile, svr, quiet, argc, argv);
#ifdef USE_WINSOCK
WSACleanup();