mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
20 lines
247 B
C
20 lines
247 B
C
|
#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);
|
||
|
}
|