diff -urN less-451/cmdbuf.c less-451-haiku/cmdbuf.c
--- less-451/cmdbuf.c	2012-07-21 20:39:58.045088768 +0000
+++ less-451-haiku/cmdbuf.c	2012-09-06 18:17:44.432799744 +0000
@@ -1364,7 +1364,11 @@
 	static char *
 histfile_name()
 {
+#ifdef __HAIKU__
+	char home[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+#else
 	char *home;
+#endif
 	char *name;
 	int len;
 	
@@ -1378,6 +1382,13 @@
 		return (save(name));
 	}
 
+#ifdef __HAIKU__
+	{
+	dev_t volume = dev_for_path("/boot");
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, true, home, sizeof(home)) != B_OK)
+		return (NULL);
+	}
+#else
 	/* Otherwise, file is in $HOME. */
 	home = lgetenv("HOME");
 	if (home == NULL || *home == '\0')
@@ -1388,6 +1399,8 @@
 #endif
 			return (NULL);
 	}
+#endif
+
 	len = strlen(home) + strlen(LESSHISTFILE) + 2;
 	name = (char *) ecalloc(len, sizeof(char));
 	SNPRINTF2(name, len, "%s/%s", home, LESSHISTFILE);
diff -urN less-451/configure.ac less-451-haiku/configure.ac
--- less-451/configure.ac	2012-07-21 20:39:59.045613056 +0000
+++ less-451-haiku/configure.ac	2012-09-06 18:17:49.640942080 +0000
@@ -589,10 +589,17 @@
  * LESSHISTFILE is the filename of the history file
  * (in the HOME directory).
  */
-#define	LESSKEYFILE		".less"
-#define	LESSKEYFILE_SYS		SYSDIR "/sysless"
-#define	DEF_LESSKEYINFILE	".lesskey"
-#define LESSHISTFILE		".lesshst"
+#ifdef __HAIKU__
+# define	LESSKEYFILE		"less"
+# define	LESSKEYFILE_SYS		SYSDIR "/sysless"
+# define	DEF_LESSKEYINFILE	"lesskey"
+# define LESSHISTFILE		"lesshst"
+#else
+# define	LESSKEYFILE		".less"
+# define	LESSKEYFILE_SYS		SYSDIR "/sysless"
+# define	DEF_LESSKEYINFILE	".lesskey"
+# define LESSHISTFILE		".lesshst"
+#endif
 
 
 /* Settings always true on Unix.  */
diff -urN less-451/filename.c less-451-haiku/filename.c
--- less-451/filename.c	2012-07-21 20:39:58.046923776 +0000
+++ less-451-haiku/filename.c	2012-09-06 18:17:53.399507456 +0000
@@ -266,12 +266,23 @@
 {
 	register char *pathname;
 
+#ifdef __HAIKU__
+	char path[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+	dev_t volume = dev_for_path("/boot");
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, true, path, sizeof(path)) != B_OK)
+		return (NULL);
+
+	pathname = dirfile(&path, filename);
+	if (pathname != NULL)
+		return (pathname);
+#else
 	/*
 	 * Try $HOME/filename.
 	 */
 	pathname = dirfile(lgetenv("HOME"), filename);
 	if (pathname != NULL)
 		return (pathname);
+#endif
 #if OS2
 	/*
 	 * Try $INIT/filename.
diff -urN less-451/less.h less-451-haiku/less.h
--- less-451/less.h	2012-07-21 20:39:59.047972352 +0000
+++ less-451-haiku/less.h	2012-09-06 18:17:57.216268800 +0000
@@ -93,6 +93,11 @@
 #include <floss.h>
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
+
 #if MSDOS_COMPILER==WIN32C || OS2
 #include <io.h>
 #endif
diff -urN less-451/lesskey.c less-451-haiku/lesskey.c
--- less-451/lesskey.c	2012-07-21 20:39:59.049020928 +0000
+++ less-451-haiku/lesskey.c	2012-09-06 18:18:06.898891776 +0000
@@ -245,8 +245,19 @@
 	char *p;
 	char *pathname;
 
+#ifdef __HAIKU__
+	char path[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+	dev_t volume = dev_for_path("/boot");
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, true, path, sizeof(path)) != B_OK)
+		return (NULL);
+
+	pathname = mkpathname(&path, filename);
+	if (pathname != NULL)
+		return (pathname);
+#else
 	if ((p = getenv("HOME")) != NULL && *p != '\0')
 		pathname = mkpathname(p, filename);
+#endif
 #if OS2
 	else if ((p = getenv("INIT")) != NULL && *p != '\0')
 		pathname = mkpathname(p, filename);
