commit - d94e08d2b84e5778f1a3bc652bf3124be5045f43
commit + cd1d043db84e31534151a1db0dd47b5a1f201b5e
blob - 58d6c642693c427083581c59d3ad6b38bcc497d1
blob + 7dea5c7de8a8ec4bc564380c08853cc03075e62d
--- include/telescope.h
+++ include/telescope.h
#define LU_MODE_NOCACHE 0x2
void gopher_send_search_req(struct tab *, const char *);
-int load_page_from_str(struct tab *, const char *);
+void load_page_from_str(struct tab *, const char *);
void load_url(struct tab *, const char *, const char *, int);
void load_url_in_tab(struct tab *, const char *, const char *, int);
int load_previous_page(struct tab*);
blob - 015d9d5ecfe02cdc7d6e3ce56d92805b1230b7c1
blob + 0bf49634d468dd6eb008148ae72b1eca5550f80c
--- telescope.c
+++ telescope.c
static void handle_imsg_buf(struct imsg *, size_t);
static void handle_imsg_eof(struct imsg *, size_t);
static void handle_dispatch_imsg(int, short, void *);
-static int load_about_url(struct tab *, const char *);
-static int load_file_url(struct tab *, const char *);
-static int load_finger_url(struct tab *, const char *);
-static int load_gemini_url(struct tab *, const char *);
-static int load_gopher_url(struct tab *, const char *);
-static int load_via_proxy(struct tab *, const char *,
- struct proxy *);
-static int make_request(struct tab *, struct get_req *, int,
+static void load_about_url(struct tab *, const char *);
+static void load_file_url(struct tab *, const char *);
+static void load_finger_url(struct tab *, const char *);
+static void load_gemini_url(struct tab *, const char *);
+static void load_gopher_url(struct tab *, const char *);
+static void load_via_proxy(struct tab *, const char *,
+ struct proxy *);
+static void make_request(struct tab *, struct get_req *, int,
const char *);
-static int do_load_url(struct tab *, const char *, const char *, int);
+static void do_load_url(struct tab *, const char *, const char *, int);
static pid_t start_child(enum telescope_process, const char *, int);
static void send_url(const char *);
static const struct proto {
const char *schema;
const char *port;
- int (*loadfn)(struct tab *, const char *);
+ void (*loadfn)(struct tab *, const char *);
} protos[] = {
{"about", NULL, load_about_url},
{"file", NULL, load_file_url},
err(1, "connection closed");
}
-static int
+static void
load_about_url(struct tab *tab, const char *url)
{
tab->trust = TS_TRUSTED;
fs_load_url(tab, url);
ui_on_tab_refresh(tab);
ui_on_tab_loaded(tab);
- return 0;
}
-static int
+static void
load_file_url(struct tab *tab, const char *url)
{
tab->trust = TS_TRUSTED;
fs_load_url(tab, url);
ui_on_tab_refresh(tab);
ui_on_tab_loaded(tab);
- return 0;
}
-static int
+static void
load_finger_url(struct tab *tab, const char *url)
{
struct get_req req;
strlcat(req.req, "\r\n", sizeof(req.req));
parser_init(tab, textplain_initparser);
- return make_request(tab, &req, PROTO_FINGER, NULL);
+ make_request(tab, &req, PROTO_FINGER, NULL);
}
-static int
+static void
load_gemini_url(struct tab *tab, const char *url)
{
struct get_req req;
strlcpy(req.host, tab->uri.host, sizeof(req.host));
strlcpy(req.port, tab->uri.port, sizeof(req.port));
- return make_request(tab, &req, PROTO_GEMINI, tab->hist_cur->h);
+ make_request(tab, &req, PROTO_GEMINI, tab->hist_cur->h);
}
static inline const char *
return ++path;
}
-static int
+static void
load_gopher_url(struct tab *tab, const char *url)
{
struct get_req req;
if (tab->last_input_url == NULL)
die();
ui_require_input(tab, 0, ir_select_gopher);
- return load_page_from_str(tab, err_pages[10]);
+ load_page_from_str(tab, err_pages[10]);
+ return;
default:
- return load_page_from_str(tab, "Unknown gopher selector");
+ load_page_from_str(tab, "Unknown gopher selector");
+ return;
}
strlcpy(req.req, path, sizeof(req.req));
}
strlcat(req.req, "\r\n", sizeof(req.req));
- return make_request(tab, &req, PROTO_GOPHER, NULL);
+ make_request(tab, &req, PROTO_GOPHER, NULL);
}
-static int
+static void
load_via_proxy(struct tab *tab, const char *url, struct proxy *p)
{
struct get_req req;
tab->proxy = p;
- return make_request(tab, &req, p->proto, tab->hist_cur->h);
+ make_request(tab, &req, p->proto, tab->hist_cur->h);
}
-static int
+static void
make_request(struct tab *tab, struct get_req *req, int proto, const char *r)
{
stop_tab(tab);
start_loading_anim(tab);
ui_send_net(IMSG_GET, tab->id, req, sizeof(*req));
-
- /*
- * So the various load_*_url can `return make_request` and
- * do_load_url is happy.
- */
- return 1;
}
void
make_request(tab, &req, PROTO_GOPHER, NULL);
}
-int
+void
load_page_from_str(struct tab *tab, const char *page)
{
parser_init(tab, gemtext_initparser);
abort();
ui_on_tab_refresh(tab);
ui_on_tab_loaded(tab);
- return 0;
}
/*
- * Effectively load the given url in the given tab. Return 1 when
- * loading the page asynchronously, and thus when an erase_buffer can
- * be done right after this function return, or 0 when loading the
- * page synchronously.
+ * Effectively load the given url in the given tab.
*/
-static int
+static void
do_load_url(struct tab *tab, const char *url, const char *base, int mode)
{
const struct proto *p;
strlcpy(tab->hist_cur->h, url, sizeof(tab->hist_cur->h));
load_page_from_str(tab, t);
free(t);
- return 0;
+ return;
}
phos_serialize_uri(&tab->uri, tab->hist_cur->h,
if (!nocache && mcache_lookup(tab->hist_cur->h, tab)) {
ui_on_tab_refresh(tab);
ui_on_tab_loaded(tab);
- return 0;
+ return;
}
for (p = protos; p->schema != NULL; ++p) {
strlcpy(tab->uri.port, p->port,
sizeof(tab->uri.port));
- return p->loadfn(tab, tab->hist_cur->h);
+ p->loadfn(tab, tab->hist_cur->h);
+ return;
}
}
TAILQ_FOREACH(proxy, &proxies, proxies) {
- if (!strcmp(tab->uri.scheme, proxy->match_proto))
- return load_via_proxy(tab, url, proxy);
+ if (!strcmp(tab->uri.scheme, proxy->match_proto)) {
+ load_via_proxy(tab, url, proxy);
+ return;
+ }
}
- return load_page_from_str(tab, err_pages[UNKNOWN_PROTOCOL]);
+ load_page_from_str(tab, err_pages[UNKNOWN_PROTOCOL]);
}
/*