[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libcdio-devel] [PATCH 4/4] Improve UDF output of iso-info -f/-l
From: |
Christophe Fergeau |
Subject: |
[Libcdio-devel] [PATCH 4/4] Improve UDF output of iso-info -f/-l |
Date: |
Wed, 17 Oct 2012 13:45:37 +0200 |
---
src/iso-info.c | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
diff --git a/src/iso-info.c b/src/iso-info.c
index 5ca384b..5d6ed87 100644
--- a/src/iso-info.c
+++ b/src/iso-info.c
@@ -295,27 +295,45 @@ print_iso9660_fs (iso9660_t *iso)
}
static void
-print_udf_file_info(const udf_dirent_t *p_udf_dirent, const char* psz_dirname)
+print_udf_file_info(const udf_dirent_t *p_udf_dirent,
+ const char* psz_dirname,
+ const char *psz_filename)
{
time_t mod_time = udf_get_modification_time(p_udf_dirent);
+ char date_str[30];
char psz_mode[11]="invalid";
- const char *psz_fname= psz_dirname
- ? psz_dirname : udf_get_filename(p_udf_dirent);
-
+ const char *psz_fname= psz_filename
+ ? psz_filename : udf_get_filename(p_udf_dirent);
+
+ if (!opts.print_iso9660) {
+ if (strcmp(psz_dirname, ".") != 0) {
+ printf("%9lu ", (long unsigned int) udf_get_file_length(p_udf_dirent));
+ printf("/%s", psz_dirname);
+ printf("%s\n", *psz_fname ? psz_fname : "/");
+ }
+ return;
+ }
/* Print directory attributes*/
printf("%s ", udf_mode_string(udf_get_posix_filemode(p_udf_dirent),
psz_mode));
- printf("%4d ", udf_get_link_count(p_udf_dirent));
- printf("%lu ", (long unsigned int) udf_get_file_length(p_udf_dirent));
- printf("%s %s", *psz_fname ? psz_fname : "/", ctime(&mod_time));
+ /* fake uid/gid */
+ printf("0 0 ");
+ printf("%3d ", udf_get_link_count(p_udf_dirent));
+ printf("%9lu ", (long unsigned int) udf_get_file_length(p_udf_dirent));
+ strftime(date_str, sizeof(date_str), "%b %d %Y %H:%M:%S ",
localtime(&mod_time));
+ printf("%s %s", date_str, *psz_fname ? psz_fname : "/");
+ printf("\n");
}
static udf_dirent_t *
list_udf_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent, const char *psz_path)
{
if (!p_udf_dirent) return NULL;
-
- print_udf_file_info(p_udf_dirent, psz_path);
+
+ if (opts.print_iso9660) {
+ printf ("\n/%s:\n", psz_path);
+ }
+ print_udf_file_info(p_udf_dirent, psz_path, ".");
while (udf_readdir(p_udf_dirent)) {
@@ -332,7 +350,7 @@ list_udf_files(udf_t *p_udf, udf_dirent_t *p_udf_dirent,
const char *psz_path)
free(psz_newpath);
}
} else {
- print_udf_file_info(p_udf_dirent, NULL);
+ print_udf_file_info(p_udf_dirent, psz_path, NULL);
}
}
return p_udf_dirent;
--
1.7.12.1