Code: Select all
(defun icp-do-lf (my-cpc)
"Handle the ICP lf command."
(if (/= (cpc-cmdtknc my-cpc) 2)
(icp-user-error my-cpc "Need exactly one load file pathname parameter")
(let ((load-stream (open (second (cpc-cmdtkns my-cpc)) :direction :input)))
(if (not load-stream)
(icp-user-error my-cpc "Can't open load file for input")
(let ((text-line (read-line load-stream nil nil)))
(if (not text-line)
(icp-user-error my-cpc "Can't read load file")
(let ((pos (calc-pos-from-str text-line)))
(if (not pos)
(icp-user-error my-cpc "Invalid FEN specification")
(progn
(load-cpc-pos pos my-cpc)
(icp-display-colorized-pos my-cpc)))))
(close load-stream)))))
(values))