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
12 ;;;; This file, part of UFFI, is Copyright (c) 2002-2005 by Kevin M. Rosenberg.
14 ;;;; *************************************************************************
20 "Return the value of the environment variable."
21 #+allegro (sys::getenv (string var))
22 #+clisp (sys::getenv (string var))
23 #+cmu (cdr (assoc (string var) ext:*environment-list* :test #'equalp
25 #+gcl (si:getenv (string var))
26 #+lispworks (lw:environment-variable (string var))
27 #+lucid (lcl:environment-variable (string var))
28 #+(or openmcl digitool) (ccl::getenv var)
29 #+sbcl (sb-ext:posix-getenv var)
30 #-(or allegro clisp cmu gcl lispworks lucid openmcl digitool sbcl)
31 (error 'not-implemented :proc (list 'getenv var)))
34 ;; modified from function ASDF -- Copyright Dan Barlow and Contributors
36 (defun run-shell-command (control-string &rest args &key output)
37 "Interpolate ARGS into CONTROL-STRING as if by FORMAT, and
38 synchronously execute the result using a Bourne-compatible shell, with
39 output to *trace-output*. Returns the shell's exit code."
41 (setq output *trace-output*))
43 (let ((command (apply #'format nil control-string args)))
45 (sb-impl::process-exit-code
49 :input nil :output output))
52 (ext:process-exit-code
56 :input nil :output output))
59 (excl:run-shell-command command :input nil :output output)
62 (system:call-system-showing-output
65 :output-stream output)
67 #+clisp ;XXX not exactly *trace-output*, I know
68 (ext:run-shell-command command :output :terminal :wait t)
72 (ccl:external-process-status
73 (ccl:run-program "/bin/sh" (list "-c" command)
74 :input nil :output output
77 #-(or openmcl clisp lispworks allegro scl cmu sbcl)
78 (error "RUN-SHELL-PROGRAM not implemented for this Lisp.")