summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2011-03-16 11:02:48 +0000
committerDimitri Sokolyuk <demon@dim13.org>2011-03-16 11:02:48 +0000
commit3d165c323e100719e1344c682476cebcee543b5b (patch)
treeafd1815b383db93b803413039486f233befe5d01
parentdf1caf8ba43bc64346e370a37278c273bbc6c429 (diff)
livewatch.de
-rw-r--r--livewatch/Makefile8
-rw-r--r--livewatch/livewatch.c47
2 files changed, 55 insertions, 0 deletions
diff --git a/livewatch/Makefile b/livewatch/Makefile
new file mode 100644
index 0000000..c4b4310
--- /dev/null
+++ b/livewatch/Makefile
@@ -0,0 +1,8 @@
+# $Id$
+
+PROG= livewatch
+DEBUG+= -Wall
+NOMAN=
+BINDIR= /var/www/cgi-bin
+
+.include <bsd.prog.mk>
diff --git a/livewatch/livewatch.c b/livewatch/livewatch.c
new file mode 100644
index 0000000..671e5de
--- /dev/null
+++ b/livewatch/livewatch.c
@@ -0,0 +1,47 @@
+/* $Id$ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+test(char *s)
+{
+ char valid[] = "0123456789abcdef";
+
+ if (strlen(s) != 32)
+ return 0;
+
+ while (*s)
+ if (!strchr(valid, *s++))
+ return 0;
+
+ return 1;
+}
+
+int
+main()
+{
+ char *s, *p;
+
+ s = getenv("QUERY_STRING");
+
+ if (s) {
+ printf("Content-type: text/html\r\n\r\n");
+
+ s = strstr(s, "key=");
+
+ if (s) {
+ s += 4;
+ p = strchr(s, '&');
+ if (p)
+ *p = '\0';
+
+ if (test(s))
+ printf("%s", s);
+ } else
+ printf("Alles OK");
+ }
+
+ return 0;
+}