Implemented file size and mtime for -ls_l

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

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" 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. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -309,7 +309,7 @@ Delete empty directories.
Mark end of particular action argument list. Mark end of particular action argument list.
.TP .TP
\fB\-rollback\fR \fB\-rollback\fR
Discard the manipulated ISO image and reload it from indrive. Discard the manipulated ISO image and reload it from -indev.
.TP .TP
.B Writing the result: .B Writing the result:
(see also paragraph about settings below) (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 Blank media resp. invalidate ISO image on media if not -dummy
is activated. is activated.
.br .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 If both drives are the same and if the ISO image was altered
then this command leads to a SORRY event. then this command leads to a SORRY event.
Defined modes are: Defined modes are:
@ -421,7 +421,7 @@ by "c" for CD and "d" for "DVD". Example speeds:
5540k = 5540kB/s = 4d = 4xDVD 5540k = 5540kB/s = 4d = 4xDVD
.br .br
If there is no hint about the speed unit attached, then the 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 .br
MMC drives usually activate their own idea of speed and take MMC drives usually activate their own idea of speed and take
the speed value given by the burn program only as upper limit 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. prepared and only in last moment is revoked by this option.
.TP .TP
\fB\-tell_media_space\fR \fB\-tell_media_space\fR
Print available space on output media (minus already Print available space on output media and the free space after
foreseeable consumption by next -commit.) subtracting already foreseeable consumption by next -commit.
.TP .TP
.B Navigation in ISO image and disk filesystem: .B Navigation in ISO image and disk filesystem:
.TP .TP
@ -542,10 +542,11 @@ image which match a shell pattern. (I.e. wildcards '*' '?')
.TP .TP
> \fB\-lsx\fR pattern > \fB\-lsx\fR pattern
List files from the current working directory on local filesystem 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 .TP
> \fB\-ls_l\fR pattern \fB\-ls_l\fR pattern
Like -ls but also list some of the file attributes. Like -ls but also list some of the file attributes.
Output format resembles shell command ls -ldn.
.TP .TP
> \fB\-ls_lx\fR pattern > \fB\-ls_lx\fR pattern
Like -lsx but also list some of the file attributes. 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 <errno.h>
#include <string.h> #include <string.h>
#include <sys/stat.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; struct iso_tree_iter *iter= NULL;
char sfe[4*SfileadrL], *npt, *rpt, perms[10]; char sfe[4*SfileadrL], *npt, *rpt, perms[10];
mode_t st_mode; 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; rpt= xorriso->result_line;
@ -1300,8 +1307,8 @@ wdi_is_not_a_dir:;
npt= (char *) iso_tree_node_get_name(node); npt= (char *) iso_tree_node_get_name(node);
rpt[0]= 0; rpt[0]= 0;
if(flag&1) { /* >>> prepend attribute info */; if(flag&1) {
if(is_dir) if(LIBISO_ISDIR(node))
strcat(rpt, "d"); strcat(rpt, "d");
else if(LIBISO_ISREG(node)) else if(LIBISO_ISREG(node))
strcat(rpt, "-"); strcat(rpt, "-");
@ -1324,18 +1331,25 @@ wdi_is_not_a_dir:;
strcat(rpt, perms); strcat(rpt, perms);
/* >>> With directories this should be : number of subdirs + 2 */ /* >>> 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 "); strcat(rpt," 1 ");
sprintf(rpt+strlen(rpt), "%-7lu ", sprintf(rpt+strlen(rpt), "%-8lu ",
(unsigned long) iso_tree_node_get_uid(node)); (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)); (unsigned long) iso_tree_node_get_gid(node));
size= iso_tree_node_get_size(node);
/* >>> obtain size */ sprintf(rpt+strlen(rpt), "%8.f ",(double) size);
sprintf(rpt+strlen(rpt), "_no_size "); mtime= iso_tree_node_get_mtime(node);
/* >>> obtain date */ tmpt= localtime_r(&mtime, &tms);
sprintf(rpt+strlen(rpt), "__no__date__ "); 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", sprintf(xorriso->result_line+strlen(xorriso->result_line), "%s\n",