Home | History | Annotate | Download | only in posix

Lines Matching defs:new

71 static int flush_exec(struct dirtree *new, struct exec_range *aa)
79 if (aa->dir && new->parent) dl = (void *)&new->parent->extra;
85 if (aa->dir && new->parent) rc = fchdir(new->parent->data);
88 perror_msg("%s", new->name);
135 static void do_print(struct dirtree *new, char c)
137 char *s=dirtree_path(new, 0);
145 char *try, *new;
148 try = new = xstrdup(s);
149 for (; *s; s++) *(new++) = tolower(*s);
152 try = new = xmalloc(strlen(s)*2+1);
158 if (len < 1) *(new++) = *(s++);
167 len = wcrtomb(new, c, 0);
169 new += len;
172 *new = 0;
181 static int do_find(struct dirtree *new)
183 int pcount = 0, print = 0, not = 0, active = !!new, test = active, recurse;
190 if (new) {
191 if (new->parent) {
192 if (!dirtree_notdotdot(new)) return 0;
193 if (TT.xdev && new->st.st_dev != new->parent->st.st_dev) recurse = 0;
195 if (S_ISDIR(new->st.st_mode)) {
196 if (!new->again) {
200 for (n = new->parent; n; n = n->parent) {
201 if (n->st.st_ino==new->st.st_ino && n->st.st_dev==new->st.st_dev) {
202 error_msg("'%s': loop detected", s = dirtree_path(new, 0));
213 if (dl->prev == (void *)1 || !new->parent)
214 toys.exitval |= flush_exec(new, (void *)dl);
278 if (check) do_print(new, s[5] ? 0 : '\n');
281 if (check) if (getpwuid(new->st.st_uid)) test = 0;
283 if (check) if (getgrgid(new->st.st_gid)) test = 0;
285 if (check && S_ISDIR(new->st.st_dev) && !TT.depth) recurse = 0;
293 char *arg = ss[1], *path = 0, *name = new->name;
296 if (new && s[i] == 'p') name = path = dirtree_path(new, 0);
298 if (check || !new) {
299 name = strlower(new ? name : arg);
300 if (!new) {
316 m2 = new->st.st_dev & 07777;
327 if ((new->st.st_mode & S_IFMT) != types[i]) test = 0;
332 test = compare_numsign(TT.now - new->st.st_atime, 86400, ss[1]);
335 test = compare_numsign(TT.now - new->st.st_ctime, 86400, ss[1]);
338 test = compare_numsign(TT.now - new->st.st_mtime, 86400, ss[1]);
341 test = compare_numsign(new->st.st_size, 512, ss[1]);
343 if (check) test = compare_numsign(new->st.st_nlink, 0, ss[1]);
346 struct dirtree *dt = new;
370 if (!new && ss[1]) {
384 if (*s == 'u') test = new->st.st_uid == udl->u.uid;
385 else if (*s == 'g') test = new->st.st_gid == udl->u.gid;
387 test = new->st.st_mtim.tv_sec > udl->u.tm.tv_sec;
388 if (new->st.st_mtim.tv_sec == udl->u.tm.tv_sec)
389 test = new->st.st_mtim.tv_nsec > udl->u.tm.tv_nsec;
400 if (!new) {
447 // name is always a new malloc, so we can always free it.
448 name = aa->dir ? xstrdup(new->name) : dirtree_path(new, 0);
465 if (aa->dir && new->parent)
466 ddl = (struct double_list **)&new->parent->extra;
477 toys.exitval |= flush_exec(new, aa);
482 if (!aa->plus) test = flush_exec(new, aa);
500 if (new) {
502 if (!print && test) do_print(new, '\n');