diff options
| author | Ray Strode <rstrode@redhat.com> | 2007-10-21 18:31:12 -0400 |
|---|---|---|
| committer | Ray Strode <rstrode@redhat.com> | 2007-10-21 18:33:34 -0400 |
| commit | b41b2a8ed464d39afde09e6c13054a176ad34f6d (patch) | |
| tree | 7ee7c1c3a7cc792a0826eb95ac02a9d068df43e6 /src | |
| parent | b347d89b7bc9d801b70ffa0321bb46d2a57aef3c (diff) | |
| download | plymouth-b41b2a8ed464d39afde09e6c13054a176ad34f6d.tar.gz plymouth-b41b2a8ed464d39afde09e6c13054a176ad34f6d.tar.xz plymouth-b41b2a8ed464d39afde09e6c13054a176ad34f6d.zip | |
add ply_list_directory function
It just does ls -R basically, but it's useful for debugging.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libply/ply-utils.c | 38 | ||||
| -rw-r--r-- | src/libply/ply-utils.h | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index 33337a9..0bd901b 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -571,6 +571,44 @@ ply_file_exists (const char *file) return S_ISREG (file_info.st_mode); } +void +ply_list_directory (const char *path) +{ + DIR *dir; + struct dirent *entry; + static int level = 0; + + dir = opendir (path); + + if (dir == NULL) + return; + + if (level > 5) + return; + + int index = 0; + while ((entry = readdir (dir)) != NULL) + { + char *subdir; + + index++; + + if (index > 10) + break; + + subdir = NULL; + asprintf (&subdir, "%s/%s", path, entry->d_name); + ply_error ("%s ", subdir); + level++; + if (entry->d_name[0] != '.') + ply_list_directory (subdir); + level--; + free (subdir); + } + + closedir (dir); +} + ply_module_handle_t * ply_open_module (const char *module_path) { diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h index ec46fef..dea2ab3 100644 --- a/src/libply/ply-utils.h +++ b/src/libply/ply-utils.h @@ -69,6 +69,7 @@ void ply_restore_errno (void); bool ply_directory_exists (const char *dir); bool ply_file_exists (const char *file); +void ply_list_directory (const char *dir); ply_module_handle_t *ply_open_module (const char *module_path); ply_module_function_t ply_module_look_up_function (ply_module_handle_t *handle, |
