summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-05-07 22:45:27 +0100
committerFreeArtMan <dos21h@gmail.com>2017-05-07 22:45:27 +0100
commit8622152983f24677316c5b817db12414c6e7c058 (patch)
tree608cea38d7fc81b4d626596558b408b7aa590b97
parentadf40686a636bfe95357c3affe011a2514bfbf52 (diff)
downloadagni-8622152983f24677316c5b817db12414c6e7c058.tar.gz
agni-8622152983f24677316c5b817db12414c6e7c058.zip
Added new command
-rw-r--r--Makefile3
-rw-r--r--cmd_cookie.c19
-rw-r--r--cmd_cookie.h11
-rw-r--r--config_cmds.h2
4 files changed, 34 insertions, 1 deletions
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 <stdlib.h>
+#include <stdio.h>
+
+#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}
};