Files
haikuports/app-shells/hstr/patches/hstr-3.1.patchset
OscarL 1cbf3289fa hstr: cleanup recipe, update to version 3.1 (#8683)
Notice: people updating from 2.x versions will need to update their
bash settings on the "~/config/settings/profile" according to the
instructions given by `hstr -B`.

Users of zsh, should follow `hstr -Z` instead.
2023-05-19 12:50:22 +02:00

220 lines
7.1 KiB
Plaintext

From 5e9675b56ed17d9af698dc7d3b8c1c8ce50aa23c Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Sun, 9 Oct 2022 18:19:00 -0300
Subject: Adjust location of history files.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Idea taken from the previous v2.0 patch by Zoltán Mizsei.
diff --git a/src/include/hstr_history.h b/src/include/hstr_history.h
index 4138767..a371690 100644
--- a/src/include/hstr_history.h
+++ b/src/include/hstr_history.h
@@ -32,9 +32,15 @@
#define ENV_VAR_HISTFILE "HISTFILE"
-#define FILE_DEFAULT_HISTORY ".bash_history"
-#define FILE_ZSH_HISTORY ".zsh_history"
-#define FILE_ZSH_ZHISTORY ".zhistory"
+#ifndef __HAIKU__
+ #define FILE_DEFAULT_HISTORY ".bash_history"
+ #define FILE_ZSH_HISTORY ".zsh_history"
+ #define FILE_ZSH_ZHISTORY ".zhistory"
+#else
+ #define FILE_DEFAULT_HISTORY "bash_history"
+ #define FILE_ZSH_HISTORY "zsh/.zsh_history"
+ #define FILE_ZSH_ZHISTORY "zsh/.zhistory"
+#endif
#define ZSH_HISTORY_EXT_DIGITS 10
--
2.37.3
From 6fc57f2e0b533c5e7748087ee23e472541aa4b3b Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Thu, 18 May 2023 09:43:01 -0300
Subject: Avoid attempting to use hardlinks
Those do not work on BFS, and also, we don't want /bin/hh anyway.
diff --git a/src/Makefile.am b/src/Makefile.am
index 7640d21..8f4fca0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,7 @@ hstr_SOURCES = \
main.c
# create hstr > hh hard link on installation
-install-exec-hook:
- ln $(DESTDIR)$(bindir)/hstr$(EXEEXT) $(DESTDIR)$(bindir)/hh$(EXEEXT)
+#install-exec-hook:
+# ln $(DESTDIR)$(bindir)/hstr$(EXEEXT) $(DESTDIR)$(bindir)/hh$(EXEEXT)
hstr_LDADD = $(NCURSES_LIBS)
--
2.37.3
From e351504aa39d571a81ba56be8737b11924b1d36a Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Thu, 18 May 2023 09:49:28 -0300
Subject: Fix #include for ncurses.h
diff --git a/src/include/hstr.h b/src/include/hstr.h
index 25383d8..a5b73c9 100644
--- a/src/include/hstr.h
+++ b/src/include/hstr.h
@@ -23,7 +23,7 @@
#include <locale.h>
#ifdef __APPLE__
#include <curses.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__HAIKU__)
#include <ncurses.h>
#else
#include <ncursesw/curses.h>
diff --git a/src/include/hstr_curses.h b/src/include/hstr_curses.h
index 5544c23..991b7aa 100644
--- a/src/include/hstr_curses.h
+++ b/src/include/hstr_curses.h
@@ -21,7 +21,7 @@
#ifdef __APPLE__
#include <curses.h>
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__HAIKU__)
#include <ncurses.h>
#else
#include <ncursesw/curses.h>
--
2.37.3
From e5546476e97643c0219f4ce8c07be1954a15891f Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Thu, 18 May 2023 09:52:53 -0300
Subject: Fix settings paths
diff --git a/src/hstr_utils.c b/src/hstr_utils.c
index c37f3ed..a5eca60 100644
--- a/src/hstr_utils.c
+++ b/src/hstr_utils.c
@@ -208,7 +208,11 @@ char* get_home_file_path(char* filename)
{
char* home = getenv(ENV_VAR_HOME);
char* path = malloc(strlen(home) + 1 + strlen(filename) + 1);
+#ifndef __HAIKU__
strcat(strcat(strcpy(path, home), "/"), filename);
+#else
+ strcat(strcat(strcpy(path, home), "/config/settings/"), filename);
+#endif
return path;
}
--
2.37.3
From bc8538bd8a56145cbc430169906a39da09b8465c Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Thu, 18 May 2023 09:58:08 -0300
Subject: No TIOCSTI in Haiku.
diff --git a/src/hstr_utils.c b/src/hstr_utils.c
index a5eca60..48a1d76 100644
--- a/src/hstr_utils.c
+++ b/src/hstr_utils.c
@@ -113,7 +113,7 @@ void hstr_chop(char *s)
bool is_tiocsti_supported(void)
{
-#if defined(__MS_WSL__) || defined(__CYGWIN__)
+#if defined(__MS_WSL__) || defined(__CYGWIN__) || defined(__HAIKU__)
return false;
#else
int fd;
@@ -143,7 +143,7 @@ bool is_tiocsti_supported(void)
#endif
}
-#if !defined(__MS_WSL__) && !defined(__CYGWIN__)
+#if !defined(__MS_WSL__) && !defined(__CYGWIN__) && !defined(__HAIKU__)
void tiocsti(void)
{
char buf[] = DEFAULT_COMMAND;
@@ -167,7 +167,9 @@ void fill_terminal_input(char* cmd, bool padding)
for (i = 0; i < size; i++) {
// terminal I/O control, simulate terminal input
c=(cmd+i);
+#if !defined(__MS_WSL__) && !defined(__CYGWIN__) && !defined(__HAIKU__)
ioctl(0, TIOCSTI, c);
+#endif
}
// echo, but don't flush to terminal
if(padding) printf("\n");
--
2.37.3
From c6f4bf663aaa3a593ee03a71d0146c65489ee774 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 19 May 2023 05:59:14 -0300
Subject: Fix up help text for Haiku.
diff --git a/src/hstr.c b/src/hstr.c
index 8183031..38bbcaf 100644
--- a/src/hstr.c
+++ b/src/hstr.c
@@ -158,7 +158,11 @@ static const char* HSTR_CASE_LABELS[]={
};
static const char* INSTALL_BASH_CODE_PREFIX=
+#if defined(__HAIKU__)
+ "\n# HSTR configuration - add this to ~/config/settings/profile"
+#else
"\n# HSTR configuration - add this to ~/.bashrc"
+#endif
"\nalias hh=hstr # hh to be alias for hstr"
"\nexport HSTR_CONFIG=hicolor # get more colors"
"\nshopt -s histappend # append new history items to .bash_history"
@@ -180,7 +184,11 @@ static const char* INSTALL_BASH_CODE_PREFIX=
// zsh doc: http://zsh.sourceforge.net/Guide/zshguide.html
static const char* INSTALL_ZSH_CODE_PREFIX=
+#if defined(__HAIKU__)
+ "\n# HSTR configuration - add this to ~/config/settings/zsh/.zshrc"
+#else
"\n# HSTR configuration - add this to ~/.zshrc"
+#endif
"\nalias hh=hstr # hh to be alias for hstr"
"\nsetopt histignorespace # skip cmds w/ leading space from history"
// HISTFILE should not be needed - HSTR must work on blank environment as well
@@ -194,9 +202,15 @@ static const char* HELP_STRING=
"\n --favorites -f ... show favorites view"
"\n --kill-last-command -k ... delete last command in history"
"\n --non-interactive -n ... print filtered history and exit"
+#if defined(__HAIKU__)
+ "\n --show-configuration -s ... show configuration to be added to ~/config/settings/profile"
+ "\n --show-bash-configuration -B ... show bash configuration to be added to ~/config/settings/profile"
+ "\n --show-zsh-configuration -z ... show zsh configuration to be added to ~/config/settings/zsh/.zshrc"
+#else
"\n --show-configuration -s ... show configuration to be added to ~/.bashrc"
"\n --show-bash-configuration -B ... show bash configuration to be added to ~/.bashrc"
"\n --show-zsh-configuration -Z ... show zsh configuration to be added to ~/.zshrc"
+#endif
"\n --show-blacklist -b ... show commands to skip on history indexation"
"\n --is-tiocsti -t ... detect whether TIOCSTI is supported and print y or n"
"\n --insert-in-terminal=[c] -i ... insert command c in terminal prompt and exit"
--
2.37.3