Lines Matching refs:arcn

370 tar_rd(ARCHD *arcn, char *buf)
380 arcn->org_name = arcn->name;
381 arcn->sb.st_nlink = 1;
382 arcn->pat = NULL;
393 arcn->nlen = l_strncpy(arcn->name, hd->name,
394 MIN(sizeof(hd->name), sizeof(arcn->name)) - 1);
395 arcn->name[arcn->nlen] = '\0';
396 arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode,sizeof(hd->mode),OCT) &
398 arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
399 arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
401 arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
402 arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
404 arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
405 arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
407 arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
413 pt = &(arcn->name[arcn->nlen - 1]);
414 arcn->pad = 0;
415 arcn->skip = 0;
422 arcn->type = PAX_SLK;
423 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
424 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
425 arcn->ln_name[arcn->ln_nlen] = '\0';
426 arcn->sb.st_mode |= S_IFLNK;
433 arcn->type = PAX_HLK;
434 arcn->sb.st_nlink = 2;
435 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
436 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name)) - 1);
437 arcn->ln_name[arcn->ln_nlen] = '\0';
443 arcn->sb.st_mode |= S_IFREG;
449 arcn->type = PAX_DIR;
450 arcn->sb.st_mode |= S_IFDIR;
451 arcn->sb.st_nlink = 2;
452 arcn->ln_name[0] = '\0';
453 arcn->ln_nlen = 0;
461 arcn->ln_name[0] = '\0';
462 arcn->ln_nlen = 0;
467 arcn->type = PAX_DIR;
468 arcn->sb.st_mode |= S_IFDIR;
469 arcn->sb.st_nlink = 2;
476 arcn->type = PAX_REG;
477 arcn->sb.st_mode |= S_IFREG;
478 arcn->pad = TAR_PAD(arcn->sb.st_size);
479 arcn->skip = arcn->sb.st_size;
489 --arcn->nlen;
507 tar_wr(ARCHD *arcn)
516 switch(arcn->type) {
526 arcn->org_name);
529 paxwarn(1, "Tar cannot archive a block device %s", arcn->org_name);
532 paxwarn(1, "Tar cannot archive a socket %s", arcn->org_name);
535 paxwarn(1, "Tar cannot archive a fifo %s", arcn->org_name);
540 if (arcn->ln_nlen >= (int)sizeof(hd->linkname)) {
541 paxwarn(1,"Link name too long for tar %s", arcn->ln_name);
554 len = arcn->nlen;
555 if (arcn->type == PAX_DIR)
558 paxwarn(1, "File name too long for tar %s", arcn->name);
571 l_strncpy(hd->name, arcn->name, sizeof(hd->name) - 1);
573 arcn->pad = 0;
575 if (arcn->type == PAX_DIR) {
586 } else if (arcn->type == PAX_SLK) {
591 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
595 } else if ((arcn->type == PAX_HLK) || (arcn->type == PAX_HRG)) {
600 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname) - 1);
611 if (ul_oct((u_long)arcn->sb.st_size, hd->size,
614 if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
617 paxwarn(1,"File is too large for tar %s", arcn->org_name);
620 arcn->pad = TAR_PAD(arcn->sb.st_size);
626 if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 0) ||
627 ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 0) ||
628 ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 0) ||
629 ul_oct((u_long)arcn->sb.st_mtime, hd->mtime, sizeof(hd->mtime), 1))
644 if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
652 paxwarn(1, "Tar header field is too small for %s", arcn->org_name);
731 ustar_rd(ARCHD *arcn, char *buf)
744 arcn->org_name = arcn->name;
745 arcn->sb.st_nlink = 1;
746 arcn->pat = NULL;
747 arcn->nlen = 0;
754 dest = arcn->name;
757 MIN(sizeof(hd->prefix), sizeof(arcn->name) - 2));
767 arcn->nlen = cnt + l_strncpy(dest, hd->name,
768 MIN(sizeof(hd->name), sizeof(arcn->name) - cnt - 1));
769 arcn->name[arcn->nlen] = '\0';
775 arcn->sb.st_mode = (mode_t)(asc_ul(hd->mode, sizeof(hd->mode), OCT) &
778 arcn->sb.st_size = (off_t)asc_ul(hd->size, sizeof(hd->size), OCT);
779 arcn->sb.st_mtime = (time_t)asc_ul(hd->mtime, sizeof(hd->mtime), OCT);
781 arcn->sb.st_size = (off_t)asc_uqd(hd->size, sizeof(hd->size), OCT);
782 arcn->sb.st_mtime = (time_t)asc_uqd(hd->mtime, sizeof(hd->mtime), OCT);
784 arcn->sb.st_ctime = arcn->sb.st_atime = arcn->sb.st_mtime;
793 if (gid_name(hd->gname, &(arcn->sb.st_gid)) < 0)
794 arcn->sb.st_gid = (gid_t)asc_ul(hd->gid, sizeof(hd->gid), OCT);
796 if (uid_name(hd->uname, &(arcn->sb.st_uid)) < 0)
797 arcn->sb.st_uid = (uid_t)asc_ul(hd->uid, sizeof(hd->uid), OCT);
802 arcn->ln_name[0] = '\0';
803 arcn->ln_nlen = 0;
804 arcn->pad = 0;
805 arcn->skip = 0;
806 arcn->sb.st_rdev = (dev_t)0;
813 arcn->type = PAX_FIF;
814 arcn->sb.st_mode |= S_IFIFO;
817 arcn->type = PAX_DIR;
818 arcn->sb.st_mode |= S_IFDIR;
819 arcn->sb.st_nlink = 2;
826 if (arcn->name[arcn->nlen - 1] == '/')
827 arcn->name[--arcn->nlen] = '\0';
835 arcn->type = PAX_BLK;
836 arcn->sb.st_mode |= S_IFBLK;
838 arcn->type = PAX_CHR;
839 arcn->sb.st_mode |= S_IFCHR;
843 arcn->sb.st_rdev = TODEV(devmajor, devminor);
848 arcn->type = PAX_SLK;
849 arcn->sb.st_mode |= S_IFLNK;
851 arcn->type = PAX_HLK;
855 arcn->sb.st_mode |= S_IFREG;
856 arcn->sb.st_nlink = 2;
861 arcn->ln_nlen = l_strncpy(arcn->ln_name, hd->linkname,
862 MIN(sizeof(hd->linkname), sizeof(arcn->ln_name) - 1));
863 arcn->ln_name[arcn->ln_nlen] = '\0';
873 arcn->type = PAX_REG;
874 arcn->pad = TAR_PAD(arcn->sb.st_size);
875 arcn->skip = arcn->sb.st_size;
876 arcn->sb.st_mode |= S_IFREG;
895 ustar_wr(ARCHD *arcn)
904 if (arcn->type == PAX_SCK) {
905 paxwarn(1, "Ustar cannot archive a socket %s", arcn->org_name);
912 if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
913 (arcn->type == PAX_HRG)) &&
914 (arcn->ln_nlen > (int)sizeof(hd->linkname))) {
915 paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
921 * pt != arcn->name, the name has to be split
923 if ((pt = name_split(arcn->name, arcn->nlen)) == NULL) {
924 paxwarn(1, "File name too long for ustar %s", arcn->name);
928 arcn->pad = 0L;
933 if (pt != arcn->name) {
939 l_strncpy(hd->prefix, arcn->name, sizeof(hd->prefix));
953 switch(arcn->type) {
964 if (arcn->type == PAX_CHR)
969 if (ul_oct((u_long)MAJOR(arcn->sb.st_rdev), hd->devmajor,
971 ul_oct((u_long)MINOR(arcn->sb.st_rdev), hd->devminor,
987 if (arcn->type == PAX_SLK)
992 l_strncpy(hd->linkname,arcn->ln_name, sizeof(hd->linkname));
1004 if (arcn->type == PAX_CTG)
1011 arcn->pad = TAR_PAD(arcn->sb.st_size);
1013 if (ul_oct((u_long)arcn->sb.st_size, hd->size,
1016 if (uqd_oct((u_quad_t)arcn->sb.st_size, hd->size,
1019 paxwarn(1,"File is too long for ustar %s",arcn->org_name);
1032 if (ul_oct((u_long)arcn->sb.st_mode, hd->mode, sizeof(hd->mode), 3) ||
1033 ul_oct((u_long)arcn->sb.st_uid, hd->uid, sizeof(hd->uid), 3) ||
1034 ul_oct((u_long)arcn->sb.st_gid, hd->gid, sizeof(hd->gid), 3) ||
1035 ul_oct((u_long)arcn->sb.st_mtime,hd->mtime,sizeof(hd->mtime),3))
1037 l_strncpy(hd->uname,name_uid(arcn->sb.st_uid, 0),sizeof(hd->uname));
1038 l_strncpy(hd->gname,name_gid(arcn->sb.st_gid, 0),sizeof(hd->gname));
1052 if ((arcn->type == PAX_CTG) || (arcn->type == PAX_REG))
1060 paxwarn(1, "Ustar header field is too small for %s", arcn->org_name);