UNIX操作系统tar命令之隐患及解决方法( 三 )


seekip=fseek(fp,-TBLOCK,SEEK_CUR);
if(seekip==0)
{
if(fwrite((dblock.dummy),TBLOCK,1,fp)!=1)
{
printf(″Can not read the %s!n″,argv[2]);
break;
}
fflush(fp);
}
}
sscanf(dblock.dbuf.size,″%12o″,&filesize);
sscanf(dblock,dbuf.chksum,″%6o″,&sum_v);
sum_v=sum_v-sum-0400-compc;
if(filesize>0&&(dblock.dbuf.linkflag==0x00|| dbloc
k.dbuf.chksum[0]==0x33))
{
mvblock=(filesize-1)/TBLOCK+1;
seekip=fseek(fp,(long)mvblock*TBLOCK,SEEK
_CUR);
}
seekip=fseek(fp,0L,SEEK_CUR);
if(dblock.dbuf.linkflag==″1″)
printf(″%snttnormal linked to %sttcompress=[%c]tsum_v=%on″,
dblock.dbuf.name,dblock.dbuf.linkname,dblock.dbuf.
compid,sum-v);
else if (dblock.dbuf.linkflag==″2″)
printf(″%snttsymbolic linked to %stcompress=[%c]tsum_v=%on,
″dblock.dbuf.name,dblock.dbuf.linkname,dblock.dbuf.
compid,sum_v);
else
printf(″%snt %8d byte-->%6d tape_blockstcompress=[%c]tsum_v=%on″,dblock.dbuf.name,filesize,mvblock,dblock.dbuf.cmpid,sum_v);

}
printf(″Total=%dKn″,ftell(fp)/1024);
fclose(fp);
}

推荐阅读