int main(int argc, char **argv) { char *cfgfile; if (sock_start()) return -1; vlist_init(&pipes, pipe_destroy); cfg_init(&cfg, 0); atexit(cleanup); /* Look for the config file in the executable directory. Windows * uses it as the working directory, so we can use a relative * filename. On UNIX or the Mac, use the executable path and * filename from argv[0]. */ #ifdef __WIN32__ cfgfile = defcfgfile; #else cfgfile = malloc(strlen(argv[0]) + 4 + 1); strcpy(cfgfile, argv[0]); strcat(cfgfile, ".cfg"); #endif /* Prefer a config file specified on the command line */ readcfg(argc > 1 ? argv[argc - 1] : cfgfile); #ifdef DEBUG debug(); #endif waitclients(); return 0; }
int main(int argc, char **argv) { if (sock_start()) return -1; vlist_init(&pipes, pipe_destroy); cfg_init(&cfg, 0); atexit(cleanup); readcfg(); #ifdef DEBUG debug(); #endif waitclients(); return 0; }
static struct service * service_alloc(const char *name) { struct service *s; char *new_name; s = calloc_a(sizeof(*s), &new_name, strlen(name) + 1); strcpy(new_name, name); vlist_init(&s->instances, avl_strcmp, service_instance_update); s->instances.keep_old = true; s->name = new_name; s->avl.key = s->name; INIT_LIST_HEAD(&s->validators); return s; }
static void __init iprule_init_list(void) { vlist_init(&iprules, rule_cmp, iprule_update_rule); }