version 1.6, 2022/03/17 14:30:21 |
version 1.12, 2022/03/19 10:04:59 |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <string.h> |
#include <syslog.h> |
#include <syslog.h> |
|
|
#include "blind.h" |
#include "blind.h" |
|
#include "config.h" |
#include "log.h" |
#include "log.h" |
|
|
static void usage(void); |
static void usage(void); |
|
|
int daemonize = 1; |
int daemonize = 1; |
int verbose = 0; |
struct blind *bl; |
|
|
static void |
static void |
usage(void) |
usage(void) |
|
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
int ch; |
int ch; |
|
int verbose = 0; |
int no_action = 0; |
int no_action = 0; |
const char *config = BL_CONF; |
const char *config = BL_CONF; |
|
|
Line 59 main(int argc, char *argv[]) |
|
Line 62 main(int argc, char *argv[]) |
|
config = optarg; |
config = optarg; |
break; |
break; |
case 'v': |
case 'v': |
verbose = 1; |
verbose = BL_OPT_VERBOSE; |
break; |
break; |
default: |
default: |
usage(); |
usage(); |
Line 72 main(int argc, char *argv[]) |
|
Line 75 main(int argc, char *argv[]) |
|
usage(); |
usage(); |
|
|
log_init(daemonize, LOG_DAEMON); |
log_init(daemonize, LOG_DAEMON); |
log_setv(verbose); |
|
log_info("%s %s starting", BL_TEXT, BL_VERS); |
log_info("%s %s starting", BL_TEXT, BL_VERS); |
log_debug("verbose mode"); |
|
|
|
// todo[0]: conf file format + ideas |
if ((bl = config_init()) == NULL) |
// todo[1]: default conf defines in blind.h |
log_fatal("default values init failed"); |
// todo[2]: struct blind in blind.h |
|
// todo[3]: initialize defualt config in blind.c |
|
|
|
|
bl->bl_opt |= verbose; |
|
log_setv(verbose); |
|
log_debug("verbose mode on"); |
|
|
|
if (strlcpy(bl->bl_conf, config, PATH_MAX) >= PATH_MAX) |
|
log_fatal("config file name exceeds PATH_MAX"); |
|
|
|
// if (parse_config(bl, config, opt)) |
|
// exit(1) // log_fatal("parsing conf file failed"); |
|
// int parse_config(struct smtpd *, const char *, int); |
|
|
|
log_debug("conf=%s", bl->bl_conf); |
|
log_debug("sock=%s", bl->bl_sock); |
|
log_debug(" ttl=%d", bl->bl_ttl); |
|
log_debug(" opt=%d", bl->bl_opt); |
|
log_debug(" flg=%d", bl->bl_flg); |
|
|
// TAILQ_INIT(&offline_queue) |
// TAILQ_INIT(&offline_queue) |
|
|
// parse_config |
// fork + process setup + communication setup |
|
|
exit(0); |
exit(0); |
} |
} |