commit - 2116f17d9692b4032c4a2534c4831f92a31f671e
commit + cfcbc23cf9c18cbc9964064ce954c05cde9fd473
blob - 16164f693136252d6151264291d8d25ef904d201
blob + d53931d48251bd4b83a7661aa43b4c46bc269a77
--- defaults.c
+++ defaults.c
#include "ui.h"
#include "utils.h"
+char *default_protocol = NULL;
char *download_path = NULL;
char *new_tab_url = NULL;
int
config_setvars(const char *var, char *val)
{
+ if (!strcmp(var, "default-protocol")) {
+ if (strcmp(val, "finger") &&
+ strcmp(val, "gopher") &&
+ strcmp(val, "gemini"))
+ return 0;
+
+ free(default_protocol);
+ default_protocol = val;
+ return 1;
+ }
+
if (!strcmp(var, "download-path")) {
const char *prfx = "", *v = val, *sufx = "";
blob - b52d550568e8735f56e4da0206d63aeb4628fbf7
blob + 2a9d1be7b0c7a7f2c3038fe66a2255b334104d45
--- include/defaults.h
+++ include/defaults.h
#ifndef DEFAULTS_H
#define DEFAULTS_H
+extern char *default_protocol;
extern char *download_path;
extern char *new_tab_url;
blob - 8d79a25e8a2df4bcf37a5f0eb7728f3a4fb2ebf3
blob + 2f8dab0975bc6a59cb9fd0f76a534bfac41771c6
--- telescope.1
+++ telescope.1
.Dq /
assume it's a file:// URL,
.It
-otherwise assume it's a Gemini URL.
+otherwise treat it like a hostname with protocol
+.Ic default-protocol
+.Pq gemini by default .
.El
.Pp
The setting
seconds after some events happens
.Pq new or closed tabs, visited a link ...
Defaults to 20.
+.It Ic default-protocol
+.Pq string
+The default protocol assumed for the
+.Ic load-url
+heuristic.
+Defaults to
+.Dq gemini .
.It Ic dont-wrap-pre
.Pq boolean
If true, don't wrap preformatted blocks.
blob - f0d7a2e2ae0487414997c8675a685974b6c111eb
blob + c91a22e859b1ba5cbb259e68f8bf65a421e70b07
--- telescope.c
+++ telescope.c
*
* - if it's a proper url use it
* - if it starts with a `./' or a `/' assume its a file:// url
- * - assume it's a gemini:// url
+ * - assume it's a default-protocol:// url
*
* `ret' (of which len is the size) will be filled with the resulting
* url.
return;
}
- strlcpy(ret, "gemini://", len);
+ strlcpy(ret, default_protocol, len);
+ strlcat(ret, "://", len);
strlcat(ret, raw, len);
}
exit(0);
}
+ if (default_protocol == NULL &&
+ (default_protocol = strdup("gemini")) == NULL)
+ err(1, "strdup");
+
if (download_path == NULL &&
(download_path = strdup("/tmp/")) == NULL)
errx(1, "strdup");