summaryrefslogtreecommitdiff
path: root/content/fetchers/about/about.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2020-09-27 00:39:56 +0100
committerVincent Sanders <vince@kyllikki.org>2020-09-27 13:46:39 +0100
commitff3b948ac0ee0142535bea9a6ebde57b7056c2eb (patch)
tree1e822bf947ee091305c9207f9ddd006a0ffbcd57 /content/fetchers/about/about.c
parent86ecde9a473deffdbb023317074a46c124477ca2 (diff)
downloadnetsurf-ff3b948ac0ee0142535bea9a6ebde57b7056c2eb.tar.gz
netsurf-ff3b948ac0ee0142535bea9a6ebde57b7056c2eb.tar.bz2
split out choices about scheme handler
Diffstat (limited to 'content/fetchers/about/about.c')
-rw-r--r--content/fetchers/about/about.c68
1 files changed, 1 insertions, 67 deletions
diff --git a/content/fetchers/about/about.c b/content/fetchers/about/about.c
index e41e6c899..1bc382b57 100644
--- a/content/fetchers/about/about.c
+++ b/content/fetchers/about/about.c
@@ -53,6 +53,7 @@
#include "imagecache.h"
#include "atestament.h"
#include "config.h"
+#include "choices.h"
#include "about.h"
typedef bool (*fetch_about_handler)(struct fetch_about_context *);
@@ -289,8 +290,6 @@ static bool fetch_about_licence_handler(struct fetch_about_context *ctx)
}
-
-
/**
* Handler to generate the nscolours stylesheet
*
@@ -337,71 +336,6 @@ aborted:
/**
- * Generate the text of a Choices file which represents the current
- * in use options.
- *
- * \param ctx The fetcher context.
- * \return true if handled false if aborted.
- */
-static bool fetch_about_choices_handler(struct fetch_about_context *ctx)
-{
- fetch_msg msg;
- char buffer[1024];
- int code = 200;
- int slen;
- unsigned int opt_loop = 0;
- int res = 0;
-
- /* content is going to return ok */
- fetch_set_http_code(ctx->fetchh, code);
-
- /* content type */
- if (fetch_about_send_header(ctx, "Content-Type: text/plain"))
- goto fetch_about_choices_handler_aborted;
-
- msg.type = FETCH_DATA;
- msg.data.header_or_data.buf = (const uint8_t *) buffer;
-
- slen = snprintf(buffer, sizeof buffer,
- "# Automatically generated current NetSurf browser Choices\n");
-
- do {
- res = nsoption_snoptionf(buffer + slen,
- sizeof buffer - slen,
- opt_loop,
- "%k:%v\n");
- if (res <= 0)
- break; /* last option */
-
- if (res >= (int) (sizeof buffer - slen)) {
- /* last entry would not fit in buffer, submit buffer */
- msg.data.header_or_data.len = slen;
- if (fetch_about_send_callback(&msg, ctx))
- goto fetch_about_choices_handler_aborted;
- slen = 0;
- } else {
- /* normal addition */
- slen += res;
- opt_loop++;
- }
- } while (res > 0);
-
- msg.data.header_or_data.len = slen;
- if (fetch_about_send_callback(&msg, ctx))
- goto fetch_about_choices_handler_aborted;
-
- fetch_about_send_finished(ctx);
-
- return true;
-
-fetch_about_choices_handler_aborted:
- return false;
-}
-
-
-
-
-/**
* Handler to generate about scheme logo page
*
* \param ctx The fetcher context.