Lines Matching defs:pax

23  * pax zip format
89 Pax_t* pax;
109 zip_done(Pax_t* pax, register Paxarchive_t* ap)
121 zip_getprologue(Pax_t* pax, Paxformat_t* fp, register Paxarchive_t* ap, Paxfile_t* f, unsigned char* buf, size_t size)
136 return paxnospace(pax);
140 return paxnospace(pax);
145 if (paxseek(pax, ap, -(off_t)ZIP_END_HEADER, SEEK_END, 1) > 0 &&
146 (hdr = paxget(pax, ap, ZIP_END_HEADER, NiL)) &&
151 zip_done(pax, ap);
152 return paxnospace(pax);
155 if (paxseek(pax, ap, pos, SEEK_SET, 1) != pos)
157 (*pax->errorf)(NiL, pax, 2, "%s: %s central header seek error", ap->name, fp->name);
158 zip_done(pax, ap);
162 while ((hdr = paxget(pax, ap, -ZIP_CEN_HEADER, NiL)) && swapget(0, &hdr[0], 4) == ZIP_CEN_MAGIC)
167 zip_done(pax, ap);
168 return paxnospace(pax);
175 if (paxread(pax, ap, mem->name, (off_t)n, (off_t)0, 0) <= 0)
177 (*pax->errorf)(NiL, pax, 2, "%s: invalid %s format verification header name [size=%I*u]", ap->name, fp->name, sizeof(n), n);
178 zip_done(pax, ap);
184 if (ext && paxread(pax, ap, NiL, (off_t)ext, (off_t)0, 0) <= 0)
186 (*pax->errorf)(NiL, pax, 2, "%s: %s: invalid %s format verification header extended data [size=%I*u]", ap->name, mem->name, fp->name, sizeof(ext), ext);
187 zip_done(pax, ap);
190 if (com && paxread(pax, ap, NiL, (off_t)com, (off_t)0, 0) <= 0)
192 (*pax->errorf)(NiL, pax, 2, "%s: %s: invalid %s format verification header comment data [size=%I*u]", ap->name, mem->name, fp->name, sizeof(com), com);
193 zip_done(pax, ap);
198 if (paxseek(pax, ap, (off_t)0, SEEK_SET, 1))
200 (*pax->errorf)(NiL, pax, 2, "%s: %s central header reposition error", ap->name, fp->name);
201 zip_done(pax, ap);
205 ar->pax = pax;
207 codexinit(&ar->codexdisc, pax->errorf);
212 zip_getheader(Pax_t* pax, register Paxarchive_t* ap, register Paxfile_t* f)
223 while (hdr = paxget(pax, ap, -(num = ZIP_LOC_HEADER), NiL))
230 paxunread(pax, ap, hdr, num);
232 if (!(hdr = paxget(pax, ap, -num, NiL)))
234 f->name = paxstash(pax, &ap->stash.head, NiL, n);
244 f->st->st_mode &= pax->modemask;
248 f->st->st_uid = pax->uid;
249 f->st->st_gid = pax->gid;
278 if (!f->st->st_size || (m = swapget(3, &hdr[ZIP_LOC_METHOD], 2)) == ZIP_COPY || (pax->test & 2))
284 (*pax->errorf)(NiL, pax, -1, "archive=%s name=%s method=%s", ap->name, f->name, ar->method);
287 paxunread(pax, ap, hdr, num);
288 if (paxread(pax, ap, NiL, (off_t)ZIP_EXT_HEADER, (off_t)0, 0) <= 0)
290 (*pax->errorf)(NiL, pax, 2, "%s: invalid %s format verification header", ap->name, ap->format->name);
295 paxunread(pax, ap, hdr, num);
296 if (paxseek(pax, ap, (off_t)0, SEEK_CUR, 0) == ar->end)
297 paxseek(pax, ap, (off_t)0, SEEK_END, 1);
305 zip_getdata(Pax_t* pax, register Paxarchive_t* ap, register Paxfile_t* f, int fd)
317 pos = paxseek(pax, ap, 0, SEEK_CUR, 0) + f->st->st_size;
321 else if (sp = paxpart(pax, ap, f->st->st_size))
324 (*pax->errorf)(NiL, pax, 2, "%s: %s: cannot decode method %s", ap->name, f->name, ar->method);
329 if ((n = sfread(sp, pax->buf, sizeof(pax->buf))) < 0)
331 (*pax->errorf)(NiL, pax, 2, "%s: %s: unexpected EOF", ap->name, f->name);
337 (*pax->errorf)(NiL, pax, 2, "%s: %s: checksum discipline error", ap->name, f->name);
338 else if (!paxchecksum(pax, ap, f, ar->checksum, sum.num))
342 if (paxdata(pax, ap, f, fd, pax->buf, n))
348 if (paxseek(pax, ap, pos, SEEK_SET, 0) != pos)
350 (*pax->errorf)(NiL, pax, 2, "%s: %s: cannot seek past %s format data", ap->name, f->name, ap->format->name);