diff --git a/configure b/configure
index 151bdae8c12d9ad07d3a5240d7c554f4c62664c8..7412cf545fa96e6be169c0055778b83a06b557f5 100755
--- a/configure
+++ b/configure
@@ -16,7 +16,8 @@ src/client.c \
src/escape.c \
src/gmnlm.c \
src/parser.c \
src/url.c
src/url.c \
src/util.c
}
all="gmni gmnlm"
diff --git a/include/util.h b/include/util.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf731bfdc75a750df6f18873f48dd859786587c7
--- /dev/null
+++ b/include/util.h
@@ -0,0 +1,12 @@
+#ifndef GEMINI_UTIL_H
+#define GEMINI_UTIL_H
+struct pathspec {
+};
+char *getpath(const struct pathspec *paths, size_t npaths);
+int mkdirs(char *path, mode_t mode);
+#endif
diff --git a/src/gmnlm.c b/src/gmnlm.c
index 4b844200eeb4318d694566d7a84eb3e64c7c7668..c5d5da36ffad8772315928e8a69b785d994511e4 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -12,6 +12,7 @@ #include <termios.h>
#include <unistd.h>
#include "gmni.h"
#include "url.h"
+#include "util.h"
struct link {
char *url;
@@ -29,6 +30,7 @@ struct gemini_options opts;
FILE *tty;
char *plain_url;
struct Curl_URL *url;
struct link *links;
struct history *history;
@@ -52,6 +54,8 @@ "q\tQuit\n"
"N\tFollow Nth link (where N is a number)\n"
"b\tBack (in the page history)\n"
"f\tForward (in the page history)\n"
"\n"
"Other commands include:\n\n"
"<Enter>\tread more lines\n"
@@ -98,6 +102,63 @@ }
return true;
}
+static char *
+get_data_pathfmt()
+{
{.var = "GMNIDATA", .path = "/%s"},
{.var = "XDG_DATA_HOME", .path = "/gmni/%s"},
{.var = "HOME", .path = "/.local/share/gmni/%s"}
+}
+static char *
+trim_ws(char *in)
+{
+}
+static void
+save_bookmark(struct browser *browser)
+{
fprintf(stderr, "Error opening %s for writing: %s\n",
path, strerror(errno));
return;
title = trim_ws(browser->page_title);
title ? " " : "", title ? title : "");
title ? title : browser->plain_url);
+}
+static void
+open_bookmarks(struct browser *browser)
+{
+}
static enum prompt_result
do_prompts(const char *prompt, struct browser *browser)
{
@@ -134,6 +195,16 @@ browser->history = browser->history->prev;
set_url(browser, browser->history->url, NULL);
result = PROMPT_ANSWERED;
goto exit;
if (in[1]) break;
save_bookmark(browser);
result = PROMPT_AGAIN;
goto exit;
if (in[1]) break;
open_bookmarks(browser);
result = PROMPT_ANSWERED;
goto exit;
case 'f':
if (in[1]) break;
if (!browser->history->next) {
@@ -205,13 +276,6 @@ free(in);
return result;
}
-static char *
-trim_ws(char *in)
-{
-}
static int
wrap(FILE *f, char *s, struct winsize *ws, int *row, int *col)
{
@@ -258,6 +322,8 @@ {
int nlinks = 0;
struct gemini_parser p;
gemini_parser_init(&p, resp->bio);
struct winsize ws;
ioctl(fileno(browser->tty), TIOCGWINSZ, &ws);
@@ -302,6 +368,9 @@ text = tok.text;
}
break;
case GEMINI_HEADING:
if (!browser->page_title) {
browser->page_title = strdup(tok.heading.title);
}
if (text == NULL) {
for (int n = tok.heading.level; n; --n) {
col += fprintf(out, "#");
diff --git a/src/util.c b/src/util.c
new file mode 100644
index 0000000000000000000000000000000000000000..26e7283a26cc8e593bb3e3fd53d4b7a9bc646e3f
--- /dev/null
+++ b/src/util.c
@@ -0,0 +1,62 @@
+#include <assert.h>
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include "util.h"
+static void
+posix_dirname(char *path, char *dname)
+{
strcpy(path, p);
+}
+/** Make directory and all of its parents */
+int
+mkdirs(char *path, mode_t mode)
+{
return 0;
return -1;
return -1;
+}
+char *
+getpath(const struct pathspec *paths, size_t npaths) {
const char *var = "";
if (paths[i].var) {
var = getenv(paths[i].var);
}
if (var) {
char *out = calloc(1,
strlen(var) + strlen(paths[i].path) + 1);
strcat(strcat(out, var), paths[i].path);
return out;
}
+}
text/gemini
This content has been proxied by September (ba2dc).