(setq *targetdir* "c:/tom/testpage/") (defun c:ftp () (setq pwd (getstring "\npwd: ")) ) (defun c:4 ()(getfilecontent);in *lis* - this plods thru dumbly one char at a time (setq liscount 0 lislen (length *lis*)) (setq pagelis nil pagecount 0 page "") (setq lisstringcharcount 1 lisstring (nth liscount *lis*)) (while (< liscount lislen) (setq pagecharcount 0 bailout nil) (while (and (not bailout)(< pagecharcount 254)) ;could use 368) (setq page (strcat page (substr lisstring lisstringcharcount 1) )) (if (> (setq lisstringcharcount (1+ lisstringcharcount)) (strlen lisstring) ) ;then (progn (setq lisstringcharcount 1 liscount (1+ liscount) lisstring (nth liscount *lis*) ) (if (>= liscount lislen)(setq bailout t)) ) ) ; end if (setq pagecharcount (1+ pagecharcount)) );while pagecharcount (setq pagelis (cons page pagelis) page "" pagecount (1+ pagecount));pagecount is diag );while liscount (setq pagelis (reverse pagelis)) ;buildpages ;buildindex (writepage *targetdir* "index.html" (buildpage "index.html" "index page";content (strcat "
page1 ");links ) ) (setq k 1) (while (< k pagecount) (writepage *targetdir* (strcat "page" (itoa k) ".html") (buildpage (strcat "page" (itoa k)) (nth (1- k) pagelis);content (strcat "
page" (itoa (1+ k)) "") ) ) (setq k (1+ k)) ) ;still need last page ) ;;;(defun test () ;;; (writepage "c:/tom/testpage/" "index.html" (buildpage "index.html" "xxxxxxxxxxxxxxxxxxxx" "lllllllllllllll")) ;;; ) (defun buildpage (title bodycontent links) (list (strcat "" title "") "" bodycontent links "" "" ) ) (defun writepage (targetdir pagename pageoutput); targetdir ends with "\\", pagename incudes extension (cond ((null (setq wfiled (open (strcat targetdir pagename) "w"))) (princ "\nCouldn't open file ")(princ (strcat targetdir pagename))(princ " for writing ")(exit)) (t (mapcar '(lambda (line)(write-line line wfiled)) pageoutput) (close wfiled) ) ) ) (defun getfilecontent () (setq filed (open "c:/tom/temp.txt" "r") *lis* nil) (while (setq line (read-line filed))(setq *lis* (cons line *lis*))) (close filed) (setq *lis* (reverse *lis*)) )