Lines Matching defs:action_data

700 static int eval_expr_log(struct expr *expr, struct action_data *action_data)
707 match = expr->atom.test->fn(&expr->atom, action_data);
712 match = !eval_expr_log(expr->unary_op.expr, action_data);
716 match = eval_expr_log(expr->expr_op.lhs, action_data);
721 match = eval_expr_log(expr->expr_op.rhs, action_data);
731 static int eval_expr(struct expr *expr, struct action_data *action_data)
737 match = expr->atom.test->fn(&expr->atom, action_data);
740 match = !eval_expr(expr->unary_op.expr, action_data);
743 match = eval_expr(expr->expr_op.lhs, action_data);
747 match = eval_expr(expr->expr_op.rhs, action_data);
755 static int eval_expr_top(struct action *action, struct action_data *action_data)
762 if(action_data->subpath)
763 expr_log(action_data->subpath);
780 match = eval_expr_log(action->expr, action_data);
794 return eval_expr(action->expr, action_data);
883 struct action_data action_data;
886 action_data.name = dir_ent->name;
887 action_data.pathname = strdup(pathname(dir_ent));
888 action_data.subpath = strdup(subpathname(dir_ent));
889 action_data.buf = &dir_ent->inode->buf;
890 action_data.depth = dir_ent->our_dir->depth;
891 action_data.dir_ent = dir_ent;
892 action_data.root = root;
901 match = eval_expr_top(action, &action_data);
907 free(action_data.pathname);
908 free(action_data.subpath);
918 struct action_data action_data;
920 action_data.name = dir_ent->name;
921 action_data.pathname = strdup(pathname(dir_ent));
922 action_data.subpath = strdup(subpathname(dir_ent));
923 action_data.buf = &dir_ent->inode->buf;
924 action_data.depth = dir_ent->our_dir->depth;
925 action_data.dir_ent = dir_ent;
926 action_data.root = root;
929 match = eval_expr_top(&fragment_spec[i], &action_data);
931 free(action_data.pathname);
932 free(action_data.subpath);
937 free(action_data.pathname);
938 free(action_data.subpath);
979 struct action_data action_data;
981 action_data.name = name;
982 action_data.pathname = pathname;
983 action_data.subpath = subpath;
984 action_data.buf = buf;
985 action_data.depth = depth;
986 action_data.dir_ent = dir_ent;
989 match = eval_expr_top(&exclude_spec[i], &action_data);
1513 struct action_data action_data;
1523 action_data.name = dir_ent->name;
1524 action_data.pathname = strdup(pathname(dir_ent));
1525 action_data.subpath = strdup(subpathname(dir_ent));
1526 action_data.buf = &dir_ent->inode->buf;
1527 action_data.depth = dir_ent->our_dir->depth;
1528 action_data.dir_ent = dir_ent;
1529 action_data.root = root;
1552 match = eval_expr_top(&empty_spec[i], &action_data);
1555 free(action_data.pathname);
1556 free(action_data.subpath);
1628 void eval_move(struct action_data *action_data, struct move_ent *move,
1692 action_data->subpath, path, comp);
1696 action_data->subpath, path, comp);
1712 action_data->subpath, path, conf_path);
1736 action_data->subpath, path, conf_path);
1764 struct action_data action_data;
1767 action_data.name = dir_ent->name;
1768 action_data.pathname = strdup(pathname(dir_ent));
1769 action_data.subpath = strdup(subpathname(dir_ent));
1770 action_data.buf = &dir_ent->inode->buf;
1771 action_data.depth = dir_ent->our_dir->depth;
1772 action_data.dir_ent = dir_ent;
1773 action_data.root = root;
1786 int match = eval_expr_top(action, &action_data);
1797 eval_move(&action_data, move, root, dir_ent,
1825 action_data.subpath, conf_path);
1839 action_data.subpath, conf_path);
1849 free(action_data.pathname);
1850 free(action_data.subpath);
1989 struct action_data action_data;
1991 action_data.name = dir_ent->name;
1992 action_data.pathname = strdup(pathname(dir_ent));
1993 action_data.subpath = strdup(subpathname(dir_ent));
1994 action_data.buf = &dir_ent->inode->buf;
1995 action_data.depth = dir_ent->our_dir->depth;
1996 action_data.dir_ent = dir_ent;
1997 action_data.root = root;
2000 match = eval_expr_top(&prune_spec[i], &action_data);
2002 free(action_data.pathname);
2003 free(action_data.subpath);
2174 static int NAME##_fn(struct atom *atom, struct action_data *action_data) \
2177 if (!file_type_match(action_data->buf->st_mode, MATCH)) \
2245 return fnmatch(atom->argv[0], action_data->name,
2249 return fnmatch(atom->argv[0], action_data->subpath,
2289 static int subpathname_fn(struct atom *atom, struct action_data *action_data)
2291 char *path = strdup(action_data->subpath);
2305 TEST_VAR_FN(filesize, ACTION_REG, action_data->buf->st_size)
2307 TEST_VAR_FN(dirsize, ACTION_DIR, action_data->buf->st_size)
2309 TEST_VAR_FN(size, ACTION_ALL_LNK, action_data->buf->st_size)
2311 TEST_VAR_FN(inode, ACTION_ALL_LNK, action_data->buf->st_ino)
2313 TEST_VAR_FN(nlink, ACTION_ALL_LNK, action_data->buf->st_nlink)
2315 TEST_VAR_FN(fileblocks, ACTION_REG, action_data->buf->st_blocks)
2317 TEST_VAR_FN(dirblocks, ACTION_DIR, action_data->buf->st_blocks)
2319 TEST_VAR_FN(blocks, ACTION_ALL_LNK, action_data->buf->st_blocks)
2321 TEST_VAR_FN(dircount, ACTION_DIR, action_data->dir_ent->dir->count)
2323 TEST_VAR_FN(depth, ACTION_ALL_LNK, action_data->depth)
2325 TEST_VAR_RANGE_FN(filesize, ACTION_REG, action_data->buf->st_size)
2327 TEST_VAR_RANGE_FN(dirsize, ACTION_DIR, action_data->buf->st_size)
2329 TEST_VAR_RANGE_FN(size, ACTION_ALL_LNK, action_data->buf->st_size)
2331 TEST_VAR_RANGE_FN(inode, ACTION_ALL_LNK, action_data->buf->st_ino)
2333 TEST_VAR_RANGE_FN(nlink, ACTION_ALL_LNK, action_data->buf->st_nlink)
2335 TEST_VAR_RANGE_FN(fileblocks, ACTION_REG, action_data->buf->st_blocks)
2337 TEST_VAR_RANGE_FN(dirblocks, ACTION_DIR, action_data->buf->st_blocks)
2339 TEST_VAR_RANGE_FN(blocks, ACTION_ALL_LNK, action_data->buf->st_blocks)
2341 TEST_VAR_RANGE_FN(gid, ACTION_ALL_LNK, action_data->buf->st_gid)
2343 TEST_VAR_RANGE_FN(uid, ACTION_ALL_LNK, action_data->buf->st_uid)
2345 TEST_VAR_RANGE_FN(depth, ACTION_ALL_LNK, action_data->depth)
2347 TEST_VAR_RANGE_FN(dircount, ACTION_DIR, action_data->dir_ent->dir->count)
2352 TEST_VAR_FN(uid, ACTION_ALL_LNK, action_data->buf->st_uid)
2397 TEST_VAR_FN(gid, ACTION_ALL_LNK, action_data->buf->st_gid)
2477 static int type_fn(struct atom *atom, struct action_data *action_data)
2481 return (action_data->buf->st_mode & S_IFMT) == type->value;
2488 static int true_fn(struct atom *atom, struct action_data *action_data)
2497 static int false_fn(struct atom *atom, struct action_data *action_data)
2531 static int file_fn(struct atom *atom, struct action_data *action_data)
2556 execlp("file", "file", "-b", action_data->pathname,
2605 static int exec_fn(struct atom *atom, struct action_data *action_data)
2640 res = setenv("NAME", action_data->name, 1);
2644 res = setenv("PATHNAME", action_data->subpath, 1);
2648 res = setenv("SOURCE_PATHNAME", action_data->pathname, 1);
2753 static int exists_fn(struct atom *atom, struct action_data *action_data)
2772 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK))
2776 return follow_path(action_data->dir_ent->our_dir,
2777 action_data->dir_ent->inode->symlink) ? 1 : 0;
2781 static int absolute_fn(struct atom *atom, struct action_data *action_data)
2796 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK))
2799 return action_data->dir_ent->inode->symlink[0] == '/';
2844 static int stat_fn(struct atom *atom, struct action_data *action_data)
2847 struct action_data eval_action;
2865 res = stat(action_data->pathname, &buf);
2878 memcpy(&eval_action, action_data, sizeof(struct action_data));
2893 static int readlink_fn(struct atom *atom, struct action_data *action_data)
2897 struct action_data eval_action;
2914 if (!file_type_match(action_data->buf->st_mode, ACTION_LNK))
2918 dir_ent = follow_path(action_data->dir_ent->our_dir,
2919 action_data->dir_ent->inode->symlink);
2929 eval_action.root = action_data->root;
2956 static int eval_fn(struct atom *atom, struct action_data *action_data)
2960 struct dir_ent *dir_ent = action_data->dir_ent;
2961 struct stat *buf = action_data->buf;
2962 struct action_data eval_action;
2987 dir_ent = action_data->root->dir_ent;
2989 dir_ent = follow_path(action_data->root, path);
3031 eval_action.root = action_data->root;
3116 static int perm_fn(struct atom *atom, struct action_data *action_data)
3119 struct stat *buf = action_data->buf;