r11859: Canonicalize whitespace
[kmrcl.git] / os.lisp
diff --git a/os.lisp b/os.lisp
index 5db6be7895700eee4ae2c86f8dfc92bb709ee73e..7b7da44e5fa23adac19e668e0010fff7f192dfea 100644 (file)
--- a/os.lisp
+++ b/os.lisp
@@ -20,11 +20,11 @@ returns (VALUES string-output error-output exit-status)"
   (let ((command (apply #'format nil control-string args)))
     #+sbcl
     (let* ((process (sb-ext:run-program
-                   "/bin/sh"
-                   (list "-c" command)
-                   :input nil :output :stream :error :stream))
-          (output (read-stream-to-string (sb-impl::process-output process)))
-          (error (read-stream-to-string (sb-impl::process-error process))))
+                    "/bin/sh"
+                    (list "-c" command)
+                    :input nil :output :stream :error :stream))
+           (output (read-stream-to-string (sb-impl::process-output process)))
+           (error (read-stream-to-string (sb-impl::process-error process))))
       (close (sb-impl::process-output process))
       (close (sb-impl::process-error process))
       (values
@@ -35,11 +35,11 @@ returns (VALUES string-output error-output exit-status)"
 
     #+(or cmu scl)
     (let* ((process (ext:run-program
-                    "/bin/sh"
-                    (list "-c" command)
-                    :input nil :output :stream :error :stream))
-          (output (read-stream-to-string (ext::process-output process)))
-          (error (read-stream-to-string (ext::process-error process))))
+                     "/bin/sh"
+                     (list "-c" command)
+                     :input nil :output :stream :error :stream))
+           (output (read-stream-to-string (ext::process-output process)))
+           (error (read-stream-to-string (ext::process-error process))))
       (close (ext::process-output process))
       (close (ext::process-error process))
 
@@ -50,21 +50,21 @@ returns (VALUES string-output error-output exit-status)"
 
     #+allegro
     (multiple-value-bind (output error status)
-       (excl.osi:command-output command :whole t)
+        (excl.osi:command-output command :whole t)
       (values output error status))
 
     #+lispworks
     ;; BUG: Lispworks combines output and error streams
     (let ((output (make-string-output-stream)))
       (unwind-protect
-         (let ((status
-                (system:call-system-showing-output
-                 command
-                 :prefix ""
-                 :show-cmd nil
-                 :output-stream output)))
-           (values (get-output-stream-string output) nil status))
-       (close output)))
+          (let ((status
+                 (system:call-system-showing-output
+                  command
+                  :prefix ""
+                  :show-cmd nil
+                  :output-stream output)))
+            (values (get-output-stream-string output) nil status))
+        (close output)))
 
     #+clisp
     ;; BUG: CLisp doesn't allow output to user-specified stream
@@ -75,17 +75,17 @@ returns (VALUES string-output error-output exit-status)"
 
     #+openmcl
     (let* ((process (ccl:run-program
-                    "/bin/sh"
-                    (list "-c" command)
-                    :input nil :output :stream :error :stream
-                    :wait t))
-          (output (read-stream-to-string (ccl::external-process-output-stream process)))
-          (error (read-stream-to-string (ccl::external-process-error-stream process))))
+                     "/bin/sh"
+                     (list "-c" command)
+                     :input nil :output :stream :error :stream
+                     :wait t))
+           (output (read-stream-to-string (ccl::external-process-output-stream process)))
+           (error (read-stream-to-string (ccl::external-process-error-stream process))))
       (close (ccl::external-process-output-stream process))
       (close (ccl::external-process-error-stream process))
       (values output
-             error
-             (nth-value 1 (ccl::external-process-status process))))
+              error
+              (nth-value 1 (ccl::external-process-status process))))
 
     #-(or openmcl clisp lispworks allegro scl cmu sbcl)
     (error "COMMAND-OUTPUT not implemented for this Lisp")
@@ -114,7 +114,7 @@ returns (VALUES output-string pid)"
 
     #+allegro
     (excl:run-shell-command command :input nil :output nil
-                           :wait t)
+                            :wait t)
 
     #+lispworks
     (system:call-system-showing-output
@@ -124,15 +124,15 @@ returns (VALUES output-string pid)"
      :prefix ""
      :output-stream nil)
 
-    #+clisp            ;XXX not exactly *verbose-out*, I know
+    #+clisp             ;XXX not exactly *verbose-out*, I know
     (ext:run-shell-command  command :output :terminal :wait t)
 
     #+openmcl
     (nth-value 1
-              (ccl:external-process-status
-               (ccl:run-program "/bin/sh" (list "-c" command)
-                                :input nil :output nil
-                                :wait t)))
+               (ccl:external-process-status
+                (ccl:run-program "/bin/sh" (list "-c" command)
+                                 :input nil :output nil
+                                 :wait t)))
 
     #-(or openmcl clisp lispworks allegro scl cmu sbcl)
     (error "RUN-SHELL-PROGRAM not implemented for this Lisp")
@@ -141,21 +141,21 @@ returns (VALUES output-string pid)"
 
 (defun delete-directory-and-files (dir &key (if-does-not-exist :error) (quiet t) force)
   #+allegro (excl:delete-directory-and-files dir :if-does-not-exist if-does-not-exist
-                                            :quiet quiet :force force)
+                                             :quiet quiet :force force)
   #-(or allegro) (declare (ignore force))
   #-(or allegro) (cond
-                  ((probe-directory dir)
-                   (let ((cmd (format nil "rm -rf ~A" (namestring dir))))
-                     (unless quiet
-                       (format *trace-output* ";; ~A" cmd))
-                     (command-output cmd)))
-                  ((eq if-does-not-exist :error)
-                   (error "Directory ~A does not exist [delete-directory-and-files]." dir))))
+                   ((probe-directory dir)
+                    (let ((cmd (format nil "rm -rf ~A" (namestring dir))))
+                      (unless quiet
+                        (format *trace-output* ";; ~A" cmd))
+                      (command-output cmd)))
+                   ((eq if-does-not-exist :error)
+                    (error "Directory ~A does not exist [delete-directory-and-files]." dir))))
 
 (defun file-size (file)
   (when (probe-file file)
     #+allegro (let ((stat (excl.osi:stat (namestring file))))
-               (excl.osi:stat-size stat))
+                (excl.osi:stat-size stat))
     #-allegro
     (with-open-file (in file :direction :input)
       (file-length in))))
@@ -170,10 +170,10 @@ returns (VALUES output-string pid)"
   #+openmcl (ccl::getpid)
   #+(and clisp unix) (system::process-id)
   #+(and clisp win32) (cond ((find-package :win32)
-                            (funcall (find-symbol "GetCurrentProcessId"
-                                                  :win32)))
-                           (t
-                            (system::getenv "PID")))
+                             (funcall (find-symbol "GetCurrentProcessId"
+                                                   :win32)))
+                            (t
+                             (system::getenv "PID")))
   )