henesyinit from p9fce6d0435 years agoHistory
26 lines · 363 B · C
RawDownload
#include <u.h>#include <libc.h> voidmain(void){	char buf[DIRLEN];	char pathname[512];	char *cp; 	cp = "?";	if(stat(".", buf) == 0){		if(buf[0] == '/'){			if(getwd(pathname, sizeof(pathname))){				cp = strrchr(pathname, '/');				if(cp == 0)					cp = pathname;				else					cp++;			}		} else			cp = buf;	}	write(1, cp, strlen(cp));	exits(0);}