version 1.18, 2022/03/25 20:54:51 |
version 1.24, 2022/10/29 06:20:52 |
|
|
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <unistd.h> |
|
#include <string.h> |
#include <string.h> |
#include <syslog.h> |
#include <syslog.h> |
|
#include <unistd.h> |
|
|
#include "blind.h" |
#include "blind.h" |
#include "config.h" |
#include "config.h" |
Line 43 main(int argc, char *argv[]) |
|
Line 43 main(int argc, char *argv[]) |
|
int ch; |
int ch; |
int verbose = 0; |
int verbose = 0; |
int no_action = 0; |
int no_action = 0; |
int daemonize = 1; |
int daemonize = 1; |
const char *config = BL_CONF; |
const char *config = BL_CONF; |
|
|
while ((ch = getopt(argc, argv, "dhnvf:")) != -1) { |
while ((ch = getopt(argc, argv, "dhnvf:")) != -1) { |
Line 57 main(int argc, char *argv[]) |
|
Line 57 main(int argc, char *argv[]) |
|
break; |
break; |
case 'n': |
case 'n': |
no_action = 1; |
no_action = 1; |
|
daemonize = 0; |
break; |
break; |
case 'f': |
case 'f': |
config = optarg; |
config = optarg; |
Line 82 main(int argc, char *argv[]) |
|
Line 83 main(int argc, char *argv[]) |
|
|
|
if (verbose) { |
if (verbose) { |
bl->bl_opt |= verbose; |
bl->bl_opt |= verbose; |
log_setv(verbose); |
log_set(verbose); |
log_debug("verbose mode on"); |
log_debug("verbose mode on"); |
} |
} |
|
|
Line 90 main(int argc, char *argv[]) |
|
Line 91 main(int argc, char *argv[]) |
|
log_fatal("file name exceeds PATH_MAX"); |
log_fatal("file name exceeds PATH_MAX"); |
|
|
if (config_load(bl)) |
if (config_load(bl)) |
log_fatal("config %s", bl->bl_conf); |
log_fatal("%s", bl->bl_conf); |
|
|
|
if (no_action) { |
|
// check config |
|
log_info("configuration ok"); |
|
free(bl); |
|
exit(0); |
|
} |
|
|
log_debug("conf=%s", bl->bl_conf); |
log_debug("conf=%s", bl->bl_conf); |
log_debug("sock=%s", bl->bl_sock); |
log_debug("sock=%s", bl->bl_sock); |
log_debug(" ttl=%d", bl->bl_ttl); |
log_debug(" ttl=%d", bl->bl_ttl); |
log_debug(" opt=%d", bl->bl_opt); |
log_debug(" opt=%d", bl->bl_opt); |
log_debug(" flg=%d", bl->bl_flg); |
|
|
|
// TAILQ_INIT(&offline_queue) |
// to be continued or not |
|
|
// fork + process setup + communication setup |
free(bl); |
|
|
exit(0); |
exit(0); |
} |
} |