pbd.c (247B)
1 #include <u.h> 2 #include <libc.h> 3 4 void 5 main(void) 6 { 7 char buf[512], *p; 8 9 p = "???"; 10 if(getwd(buf, sizeof buf)){ 11 p = strrchr(buf, '/'); 12 if(p == nil) 13 p = buf; 14 else if(p>buf || p[1]!='\0') 15 p++; 16 } 17 write(1, p, strlen(p)); 18 exits(0); 19 }