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)
132 else if (!state->force)
145 if (!state->force)
151 if (!state->recursive)
159 if (state->unconditional && (ent->fts_statp->st_mode ^ S_IRWXU))
181 if (state->interactive)
183 if ((v = astquery(-1, "remove directory %s? ", ent->fts_path)) < 0 || sh_checksig(state->context))
204 if (isempty(ent) || state->directory)
210 if (state->verbose)
212 if ((ent->fts_info == FTS_DC || state->directory) ? remove(path) : rmdir(path))
230 if (!state->force)
237 else if (!state->force)
245 if (!state->force)
253 if (state->verbose)
255 if (state->interactive)
257 if ((v = astquery(-1, "remove %s? ", ent->fts_path)) < 0 || sh_checksig(state->context))
265 else if (!state->force && state->terminal && S_ISREG(ent->fts_statp->st_mode))
280 ent->fts_statp->st_uid != state->uid ? "``not owner''" :
282 sh_checksig(state->context))
294 if (state->clobber && S_ISREG(ent->fts_statp->st_mode) && ent->fts_statp->st_size > 0)
304 if (write(n, state->buf, sizeof(state->buf)) != sizeof(state->buf))
309 if (c <= sizeof(state->buf))
311 c -= sizeof(state->buf);
326 if (!state->force || state->interactive)
341 State_t state;
347 memset(&state, 0, sizeof(state));
348 state.context = context;
349 state.fs3d = fs3d(FS3D_TEST);
350 state.terminal = isatty(0);
356 state.directory = 1;
359 state.force = 1;
360 state.interactive = 0;
363 state.interactive = 1;
364 state.force = 0;
368 state.recursive = 1;
372 state.clobber = 1;
378 state.unconditional = 1;
381 state.verbose = 1;
402 if (state.interactive)
403 state.verbose = 0;
404 state.uid = geteuid();
405 state.unconditional = state.unconditional && state.recursive && state.force;
406 if (state.recursive && state.fs3d)
408 set3d = state.fs3d;
409 state.fs3d = 0;
416 while (!sh_checksig(context) && (ent = fts_read(fts)) && !rm(&state, ent));
419 else if (!state.force)