Lisp 구현체에 따라 적절한 전역 변수를 읽어서 반환하게 하는 것이 기본이 된다.
환경 변수를 얻는 함수:
명령행 인수를 얻는 함수:
출처: http://cl-cookbook.sourceforge.net/os.html (상기 두개 말고도 참고 자료가 좀 더 있다.)
happy hackin'
환경 변수를 얻는 함수:
(defun my-getenv (name &optional default)
#+CMU
(let ((x (assoc name ext:*environment-list*
:test #'string=)))
(if x (cdr x) default))
#-CMU
(or
#+Allegro (sys:getenv name)
#+CLISP (ext:getenv name)
#+ECL (si:getenv name)
#+SBCL (sb-unix::posix-getenv name)
#+LISPWORKS (lispworks:environment-variable name)
default))
명령행 인수를 얻는 함수:
(defun my-command-line ()
(or
#+SBCL *posix-argv*
#+LISPWORKS system:*line-arguments-list*
#+CMU extensions:*command-line-words*
nil))
출처: http://cl-cookbook.sourceforge.net/os.html (상기 두개 말고도 참고 자료가 좀 더 있다.)
happy hackin'