Implemented file size and mtime for -ls_l

This commit is contained in:
Thomas Schmitt 2007-10-22 21:18:13 +00:00
parent 3888b469ae
commit 73020b5c31
3 changed files with 35 additions and 20 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "October 21, 2007"
.TH XORRISO 1 "October 22, 2007"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -309,7 +309,7 @@ Delete empty directories.
Mark end of particular action argument list.
.TP
\fB\-rollback\fR
Discard the manipulated ISO image and reload it from indrive.
Discard the manipulated ISO image and reload it from -indev.
.TP
.B Writing the result:
(see also paragraph about settings below)
@ -348,7 +348,7 @@ Note: It is not possible yet to effectively eject disk files.
Blank media resp. invalidate ISO image on media if not -dummy
is activated.
.br
This affects only the outdrive not the indrive.
This affects only the -outdev not the -indev.
If both drives are the same and if the ISO image was altered
then this command leads to a SORRY event.
Defined modes are:
@ -421,7 +421,7 @@ by "c" for CD and "d" for "DVD". Example speeds:
5540k = 5540kB/s = 4d = 4xDVD
.br
If there is no hint about the speed unit attached, then the
media in the outdrive will decide. Default unit is CD = 176.4k.
media in the -outdev will decide. Default unit is CD = 176.4k.
.br
MMC drives usually activate their own idea of speed and take
the speed value given by the burn program only as upper limit
@ -518,8 +518,8 @@ by next -commit. This can last a while as a -commit gets
prepared and only in last moment is revoked by this option.
.TP
\fB\-tell_media_space\fR
Print available space on output media (minus already
foreseeable consumption by next -commit.)
Print available space on output media and the free space after
subtracting already foreseeable consumption by next -commit.
.TP
.B Navigation in ISO image and disk filesystem:
.TP
@ -542,10 +542,11 @@ image which match a shell pattern. (I.e. wildcards '*' '?')
.TP
> \fB\-lsx\fR pattern
List files from the current working directory on local filesystem
which match a shell pattern. (I.e. wildcards '*' '?')
which match a shell pattern. (I.e. wildcards '*' '?', but no '/')
.TP
> \fB\-ls_l\fR pattern
\fB\-ls_l\fR pattern
Like -ls but also list some of the file attributes.
Output format resembles shell command ls -ldn.
.TP
> \fB\-ls_lx\fR pattern
Like -lsx but also list some of the file attributes.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.21.213303"
#define Xorriso_timestamP "2007.10.22.211928"

View File

@ -17,6 +17,7 @@
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <time.h>
/* ------------------------------------------------------------------------ */
@ -1229,6 +1230,12 @@ int Xorriso_ls(struct XorrisO *xorriso, int flag)
struct iso_tree_iter *iter= NULL;
char sfe[4*SfileadrL], *npt, *rpt, perms[10];
mode_t st_mode;
off_t size;
time_t mtime;
struct tm tms, *tmpt;
static char months[12][4]= { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
rpt= xorriso->result_line;
@ -1300,8 +1307,8 @@ wdi_is_not_a_dir:;
npt= (char *) iso_tree_node_get_name(node);
rpt[0]= 0;
if(flag&1) { /* >>> prepend attribute info */;
if(is_dir)
if(flag&1) {
if(LIBISO_ISDIR(node))
strcat(rpt, "d");
else if(LIBISO_ISREG(node))
strcat(rpt, "-");
@ -1324,18 +1331,25 @@ wdi_is_not_a_dir:;
strcat(rpt, perms);
/* >>> With directories this should be : number of subdirs + 2 */
/* >>> ??? How to obtain RR harlink number for other types ? */
/* >>> ??? How to obtain RR hardlink number for other types ? */
strcat(rpt," 1 ");
sprintf(rpt+strlen(rpt), "%-7lu ",
sprintf(rpt+strlen(rpt), "%-8lu ",
(unsigned long) iso_tree_node_get_uid(node));
sprintf(rpt+strlen(rpt), "%-7lu ",
sprintf(rpt+strlen(rpt), "%-8lu ",
(unsigned long) iso_tree_node_get_gid(node));
/* >>> obtain size */
sprintf(rpt+strlen(rpt), "_no_size ");
/* >>> obtain date */
sprintf(rpt+strlen(rpt), "__no__date__ ");
size= iso_tree_node_get_size(node);
sprintf(rpt+strlen(rpt), "%8.f ",(double) size);
mtime= iso_tree_node_get_mtime(node);
tmpt= localtime_r(&mtime, &tms);
if(tmpt==0)
sprintf(rpt+strlen(rpt), "%12.f ",(double) mtime);
else if(time(0)-mtime < 180*86400)
sprintf(rpt+strlen(rpt), "%3s %2d %2.2d:%2.2d ",
months[tms.tm_mon], tms.tm_mday, tms.tm_hour, tms.tm_min);
else
sprintf(rpt+strlen(rpt), "%3s %2d %4.4d ",
months[tms.tm_mon], tms.tm_mday, 1900+tms.tm_year);
}
sprintf(xorriso->result_line+strlen(xorriso->result_line), "%s\n",