Lines Matching refs:hd

303 	HD_TAR *hd;
308 hd = (HD_TAR *)blk;
318 if (hd->name[0] == '\0')
322 if (asc_ul(hd->chksum,sizeof(hd->chksum),OCT) != tar_chksm(blk,BLKMULT))
374 HD_TAR *hd;
389 hd = (HD_TAR *)buf;
395 arcn->nlen = l_strncpy(arcn->name, hd->name,
396 MIN(sizeof(hd->name), sizeof(arcn->name)) - 1);
398 arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode,sizeof(hd->mode),OCT) &
400 arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
401 arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
403 arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
404 arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
406 arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
407 arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
418 switch(hd->linkflag) {
425 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
426 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
437 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
438 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
511 HD_TAR *hd;
542 if (arcn->ln_nlen >= (int)sizeof(hd->linkname)) {
559 if (len >= (int)sizeof(hd->name)) {
572 hd = &hdblk;
573 l_strncpy(hd->name, arcn->name, sizeof(hd->name) - 1);
574 hd->name[sizeof(hd->name) - 1] = '\0';
583 hd->linkflag = AREGTYPE;
584 memset(hd->linkname, 0, sizeof(hd->linkname));
585 hd->name[len-1] = '/';
586 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
592 hd->linkflag = SYMTYPE;
593 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
594 hd->linkname[sizeof(hd->linkname) - 1] = '\0';
595 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
601 hd->linkflag = LNKTYPE;
602 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
603 hd->linkname[sizeof(hd->linkname) - 1] = '\0';
604 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 1))
610 hd->linkflag = AREGTYPE;
611 memset(hd->linkname, 0, sizeof(hd->linkname));
613 if (ul_oct((u_long)arcn->sb.st_size, hd->size,
614 sizeof(hd->size), 1)) {
616 if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
617 sizeof(hd->size), 1)) {
628 if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) ||
629 ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) ||
630 ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0) ||
631 ul_oct((u_long)arcn->sb.st_mtime, hd->mtime, sizeof(hd->mtime), 1))
639 if (ul_oct(tar_chksm((char *)&hdblk, sizeof(HD_TAR)), hd->chksum,
640 sizeof(hd->chksum), 3))
703 HD_USTAR *hd;
707 hd = (HD_USTAR *)blk;
715 if (hd->name[0] == '\0')
717 if (strncmp(hd->magic, TMAGIC, TMAGLEN - 1) != 0)
719 if (asc_ul(hd->chksum,sizeof(hd->chksum),OCT) != tar_chksm(blk,BLKMULT))
735 HD_USTAR *hd;
750 hd = (HD_USTAR *)buf;
757 if (*(hd->prefix) != '\0') {
758 cnt = l_strncpy(dest, hd->prefix,
759 MIN(sizeof(hd->prefix), sizeof(arcn->name) - 2));
769 arcn->nlen = cnt + l_strncpy(dest, hd->name,
770 MIN(sizeof(hd->name), sizeof(arcn->name) - cnt - 1));
777 arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
780 arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
781 arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
783 arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
784 arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
794 hd->gname[sizeof(hd->gname) - 1] = '\0';
795 if (gid_name(hd->gname, &(arcn->sb.st_gid)) < 0)
796 arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
797 hd->uname[sizeof(hd->uname) - 1] = '\0';
798 if (uid_name(hd->uname, &(arcn->sb.st_uid)) < 0)
799 arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
813 switch(hd->typeflag) {
836 if (hd->typeflag == BLKTYPE) {
843 devmajor = (dev_t)asc_ul(hd->devmajor,sizeof(hd->devmajor),OCT);
844 devminor = (dev_t)asc_ul(hd->devminor,sizeof(hd->devminor),OCT);
849 if (hd->typeflag == SYMTYPE) {
863 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
864 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name) - 1));
899 HD_USTAR *hd;
916 (arcn->ln_nlen > (int)sizeof(hd->linkname))) {
929 hd = &hdblk;
941 l_strncpy(hd->prefix, arcn->name, sizeof(hd->prefix));
944 memset(hd->prefix, 0, sizeof(hd->prefix));
950 l_strncpy(hd->name, pt, sizeof(hd->name));
957 hd->typeflag = DIRTYPE;
958 memset(hd->linkname, 0, sizeof(hd->linkname));
959 memset(hd->devmajor, 0, sizeof(hd->devmajor));
960 memset(hd->devminor, 0, sizeof(hd->devminor));
961 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
967 hd->typeflag = CHRTYPE;
969 hd->typeflag = BLKTYPE;
970 memset(hd->linkname, 0, sizeof(hd->linkname));
971 if (ul_oct((u_long)MAJOR(arcn->sb.st_rdev), hd->devmajor,
972 sizeof(hd->devmajor), 3) ||
973 ul_oct((u_long)MINOR(arcn->sb.st_rdev), hd->devminor,
974 sizeof(hd->devminor), 3) ||
975 ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
979 hd->typeflag = FIFOTYPE;
980 memset(hd->linkname, 0, sizeof(hd->linkname));
981 memset(hd->devmajor, 0, sizeof(hd->devmajor));
982 memset(hd->devminor, 0, sizeof(hd->devminor));
983 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
990 hd->typeflag = SYMTYPE;
992 hd->typeflag = LNKTYPE;
994 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
995 memset(hd->devmajor, 0, sizeof(hd->devmajor));
996 memset(hd->devminor, 0, sizeof(hd->devminor));
997 if (ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
1007 hd->typeflag = CONTTYPE;
1009 hd->typeflag = REGTYPE;
1010 memset(hd->linkname, 0, sizeof(hd->linkname));
1011 memset(hd->devmajor, 0, sizeof(hd->devmajor));
1012 memset(hd->devminor, 0, sizeof(hd->devminor));
1015 if (ul_oct((u_long)arcn->sb.st_size, hd->size,
1016 sizeof(hd->size), 3)) {
1018 if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
1019 sizeof(hd->size), 3)) {
1027 l_strncpy(hd->magic, TMAGIC, TMAGLEN);
1028 l_strncpy(hd->version, TVERSION, TVERSLEN);
1034 if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 3) ||
1035 ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 3) ||
1036 ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 3) ||
1037 ul_oct((u_long)arcn->sb.st_mtime,hd->mtime,sizeof(hd->mtime),3))
1039 l_strncpy(hd->uname,name_uid(arcn->sb.st_uid, 0),sizeof(hd->uname));
1040 l_strncpy(hd->gname,name_gid(arcn->sb.st_gid, 0),sizeof(hd->gname));
1047 if (ul_oct(tar_chksm((char *)&hdblk, sizeof(HD_USTAR)), hd->chksum,
1048 sizeof(hd->chksum), 3))