tMove formatting/settings to config.h - phroxy - Gopher to HTTP proxy
HTML git clone git://git.z3bra.org/phroxy.git
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
DIR commit 5b689675cc8bd3a8c3dd5fa25f8671035ab2b293
DIR parent 5f318d5ec96f8ca1d8d51c6a4f19581048299a09
HTML Author: Willy Goiffon <dev@z3bra.org>
Date: Fri, 11 Sep 2020 22:50:11 +0200
Move formatting/settings to config.h
Diffstat:
A config.def.h | 11 +++++++++++
M makefile | 5 +++++
M mkfile | 5 +++++
M phroxy.c | 12 +-----------
4 files changed, 22 insertions(+), 11 deletions(-)
---
DIR diff --git a/config.def.h b/config.def.h
t@@ -0,0 +1,11 @@
+const char *host = "z3bra.org";
+const char *foot = "</pre></body></html>";
+const char *head =
+ "<!DOCTYPE HTML>"
+ "<html><head>"
+ "<meta charset=\"utf-8\">"
+ "<meta name=\"viewport\" content=\"width=device-width\">"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://z3bra.org/z3bra.css\">"
+ "<title>phroxy(8)</title>"
+ "</head><body><pre>\n";
+
DIR diff --git a/makefile b/makefile
t@@ -5,6 +5,11 @@ all: phroxy
phroxy: phroxy.o
${LD} ${LDFLAGS} -o $@ phroxy.o
+phroxy.o: config.h
+
+config.h: config.def.h
+ cp config.def.h config.h
+
install: phroxy phroxy.8
mkdir -p ${DESTDIR}${PREFIX}/bin
mkdir -p ${DESTDIR}${MANDIR}/man1
DIR diff --git a/mkfile b/mkfile
t@@ -5,6 +5,11 @@ all:V: phroxy
phroxy: phroxy.o
$LD $LDFLAGS -o $target $prereq
+phroxy.o: config.h
+
+%.h: %.def.h
+ cp $stem.def.h $stem.h
+
%.o: %.c
$CC $CPPFLAGS $CFLAGS -c $stem.c
DIR diff --git a/phroxy.c b/phroxy.c
t@@ -12,7 +12,7 @@
#include <sys/socket.h>
#include <sys/socket.h>
-const char *host = "z3bra.org";
+#include "config.h"
void *
xreallocarray(void *m, const size_t n, const size_t s)
t@@ -211,16 +211,6 @@ htmlize(char *data, size_t len, size_t *newsize)
size_t hlen;
char *html = NULL;
- char *foot = "</pre></body></html>";
- char *head =
- "<!DOCTYPE HTML>"
- "<html><head>"
- "<meta charset=\"utf-8\">"
- "<meta name=\"viewport\" content=\"width=device-width\">"
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://z3bra.org/z3bra.css\">"
- "<title>phroxy(8)</title>"
- "</head><body><pre>\n";
-
hlen = len + strlen(head) + strlen(foot);
html = malloc(hlen);
if (!html)