diff options
author | June McEnroe <june@causal.agency> | 2020-06-11 19:01:02 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-06-11 19:01:02 -0400 |
commit | dd3cfbcc6ea0f290531b66bc1175f2c5c039ba33 (patch) | |
tree | 51e36d685b2cd9a28a84a5bff0d1cb6a37e154fb /bin | |
parent | Alias sudo=doas if available (diff) | |
download | src-dd3cfbcc6ea0f290531b66bc1175f2c5c039ba33.tar.gz src-dd3cfbcc6ea0f290531b66bc1175f2c5c039ba33.zip |
Fix pbd for neovim
At some point neovim started setting argv[0] to the absolute path for some reason.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pbd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/pbd.c b/bin/pbd.c index f491385e..58326053 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(); |