Lines Matching refs:plan
69 switch (plan->flags) { \
81 static int64_t find_parsenum(PLAN *, const char *, const char *, char *);
82 static void run_f_exec(PLAN *);
83 int f_always_true(PLAN *, FTSENT *);
84 int f_amin(PLAN *, FTSENT *);
85 int f_anewer(PLAN *, FTSENT *);
86 int f_asince(PLAN *, FTSENT *);
87 int f_atime(PLAN *, FTSENT *);
88 int f_cmin(PLAN *, FTSENT *);
89 int f_cnewer(PLAN *, FTSENT *);
90 int f_csince(PLAN *, FTSENT *);
91 int f_ctime(PLAN *, FTSENT *);
92 int f_delete(PLAN *, FTSENT *);
93 int f_empty(PLAN *, FTSENT *);
94 int f_exec(PLAN *, FTSENT *);
95 int f_execdir(PLAN *, FTSENT *);
96 int f_false(PLAN *, FTSENT *);
97 int f_flags(PLAN *, FTSENT *);
98 int f_fprint(PLAN *, FTSENT *);
99 int f_fstype(PLAN *, FTSENT *);
100 int f_group(PLAN *, FTSENT *);
101 int f_iname(PLAN *, FTSENT *);
102 int f_inum(PLAN *, FTSENT *);
103 int f_links(PLAN *, FTSENT *);
104 int f_ls(PLAN *, FTSENT *);
105 int f_mindepth(PLAN *, FTSENT *);
106 int f_maxdepth(PLAN *, FTSENT *);
107 int f_mmin(PLAN *, FTSENT *);
108 int f_mtime(PLAN *, FTSENT *);
109 int f_name(PLAN *, FTSENT *);
110 int f_newer(PLAN *, FTSENT *);
114 int f_newerBB(PLAN *, FTSENT *);
115 int f_newerBa(PLAN *, FTSENT *);
116 int f_newerBc(PLAN *, FTSENT *);
117 int f_newerBm(PLAN *, FTSENT *);
118 int f_newerBt(PLAN *, FTSENT *);
119 int f_neweraB(PLAN *, FTSENT *);
120 int f_newerac(PLAN *, FTSENT *);
121 int f_neweram(PLAN *, FTSENT *);
122 int f_newerca(PLAN *, FTSENT *);
123 int f_newercm(PLAN *, FTSENT *);
124 int f_newercB(PLAN *, FTSENT *);
125 int f_newermB(PLAN *, FTSENT *);
126 int f_newerma(PLAN *, FTSENT *);
127 int f_newermc(PLAN *, FTSENT *);
130 int f_nogroup(PLAN *, FTSENT *);
131 int f_nouser(PLAN *, FTSENT *);
132 int f_path(PLAN *, FTSENT *);
133 int f_perm(PLAN *, FTSENT *);
134 int f_print(PLAN *, FTSENT *);
135 int f_print0(PLAN *, FTSENT *);
136 int f_printx(PLAN *, FTSENT *);
137 int f_prune(PLAN *, FTSENT *);
138 int f_regex(PLAN *, FTSENT *);
139 int f_since(PLAN *, FTSENT *);
140 int f_size(PLAN *, FTSENT *);
141 int f_type(PLAN *, FTSENT *);
142 int f_user(PLAN *, FTSENT *);
143 int f_not(PLAN *, FTSENT *);
144 int f_or(PLAN *, FTSENT *);
145 static PLAN *c_regex_common(char ***, int, enum ntype, bool);
146 static PLAN *palloc(enum ntype, int (*)(PLAN *, FTSENT *));
157 find_parsenum(PLAN *plan, const char *option, const char *vp, char *endch)
168 plan->flags = F_GREATER;
172 plan->flags = F_LESSTHAN;
175 plan->flags = F_EQUAL;
200 find_parsedate(PLAN *plan, const char *option, const char *vp)
228 f_amin(PLAN *plan, FTSENT *entry)
231 SECSPERMIN - 1) / SECSPERMIN, plan->t_data);
234 PLAN *
238 PLAN *new;
257 f_anewer(PLAN *plan, FTSENT *entry)
260 return timespeccmp(&entry->fts_statp->st_atim, &plan->ts_data, >);
263 PLAN *
267 PLAN *new;
286 f_asince(PLAN *plan, FTSENT *entry)
288 COMPARE(entry->fts_statp->st_atime, plan->t_data);
291 PLAN *
295 PLAN *new;
313 f_atime(PLAN *plan, FTSENT *entry)
316 SECSPERDAY - 1) / SECSPERDAY, plan->t_data);
319 PLAN *
323 PLAN *new;
341 f_cmin(PLAN *plan, FTSENT *entry)
344 SECSPERMIN - 1) / SECSPERMIN, plan->t_data);
347 PLAN *
351 PLAN *new;
370 f_cnewer(PLAN *plan, FTSENT *entry)
373 return timespeccmp(&entry->fts_statp->st_ctim, &plan->ts_data, >);
376 PLAN *
380 PLAN *new;
399 f_csince(PLAN *plan, FTSENT *entry)
401 COMPARE(entry->fts_statp->st_ctime, plan->t_data);
404 PLAN *
408 PLAN *new;
426 f_ctime(PLAN *plan, FTSENT *entry)
429 SECSPERDAY - 1) / SECSPERDAY, plan->t_data);
432 PLAN *
436 PLAN *new;
453 f_delete(PLAN *plan __unused, FTSENT *entry)
492 PLAN *
513 f_always_true(PLAN *plan, FTSENT *entry)
519 PLAN *
533 f_empty(PLAN *plan, FTSENT *entry)
560 PLAN *
590 f_exec(PLAN *plan, FTSENT *entry)
597 if (plan->flags & F_PLUSSET) {
603 if (plan->ep_p + l < plan->ep_ebp) {
604 plan->ep_bxp[plan->ep_narg++] =
605 strcpy(plan->ep_p, entry->fts_path);
606 plan->ep_p += l + 1;
608 if (plan->ep_narg == plan->ep_maxargs)
609 run_f_exec(plan);
616 run_f_exec(plan);
617 if ((plan->ep_p + l < plan->ep_ebp)) {
618 plan->ep_bxp[plan->ep_narg++]
619 = strcpy(plan->ep_p, entry->fts_path);
620 plan->ep_p += l + 1;
626 for (cnt = 0; plan->e_argv[cnt]; ++cnt)
627 if (plan->e_len[cnt])
628 brace_subst(plan->e_orig[cnt],
629 &plan->e_argv[cnt],
631 &plan->e_len[cnt]);
632 if (plan->flags & F_NEEDOK && !queryuser(plan->e_argv))
649 execvp(plan->e_argv[0], plan->e_argv);
650 warn("%s", plan->e_argv[0]);
660 run_f_exec(PLAN *plan)
666 plan->ep_bxp[plan->ep_narg] = NULL;
682 execvp(plan->e_argv[0], plan->e_argv);
683 warn("%s", plan->e_argv[0]);
688 plan->ep_narg = 0;
689 plan->ep_bxp[plan->ep_narg] = NULL;
691 plan->ep_p = plan->ep_bbp;
692 *plan->ep_p = '\0';
705 plan->ep_rval = rval;
719 PLAN *
722 PLAN *new; /* node returned */
836 f_execdir(PLAN *plan, FTSENT *entry)
849 for (cnt = 0; plan->e_argv[cnt]; ++cnt)
850 if (plan->e_len[cnt])
851 brace_subst(plan->e_orig[cnt], &plan->e_argv[cnt],
852 file, &plan->e_len[cnt]);
863 execvp(plan->e_argv[0], plan->e_argv);
864 warn("%s", plan->e_argv[0]);
878 PLAN *
881 PLAN *new; /* node returned */
921 PLAN *
925 PLAN *new;
946 f_false(PLAN *plan, FTSENT *entry)
952 PLAN *
963 f_flags(PLAN *plan, FTSENT *entry)
968 if (plan->flags == F_ATLEAST)
969 return ((plan->f_data | flags) == flags);
971 return (flags == plan->f_data);
975 PLAN *
979 PLAN *new;
1006 PLAN *
1020 f_fprint(PLAN *plan, FTSENT *entry)
1023 if (-1 == fprintf(plan->fprint_file, "%s\n", entry->fts_path))
1032 PLAN *
1035 PLAN *new;
1054 f_fstype(PLAN *plan, FTSENT *entry)
1104 switch (plan->flags) {
1106 return (val & plan->mt_data);
1108 return (strncmp(fstype, plan->c_data, sizeof(fstype)) == 0);
1114 PLAN *
1118 PLAN *new;
1155 f_group(PLAN *plan, FTSENT *entry)
1158 COMPARE(entry->fts_statp->st_gid, plan->g_data);
1161 PLAN *
1165 PLAN *new;
1195 f_inum(PLAN *plan, FTSENT *entry)
1198 COMPARE(entry->fts_statp->st_ino, plan->i_data);
1201 PLAN *
1205 PLAN *new;
1221 f_links(PLAN *plan, FTSENT *entry)
1224 COMPARE(entry->fts_statp->st_nlink, plan->l_data);
1227 PLAN *
1231 PLAN *new;
1247 f_ls(PLAN *plan, FTSENT *entry)
1254 PLAN *
1271 f_maxdepth(PLAN *plan, FTSENT *entry)
1275 if (entry->fts_level >= plan->max_data)
1277 return (entry->fts_level <= plan->max_data);
1280 PLAN *
1284 PLAN *new;
1299 f_mindepth(PLAN *plan, FTSENT *entry)
1301 return (entry->fts_level >= plan->min_data);
1304 PLAN *
1308 PLAN *new;
1323 f_mmin(PLAN *plan, FTSENT *entry)
1326 SECSPERMIN, plan->t_data);
1329 PLAN *
1333 PLAN *new;
1351 f_mtime(PLAN *plan, FTSENT *entry)
1354 SECSPERDAY, plan->t_data);
1357 PLAN *
1361 PLAN *new;
1379 f_name(PLAN *plan, FTSENT *entry)
1382 return (!fnmatch(plan->c_data, entry->fts_name, 0));
1385 PLAN *
1389 PLAN *new;
1404 f_iname(PLAN *plan, FTSENT *entry)
1406 return (!fnmatch(plan->c_data, entry->fts_name, FNM_CASEFOLD));
1409 PLAN *
1413 PLAN *new;
1429 f_newer(PLAN *plan, FTSENT *entry)
1432 return timespeccmp(&entry->fts_statp->st_mtim, &plan->ts_data, >);
1435 PLAN *
1439 PLAN *new;
1459 f_nogroup(PLAN *plan, FTSENT *entry)
1465 PLAN *
1480 f_nouser(PLAN *plan, FTSENT *entry)
1486 PLAN *
1501 f_path(PLAN *plan, FTSENT *entry)
1504 return (!fnmatch(plan->c_data, entry->fts_path, 0));
1507 PLAN *
1511 PLAN *new;
1527 f_perm(PLAN *plan, FTSENT *entry)
1533 if (plan->flags == F_ATLEAST)
1534 return ((plan->m_data | mode) == mode);
1536 return (mode == plan->m_data);
1540 PLAN *
1544 PLAN *new;
1572 f_print(PLAN *plan, FTSENT *entry)
1580 f_print0(PLAN *plan, FTSENT *entry)
1589 f_printx(PLAN *plan, FTSENT *entry)
1606 PLAN *
1615 PLAN *
1624 PLAN *
1639 f_prune(PLAN *plan, FTSENT *entry)
1646 PLAN *
1661 f_regex(PLAN *plan, FTSENT *entry)
1664 return (regexec(&plan->regexp_data, entry->fts_path, 0, NULL, 0) == 0);
1667 static PLAN *
1674 PLAN *new;
1700 PLAN *
1707 PLAN *
1720 f_since(PLAN *plan, FTSENT *entry)
1722 COMPARE(entry->fts_statp->st_mtime, plan->t_data);
1725 PLAN *
1729 PLAN *new;
1751 f_size(PLAN *plan, FTSENT *entry)
1757 COMPARE(size, plan->o_data);
1760 PLAN *
1764 PLAN *new;
1786 f_type(PLAN *plan, FTSENT *entry)
1789 return ((entry->fts_statp->st_mode & S_IFMT) == plan->m_data);
1792 PLAN *
1796 PLAN *new;
1850 f_user(PLAN *plan, FTSENT *entry)
1853 COMPARE(entry->fts_statp->st_uid, plan->u_data);
1856 PLAN *
1860 PLAN *new;
1890 PLAN *
1904 f_expr(PLAN *plan, FTSENT *entry)
1906 PLAN *p;
1910 for (p = plan->p_data[0];
1920 PLAN *
1924 return (palloc(N_OPENPAREN, (int (*)(PLAN *, FTSENT *))-1));
1927 PLAN *
1931 return (palloc(N_CLOSEPAREN, (int (*)(PLAN *, FTSENT *))-1));
1940 f_not(PLAN *plan, FTSENT *entry)
1942 PLAN *p;
1946 for (p = plan->p_data[0];
1951 PLAN *
1965 f_or(PLAN *plan, FTSENT *entry)
1967 PLAN *p;
1971 for (p = plan->p_data[0];
1977 for (p = plan->p_data[1];
1982 PLAN *
1989 PLAN *
1999 * Check and see if the specified plan has any residual state,
2008 plan_cleanup(PLAN *plan, void *arg)
2010 if (plan->type==N_EXEC && plan->ep_narg)
2011 run_f_exec(plan);
2013 return plan->ep_rval; /* Passed save exit-status up chain */
2016 static PLAN *
2017 palloc(enum ntype t, int (*f)(PLAN *, FTSENT *))
2019 PLAN *new;
2021 if ((new = malloc(sizeof(PLAN))) == NULL)
2023 memset(new, 0, sizeof(PLAN));