From 8622152983f24677316c5b817db12414c6e7c058 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 7 May 2017 22:45:27 +0100 Subject: Added new command --- Makefile | 3 ++- cmd_cookie.c | 19 +++++++++++++++++++ cmd_cookie.h | 11 +++++++++++ config_cmds.h | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 cmd_cookie.c create mode 100644 cmd_cookie.h diff --git a/Makefile b/Makefile index 6fbc0fc..62f2d11 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,10 @@ make: version $(CC) $(CFLAGS) cmd_cmd.c -c $(CC) $(CFLAGS) sha1.c -c $(CC) $(CFLAGS) cmd_sha1.c -c + $(CC) $(CFLAGS) cmd_cookie.c -c $(CC) $(CFLAGS) tbl_qcmd.o mq_cmd.o mq_ntf.o buf.o mmm.o darray.o util.o sock_conn.o \ irc_parse.o mmm.c cmd_date.o cmd_uptime.o cmd_version.o cmd_ping.o cmd_loadavg.o \ - cmd_rusage.c cmd_cmd.o sha1.o cmd_sha1.o agni.c \ + cmd_rusage.c cmd_cmd.o sha1.o cmd_sha1.o cmd_cookie.o agni.c \ -o $(PROJECT) -std=c11 -lrt version: diff --git a/cmd_cookie.c b/cmd_cookie.c new file mode 100644 index 0000000..8071e10 --- /dev/null +++ b/cmd_cookie.c @@ -0,0 +1,19 @@ +#include "cmd_cookie.h" + +void *cmd_cookie(void *data) +{ + char *param = (char *)data; + char *ret = NULL; + + const int buf_size = 128; + char buf[buf_size+1]; + + printf("COOKIE\n"); + + + snprintf(buf, buf_size, "No heroes yet\n"); + ret = alloc_new_str(buf); + + + return ret; +} \ No newline at end of file diff --git a/cmd_cookie.h b/cmd_cookie.h new file mode 100644 index 0000000..62a4779 --- /dev/null +++ b/cmd_cookie.h @@ -0,0 +1,11 @@ +#ifndef __CMD_COOKIE_H +#define __CMD_COOKIE_H + +#include +#include + +#include "util.h" + +void *cmd_cookie(void *data); + +#endif \ No newline at end of file diff --git a/config_cmds.h b/config_cmds.h index 2fc20a5..1eea56a 100644 --- a/config_cmds.h +++ b/config_cmds.h @@ -17,6 +17,7 @@ typedef struct single_cmd_def #include "cmd_rusage.h" #include "cmd_cmd.h" #include "cmd_sha1.h" +#include "cmd_cookie.h" //some commands have aliases for compat with some developerslv bots @@ -31,6 +32,7 @@ single_cmd_def confgi_cmd_list[] = {"RUSE",cmd_rusage}, {"CMD",cmd_cmd}, {"!echo",cmd_cmd}, {"SHA1",cmd_sha1}, + {"COOKIE",cmd_cookie}, {NULL,NULL} }; -- cgit v1.2.3