mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
* less: bump version, remove old version Fixes CVE-2022-46663 * less: use B_USER_VAR_DIRECTORY for the history file It now uses XDG_STATE_DIR by default, the find_directory based code path is only used as fallback instead of `~/.local/state` if that isn't defined. XDG_STATE_DIR is defined since hrev57631 and defaults to B_USER_VAR_DIRECTORY.
167 lines
4.5 KiB
Plaintext
167 lines
4.5 KiB
Plaintext
From 42981d3f93f7163f1b2f29c6931e74bc008e9285 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 c813283..dac4c98 100644
|
|
--- a/cmdbuf.c
|
|
+++ b/cmdbuf.c
|
|
@@ -1356,12 +1356,19 @@ static char * histfile_find(int 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 37dc496..f4d003b 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -582,9 +582,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 a8726dc..8efcccb 100644
|
|
--- a/filename.c
|
|
+++ b/filename.c
|
|
@@ -253,10 +253,21 @@ public char * homefile(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 2ba8c35..080daaf 100644
|
|
--- a/less.h
|
|
+++ b/less.h
|
|
@@ -111,6 +111,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 61311c7..14b6c2c 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
|
|
+
|
|
char fileheader[] = {
|
|
C0_LESSKEY_MAGIC,
|
|
C1_LESSKEY_MAGIC,
|
|
@@ -159,8 +164,19 @@ char * homefile(char *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.43.2
|
|
|
|
|
|
From 52be1da870e69f51ccd06b59683285381487bed3 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Joachim=20Mairb=C3=B6ck?= <j.mairboeck@gmail.com>
|
|
Date: Fri, 12 Apr 2024 16:35:13 +0200
|
|
Subject: gcc2 build fix
|
|
|
|
|
|
diff --git a/command.c b/command.c
|
|
index f5ee7ed..e38be19 100644
|
|
--- a/command.c
|
|
+++ b/command.c
|
|
@@ -713,6 +713,7 @@ static int mca_char(int c)
|
|
/* Incremental search: do a search after every input char. */
|
|
int st = (search_type & (SRCH_FORW|SRCH_BACK|SRCH_NO_MATCH|SRCH_NO_REGEX|SRCH_NO_MOVE|SRCH_WRAP|SRCH_SUBSEARCH_ALL));
|
|
char *pattern = get_cmdbuf();
|
|
+ int save_updown_match;
|
|
if (pattern == NULL)
|
|
return (MCA_MORE);
|
|
/*
|
|
@@ -720,7 +721,7 @@ static int mca_char(int c)
|
|
* reinits it. That breaks history scrolling.
|
|
* {{ This is ugly. mca_search probably shouldn't call set_mlist. }}
|
|
*/
|
|
- int save_updown_match = updown_match;
|
|
+ save_updown_match = updown_match;
|
|
cmd_exec();
|
|
if (*pattern == '\0')
|
|
{
|
|
--
|
|
2.43.2
|
|
|