mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-14 07:40:07 +02:00
139 lines
3.3 KiB
Plaintext
139 lines
3.3 KiB
Plaintext
From 4ac7dd380f1bb5eac3def440024ffb74dc75cc6d Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Thu, 29 Jun 2017 17:06:55 +0200
|
|
Subject: import fix from previous version
|
|
|
|
|
|
diff --git a/cmdbuf.c b/cmdbuf.c
|
|
index ccca0c8..a025fef 100644
|
|
--- a/cmdbuf.c
|
|
+++ b/cmdbuf.c
|
|
@@ -1399,7 +1399,11 @@ mlist_size(ml)
|
|
static char *
|
|
histfile_name()
|
|
{
|
|
+#ifdef __HAIKU__
|
|
+ char home[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
|
|
+#else
|
|
char *home;
|
|
+#endif
|
|
char *name;
|
|
int len;
|
|
|
|
@@ -1417,6 +1421,13 @@ histfile_name()
|
|
if (strcmp(LESSHISTFILE, "") == 0 || strcmp(LESSHISTFILE, "-") == 0)
|
|
return (NULL);
|
|
|
|
+#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')
|
|
@@ -1427,6 +1438,7 @@ histfile_name()
|
|
#endif
|
|
return (NULL);
|
|
}
|
|
+#endif
|
|
len = (int) (strlen(home) + strlen(LESSHISTFILE) + 2);
|
|
name = (char *) ecalloc(len, sizeof(char));
|
|
SNPRINTF2(name, len, "%s/%s", home, LESSHISTFILE);
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 6dae556..60fc5de 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -610,11 +610,17 @@ AH_TOP([
|
|
* LESSHISTFILE is the filename of the history file
|
|
* (in the HOME directory).
|
|
*/
|
|
+#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 --git a/filename.c b/filename.c
|
|
index b70acd4..52a9b98 100644
|
|
--- a/filename.c
|
|
+++ b/filename.c
|
|
@@ -259,12 +259,23 @@ homefile(filename)
|
|
{
|
|
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 --git a/less.h b/less.h
|
|
index 85dbcf1..8234176 100644
|
|
--- a/less.h
|
|
+++ b/less.h
|
|
@@ -100,6 +100,11 @@
|
|
#include <floss.h>
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#include <StorageDefs.h>
|
|
+#endif
|
|
+
|
|
#if MSDOS_COMPILER==WIN32C || OS2
|
|
#include <io.h>
|
|
#endif
|
|
diff --git a/lesskey.c b/lesskey.c
|
|
index bb85017..056a1f5 100644
|
|
--- a/lesskey.c
|
|
+++ b/lesskey.c
|
|
@@ -250,8 +250,19 @@ homefile(filename)
|
|
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);
|
|
--
|
|
2.17.0
|
|
|