Make the plumber configurable in config.h. - sacc - sacc(omys), simple console gopher client
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
Log
Files
Refs
Tags
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:
  M Makefile                            |       5 ++++-
  A config.def.h                        |       4 ++++
  M sacc.c                              |       4 +++-

3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/Makefile b/Makefile
@@ -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
@@ -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
@@ -20,6 +20,8 @@
 
 #include "common.h"
 
+#include "config.h"
+
 static char *mainurl;
 static Item *mainentry;
 static int parent = 1;
@@ -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));
         }
 }