]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/kpath.cc
release commit
[lilypond.git] / lily / kpath.cc
index 0e39e0c1ff8c60227c9c22cb9cb55db8f711a808..a8a521143789d35e04ce4615858d1d81205b57bd 100644 (file)
@@ -3,16 +3,29 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include <stdio.h>
 #include <string.h>
 
+/*
+
+The problem, as far as I can tell, is that MacOS X has its getopt
+prototype in <unistd.h>, while I think other operating systems have it
+in other places. <unistd.h> is included by kpathsea.h, so you end up
+renaming both conflicting prototypes to YAKLUDGE.
+
+I found a somewhat more elegant patch for this: Just #include
+<unistd.h> before defining YAKLUDGE.
+
+*/
+#include <unistd.h>    
 #include "config.h"
 
 #define popen REALLYUGLYKLUDGE
 #define pclose ANOTHERREALLYUGLYKLUDGE
+#define getopt YAKLUDGE
 
 #if HAVE_KPATHSEA_KPATHSEA_H
 extern "C" {
@@ -25,16 +38,27 @@ extern "C" {
 #include "string.hh"
 #include "main.hh"
 #include "kpath.hh"
-#include "lily-version.hh"
-
+#include "warn.hh"
 
-char *
+String
 ly_find_afm (char const * name)
 {
 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
-  return kpse_find_file (name, kpse_afm_format, true);
+  char * name_ptr =  kpse_find_file (name, kpse_afm_format, true);
+
+  if(!name_ptr)
+    {
+  /*
+    don't mutter about afms, since we try to find them first, and lots of
+    TFMs don't have AFMs. 
+   */
+      //      warning (_f("kpathsea couldn't find AFM file `%s'", name));
+    }
+  else
+    return name_ptr;
+  
 #endif
-  return 0;
+  return "";
 }
 
 String
@@ -42,11 +66,18 @@ ly_find_tfm (char const * name)
 {
   String p = global_path.find (String (name) + ".tfm");
 
-  if (p.length_i ())
+  if (p.length ())
     return p;
   
 #if (KPATHSEA && HAVE_KPSE_FIND_FILE)
-  return kpse_find_file (name, kpse_tfm_format, true);
+  char * name_ptr =  kpse_find_file (name, kpse_tfm_format, true);
+  if(!name_ptr)
+    {
+      warning (_f("Kpathsea couldn't find TFM file `%s'", name));
+    }
+  else
+    return name_ptr;
+  
 #endif
   return "";
 }