~sircmpwn/gmni-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH gmni] gmnlm: allow ~ as home alias in file:// URLs

Ondřej Fiala <temp.xanomes@volny.cz>
Details
Message ID
<20220702113513.18296-1-temp.xanomes@volny.cz>
DKIM signature
missing
Download raw message
Patch: +13 -0
---
 src/gmnlm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/gmnlm.c b/src/gmnlm.c
index 884796c..de5428f 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -425,6 +425,19 @@ do_requests(struct browser *browser, struct gemini_response *resp)
				break;
			}

			if (path[0] == '~') {
				char *home = getenv("HOME");
				int sz = strlen(home) + strlen(&path[1]) + 1;
				char *newpath = malloc(sz);
				if (!newpath) return GEMINI_ERR_OOM;

				int n = snprintf(newpath, sz, "%s%s",
						home, &path[1]);
				assert(n >= 0 && n < sz);
				free(path);
				path = newpath;
			}

			int fd = open(path, O_RDONLY);
			if (fd < 0) {
				resp->status = GEMINI_STATUS_NOT_FOUND;
-- 
2.36.1
Details
Message ID
<CL5ECUBH26J3.14SI72TC1XE3O@taiga>
In-Reply-To
<20220702113513.18296-1-temp.xanomes@volny.cz> (view parent)
DKIM signature
missing
Download raw message
I'd rather not do this one.
Reply to thread Export thread (mbox)