Fix typos; cosmetic.
[seven-1.x.git] / ircd / libseven / libseven.c
blob954605fef961de25bb28768971eb1496a1e56d92
1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center.
4 * Copyright (C) 1996-2002 Hybrid Development Team.
5 * Copyright (C) 2002-2005 ircd-ratbox development team.
6 * Copyright (C) 2005 William Pitcock and Jilles Tjoelker.
8 * Based on mkpasswd.c, originally by Nelson Minar (minar@reed.edu).
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to:
23 * Free Software Foundation, Inc.
24 * 51 Franklin St - Fifth Floor
25 * Boston, MA 02110-1301
26 * USA
28 * }}} */
30 #include "stdinc.h"
31 #include "libseven.h"
33 static seven_log_cb log_callback = NULL;
34 static seven_log_cb restart_callback = NULL;
35 static seven_log_cb die_callback = NULL;
37 static char errbuf[BUFSIZE * 2];
39 /* {{{ void libseven_log() */
40 void libseven_log(const char *str, ...)
42 va_list args;
44 if (log_callback == NULL)
45 return;
47 va_start(args, str);
48 ircvsnprintf(errbuf, BUFSIZE * 2, str, args);
49 va_end(args);
51 log_callback(errbuf);
53 /* }}} */
55 /* {{{ void libseven_restart() */
56 void libseven_restart(const char *str, ...)
58 va_list args;
60 if (restart_callback == NULL)
61 return;
63 va_start(args, str);
64 ircvsnprintf(errbuf, BUFSIZE * 2, str, args);
65 va_end(args);
67 restart_callback(errbuf);
69 /* }}} */
71 /* {{{ void libseven_die() */
72 void libseven_die(const char *str, ...)
74 va_list args;
76 if (die_callback == NULL)
77 return;
79 va_start(args, str);
80 ircvsnprintf(errbuf, BUFSIZE * 2, str, args);
81 va_end(args);
83 die_callback(errbuf);
85 /* }}} */
87 /* {{{ void libseven_init() */
88 void libseven_init(seven_log_cb log_cb, seven_log_cb restart_cb, seven_log_cb die_cb)
90 log_callback = log_cb;
91 restart_callback = restart_cb;
92 die_callback = die_cb;
94 fdlist_init();
95 init_netio();
96 eventInit();
97 initBlockHeap();
98 init_dlink_nodes();
99 linebuf_init();
101 /* }}} */
104 * vim: ts=8 sw=8 noet fdm=marker tw=80