aboutsummaryrefslogtreecommitdiff
path: root/register.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-04-14 21:03:28 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-04-14 21:03:28 +0200
commitd7c917ea63e0374fc03622d4f21df8ac4c574fae (patch)
tree49702ab84115cd1d5b07bc2faedf185804660e10 /register.c
parent55be869aa4d48615e788558963ae1f48e2563a42 (diff)
downloadvis-d7c917ea63e0374fc03622d4f21df8ac4c574fae.tar.gz
vis-d7c917ea63e0374fc03622d4f21df8ac4c574fae.tar.xz
vis: add #defines to ease overriding of utility names
This should ease packaging for systems with an existing vis(1) binary.
Diffstat (limited to 'register.c')
-rw-r--r--register.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/register.c b/register.c
index bf56d42..6f8caa5 100644
--- a/register.c
+++ b/register.c
@@ -6,6 +6,10 @@
#include "util.h"
#include "register.h"
+#ifndef VIS_CLIPBOARD
+#define VIS_CLIPBOARD "vis-clipboard"
+#endif
+
static ssize_t read_buffer(void *context, char *data, size_t len) {
buffer_append(context, data, len);
return len;
@@ -30,7 +34,7 @@ const char *register_get(Vis *vis, Register *reg, size_t *len) {
buffer_clear(&reg->buf);
int status = vis_pipe(vis, &(Filerange){ .start = 0, .end = 0 },
- (const char*[]){ "vis-clipboard", "--paste", NULL },
+ (const char*[]){ VIS_CLIPBOARD, "--paste", NULL },
&reg->buf, read_buffer, &buferr, read_buffer);
if (status != 0)
@@ -70,7 +74,7 @@ bool register_put_range(Vis *vis, Register *reg, Text *txt, Filerange *range) {
Buffer buferr;
buffer_init(&buferr);
- int status = vis_pipe(vis, range, (const char*[]){ "vis-clipboard", "--copy", NULL },
+ int status = vis_pipe(vis, range, (const char*[]){ VIS_CLIPBOARD, "--copy", NULL },
NULL, NULL, &buferr, read_buffer);
if (status != 0)