summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eeae8f7)
raw | patch | inline | side by side (parent: eeae8f7)
author | Vaclav Malek <scippio@berounet.cz> | |
Fri, 25 Dec 2009 09:50:37 +0000 (10:50 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Fri, 25 Dec 2009 22:14:32 +0000 (23:14 +0100) |
src/battery.c | patch | blob | history | |
src/common.c | patch | blob | history | |
src/common.h | patch | blob | history | |
src/filecount.c | patch | blob | history | |
src/thermal.c | patch | blob | history |
diff --git a/src/battery.c b/src/battery.c
index b62ad81df35b4686d7844ccd2d565e38e1365e83..4178d8b5145f2b728e5c7c949d72ebd8d126a89e 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
if (0 == access (battery_acpi_dir, R_OK))
walk_directory (battery_acpi_dir, battery_read_acpi,
- /* user_data = */ NULL);
+ /* user_data = */ NULL,
+ /* include hidden */ 0);
else
{
char errbuf[1024];
diff --git a/src/common.c b/src/common.c
index c6a651dc56248050ccc0b7a50c7aca68e4f2c3f9..3695a9b794406c9ea4e8d76a135cad5d2eb93767 100644 (file)
--- a/src/common.c
+++ b/src/common.c
} /* int notification_init */
int walk_directory (const char *dir, dirwalk_callback_f callback,
- void *user_data)
+ void *user_data, int include_hidden)
{
struct dirent *ent;
DIR *dh;
while ((ent = readdir (dh)) != NULL)
{
int status;
-
- if (ent->d_name[0] == '.')
- continue;
+
+ if (include_hidden)
+ {
+ if ((strcmp (".", ent->d_name) == 0)
+ || (strcmp ("..", ent->d_name) == 0))
+ continue;
+ }
+ else /* if (!include_hidden) */
+ {
+ if (ent->d_name[0]=='.')
+ continue;
+ }
status = (*callback) (dir, ent->d_name, user_data);
if (status != 0)
diff --git a/src/common.h b/src/common.h
index 019e8b69f9817e673df2b7f3f673401d91e7579f..2d5c7945f44b0e5448c33c7880487f1e57b0f4e6 100644 (file)
--- a/src/common.h
+++ b/src/common.h
typedef int (*dirwalk_callback_f)(const char *dirname, const char *filename,
void *user_data);
int walk_directory (const char *dir, dirwalk_callback_f callback,
- void *user_data);
+ void *user_data, int hidden);
int read_file_contents (const char *filename, char *buf, int bufsize);
counter_t counter_diff (counter_t old_value, counter_t new_value);
diff --git a/src/filecount.c b/src/filecount.c
index 05bb4b3792e16b72d83cb8cf00827cf58443c7f7..6899d509b2b3d30153125299d489c458e22215ff 100644 (file)
--- a/src/filecount.c
+++ b/src/filecount.c
if (S_ISDIR (statbuf.st_mode) && (dir->options & FC_RECURSIVE))
{
- status = walk_directory (abs_path, fc_read_dir_callback, dir);
+ 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);
+ 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);
diff --git a/src/thermal.c b/src/thermal.c
index 2b708052d707461afa3f9976f3bd9132affa79a6..b9d07bf5ce22fcacd55f5dcac729e4ad665b12d5 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
static int thermal_sysfs_read (void)
{
return walk_directory (dirname_sysfs, thermal_sysfs_device_read,
- /* user_data = */ NULL);
+ /* user_data = */ NULL, /* include hidden */ 0);
}
static int thermal_procfs_read (void)
{
return walk_directory (dirname_procfs, thermal_procfs_device_read,
- /* user_data = */ NULL);
+ /* user_data = */ NULL, /* include hidden */ 0);
}
static int thermal_init (void)