From ffc19e2ee1b6eef4ac08e85fc7ef2e98ec32db9c Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 11 Jun 2020 19:01:02 -0400 Subject: Fix pbd for neovim At some point neovim started setting argv[0] to the absolute path for some reason. --- bin/pbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bin') 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(); -- cgit 1.4.1