Home | History | Annotate | Download | only in pending

Lines Matching refs:hdr

163   struct tar_hdr hdr;
192 memset(&hdr, 0, sizeof(hdr));
193 strncpy(hdr.name, hname, sizeof(hdr.name));
194 itoo(hdr.mode, sizeof(hdr.mode), st->st_mode &07777);
195 itoo(hdr.uid, sizeof(hdr.uid), st->st_uid);
196 itoo(hdr.gid, sizeof(hdr.gid), st->st_gid);
197 itoo(hdr.size, sizeof(hdr.size), 0); //set size later
198 itoo(hdr.mtime, sizeof(hdr.mtime), st->st_mtime);
199 for (i=0; i<sizeof(hdr.chksum); i++) hdr.chksum[i] = ' ';
203 hdr.type = '1';
204 if (strlen(node->arg) > sizeof(hdr.link))
206 xstrncpy(hdr.link, node->arg, sizeof(hdr.link));
208 hdr.type = '0';
210 itoo(hdr.size, sizeof(hdr.size), st->st_size);
217 hdr.type = '2'; //'K' long link
222 if (strlen(lnk) > sizeof(hdr.link))
224 xstrncpy(hdr.link, lnk, sizeof(hdr.link));
227 else if (S_ISDIR(st->st_mode)) hdr.type = '5';
228 else if (S_ISFIFO(st->st_mode)) hdr.type = '6';
230 hdr.type = (S_ISCHR(st->st_mode))?'3':'4';
231 itoo(hdr.major, sizeof(hdr.major), dev_major(st->st_rdev));
232 itoo(hdr.minor, sizeof(hdr.minor), dev_minor(st->st_rdev));
237 if (strlen(hname) > sizeof(hdr.name))
239 strcpy(hdr.magic, "ustar ");
241 snprintf(hdr.uname, sizeof(hdr.uname), "%s", pw->pw_name);
242 else snprintf(hdr.uname, sizeof(hdr.uname), "%d", st->st_uid);
245 snprintf(hdr.gname, sizeof(hdr.gname), "%s", gr->gr_name);
246 else snprintf(hdr.gname, sizeof(hdr.gname), "%d", st->st_gid);
249 for (i= 0; i < 512; i++) sum += (unsigned int)((char*)&hdr)[i];
250 itoo(hdr.chksum, sizeof(hdr.chksum)-1, sum);
252 writeall(tar->src_fd, (void*)&hdr, 512);
255 if (hdr.type != '0') return; //nothing to write