Lines Matching refs:new

83 static int flush_exec(struct dirtree *new, struct exec_range *aa)  in flush_exec()  argument
96 if (aa->dir && new && new->parent) { in flush_exec()
98 rc = fchdir(new->parent->dirfd); in flush_exec()
101 perror_msg_raw(revert ? new->name : "."); in flush_exec()
151 static void do_print(struct dirtree *new, char c) in do_print() argument
153 char *s=dirtree_path(new, 0); in do_print()
160 static void execdir(struct dirtree *new, int flush) in execdir() argument
166 if (new && TT.topdir == -1) return; in execdir()
171 if (!aa->plus || (new && !aa->dir)) continue; in execdir()
177 toys.exitval |= flush_exec(new, aa); in execdir()
198 static int do_find(struct dirtree *new) in do_find() argument
200 int pcount = 0, print = 0, not = 0, active = !!new, test = active, recurse; in do_find()
207 if (new) { in do_find()
208 if (new->parent) { in do_find()
209 if (!dirtree_notdotdot(new)) return 0; in do_find()
210 if (TT.xdev && new->st.st_dev != new->parent->st.st_dev) recurse = 0; in do_find()
213 if (S_ISDIR(new->st.st_mode)) { in do_find()
215 if (!new->again) { in do_find()
218 for (n = new->parent; n; n = n->parent) { in do_find()
219 if (n->st.st_ino==new->st.st_ino && n->st.st_dev==new->st.st_dev) { in do_find()
220 error_msg("'%s': loop detected", s = dirtree_path(new, 0)); in do_find()
228 execdir(new, 0); in do_find()
234 execdir(new, 1); in do_find()
285 if (new && check) in do_find()
286 test = !unlinkat(dirtree_parentfd(new), new->name, in do_find()
287 S_ISDIR(new->st.st_mode) ? AT_REMOVEDIR : 0); in do_find()
304 if (check) do_print(new, s[5] ? 0 : '\n'); in do_find()
309 if (S_ISDIR(new->st.st_mode)) { in do_find()
310 int fd = openat(dirtree_parentfd(new), new->name, O_RDONLY); in do_find()
318 } else if (S_ISREG(new->st.st_mode)) { in do_find()
319 if (new->st.st_size) test = 0; in do_find()
323 if (check) if (bufgetpwuid(new->st.st_uid)) test = 0; in do_find()
325 if (check) if (bufgetgrgid(new->st.st_gid)) test = 0; in do_find()
327 if (check && S_ISDIR(new->st.st_mode) && !TT.depth) recurse = 0; in do_find()
336 char *arg = ss[1], *path = 0, *name = new ? new->name : arg; in do_find()
339 if (new && is_path) name = path = dirtree_path(new, 0); in do_find()
341 if ((check || !new) && name) name = strlower(name); in do_find()
342 if (!new) dlist_add(&TT.argdata, name); in do_find()
353 char *path = dirtree_path(new, 0), *context; in do_find()
367 m2 = new->st.st_mode & 07777; in do_find()
378 if ((new->st.st_mode & S_IFMT) != types[i]) test = 0; in do_find()
386 time_t thyme = (int []){new->st.st_atime, new->st.st_ctime, in do_find()
387 new->st.st_mtime}[stridx("acm", *s)]; in do_find()
399 if (check) test = compare_numsign(new->st.st_size, 512, ss[1]); in do_find()
401 if (check) test = compare_numsign(new->st.st_nlink, 0, ss[1]); in do_find()
403 if (check) test = compare_numsign(new->st.st_ino, 0, ss[1]); in do_find()
406 struct dirtree *dt = new; in do_find()
430 if (!new) { in do_find()
447 if (*s == 'u') test = new->st.st_uid == udl->u.uid; in do_find()
448 else if (*s == 'g') test = new->st.st_gid == udl->u.gid; in do_find()
450 test = new->st.st_mtim.tv_sec > udl->u.tm.tv_sec; in do_find()
451 if (new->st.st_mtim.tv_sec == udl->u.tm.tv_sec) in do_find()
452 test = new->st.st_mtim.tv_nsec > udl->u.tm.tv_nsec; in do_find()
464 if (!new) { in do_find()
504 name = aa->dir ? xstrdup(new->name) : dirtree_path(new, 0); in do_find()
531 toys.exitval |= flush_exec(new, aa); in do_find()
533 } else test = !flush_exec(new, aa); in do_find()
551 if (new) { in do_find()
553 if (!print && test) do_print(new, '\n'); in do_find()
555 if (S_ISDIR(new->st.st_mode)) execdir(new, 0); in do_find()