summary refs log tree commit diff
diff options
context:
space:
mode:
-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();