Lines Matching refs:state

82 typedef struct State_s			/* program state		*/
105 rm(State_t* state, register FTSENT* ent)
114 if (!state->force)
117 else if (state->fs3d && iview(ent->fts_statp))
123 if (state->unconditional)
134 else if (!state->force)
147 if (!state->force)
153 if (!state->recursive)
161 if (state->unconditional && (ent->fts_statp->st_mode & S_IRWXU) != S_IRWXU)
183 if (state->interactive)
185 if ((v = astquery(-1, "remove directory %s? ", ent->fts_path)) < 0 || sh_checksig(state->context))
206 if (isempty(ent) || state->directory)
212 if (state->verbose)
214 if ((ent->fts_info == FTS_DC || state->directory) ? remove(path) : rmdir(path))
232 if (!state->force)
239 else if (!state->force)
247 if (!state->force)
255 if (state->verbose)
257 if (state->interactive)
259 if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 0 || sh_checksig(state->context))
267 else if (!state->force && state->terminal && eaccess(path, W_OK))
273 ent->fts_statp->st_uid != state->uid ? "``not owner''" :
275 sh_checksig(state->context))
284 if (state->clobber && S_ISREG(ent->fts_statp->st_mode) && ent->fts_statp->st_size > 0)
294 if (write(n, state->buf, sizeof(state->buf)) != sizeof(state->buf))
299 if (c <= sizeof(state->buf))
301 c -= sizeof(state->buf);
316 if (!state->force || state->interactive)
331 State_t state;
337 memset(&state, 0, sizeof(state));
338 state.context = context;
339 state.fs3d = fs3d(FS3D_TEST);
340 state.terminal = isatty(0);
346 state.directory = 1;
349 state.force = 1;
350 state.interactive = 0;
353 state.interactive = 1;
354 state.force = 0;
358 state.recursive = 1;
362 state.clobber = 1;
368 state.unconditional = 1;
371 state.verbose = 1;
392 if (state.interactive)
393 state.verbose = 0;
394 state.uid = geteuid();
395 state.unconditional = state.unconditional && state.recursive && state.force;
396 if (state.recursive && state.fs3d)
398 set3d = state.fs3d;
399 state.fs3d = 0;
406 while (!sh_checksig(context) && (ent = fts_read(fts)) && !rm(&state, ent));
409 else if (!state.force)