From fc34ba2596c989a815578a7cdae74efaa7d0152a Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Sun, 4 Jun 2023 02:57:17 -0700 Subject: [PATCH] Fix Linenoise REPL on AARCH64 --- third_party/linenoise/linenoise.c | 12 ++++++------ tool/net/redbean.c | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/third_party/linenoise/linenoise.c b/third_party/linenoise/linenoise.c index 62ef23258..60a66e5dc 100644 --- a/third_party/linenoise/linenoise.c +++ b/third_party/linenoise/linenoise.c @@ -126,6 +126,7 @@ │ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. │ │ │ ╚─────────────────────────────────────────────────────────────────────────────*/ +#include "third_party/linenoise/linenoise.h" #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/calls/sig.internal.h" @@ -169,7 +170,6 @@ #include "libc/sysv/consts/termios.h" #include "libc/sysv/errfuns.h" #include "net/http/escape.h" -#include "third_party/linenoise/linenoise.h" #include "tool/build/lib/case.h" asm(".ident\t\"\\n\\n\ @@ -290,11 +290,11 @@ static const char *const kUnsupported[] = {"dumb", "cons25", "emacs"}; static int gotint; static int gotcont; static int gotwinch; -static char rawmode = -1; static char maskmode; static char ispaused; static char iscapital; static int historylen; +static signed char rawmode = -1; static struct linenoiseRing ring; static struct sigaction orig_int; static struct sigaction orig_quit; @@ -2175,11 +2175,11 @@ ssize_t linenoiseEdit(struct linenoiseState *l, const char *prompt, char **obuf, default: break; } - } else if (rc == 6 && seq[2] == '1' && - seq[3] == ';' && seq[4] == '5') { + } else if (rc == 6 && seq[2] == '1' && seq[3] == ';' && + seq[4] == '5') { switch (seq[5]) { - CASE('C', linenoiseEditRightWord(l)); // \e[1;5C ctrl-right - CASE('D', linenoiseEditLeftWord(l)); // \e[1;5D ctrl-left + CASE('C', linenoiseEditRightWord(l)); // \e[1;5C ctrl-right + CASE('D', linenoiseEditLeftWord(l)); // \e[1;5D ctrl-left default: break; } diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 7df38b32a..96b5d741a 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -7490,6 +7490,9 @@ void RedBean(int argc, char *argv[]) { } int main(int argc, char *argv[]) { +#if !IsTiny() && !defined(__x86_64__) + ShowCrashReports(); +#endif LoadZipArgs(&argc, &argv); RedBean(argc, argv);