Lines Matching defs:bsdtar
43 #include "bsdtar.h"
229 /* To be resilient when stdin is a pipe, bsdtar prefers to read from
289 set_chdir(struct bsdtar *bsdtar, const char *newdir)
301 free(bsdtar->pending_chdir);
302 bsdtar->pending_chdir = NULL;
304 if (bsdtar->pending_chdir == NULL)
306 bsdtar->pending_chdir = strdup(newdir);
309 char *old_pending = bsdtar->pending_chdir;
312 bsdtar->pending_chdir = malloc(new_len);
315 if (bsdtar->pending_chdir != NULL)
316 snprintf(bsdtar->pending_chdir, new_len, "%s/%s",
320 if (bsdtar->pending_chdir == NULL)
325 do_chdir(struct bsdtar *bsdtar)
327 if (bsdtar->pending_chdir == NULL)
330 if (chdir(bsdtar->pending_chdir) != 0) {
332 bsdtar->pending_chdir);
334 free(bsdtar->pending_chdir);
335 bsdtar->pending_chdir = NULL;
378 warn_strip_leading_char(struct bsdtar *bsdtar, const char *c)
380 if (!bsdtar->warned_lead_slash) {
384 bsdtar->warned_lead_slash = 1;
389 warn_strip_drive_letter(struct bsdtar *bsdtar)
391 if (!bsdtar->warned_lead_slash) {
395 bsdtar->warned_lead_slash = 1;
404 strip_absolute_path(struct bsdtar *bsdtar, const char *p)
423 warn_strip_drive_letter(bsdtar);
433 warn_strip_drive_letter(bsdtar);
447 warn_strip_leading_char(bsdtar, rp);
467 edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
478 r = apply_substitution(bsdtar, name, &subst_name, 0, 0);
496 r = apply_substitution(bsdtar, hardlinkname, &subst_name, 0, 1);
511 r = apply_substitution(bsdtar, archive_entry_symlink(entry), &subst_name, 1, 0);
524 if (bsdtar->strip_components > 0) {
525 name = strip_components(name, bsdtar->strip_components);
531 bsdtar->strip_components);
537 if ((bsdtar->flags & OPTFLAG_ABSOLUTE_PATHS) == 0) {
539 name = strip_absolute_path(bsdtar, name);
544 hardlinkname = strip_absolute_path(bsdtar, hardlinkname);
593 * that bsdtar can normalize paths and use fast strcmp() instead
631 struct bsdtar *bsdtar = (struct bsdtar *)_client_data;
634 if (bsdtar->ppbuff == NULL) {
635 bsdtar->ppbuff = malloc(PPBUFF_SIZE);
636 if (bsdtar->ppbuff == NULL)
640 bsdtar->ppbuff, PPBUFF_SIZE);
661 list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
681 if (!bsdtar->u_width) {
682 bsdtar->u_width = 6;
683 bsdtar->gs_width = 13;
699 if (w > bsdtar->u_width)
700 bsdtar->u_width = w;
701 fprintf(out, "%-*s ", (int)bsdtar->u_width, p);
728 if (w + strlen(tmp) >= bsdtar->gs_width)
729 bsdtar->gs_width = w+strlen(tmp)+1;
730 fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp);
741 fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y";
743 fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";