add force netstring overwrite commandline option

This commit is contained in:
whottgen 2006-09-20 19:09:50 +00:00
parent dfa2da5ce8
commit 734f36df4e

View File

@ -141,7 +141,7 @@ count_t thread_counter;
cfg_t *cfg; cfg_t *cfg;
int netstring_disabled = 0; int netstring_disabled = 0;
int force_netstring_disabled = 0;
void * statser(void * arg) { void * statser(void * arg) {
@ -320,7 +320,7 @@ int server() {
char *cfg_address, *cfg_port; char *cfg_address, *cfg_port;
netstring_disabled = atoi(findcfgx(cfg, CFG_SECTION_GLOBAL, CFG_NETSTRING_DISABLED, "0")); netstring_disabled = atoi(findcfgx(cfg, CFG_SECTION_GLOBAL, CFG_NETSTRING_DISABLED, "0")) || force_netstring_disabled;
serverSock = socket(AF_INET, SOCK_STREAM, 0); serverSock = socket(AF_INET, SOCK_STREAM, 0);
@ -439,6 +439,7 @@ int server() {
void usage() { void usage() {
printf("smmapd [-F] [-p pidfile] [-f cfgfile] [-h]\n"); printf("smmapd [-F] [-p pidfile] [-f cfgfile] [-h]\n");
printf(" -F run in foreground, overwrite smmapd.ini setting\n"); printf(" -F run in foreground, overwrite smmapd.ini setting\n");
printf(" -n force netstring disable, overwrite smmapd.ini setting\n");
printf(" -p pidfile, overwrite smmapd.ini setting\n"); printf(" -p pidfile, overwrite smmapd.ini setting\n");
printf(" -f cfgfile\n"); printf(" -f cfgfile\n");
printf(" -v version and release info\n"); printf(" -v version and release info\n");
@ -451,7 +452,7 @@ int main(int argc, char **argv) {
FILE *f; FILE *f;
while ((c = getopt(argc, argv,"Fp:f:hv")) != -1) while ((c = getopt(argc, argv,"Fp:f:hvn")) != -1)
switch (c) { switch (c) {
case 'F': case 'F':
foreground = 1; foreground = 1;
@ -462,6 +463,9 @@ int main(int argc, char **argv) {
case 'p': case 'p':
pid_file = htstrdup(optarg); pid_file = htstrdup(optarg);
break; break;
case 'n':
force_netstring_disabled = 1;
break;
case 'v': case 'v':
printf("\nsmmapd - Wolfgang Hottgenroth <woho@hottis.de>\n"); printf("\nsmmapd - Wolfgang Hottgenroth <woho@hottis.de>\n");
printf(" cvs_id: %s\n", CVS_ID); printf(" cvs_id: %s\n", CVS_ID);