strcpy(fnb, wdir); cp = fnb + strlen(fnb);
cp = fnb + strlcpy(fnb, wdir, sizeof(fnb));
adjustname(fn)	char           *fn;{	char           *cp;	static char     fnb[NFILEN];	struct passwd  *pwent;#ifdef	SYMBLINK	struct stat     statbuf;	int             i, j;	char            linkbuf[NFILEN];#endif	switch (*fn) {	case '/':		cp = fnb;		*cp++ = *fn++;		break;	case '~':		fn++;		cp = getenv("HOME");		if (cp != NULL && *cp != '\0' && (*fn == '/' || *fn == '\0')) {			(void) strcpy(fnb, cp);			cp = fnb + strlen(fnb);			if (*fn)				fn++;			break;		} else {			cp = fnb;			while (*fn && *fn != '/')				*cp++ = *fn++;			*cp = '\0';			if ((pwent = getpwnam(fnb)) != NULL) {				(void) strcpy(fnb, pwent->pw_dir);				cp = fnb + strlen(fnb);				break;			} else {				fn -= strlen(fnb) + 1;				/* can't find ~user, continue to default case */			}		}	default:#ifndef	NODIR		strcpy(fnb, wdir);		cp = fnb + strlen(fnb);		break;#else		return fn;	/* punt */#endif	}	if (cp != fnb && cp[-1] != '/')		*cp++ = '/';	while (*fn) {		switch (*fn) {		case '.':			switch (fn[1]) {			case '\0':				*--cp = '\0';				return fnb;			case '/':				fn += 2;				continue;			case '.':				if (fn[2] != '/' && fn[2] != '\0')					break;#ifdef SYMBLINK				cp[-1] = '\0';				for (j = MAXLINK; j-- &&				     lstat(fnb, &statbuf) != -1 &&				     (statbuf.st_mode & S_IFMT) == S_IFLNK &&				     (i = readlink(fnb, linkbuf, sizeof linkbuf))				     != -1;) {					if (linkbuf[0] != '/') {						--cp;						while (cp > fnb && *--cp != '/') {						}						++cp;						(void) strncpy(cp, linkbuf, i);						cp += i;					} else {						(void) strncpy(fnb, linkbuf, i);						cp = fnb + i;					}					if (cp[-1] != '/')						*cp++ = '\0';					else						cp[-1] = '\0';				}				cp[-1] = '/';#endif				--cp;				while (cp > fnb && *--cp != '/') {				}				++cp;				if (fn[2] == '\0') {					*--cp = '\0';					return fnb;				}				fn += 3;				continue;			default:				break;			}			break;		case '/':			fn++;			continue;		default:			break;		}		while (*fn && (*cp++ = *fn++) != '/') {		}	}	if (cp[-1] == '/')		--cp;	*cp = '\0';	return fnb;}