Lines Matching refs:new
82 static int flush_exec(struct dirtree *new, struct exec_range *aa) in flush_exec() argument
95 if (aa->dir && new && new->parent) { in flush_exec()
97 rc = fchdir(new->parent->dirfd); in flush_exec()
100 perror_msg_raw(revert ? new->name : "."); in flush_exec()
150 static void do_print(struct dirtree *new, char c) in do_print() argument
152 char *s=dirtree_path(new, 0); in do_print()
159 static void execdir(struct dirtree *new, int flush) in execdir() argument
165 if (new && TT.topdir == -1) return; in execdir()
170 if (!aa->plus || (new && !aa->dir)) continue; in execdir()
176 toys.exitval |= flush_exec(new, aa); in execdir()
197 static int do_find(struct dirtree *new) in do_find() argument
199 int pcount = 0, print = 0, not = 0, active = !!new, test = active, recurse; in do_find()
206 if (new) { in do_find()
207 if (new->parent) { in do_find()
208 if (!dirtree_notdotdot(new)) return 0; in do_find()
209 if (TT.xdev && new->st.st_dev != new->parent->st.st_dev) recurse = 0; in do_find()
212 if (S_ISDIR(new->st.st_mode)) { in do_find()
214 if (!new->again) { in do_find()
217 for (n = new->parent; n; n = n->parent) { in do_find()
218 if (n->st.st_ino==new->st.st_ino && n->st.st_dev==new->st.st_dev) { in do_find()
219 error_msg("'%s': loop detected", s = dirtree_path(new, 0)); in do_find()
227 execdir(new, 0); in do_find()
233 execdir(new, 1); in do_find()
284 if (new && check) in do_find()
285 test = !unlinkat(dirtree_parentfd(new), new->name, in do_find()
286 S_ISDIR(new->st.st_mode) ? AT_REMOVEDIR : 0); in do_find()
303 if (check) do_print(new, s[5] ? 0 : '\n'); in do_find()
306 if (check) if (getpwuid(new->st.st_uid)) test = 0; in do_find()
308 if (check) if (getgrgid(new->st.st_gid)) test = 0; in do_find()
310 if (check && S_ISDIR(new->st.st_mode) && !TT.depth) recurse = 0; in do_find()
318 char *arg = ss[1], *path = 0, *name = new ? new->name : arg; in do_find()
321 if (new && s[i] == 'p') name = path = dirtree_path(new, 0); in do_find()
323 if (check || !new) { in do_find()
325 if (!new) { in do_find()
343 m2 = new->st.st_mode & 07777; in do_find()
354 if ((new->st.st_mode & S_IFMT) != types[i]) test = 0; in do_find()
359 test = compare_numsign(TT.now - new->st.st_atime, 86400, ss[1]); in do_find()
362 test = compare_numsign(TT.now - new->st.st_ctime, 86400, ss[1]); in do_find()
365 test = compare_numsign(TT.now - new->st.st_mtime, 86400, ss[1]); in do_find()
368 test = compare_numsign(new->st.st_size, 512, ss[1]); in do_find()
370 if (check) test = compare_numsign(new->st.st_nlink, 0, ss[1]); in do_find()
373 test = compare_numsign(new->st.st_ino, 0, ss[1]); in do_find()
376 struct dirtree *dt = new; in do_find()
400 if (!new) { in do_find()
417 if (*s == 'u') test = new->st.st_uid == udl->u.uid; in do_find()
418 else if (*s == 'g') test = new->st.st_gid == udl->u.gid; in do_find()
420 test = new->st.st_mtim.tv_sec > udl->u.tm.tv_sec; in do_find()
421 if (new->st.st_mtim.tv_sec == udl->u.tm.tv_sec) in do_find()
422 test = new->st.st_mtim.tv_nsec > udl->u.tm.tv_nsec; in do_find()
434 if (!new) { in do_find()
474 name = aa->dir ? xstrdup(new->name) : dirtree_path(new, 0); in do_find()
501 toys.exitval |= flush_exec(new, aa); in do_find()
503 } else test = flush_exec(new, aa); in do_find()
521 if (new) { in do_find()
523 if (!print && test) do_print(new, '\n'); in do_find()
525 if (S_ISDIR(new->st.st_mode)) execdir(new, 0); in do_find()