From fc18ce32a741119f78108823fbcc0ec6012121c5 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Wed, 9 Oct 2013 16:04:04 -0600
Subject: Enhance Haiku support by tweaking paths and defining a HAIKU
 variable.


diff --git a/slsh/slsh.c b/slsh/slsh.c
index 9745543..18a599e 100644
--- a/slsh/slsh.c
+++ b/slsh/slsh.c
@@ -26,6 +26,10 @@ USA.
 # include <windows.h>
 # include <io.h>
 #endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
 
 #include <sys/stat.h>
 
@@ -52,7 +56,11 @@ static char *Slsh_Version = "0.8.6-0";
 # define SLSH_LIB_DIR_ENV "SLSH_LIB_DIR"
 #endif
 
-#if defined(REAL_UNIX_SYSTEM) || defined(__APPLE__)
+#if defined(__HAIKU__)
+/* # define DEFAULT_LIBRARY_PATH "/usr/local/share/slsh:/usr/local/lib/slsh:/usr/share/slsh:/usr/lib/slsh"; */
+# define DEFAULT_CONF_PATH "/boot/system/settings:/boot/home/config/settings";
+# define USER_SLSHRC "slsh.rc"
+#elif defined(REAL_UNIX_SYSTEM) || defined(__APPLE__)
 /* # define DEFAULT_LIBRARY_PATH "/usr/local/share/slsh:/usr/local/lib/slsh:/usr/share/slsh:/usr/lib/slsh"; */
 # define DEFAULT_CONF_PATH "/usr/local/etc:/usr/local/etc/slsh:/etc:/etc/slsh";
 # define USER_SLSHRC ".slshrc"
@@ -494,6 +502,9 @@ int main (int argc, char **argv)
    int test_mode = 0;
    char *exec_string = NULL;
    int quiet = 0;
+#if defined(__HAIKU__)
+   char buffer[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+#endif
 
    (void) SLutf8_enable (-1);
 
@@ -512,8 +523,13 @@ int main (int argc, char **argv)
 #endif
 
    /* FIXME for other systems */
-#ifdef __WIN32__
+#if defined(__WIN32__)
    init_file_dir = getenv ("USERPROFILE");
+#elif defined(__HAIKU__)
+   if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer)) != B_OK)
+     sprintf(buffer, "/boot/home/config/settings");
+
+   init_file_dir = &buffer;
 #else
    init_file_dir = getenv ("HOME");
 #endif
diff --git a/src/slstd.c b/src/slstd.c
index d86765e..f80295e 100644
--- a/src/slstd.c
+++ b/src/slstd.c
@@ -1279,6 +1279,9 @@ int SLang_init_slang (void) /*{{{*/
 #ifdef REAL_UNIX_SYSTEM
 	"UNIX",
 #endif
+#if defined(__HAIKU__)
+	"HAIKU",
+#endif
 #if SLANG_HAS_FLOAT
 	"SLANG_DOUBLE_TYPE",
 #endif
-- 
1.8.3.4


From 95a0248382ceb2d0248fa95379136a74bf998075 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Fri, 11 Oct 2013 00:32:22 -0600
Subject: Change location of some install paths


diff --git a/modules/Makefile.in b/modules/Makefile.in
index 0384359..9d84c93 100644
--- a/modules/Makefile.in
+++ b/modules/Makefile.in
@@ -63,7 +63,7 @@ INSTALL		= @INSTALL@
 INSTALL_DATA	= @INSTALL_DATA@
 INSTALL_MODULE	= @INSTALL_MODULE@
 MKINSDIR	= $(CONFIG_DIR)/autoconf/mkinsdir.sh
-SLSH_DIR	= $(prefix)/share/slsh
+SLSH_DIR	= @datarootdir@/slsh
 CMAPS_DIR	= $(SLSH_DIR)/cmaps
 HELP_DIR	= $(SLSH_DIR)/help
 #---------------------------------------------------------------------------
diff --git a/slsh/Makefile.in b/slsh/Makefile.in
index b71b9bc..be16ada 100644
--- a/slsh/Makefile.in
+++ b/slsh/Makefile.in
@@ -30,7 +30,7 @@ MKINSDIR	= $(CONFIG_DIR)/autoconf/mkinsdir.sh
 SLSH_CONF_DIR	= @sysconfdir@
 SLSH_LIB_DIR	= $(datarootdir)/slsh
 SLSH_HELP_DIR	= $(SLSH_LIB_DIR)/help
-SLSH_DOC_DIR	= $(datarootdir)/doc/slsh
+SLSH_DOC_DIR	= @docdir@/slsh
 SLSH_LOCALLIB_DIR = $(SLSH_LIB_DIR)/local-packages
 SLSH_SCRIPT_DIR	= $(SLSH_LIB_DIR)/scripts
 SCRIPTS		= jpegsize lsrpm sldb svnsh slprof slstkchk
diff --git a/src/Makefile.in b/src/Makefile.in
index 03fa056..fab1477 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -45,7 +45,7 @@ exec_prefix = @exec_prefix@
 install_lib_dir = @libdir@
 install_bin_dir = @bindir@
 install_include_dir = @includedir@
-install_doc_dir = $(prefix)/share/doc/slang/v@slang_major_version@
+install_doc_dir = @docdir@/slang/v@slang_major_version@
 DOC_FILES = ../changes.txt ../COPY* ../doc/slangdoc.html ../doc/text/*.txt
 MODULE_INSTALL_DIR = @libdir@/slang/v@slang_major_version@/modules
 #---------------------------------------------------------------------------
-- 
1.8.3.4

