]>
jfr.im git - solanum.git/blob - libcharybdis/libcharybdis.c
2 * charybdis: A slightly useful ircd.
3 * libcharybdis.c: library entrypoint
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
8 * Copyright (C) 2005 William Pitcock and Jilles Tjoelker
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 the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 * $Id: libcharybdis.c 386 2005-12-07 16:21:24Z nenolod $
29 #include "libcharybdis.h"
31 static void (*log_callback
)(const char *str
) = NULL
;
32 static void (*restart_callback
)(const char *str
) = NULL
;
33 static void (*die_callback
)(const char *str
) = NULL
;
34 static char errbuf
[BUFSIZE
* 2];
36 void libcharybdis_log(const char *str
, ...)
40 if (log_callback
== NULL
)
44 ircvsnprintf(errbuf
, BUFSIZE
* 2, str
, args
);
50 void libcharybdis_restart(const char *str
, ...)
54 if (restart_callback
== NULL
)
58 ircvsnprintf(errbuf
, BUFSIZE
* 2, str
, args
);
61 restart_callback(errbuf
);
64 void libcharybdis_die(const char *str
, ...)
68 if (die_callback
== NULL
)
72 ircvsnprintf(errbuf
, BUFSIZE
* 2, str
, args
);
78 void libcharybdis_init(void (*log_cb
)(const char *str
),
79 void (*restart_cb
)(const char *str
), void (*die_cb
)(const char *str
))
81 log_callback
= log_cb
;
82 restart_callback
= restart_cb
;
83 die_callback
= die_cb
;