Reading pipe from *standard-input*?
Jean Louis <[email protected]> Thu, 23 Mar 2017 17:42:38 +0300
| Newsgroups | gmane.lisp.clisp.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I really need a clue how to read a pipe from *standard-input*.
I need to accept *standard-input*. I am not sure if this one works
forever, it accepts .org file and spits out the markdown. I was
testing prior to this email and now I don't see any errors, while
there were some errors with the output previously.
Anyway if this need improvement, let me know.
Maybe there is some simpler function in CLISP?
Jean
(let ((quicklisp-init (merge-pathnames "lib/lisp/quicklisp/setup.lisp" (user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
;; (saveinitmem
(ql:quickload "alexandria" :verbose nil :quiet t)
;; (load #P"/home/data1/protected/Programming/git/RCDBusiness/lib/lisp/streamtools.lisp")
(defparameter memdir "/run/shm/")
(defparameter tmp-file "rcd-wrs-XXXXXX")
(defparameter tmp-org (format nil "~a~a.org" memdir tmp-file))
(defparameter tmp-md (format nil "~a~a.md" memdir tmp-file))
(defun main nil
(let ((input (with-open-stream (str *standard-input*)
(alexandria.0.dev:read-stream-content-into-string str))))
(alexandria.0.dev:write-string-into-file input tmp-org :if-exists :supersede :if-does-not-exist :create :external-format "utf-8")
(shell (format nil "/usr/bin/emacs -Q -l ~~/.emacs.d/elpa/org-20170210/org-autoloads.el \"~a\" --batch -f org-mode -f org-md-export-to-markdown --kill" tmp-org))
(format t (alexandria.0.dev:read-file-into-string tmp-md :external-format "utf-8")))
(exit))
(main)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list