summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7a6c5e)
raw | patch | inline | side by side (parent: f7a6c5e)
author | Vaclav Malek <scippio@berounet.cz> | |
Fri, 25 Dec 2009 10:06:54 +0000 (11:06 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 25 Dec 2009 22:14:51 +0000 (23:14 +0100) |
src/filecount.c | patch | blob | history |
diff --git a/src/filecount.c b/src/filecount.c
index 6899d509b2b3d30153125299d489c458e22215ff..b9dcad866ea203a0f3345ea31e79dde671d4b1ed 100644 (file)
--- a/src/filecount.c
+++ b/src/filecount.c
#include <fnmatch.h>
#define FC_RECURSIVE 1
+#define FC_HIDDEN 1
struct fc_directory_conf_s
{
return (0);
} /* int fc_config_add_dir_recursive */
+static int fc_config_add_dir_hidden (fc_directory_conf_t *dir,
+ oconfig_item_t *ci)
+{
+ if ((ci->values_num != 1)
+ || (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))
+ {
+ WARNING ("filecount plugin: The `Hidden' config options needs exactly "
+ "one boolean argument.");
+ return (-1);
+ }
+
+ if (ci->values[0].value.boolean)
+ dir->options |= FC_HIDDEN;
+ else
+ dir->options &= ~FC_HIDDEN;
+
+ return (0);
+} /* int fc_config_add_dir_hidden */
+
static int fc_config_add_dir (oconfig_item_t *ci)
{
fc_directory_conf_t *dir;
fc_config_set_instance (dir, dir->path);
dir->options = FC_RECURSIVE;
+ dir->options = FC_HIDDEN;
dir->name = NULL;
dir->mtime = 0;
status = fc_config_add_dir_size (dir, option);
else if (strcasecmp ("Recursive", option->key) == 0)
status = fc_config_add_dir_recursive (dir, option);
+ else if (strcasecmp ("Hidden", option->key) == 0)
+ status = fc_config_add_dir_hidden (dir, option);
else
{
WARNING ("filecount plugin: fc_config_add_dir: "
if (S_ISDIR (statbuf.st_mode) && (dir->options & FC_RECURSIVE))
{
- status = walk_directory (abs_path, fc_read_dir_callback, dir,
- /* include hidden = */ 0);
+ if(dir->options & FC_HIDDEN)
+ status = walk_directory (abs_path, fc_read_dir_callback, dir,/* include hidden */1);
+ else
+ status = walk_directory (abs_path, fc_read_dir_callback, dir,/* include hidden */ 0);
return (status);
}
else if (!S_ISREG (statbuf.st_mode))
if (dir->mtime != 0)
dir->now = time (NULL);
-
- status = walk_directory (dir->path, fc_read_dir_callback, dir,
- /* include hidden = */ 0);
+
+ if(dir->options & FC_HIDDEN)
+ status = walk_directory (dir->path, fc_read_dir_callback, dir,/* include hidden */ 1);
+ else
+ status = walk_directory (dir->path, fc_read_dir_callback, dir,/* include hidden */ 0);
if (status != 0)
{
WARNING ("filecount plugin: walk_directory (%s) failed.", dir->path);