#!/usr/local/bin/clisp
;
; CPU Resource Server (started via inetd)
; Simple Grid Protocol 1.04 - Copyright (c) Brendan Kosowski 2004, 2005, 2015
;
(defvar token)
(defvar lin)
(defvar fr)

(format t "Simple Grid Protocol 1.04 - Copyright (c) Brendan Kosowski 2004, 2005, 2015~%")

(setq fr (open "/home/grid/token.dat" :direction :input))
(setq token (read-line fr))
(close fr)

(format t "token?~%")
(when (string= token (read-line))

	(loop
		(format t "what?~%")
		(setq lin (read-line))

		(when (string= lin "help")
			(format t "commands: help bye quit eval~%")
		)

		(when (string= lin "bye")
			(return)
		)

		(when (string= lin "quit")
			(return)
		)

		(when (string= lin "eval")

			(format t "code?~%")
			(prin1 (eval (read-from-string (read-line))))
			(format t "~%")
		)
	)
)
