summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-06-11 19:01:02 -0400
committerJune McEnroe <june@causal.agency>2020-06-11 19:01:02 -0400
commitffc19e2ee1b6eef4ac08e85fc7ef2e98ec32db9c (patch)
treebce7c9c4b747e21c0d2bb351fdf4c9c328ebce0c
parentAlias sudo=doas if available (diff)
downloadsrc-ffc19e2ee1b6eef4ac08e85fc7ef2e98ec32db9c.tar.gz
src-ffc19e2ee1b6eef4ac08e85fc7ef2e98ec32db9c.zip
Fix pbd for neovim
At some point neovim started setting argv[0] to the absolute path for
some reason.
Diffstat (limited to '')
-rw-r--r--bin/pbd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/pbd.c b/bin/pbd.c
index d40389d5..2ba333fd 100644
--- a/bin/pbd.c
+++ b/bin/pbd.c
@@ -139,8 +139,10 @@ static int open1(const char *url) {
 
 int main(int argc, char *argv[]) {
 	(void)argc;
-	if (!argv[0][0] || !argv[0][1]) return EX_USAGE;
-	switch (argv[0][2]) {
+	if (strchr(argv[0], '/')) {
+		argv[0] = strrchr(argv[0], '/') + 1;
+	}
+	switch (argv[0][0] && argv[0][1] ? argv[0][2] : 0) {
 		case 'd': return pbd();
 		case 'c': return pbcopy();
 		case 'p': return pbpaste();