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 | ffc19e2ee1b6eef4ac08e85fc7ef2e98ec32db9c (patch) | |
tree | bce7c9c4b747e21c0d2bb351fdf4c9c328ebce0c /bin | |
parent | Alias sudo=doas if available (diff) | |
download | src-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 '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 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(); |