[libgsf] gsf: print modtime when available.



commit ec0f76448d2fcc5830558c0bed5f29c11ab2d610
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 4 15:12:47 2013 -0500

    gsf: print modtime when available.

 ChangeLog   |    2 ++
 NEWS        |    1 +
 tools/gsf.c |   11 ++++++++++-
 3 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4b32348..6ffbc3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2013-03-04  Morten Welinder  <terra gnome org>
 
+       * tools/gsf.c (ls_R): Print also modtime when available.
+
        * gsf/gsf-infile-zip.c (gsf_infile_zip_new_child): Set modtime of
        child.
        (zip_dirent_new_in): Read modtime from file.
diff --git a/NEWS b/NEWS
index c13e727..154bc76 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Morten:
        * Fix uncompress problem with bzip'd files.
        * Add modtime support for GsfInput.
        * Add modtime support for GsfOutput.
+       * Enhance gsf tool to print modtime.
 
 --------------------------------------------------------------------------
 libgsf 1.14.26
diff --git a/tools/gsf.c b/tools/gsf.c
index 304cbd6..b8cccf7 100644
--- a/tools/gsf.c
+++ b/tools/gsf.c
@@ -119,6 +119,8 @@ ls_R (GsfInput *input, char const *prefix)
        gboolean is_dir = infile && gsf_infile_num_children (infile) > 0;
        char *full_name;
        char *new_prefix;
+       GDateTime *modtime = gsf_input_get_modtime (input);
+       char *modtxt;
 
        if (prefix) {
                char *display_name = name ?
@@ -134,11 +136,18 @@ ls_R (GsfInput *input, char const *prefix)
                new_prefix = g_strdup ("");
        }
 
-       g_print ("%c %10" GSF_OFF_T_FORMAT " %s\n",
+       modtxt = modtime
+               ? g_date_time_format (modtime, "%F %H:%M:%S")
+               : g_strdup ("                   ");
+
+       g_print ("%c  %s  %10" GSF_OFF_T_FORMAT " %s\n",
                 (is_dir ? 'd' : 'f'),
+                modtxt,
                 gsf_input_size (input),
                 full_name);
 
+       g_free (modtxt);
+
        if (is_dir) {
                int i;
                for (i = 0 ; i < gsf_infile_num_children (infile) ; i++) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]