From: Thomas Goodsell
Subject: Lisp CGI
Date: 
Message-ID: <367C1EA2.50AE8B8C@cc.usu.edu>
I've written a hello world cgi program in Lisp, but I can't get it to
work.  Does anyone in this newsgroup have any ideas?

I'm using ACL 5.0 for Linux, and I compiled the file into a binary
executable.  The source code, command line output, and more can all be
found at http://cc.usu.edu/~slvhh/cgi.html if you want to take a look at
it.

I'd appreciate any ideas.

Thanks,
Thom Goodsell
·············@usu.edu
From: Steve Gonedes
Subject: Re: Lisp CGI
Date: 
Message-ID: <m267b7eblo.fsf@KludgeUnix.com>
Thomas Goodsell <·····@cc.usu.edu> writes:

< I've written a hello world cgi program in Lisp, but I can't get it to
< work.  Does anyone in this newsgroup have any ideas?
< 
< I'm using ACL 5.0 for Linux, and I compiled the file into a binary
< executable.  The source code, command line output, and more can all be
< found at http://cc.usu.edu/~slvhh/cgi.html if you want to take a look at
< it.
< 
< I'd appreciate any ideas.
< 
< Thanks,
< Thom Goodsell
< ·············@usu.edu

If the command line options were `./hello' then the problem is that
you didn't call the function `hello-world'.

Here's a quicker way to do what you need without dumping a new image.

KludgeUnix:~$ lisp -e '(progn (format t "Hi!~%") (exit 0 :quiet t))'

=> Hi!


Writing CGI scripts in lisp and starting them from the command line
usually isn't the best way to go about it. There is an example in the
#p"sys:examples;server.cl" on how to write servers using a seperate
lisp process (a process in lisp is really a thread - no fork/exec).

Here is an example of a `hello world server'.

;;; Don't cut here (because it's glass - an attempt at humor :)

(load #p"sys:examples;server.cl")

(defun hello-world-server (&optional port)
  (make-socket-server
     :port port
     :name "Hello World Server"
     :function #'(lambda (port)
                     (fresh-line port) 
                     (write-string "Hello world!" port)
                     (fresh-line port))))

;;; launch the server
(hello-world-server 7003)

;;; EOF

This is realy neat because if you are in your lisp you can monitor the
status of the "Hello World Server" using the :process command. You can
telnet to the port and see what's going on too.

KludgeUnix:~$ telnet localhost 7003
  telnet localhost 7003
  Trying 127.0.0.1...
  Connected to localhost.
  Escape character is '^]'.
  Hello world!
  Connection closed by foreign host.

You can actually use the fi:telenet-jawn, but I don't have that
compiled in right now (I don't telnet too often). There is an eval
server - but I would be somewhat cautious using this over the internet
for obvious reasons (it's a neat idea but lacks any kind of
interaction between users - that would be neat).

Hope this helps some.