aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/pbd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/pbd.c')
-rw-r--r--src/cmd/pbd.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cmd/pbd.c b/src/cmd/pbd.c
new file mode 100644
index 00000000..2e859f84
--- /dev/null
+++ b/src/cmd/pbd.c
@@ -0,0 +1,19 @@
+#include <u.h>
+#include <libc.h>
+
+void
+main(void)
+{
+ char buf[512], *p;
+
+ p = "???";
+ if(getwd(buf, sizeof buf)){
+ p = strrchr(buf, '/');
+ if(p == nil)
+ p = buf;
+ else if(p>buf || p[1]!='\0')
+ p++;
+ }
+ write(1, p, strlen(p));
+ exits(0);
+}