shithub: riscv

ref: c59eb6d117c6dc99bc6e4330d3a9a3453888dee7
dir: /sys/src/cmd/pbd.c/

View raw version
#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);
}