"%s%s", prefixx, dent->d_name) > sizeof(current->fl_name)) {
"%s%s%s", prefixx, dent->d_name, dent->d_type == DT_DIR? "/" : "") >= sizeof(current->fl_name)) {
make_file_list(buf)	char           *buf;{	char           *dir, *file, *cp;	int             len, preflen;	DIR	       *dirp;	struct dirent  *dent;	LIST           *last;	struct filelist *current;	char            prefixx[NFILEN + 1];	struct stat     statbuf;	char            statname[NFILEN + 2];	/*	 * We need three different strings: dir - the name of the directory	 * containing what the user typed. Must be a real unix file name,	 * e.g. no ~user, etc..  Must not end in /. prefix - the portion of	 * what the user typed that is before the names we are going to find	 * in the directory.  Must have a trailing / if the user typed it.	 * names from the directory. we open dir, and return prefix	 * concatenated with names.	 */	/* first we get a directory name we can look up */	/*	 * Names ending in . are potentially odd, because adjustname will	 * treat foo/.. as a reference to another directory, whereas we are	 * interested in names starting with ..	 */	len = strlen(buf);	if (buf[len - 1] == '.') {		buf[len - 1] = 'x';		dir = adjustname(buf);		buf[len - 1] = '.';	} else		dir = adjustname(buf);	/*	 * If the user typed a trailing / or the empty string	 * he wants us to use his file spec as a directory name.	 */	if (buf[0] && buf[strlen(buf) - 1] != '/') {		file = strrchr(dir, '/');		if (file) {			*file = 0;			if (*dir == 0)				dir = "/";		} else {			return (NULL);		}	}	/* Now we get the prefix of the name the user typed. */	strcpy(prefixx, buf);	cp = strrchr(prefixx, '/');	if (cp == NULL)		prefixx[0] = 0;	else		cp[1] = 0;	preflen = strlen(prefixx);	/* cp is the tail of buf that really needs to be compared */	cp = buf + preflen;	len = strlen(cp);	/*	 * Now make sure that file names will fit in the buffers allocated.	 * SV files are fairly short.  For BSD, something more general would	 * be required.	 */	if ((preflen + MAXNAMLEN) > NFILEN)		return (NULL);	/* loop over the specified directory, making up the list of files */	/*	 * Note that it is worth our time to filter out names that don't	 * match, even though our caller is going to do so again, and to	 * avoid doing the stat if completion is being done, because stat'ing	 * every file in the directory is relatively expensive.	 */	dirp = opendir(dir);	if (dirp == NULL)		return (NULL);	last = NULL;	while ((dent = readdir(dirp)) != NULL) {		if (dent->d_namlen < len || memcmp(cp, dent->d_name, len) != 0)			continue;		current = (struct filelist *) malloc(sizeof(struct filelist));		if (current == NULL)			break;		if (snprintf(current->fl_name, sizeof(current->fl_name),		    "%s%s", prefixx, dent->d_name) > sizeof(current->fl_name)) {			free(current);			continue;		}		current->fl_l.l_next = last;		current->fl_l.l_name = current->fl_name;		last = (LIST *) current;		if (dent->d_type == DT_DIR) {			strcat(current->fl_name, "/");			continue;		} else if (dent->d_type != DT_UNKNOWN)			continue;		statbuf.st_mode = 0;		if (snprintf(statname, sizeof(statname), "%s/%s",		    dir, dent->d_name) > sizeof(statname) - 1) {			continue;		}		if (stat(statname, &statbuf) < 0)			continue;		if (statbuf.st_mode & 040000)			strcat(current->fl_name, "/");	}	closedir(dirp);	return (last);}