Lines Matching refs:ent

236 visit(State_t* state, register FTSENT* ent)  in visit()  argument
255 if (ent->fts_info == FTS_DC) in visit()
257 error(2, "%s: directory causes cycle", ent->fts_path); in visit()
258 fts_set(NiL, ent, FTS_SKIP); in visit()
261 if (ent->fts_level == 0) in visit()
263 base = ent->fts_name; in visit()
264 len = ent->fts_namelen; in visit()
269 state->presiz = ent->fts_pathlen; in visit()
275 state->presiz -= base - ent->fts_name; in visit()
276 base = ent->fts_name + len; in visit()
277 while (base > ent->fts_name && *(base - 1) == '/') in visit()
279 while (base > ent->fts_name && *(base - 1) != '/') in visit()
281 len -= base - ent->fts_name; in visit()
288 base = ent->fts_path + state->presiz + 1; in visit()
289 len = ent->fts_pathlen - state->presiz - 1; in visit()
296 if (state->hierarchy && ent->fts_level == 0 && strchr(base, '/')) in visit()
314 … error(ERROR_SYSTEM|2, "%s: cannot create directory -- %s ignored", state->path, ent->fts_path); in visit()
315 fts_set(NiL, ent, FTS_SKIP); in visit()
324 switch (ent->fts_info) in visit()
327 …if (state->preserve && state->op != LN || ent->fts_level > 0 && (ent->fts_statp->st_mode & S_IRWXU… in visit()
329 if (len && ent->fts_level > 0) in visit()
337 …if ((ent->fts_statp->st_mode & S_IPERM) != (st.st_mode & S_IPERM) && chmod(state->path, ent->fts_s… in visit()
340 preserve(state, state->path, &st, ent->fts_statp); in visit()
349 fts_set(NiL, ent, FTS_SKIP); in visit()
351 error(1, "%s: directory -- copying as plain file", ent->fts_path); in visit()
354 error(2, "%s: cannot link directory", ent->fts_path); in visit()
358 else switch (ent->fts_info) in visit()
361 error(2, "%s: cannot read directory", ent->fts_path); in visit()
364 error(2, "%s: cannot search directory", ent->fts_path); in visit()
365 fts_set(NiL, ent, FTS_SKIP); in visit()
375 error(2, "%s: not a directory -- %s ignored", state->path, ent->fts_path); in visit()
379 …else if (mkdir(state->path, (ent->fts_statp->st_mode & S_IPERM)|(ent->fts_info == FTS_D ? S_IRWXU … in visit()
381 error(ERROR_SYSTEM|2, "%s: cannot create directory -- %s ignored", state->path, ent->fts_path); in visit()
382 fts_set(NiL, ent, FTS_SKIP); in visit()
398 error(2, "%s: not found", ent->fts_path); in visit()
406 error(2, "%s: cannot copy non-terminal symbolic link", ent->fts_path); in visit()
416 …else if (state->update && !S_ISDIR(st.st_mode) && (unsigned long)ent->fts_statp->st_mtime < (unsig… in visit()
418 fts_set(NiL, ent, FTS_SKIP); in visit()
427 if (state->op != LN && st.st_dev == ent->fts_statp->st_dev && st.st_ino == ent->fts_statp->st_ino) in visit()
440 error(2, "%s: identical to %s", state->path, ent->fts_path); in visit()
450 rm = state->remove || ent->fts_info == FTS_SL; in visit()
558 if (!rename(ent->fts_path, state->path)) in visit()
567 if (errno != EXDEV && (rm || S_ISDIR(ent->fts_statp->st_mode))) in visit()
569 error(ERROR_SYSTEM|2, "%s: cannot rename to %s", ent->fts_path, state->path); in visit()
577 if (S_ISLNK(ent->fts_statp->st_mode)) in visit()
579 if ((n = pathgetlink(ent->fts_path, state->text, sizeof(state->text) - 1)) < 0) in visit()
581 error(ERROR_SYSTEM|2, "%s: cannot read symbolic link text", ent->fts_path); in visit()
587 error(ERROR_SYSTEM|2, "%s: cannot copy symbolic link to %s", ent->fts_path, state->path); in visit()
591 else if (state->op == CP || S_ISREG(ent->fts_statp->st_mode) || S_ISDIR(ent->fts_statp->st_mode)) in visit()
593 if (ent->fts_statp->st_size > 0 && (rfd = open(ent->fts_path, O_RDONLY|O_BINARY|O_cloexec)) < 0) in visit()
595 error(ERROR_SYSTEM|2, "%s: cannot read", ent->fts_path); in visit()
598 …>path, (st.st_mode ? (state->wflags & ~O_EXCL) : state->wflags)|O_cloexec, ent->fts_statp->st_mode… in visit()
601 if (ent->fts_statp->st_size > 0) in visit()
605 else if (ent->fts_statp->st_size > 0) in visit()
609 error(ERROR_SYSTEM|2, "%s: %s read stream error", ent->fts_path, state->path); in visit()
616 error(ERROR_SYSTEM|2, "%s: %s write stream error", ent->fts_path, state->path); in visit()
632 …error(ERROR_SYSTEM|2, "%s: %s %s error", ent->fts_path, state->path, n == 1 ? ERROR_translate(0, 0… in visit()
639 …else if (S_ISBLK(ent->fts_statp->st_mode) || S_ISCHR(ent->fts_statp->st_mode) || S_ISFIFO(ent->fts… in visit()
641 if (mknod(state->path, ent->fts_statp->st_mode, idevice(ent->fts_statp))) in visit()
643 error(ERROR_SYSTEM|2, "%s: cannot copy special file to %s", ent->fts_path, state->path); in visit()
649 …error(2, "%s: cannot copy -- unknown file type 0%o", ent->fts_path, S_ITYPE(ent->fts_statp->st_mod… in visit()
654 if (ent->fts_info != FTS_SL) in visit()
660 …reserve & PRESERVE_PERM) && (ent->fts_statp->st_mode & state->perm) != (st.st_mode & state->perm) … in visit()
663 preserve(state, state->path, &st, ent->fts_statp); in visit()
666 if (state->op == MV && remove(ent->fts_path)) in visit()
667 error(ERROR_SYSTEM|1, "%s: cannot remove", ent->fts_path); in visit()
671 if ((*state->link)(ent->fts_path, state->path)) in visit()
672 error(ERROR_SYSTEM|2, "%s: cannot link to %s", ent->fts_path, state->path); in visit()
686 FTSENT* ent; in b_cp() local
988 while (!sh_checksig(context) && (ent = fts_read(fts)) && !visit(state, ent)); in b_cp()