cgmnlm

colorful gemini line mode browser
git clone https://git.clttr.info/cgmnlm.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit c9cabb467f939bdc0482ba50e1bef970de1bfce6
parent 1c641995e7b587dfa234a2311a47a8cb8b1c9857
Author: Ondřej Fiala <temp.xanomes@volny.cz>
Date:   Fri,  1 Jul 2022 05:51:00 +0200

gmnlm: don't assume everything starting with b/f is b/f command

It was impossible to enter a file:// URL because it got interpreted
as a 'f' command without any warning about invalid argument. The same
thing happened with relative addresses beginning with 'b' or 'f'.

Diffstat:
Msrc/gmnlm.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gmnlm.c b/src/gmnlm.c @@ -652,8 +652,11 @@ do_prompts(const char *prompt, struct browser *browser) result = PROMPT_ANSWERED; goto exit; case 'b': - if (in[1]) { + if (in[1] && isdigit(in[1])) { historyhops =(int)strtol(in+1, &endptr, 10); + if (endptr[0]) break; + } else if (in[1]) { + break; } while (historyhops > 0) { if (browser->history->prev) { @@ -665,8 +668,11 @@ do_prompts(const char *prompt, struct browser *browser) result = PROMPT_ANSWERED; goto exit; case 'f': - if (in[1]) { + if (in[1] && isdigit(in[1])) { historyhops =(int)strtol(in+1, &endptr, 10); + if (endptr[0]) break; + } else if (in[1]) { + break; } while (historyhops > 0) { if (browser->history->next) {