Browse code

Fixed CGI scripts.

Jaidyn Lev authored on 2018-06-14 18:47:10
Showing 6 changed files
1 1
old mode 100644
2 2
new mode 100755
... ...
@@ -2,10 +2,11 @@
2 2
   :version "0.0"
3 3
   :author "Jaidyn Lev <jadedctrl@teknik.io>"
4 4
   :license "CSL v1+"
5
-  :depends-on ("simple-sql") 
5
+  :depends-on ("simple-sql" "cl-cgi") 
6 6
   :components ((:module "src"
7 7
                 :components
8 8
 		((:file "package")
9
+		(:file "web")
9 10
 		(:file "main"))))
10 11
   :description
11 12
 	"Guest/visitor-counter for websites.")
... ...
@@ -1,19 +1,16 @@
1
+(in-package :doormat)
2
+
1 3
 (defun init ()
2 4
   "Init function for use directly in CGI scripts."
3 5
 
4
-  (let ((*standard-output* (make-broadcast-stream)))
5
-    (load "/var/lighttpd/.sbclrc"))
6
-  (let ((*standard-output* (make-broadcast-stream)))
7
-    (ql:quickload "doormat"))
8
-
9 6
   (cl-cgi:populate-environment))
10 7
 
11
-;;(format t "Content-Type: text/html~%~%")
12
-
13 8
 
14 9
 (defun dm-txt ()
15 10
   "Prints out/creates visitor-count for the requested URL."
16 11
 
12
+  (format t "Content-Type: text/plain~%~%")
13
+
17 14
   (let ((visitors (doormat:fetch-visitors cl-cgi:*query-string*)))
18 15
     (if visitors
19 16
       (doormat:increment-visitors cl-cgi:*query-string*)
20 17
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+To set up Doormat, you need to:
2
+
3
+
4
+1) Place `dm.cgi` and `dm-txt.lisp` on your webserver somewhere.
5
+
6
+2) Use ASDF, Quicklisp, or whatever to load the :doormat package and all of
7
+   its dependencies.
8
+
9
+3) Make a core-file (save-lisp-and-die "doormat.core"), and place it in your
10
+   webserver in the same directory as dm.cgi and dm-txt.lisp under the name
11
+   of `doormat.core`
12
+
13
+3.5) Steps 2 and 3 can be automated/made easier with the "generate-core.lisp"
14
+     script. If you have SBCL and Quicklisp installed, it'll make a Doormat
15
+     core automatically. :)
16
+
17
+4) Make sure that your web-server recognizes `.cgi` files, and executes accordingly.
0 18
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+(ql:quickload "doormat")
2
+(save-lisp-and-die "doormat.core")
0 3
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+(doormat:init)
2
+
3
+(doormat:dm-txt)
0 4
new file mode 100755
... ...
@@ -0,0 +1,3 @@
1
+#!/bin/sh
2
+
3
+sbcl --core doormat.core --script dm-txt.lisp