Lines Matching refs:ent

105 rm(State_t* state, register FTSENT* ent)  in rm()  argument
112 if (ent->fts_info == FTS_NS || ent->fts_info == FTS_ERR || ent->fts_info == FTS_SLNONE) in rm()
115 error(2, "%s: not found", ent->fts_path); in rm()
117 else if (state->fs3d && iview(ent->fts_statp)) in rm()
118 fts_set(NiL, ent, FTS_SKIP); in rm()
119 else switch (ent->fts_info) in rm()
125 if (!chmod(ent->fts_name, (ent->fts_statp->st_mode & S_IPERM)|S_IRWXU)) in rm()
127 fts_set(NiL, ent, FTS_AGAIN); in rm()
133 error(2, "%s: cannot %s directory", ent->fts_path, (ent->fts_info & FTS_NR) ? "read" : "search"); in rm()
136 fts_set(NiL, ent, FTS_SKIP); in rm()
137 nonempty(ent); in rm()
141 path = ent->fts_name; in rm()
142 if (path[0] == '.' && (!path[1] || path[1] == '.' && !path[2]) && (ent->fts_level > 0 || path[1])) in rm()
144 fts_set(NiL, ent, FTS_SKIP); in rm()
146 error(2, "%s: cannot remove", ent->fts_path); in rm()
153 fts_set(NiL, ent, FTS_SKIP); in rm()
154 error(2, "%s: directory", ent->fts_path); in rm()
157 if (!beenhere(ent)) in rm()
159 if (state->unconditional && (ent->fts_statp->st_mode ^ S_IRWXU)) in rm()
160 chmod(path, (ent->fts_statp->st_mode & S_IPERM)|S_IRWXU); in rm()
161 if (ent->fts_level > 0) in rm()
165 if (ent->fts_accpath == ent->fts_name || !(s = strrchr(ent->fts_accpath, '/'))) in rm()
169 path = ent->fts_accpath; in rm()
175 …v = st.st_nlink <= 2 || st.st_ino == ent->fts_parent->fts_statp->st_ino && st.st_dev == ent->fts_p… in rm()
183 … if ((v = astquery(-1, "remove directory %s? ", ent->fts_path)) < 0 || sh_checksig(state->context)) in rm()
187 fts_set(NiL, ent, FTS_SKIP); in rm()
188 nonempty(ent); in rm()
191 if (ent->fts_info == FTS_D) in rm()
196 ent->fts_info = FTS_DC; in rm()
197 error(1, "%s: hard link to directory", ent->fts_path); in rm()
200 else if (ent->fts_info == FTS_D) in rm()
204 if (isempty(ent) || state->directory) in rm()
206 path = ent->fts_name; in rm()
209 path = ent->fts_accpath; in rm()
211 sfputr(sfstdout, ent->fts_path, '\n'); in rm()
212 if ((ent->fts_info == FTS_DC || state->directory) ? remove(path) : rmdir(path)) in rm()
221 if (ent->fts_info == FTS_DP && !beenhere(ent)) in rm()
223 retry(ent); in rm()
224 fts_set(NiL, ent, FTS_AGAIN); in rm()
229 nonempty(ent); in rm()
231 error(ERROR_SYSTEM|2, "%s: directory not removed", ent->fts_path); in rm()
238 error(2, "%s: cannot remove", ent->fts_path); in rm()
244 nonempty(ent); in rm()
246 error(2, "%s: directory not removed", ent->fts_path); in rm()
252 path = ent->fts_accpath; in rm()
254 sfputr(sfstdout, ent->fts_path, '\n'); in rm()
257 if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 0 || sh_checksig(state->context)) in rm()
261 nonempty(ent); in rm()
265 else if (!state->force && state->terminal && S_ISREG(ent->fts_statp->st_mode)) in rm()
280 ent->fts_statp->st_uid != state->uid ? "``not owner''" : in rm()
281 fmtmode(ent->fts_statp->st_mode & S_IPERM, 0) + 1, ent->fts_path)) < 0 || in rm()
286 nonempty(ent); in rm()
294 if (state->clobber && S_ISREG(ent->fts_statp->st_mode) && ent->fts_statp->st_size > 0) in rm()
297 error(ERROR_SYSTEM|2, "%s: cannot clear data", ent->fts_path); in rm()
300 off_t c = ent->fts_statp->st_size; in rm()
306 error(ERROR_SYSTEM|2, "%s: data clear error", ent->fts_path); in rm()
320 nonempty(ent); in rm()
327 error(ERROR_SYSTEM|2, "%s: not removed", ent->fts_path); in rm()
343 FTSENT* ent; in b_rm() local
416 while (!sh_checksig(context) && (ent = fts_read(fts)) && !rm(&state, ent)); in b_rm()