comparison tests/test-plugin-hangman.c @ 1065:d8db515adbd4

misc: remove usage of BSD errx?() functions
author David Demelier <markand@malikania.fr>
date Mon, 12 Jul 2021 20:40:45 +0200
parents 8f8ce47aba8a
children f06e9761cc90
comparison
equal deleted inserted replaced
1064:f7f73da81a5f 1065:d8db515adbd4
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */ 17 */
18 18
19 #include <err.h>
20
21 #define GREATEST_USE_ABBREVS 0 19 #define GREATEST_USE_ABBREVS 0
22 #include <greatest.h> 20 #include <greatest.h>
23 21
24 #include <irccd/conn.h> 22 #include <irccd/conn.h>
25 #include <irccd/js-plugin.h> 23 #include <irccd/js-plugin.h>
26 #include <irccd/log.h> 24 #include <irccd/log.h>
27 #include <irccd/plugin.h> 25 #include <irccd/plugin.h>
28 #include <irccd/server.h> 26 #include <irccd/server.h>
27 #include <irccd/util.h>
29 28
30 #define CALL(t, m) do { \ 29 #define CALL(t, m) do { \
31 memset(server->conn->out, 0, sizeof (server->conn->out)); \ 30 memset(server->conn->out, 0, sizeof (server->conn->out)); \
32 irc_plugin_handle(plugin, &(const struct irc_event) { \ 31 irc_plugin_handle(plugin, &(const struct irc_event) { \
33 .type = t, \ 32 .type = t, \
63 62
64 server = irc_server_new("test", "t", "t", "t", "127.0.0.1", 6667); 63 server = irc_server_new("test", "t", "t", "t", "127.0.0.1", 6667);
65 plugin = js_plugin_open("hangman", TOP "/plugins/hangman/hangman.js"); 64 plugin = js_plugin_open("hangman", TOP "/plugins/hangman/hangman.js");
66 65
67 if (!plugin) 66 if (!plugin)
68 errx(1, "could not load plugin"); 67 irc_util_die("could not load plugin\n");
69 68
70 irc_log_to_console(); 69 irc_log_to_console();
71 irc_server_incref(server); 70 irc_server_incref(server);
72 irc_plugin_set_template(plugin, "asked", "asked=#{plugin}:#{command}:#{server}:#{channel}:#{origin}:#{nickname}:#{letter}"); 71 irc_plugin_set_template(plugin, "asked", "asked=#{plugin}:#{command}:#{server}:#{channel}:#{origin}:#{nickname}:#{letter}");
73 irc_plugin_set_template(plugin, "dead", "dead=#{plugin}:#{command}:#{server}:#{channel}:#{origin}:#{nickname}:#{word}"); 72 irc_plugin_set_template(plugin, "dead", "dead=#{plugin}:#{command}:#{server}:#{channel}:#{origin}:#{nickname}:#{word}");