1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: UFFI -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Operating system interface for UFFI
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Sep 2002
10 ;;;; This file, part of UFFI, is Copyright (c) 2002-2010 by Kevin M. Rosenberg.
12 ;;;; *************************************************************************
18 "Return the value of the environment variable."
19 #+allegro (sys::getenv (string var))
20 #+clisp (sys::getenv (string var))
21 #+cmu (cdr (assoc (string var) ext:*environment-list* :test #'equalp
23 #+gcl (si:getenv (string var))
24 #+lispworks (lw:environment-variable (string var))
25 #+lucid (lcl:environment-variable (string var))
26 #+(or openmcl digitool) (ccl::getenv var)
27 #+sbcl (sb-ext:posix-getenv var)
28 #-(or allegro clisp cmu gcl lispworks lucid openmcl digitool sbcl)
29 (error 'not-implemented :proc (list 'getenv var)))
32 ;; modified from function ASDF -- Copyright Dan Barlow and Contributors
34 (defun run-shell-command (control-string &rest args &key output)
35 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
36 synchronously execute the result using a Bourne-compatible shell, with
37 output to *trace-output*. Returns the shell's exit code."
39 (setq output *trace-output*))
41 (let ((command (apply #'format nil control-string args)))
43 (sb-impl::process-exit-code
47 :input nil :output output))
50 (ext:process-exit-code
54 :input nil :output output))
57 (excl:run-shell-command command :input nil :output output)
60 (system:call-system-showing-output
63 :output-stream output)
65 #+clisp ;XXX not exactly *trace-output*, I know
66 (ext:run-shell-command command :output :terminal :wait t)
70 (ccl:external-process-status
71 (ccl:run-program "/bin/sh" (list "-c" command)
72 :input nil :output output
75 #-(or openmcl clisp lispworks allegro scl cmu sbcl)
76 (error "RUN-SHELL-PROGRAM not implemented for this Lisp.")