Lines Matching refs:ent

218 visit(State_t* state, register FTSENT* ent)  in visit()  argument
237 if (ent->fts_info == FTS_DC) in visit()
239 error(2, "%s: directory causes cycle", ent->fts_path); in visit()
240 fts_set(NiL, ent, FTS_SKIP); in visit()
243 if (ent->fts_level == 0) in visit()
245 base = ent->fts_name; in visit()
246 len = ent->fts_namelen; in visit()
251 state->presiz = ent->fts_pathlen; in visit()
257 state->presiz -= base - ent->fts_name; in visit()
258 base = ent->fts_name + len; in visit()
259 while (base > ent->fts_name && *(base - 1) == '/') in visit()
261 while (base > ent->fts_name && *(base - 1) != '/') in visit()
263 len -= base - ent->fts_name; in visit()
270 base = ent->fts_path + state->presiz + 1; in visit()
271 len = ent->fts_pathlen - state->presiz - 1; in visit()
278 if (state->hierarchy && ent->fts_level == 0 && strchr(base, '/')) in visit()
296 … error(ERROR_SYSTEM|2, "%s: cannot create directory -- %s ignored", state->path, ent->fts_path); in visit()
297 fts_set(NiL, ent, FTS_SKIP); in visit()
306 switch (ent->fts_info) in visit()
309 …if (state->preserve && state->op != LN || ent->fts_level > 0 && (ent->fts_statp->st_mode & S_IRWXU… in visit()
311 if (len && ent->fts_level > 0) in visit()
319 …if ((ent->fts_statp->st_mode & S_IPERM) != (st.st_mode & S_IPERM) && chmod(state->path, ent->fts_s… in visit()
322 preserve(state, state->path, &st, ent->fts_statp); in visit()
331 fts_set(NiL, ent, FTS_SKIP); in visit()
333 error(1, "%s: directory -- copying as plain file", ent->fts_path); in visit()
336 error(2, "%s: cannot link directory", ent->fts_path); in visit()
340 else switch (ent->fts_info) in visit()
343 error(2, "%s: cannot read directory", ent->fts_path); in visit()
346 error(2, "%s: cannot search directory", ent->fts_path); in visit()
347 fts_set(NiL, ent, FTS_SKIP); in visit()
357 error(2, "%s: not a directory -- %s ignored", state->path, ent->fts_path); in visit()
361 …else if (mkdir(state->path, (ent->fts_statp->st_mode & S_IPERM)|(ent->fts_info == FTS_D ? S_IRWXU … in visit()
363 error(ERROR_SYSTEM|2, "%s: cannot create directory -- %s ignored", state->path, ent->fts_path); in visit()
364 fts_set(NiL, ent, FTS_SKIP); in visit()
380 error(2, "%s: not found", ent->fts_path); in visit()
388 error(2, "%s: cannot copy non-terminal symbolic link", ent->fts_path); in visit()
398 …else if (state->update && !S_ISDIR(st.st_mode) && (unsigned long)ent->fts_statp->st_mtime < (unsig… in visit()
400 fts_set(NiL, ent, FTS_SKIP); in visit()
409 if (st.st_dev == ent->fts_statp->st_dev && st.st_ino == ent->fts_statp->st_ino) in visit()
422 error(2, "%s: identical to %s", state->path, ent->fts_path); in visit()
432 rm = state->op == LN || ent->fts_info == FTS_SL; in visit()
535 if (!rename(ent->fts_path, state->path)) in visit()
544 if (errno != EXDEV && (rm || S_ISDIR(ent->fts_statp->st_mode))) in visit()
546 error(ERROR_SYSTEM|2, "%s: cannot rename to %s", ent->fts_path, state->path); in visit()
554 if (S_ISLNK(ent->fts_statp->st_mode)) in visit()
556 if ((n = pathgetlink(ent->fts_path, state->text, sizeof(state->text) - 1)) < 0) in visit()
558 error(ERROR_SYSTEM|2, "%s: cannot read symbolic link text", ent->fts_path); in visit()
564 error(ERROR_SYSTEM|2, "%s: cannot copy symbolic link to %s", ent->fts_path, state->path); in visit()
568 else if (state->op == CP || S_ISREG(ent->fts_statp->st_mode) || S_ISDIR(ent->fts_statp->st_mode)) in visit()
570 if (ent->fts_statp->st_size > 0 && (rfd = open(ent->fts_path, O_RDONLY|O_BINARY)) < 0) in visit()
572 error(ERROR_SYSTEM|2, "%s: cannot read", ent->fts_path); in visit()
575 …else if ((wfd = open(state->path, st.st_mode ? (state->wflags & ~O_EXCL) : state->wflags, ent->fts… in visit()
578 if (ent->fts_statp->st_size > 0) in visit()
582 else if (ent->fts_statp->st_size > 0) in visit()
586 error(ERROR_SYSTEM|2, "%s: %s read stream error", ent->fts_path, state->path); in visit()
595 error(ERROR_SYSTEM|2, "%s: %s write stream error", ent->fts_path, state->path); in visit()
610 …error(ERROR_SYSTEM|2, "%s: %s %s error", ent->fts_path, state->path, n == 1 ? ERROR_translate(0, 0… in visit()
617 …else if (S_ISBLK(ent->fts_statp->st_mode) || S_ISCHR(ent->fts_statp->st_mode) || S_ISFIFO(ent->fts… in visit()
619 if (mknod(state->path, ent->fts_statp->st_mode, idevice(ent->fts_statp))) in visit()
621 error(ERROR_SYSTEM|2, "%s: cannot copy special file to %s", ent->fts_path, state->path); in visit()
627 …error(2, "%s: cannot copy -- unknown file type 0%o", ent->fts_path, S_ITYPE(ent->fts_statp->st_mod… in visit()
632 if (ent->fts_info != FTS_SL) in visit()
638 …if ((ent->fts_statp->st_mode & state->perm) != (st.st_mode & state->perm) && chmod(state->path, en… in visit()
640 preserve(state, state->path, &st, ent->fts_statp); in visit()
643 if (state->op == MV && remove(ent->fts_path)) in visit()
644 error(ERROR_SYSTEM|1, "%s: cannot remove", ent->fts_path); in visit()
648 if ((*state->link)(ent->fts_path, state->path)) in visit()
649 error(ERROR_SYSTEM|2, "%s: cannot link to %s", ent->fts_path, state->path); in visit()
663 FTSENT* ent; in b_cp() local
925 while (!sh_checksig(context) && (ent = fts_read(fts)) && !visit(state, ent)); in b_cp()