Show correct (gopher) URLs for menuentries pointing to HTML files. - sacc - sacc(omys), simple console gopher client
HTML git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR LICENSE
---
DIR commit 4fe03eaa05536aac1704b92c0267fb099125a3a3
DIR parent d70616c357a135b8e251fe1974cf88f529dbc67f
HTML Author: Julian Schweinsberg <pazz0@0xfa.de>
Date: Sun, 28 Jan 2024 15:25:55 +0100
Show correct (gopher) URLs for menuentries pointing to HTML files.
Only the 'h'tml links providing an external URI (prefixed with "URL:")
should be printed directly.
Otherwise print the link like any other gopher link.
Example for a menu pointing to HTML files in the real world:
gopher://gopher.metafilter.com/1/MetaFilter
Diffstat:
M sacc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
DIR diff --git a/sacc.c b/sacc.c
@@ -305,10 +305,11 @@ itemuri(Item *item, char *buf, size_t bsz)
n = snprintf(buf, bsz, "tn3270://%s@%s:%s",
item->selector, item->host, item->port);
break;
- case 'h':
- n = snprintf(buf, bsz, "%s", item->selector +
- (strncmp(item->selector, "URL:", 4) ? 0 : 4));
- break;
+ case 'h': /* fallthrough */
+ if (!strncmp(item->selector, "URL:", 4)) {
+ n = snprintf(buf, bsz, "%s", item->selector+4);
+ break;
+ }
default:
n = snprintf(buf, bsz, "gopher://%s", item->host);