tMake the plumber configurable in config.h. - sacc - sacc (saccomys): simple gopher client.
Log
Files
Refs
LICENSE
---
commit d03c161c2aa47bf254336a7098caf428a4d58134
parent 67cc5414425ecccc9f75a12f7ba4cc40b3f97fa7
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 25 Jul 2017 18:55:34 +0200

Make the plumber configurable in config.h.

Diffstat:
  Makefile                            |       5 ++++-
  config.def.h                        |       4 ++++
  sacc.c                              |       4 +++-

3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/Makefile b/Makefile
t@@ -9,7 +9,10 @@ OBJ = $(BIN:=.o) ui_$(UI).o
 
 all: $(BIN)
 
-$(BIN): config.mk common.h $(OBJ)
+config.h:
+        cp config.def.h config.h
+
+$(BIN): config.h config.mk common.h $(OBJ)
         $(CC) $(OBJ) $(SACCLDFLAGS) -o $@
 
 clean:
diff --git a/config.def.h b/config.def.h
t@@ -0,0 +1,4 @@
+/* See LICENSE file for copyright and license details. */
+
+static char *plumber = "xdg-open";
+
diff --git a/sacc.c b/sacc.c
t@@ -20,6 +20,8 @@
 
 #include "common.h"
 
+#include "config.h"
+
 static char *mainurl;
 static Item *mainentry;
 static int parent = 1;
t@@ -471,7 +473,7 @@ plumb(char *url)
                 return;
         case 0:
                 parent = 0;
-                if (execlp("xdg-open", "xdg-open", url, NULL) < 0)
+                if (execlp(plumber, plumber, url, NULL) < 0)
                         die("execlp: %s", strerror(errno));
         }
 }