Files
haikuports/sys-apps/less/patches/less-668.patchset
2024-12-01 19:25:26 +01:00

229 lines
6.6 KiB
Plaintext

From 75eebdefd18dfb1c8c962fd51bfb12e9f241fc78 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
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Joachim Mairböck <j.mairboeck@gmail.com>
diff --git a/cmdbuf.c b/cmdbuf.c
index 73dd297..027f261 100644
--- a/cmdbuf.c
+++ b/cmdbuf.c
@@ -1373,12 +1373,19 @@ static char * histfile_find(lbool must_exist)
name = dirfile(lgetenv("XDG_STATE_HOME"), &LESSHISTFILE[1], must_exist);
if (name == NULL)
{
+#ifdef __HAIKU__
+ char dir[B_PATH_NAME_LENGTH+B_FILE_NAME_LENGTH];
+ dev_t volume = dev_for_path("/boot");
+ if (find_directory(B_USER_VAR_DIRECTORY, volume, true, dir, sizeof(dir)) == B_OK)
+ name = dirfile(dir, &LESSHISTFILE[1], must_exist);
+#else
char *dir = dirfile(home, ".local/state", 1);
if (dir != NULL)
{
name = dirfile(dir, &LESSHISTFILE[1], must_exist);
free(dir);
}
+#endif
}
if (name == NULL)
name = dirfile(lgetenv("XDG_DATA_HOME"), &LESSHISTFILE[1], must_exist);
diff --git a/configure.ac b/configure.ac
index 4c14de0..48474dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -581,9 +581,15 @@ 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"
+#else
#define LESSKEYFILE ".less"
#define LESSKEYFILE_SYS SYSDIR "/sysless"
#define DEF_LESSKEYINFILE ".lesskey"
+#endif
#define LESSKEYINFILE_SYS SYSDIR "/syslesskey"
#define LESSHISTFILE ".lesshst"
diff --git a/filename.c b/filename.c
index 219eac7..014179a 100644
--- a/filename.c
+++ b/filename.c
@@ -278,10 +278,21 @@ public char * homefile(constant char *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, 1);
+ if (pathname != NULL)
+ return (pathname);
+#else
/* Try $HOME/filename. */
pathname = dirfile(lgetenv("HOME"), filename, 1);
if (pathname != NULL)
return (pathname);
+#endif
#if OS2
/* Try $INIT/filename. */
pathname = dirfile(lgetenv("INIT"), filename, 1);
diff --git a/less.h b/less.h
index cc63951..7e22f41 100644
--- a/less.h
+++ b/less.h
@@ -104,6 +104,11 @@ typedef unsigned long uintmax;
#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 7f92522..502cdc9 100644
--- a/lesskey.c
+++ b/lesskey.c
@@ -87,6 +87,11 @@
#include "lesskey.h"
#include "cmd.h"
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
+
constant char fileheader[] = {
C0_LESSKEY_MAGIC,
C1_LESSKEY_MAGIC,
@@ -159,8 +164,19 @@ char * homefile(constant char *filename)
constant 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.45.2
From d8c946c33d05e9cc3ef439b8a436f5d7ce5ccf2b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Sun, 1 Dec 2024 19:24:35 +0100
Subject: gcc2 build fix
diff --git a/decode.c b/decode.c
index 71b7118..bc80d54 100644
--- a/decode.c
+++ b/decode.c
@@ -1004,9 +1004,10 @@ public int lesskey(constant char *filename, lbool sysvar)
static int lesskey_text(constant char *filename, lbool sysvar, lbool content)
{
static struct lesskey_tables tables;
+ int r;
if (!secure_allow(SF_LESSKEY))
return (1);
- int r = content ? parse_lesskey_content(filename, &tables) : parse_lesskey(filename, &tables);
+ r = content ? parse_lesskey_content(filename, &tables) : parse_lesskey(filename, &tables);
if (r != 0)
return (r);
add_fcmd_table(tables.cmdtable.buf.data, tables.cmdtable.buf.end);
@@ -1080,8 +1081,8 @@ static int add_hometable(int (*call_lesskey)(constant char *, lbool), constant c
*/
static void add_content_table(int (*call_lesskey)(constant char *, lbool), constant char *envname, lbool sysvar)
{
- (void) call_lesskey; /* not used */
constant char *content = lgetenv(envname);
+ (void) call_lesskey; /* not used */
if (isnullenv(content))
return;
lesskey_content(content, sysvar);
diff --git a/forwback.c b/forwback.c
index b0efc47..06bdebb 100644
--- a/forwback.c
+++ b/forwback.c
@@ -53,11 +53,13 @@ public void eof_bell(void)
if (no_eof_bell)
return;
#if HAVE_TIME
+{
static time_type last_eof_bell = 0;
time_type now = get_time();
if (now == last_eof_bell) /* max once per second */
return;
last_eof_bell = now;
+}
#endif
if (quiet == NOT_QUIET)
bell();
diff --git a/line.c b/line.c
index 6506c05..48f18be 100644
--- a/line.c
+++ b/line.c
@@ -1371,9 +1371,11 @@ static void col_vs_pos(POSITION linepos, mutable struct col_pos *cp, POSITION sa
utf8_buf[utf8_len++] = ch;
if (is_utf8_well_formed(utf8_buf, utf8_len))
{
- LWCHAR wch = get_wchar(utf8_buf);
+ int attr;
+ LWCHAR wch;
utf8_len = 0;
- int attr = 0; /* {{ ignoring attribute is not correct for magic cookie terminals }} */
+ attr = 0; /* {{ ignoring attribute is not correct for magic cookie terminals }} */
+ wch = get_wchar(utf8_buf);
if (utf_mode && ctldisp != OPT_ON && is_ubin_char(wch))
cw = strlen(prutfchar(wch));
else
diff --git a/search.c b/search.c
index a8142ea..de66ced 100644
--- a/search.c
+++ b/search.c
@@ -1264,12 +1264,14 @@ struct osc8_parse_info {
static lbool osc8_parse(constant char *line, constant char *line_end, struct osc8_parse_info *pop)
{
constant char *oline;
+ LWCHAR ch;
+ struct ansi_state *pansi;
pop->osc8_start = pop->osc8_end = pop->uri_start = pop->uri_end = pop->params_start = pop->params_end = NULL;
oline = line;
- LWCHAR ch = step_charc(&line, +1, line_end);
+ ch = step_charc(&line, +1, line_end);
/* oline points to character ch, line points to the one after it. */
- struct ansi_state *pansi = ansi_start(ch);
+ pansi = ansi_start(ch);
if (pansi == NULL)
return FALSE;
pop->osc8_start = oline; /* start at the ESC */
--
2.45.2