Skip to content

Instantly share code, notes, and snippets.

@kosh04
Created July 6, 2009 17:44
Show Gist options
  • Save kosh04/141574 to your computer and use it in GitHub Desktop.
Save kosh04/141574 to your computer and use it in GitHub Desktop.
#!/usr/bin/env newlisp
;;; Usage:
;; $ ./cat.lsp cat.lsp
;; $ newlisp cat.lsp http://vt100.net/animation/xmas0.txt 50
;; $ newlisp cat.lsp http://artscene.textfiles.com/vt100/twilightzone.vt
(define (cat filename (interval 0))
"FILENAMEの中身をINTERVALミリ秒間隔で表示する."
(dolist (line (parse (read-file filename) "\n"))
(println line)
(sleep interval)))
(let ((file (or (main-args 2) ""))
(n (or (int (main-args 3)) 25)))
(if (or (file? file)
(starts-with file "http://"))
(cat file n)
(println "Usage: newlisp cat.lsp [FILE|URL] [INTERVAL]")))
(exit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment