cnt = l_strncpy(arcn->name, hd->prefix, sizeof(hd->prefix) - 1);
cnt = l_strncpy(dest, hd->prefix, sizeof(hd->prefix) - 1);
ustar_rd(register ARCHD *arcn, register char *buf)#elseintustar_rd(arcn, buf)	register ARCHD *arcn;	register char *buf;#endif{	register HD_USTAR *hd;	register char *dest;	register int cnt = 0;	dev_t devmajor;	dev_t devminor;	/*	 * we only get proper sized buffers	 */	if (ustar_id(buf, BLKMULT) < 0)		return(-1);	arcn->org_name = arcn->name;	arcn->sb.st_nlink = 1;	arcn->pat = NULL;	hd = (HD_USTAR *)buf;	/*	 * see if the filename is split into two parts. if, so joint the parts.	 * we copy the prefix first and add a / between the prefix and name.	 */	dest = arcn->name;	if (*(hd->prefix) != '\0') {		cnt = l_strncpy(arcn->name, hd->prefix, sizeof(hd->prefix) - 1);		hd->prefix[sizeof(hd->prefix) - 1] = '\0';		dest = arcn->name + arcn->nlen;		*dest++ = '/';	}	arcn->nlen = l_strncpy(dest, hd->name, sizeof(hd->name) - 1);	arcn->nlen += cnt;	arcn->name[arcn->nlen] = '\0';	/*	 * follow the spec to the letter. we should only have mode bits, strip	 * off all other crud we may be passed.	 */	arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &	    0xfff);	arcn->sb.st_size = (size_t)asc_ul(hd->size, sizeof(hd->size), OCT);	arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);	arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;	/*	 * If we can find the ascii names for gname and uname in the password	 * and group files we will use the uid's and gid they bind. Otherwise	 * we use the uid and gid values stored in the header. (This is what	 * the posix spec wants).	 */	hd->gname[sizeof(hd->gname) - 1] = '\0';	if (gid_name(hd->gname, &(arcn->sb.st_gid)) < 0)		arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);	hd->uname[sizeof(hd->uname) - 1] = '\0';	if (uid_name(hd->uname, &(arcn->sb.st_uid)) < 0)		arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);	/*	 * set the defaults, these may be changed depending on the file type	 */	arcn->ln_name[0] = '\0';	arcn->ln_nlen = 0;	arcn->pad = 0;	arcn->skip = 0;	arcn->sb.st_rdev = (dev_t)0;	/*	 * set the mode and PAX type according to the typeflag in the header	 */	switch(hd->typeflag) {	case FIFOTYPE:		arcn->type = PAX_FIF;		arcn->sb.st_mode |= S_IFIFO;		break;	case DIRTYPE:		arcn->type = PAX_DIR;		arcn->sb.st_mode |= S_IFDIR;		arcn->sb.st_nlink = 2;		/*		 * Some programs that create ustar archives append a '/'		 * to the pathname for directories. This clearly violates		 * ustar specs, but we will silently strip it off anyway.		 */		if (arcn->name[arcn->nlen - 1] == '/')			arcn->name[--arcn->nlen] = '\0';		break;	case BLKTYPE:	case CHRTYPE:		/*		 * this type requires the rdev field to be set.		 */		if (hd->typeflag == BLKTYPE) {			arcn->type = PAX_BLK;			arcn->sb.st_mode |= S_IFBLK;		} else {			arcn->type = PAX_CHR;			arcn->sb.st_mode |= S_IFCHR;		}		devmajor = (dev_t)asc_ul(hd->devmajor,sizeof(hd->devmajor),OCT);		devminor = (dev_t)asc_ul(hd->devminor,sizeof(hd->devminor),OCT);		arcn->sb.st_rdev = TODEV(devmajor, devminor);		break;	case SYMTYPE:	case LNKTYPE:		if (hd->typeflag == SYMTYPE) {			arcn->type = PAX_SLK;			arcn->sb.st_mode |= S_IFLNK;		} else {			arcn->type = PAX_HLK;			/*			 * so printing looks better			 */			arcn->sb.st_mode |= S_IFREG;			arcn->sb.st_nlink = 2;		}		/*		 * copy the link name		 */		arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,			sizeof(hd->linkname) - 1);		arcn->ln_name[arcn->ln_nlen] = '\0';		break;	case CONTTYPE:	case AREGTYPE:	case REGTYPE:	default:		/*		 * these types have file data that follows. Set the skip and		 * pad fields.		 */		arcn->type = PAX_REG;		arcn->pad = TAR_PAD(arcn->sb.st_size);		arcn->skip = arcn->sb.st_size;		arcn->sb.st_mode |= S_IFREG;		break;	}	return(0);}