From 7f08a361a1214a4b49d19325ef48dd97f0c9f215 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Wed, 20 Jul 2005 21:06:32 +0000
Subject: [PATCH] *** empty log message ***

---
 ChangeLog    |  7 +++++++
 scm/lily.scm | 13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index d438835b6d..e7bddc42a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-19  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* lily/main.cc (main): Remove invalid handle kludge.
+
+	* scm/lily.scm (running-from-gui?): WINDOWS: check -dgui.
+	(lambda): add gui define.
+
 2005-07-15  Graham Percuval  <gperlist@shaw.ca>
 
 	* Documentation/user/ <various>: backported stuff.
diff --git a/scm/lily.scm b/scm/lily.scm
index d73b883b51..faa9e62d3a 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -24,6 +24,7 @@ similar to chord syntax")
 	    (preview-include-book-title #t "include book-titles in preview images.")
 	    (gs-font-load #f
 			  "load fonts via Ghostscript.")
+	    (gui #f "running from gui; redirect stderr to log file")
 	    (delete-intermediate-files #f
 				       "delete unusable PostScript files")
 	    (verbose #f "value for the --verbose flag")
@@ -115,6 +116,12 @@ similar to chord syntax")
    (string-downcase
     (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
 
+(define-public DOS
+  (let ((platform (string-tokenize
+		   (vector-ref (uname) 0) char-set:letter+digit)))
+    (if (null? (cdr platform)) #f
+	(member (string-downcase (cadr platform)) '("95" "98" "me")))))
+
 (case PLATFORM
   ((windows)
    (define native-getcwd getcwd)
@@ -381,9 +388,13 @@ The syntax is the same as `define*-public'."
     ;; If no TTY and not using safe, assume running from GUI.
     (cond
      ((eq? PLATFORM 'windows)
+      (if DOS #f
       ;; This only works for i586-mingw32msvc-gcc -mwindows
       (not (string-match "standard input"
-			 (format #f "~S" (current-input-port)))))
+			 (format #f "~S" (current-input-port))))))
+     ;; FIXME: using -dgui would be nice, but it does not work
+     ((eq? PLATFORM 'foo-windows)
+      (ly:get-option 'gui))
      ((eq? PLATFORM 'darwin) #f)
      (else
       (not have-tty?)))))
-- 
2.39.5