Lines Matching refs:bsdtar

62 #include "bsdtar.h"
290 set_chdir(struct bsdtar *bsdtar, const char *newdir)
302 free(bsdtar->pending_chdir);
303 bsdtar->pending_chdir = NULL;
305 if (bsdtar->pending_chdir == NULL)
307 bsdtar->pending_chdir = strdup(newdir);
310 char *old_pending = bsdtar->pending_chdir;
312 bsdtar->pending_chdir = malloc(old_len + strlen(newdir) + 2);
315 if (bsdtar->pending_chdir != NULL)
316 sprintf(bsdtar->pending_chdir, "%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)
685 if (!bsdtar->u_width) {
686 bsdtar->u_width = 6;
687 bsdtar->gs_width = 13;
703 if (w > bsdtar->u_width)
704 bsdtar->u_width = w;
705 fprintf(out, "%-*s ", (int)bsdtar->u_width, p);
732 if (w + strlen(tmp) >= bsdtar->gs_width)
733 bsdtar->gs_width = w+strlen(tmp)+1;
734 fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp);
745 fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y";
747 fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";