From d3b35b50cd593cf9d36d9015562a1b493234f279 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 7 Aug 2008 11:26:37 +0000 Subject: [PATCH] Minor changes around display of time and byte counts --- xorriso/xorriso.c | 33 +++++++++++++++++++++------------ xorriso/xorriso_timestamp.h | 2 +- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index a607cb37..fd36b6aa 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -401,9 +401,16 @@ int Sfile_scale(double value, char *result, int siz, double thresh, int flag) bit2= no fraction (if it would fit at all) */ { - char scale_c,scales[6],form[80]; + char scale_c,scales[6],form[80], *negpt= NULL, *cpt; int i,dec_siz= 0,avail_siz= 1; + if(value<0) { + value= -value; + siz--; + result[0]= '-'; + negpt= result; + result++; + } strcpy(scales,"bkmgtp"); scale_c= scales[0]; for(i=1;scales[i]!=0;i++) { @@ -434,6 +441,13 @@ int Sfile_scale(double value, char *result, int siz, double thresh, int flag) sprintf(form,"%%%d.f%%c",siz-1); sprintf(result,form,value,scale_c); } + if(negpt != NULL) { + for(cpt= result; *cpt==' '; cpt++); + if(cpt > result) { + *negpt= ' '; + *(cpt - 1)= '-'; + } + } return(1); } @@ -1339,7 +1353,7 @@ char *Ftimetxt(time_t t, char timetext[40], int flag) sprintf(rpt+strlen(rpt), "%12.f", (double) t); else if (form==1) sprintf(rpt+strlen(rpt), "%4.4d.%2.2d.%2.2d.%2.2d%2.2d%2.2d", - 1900+tms.tm_year, tms.tm_mon, tms.tm_mday, + 1900+tms.tm_year, tms.tm_mon+1, tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec); else if (form==2) sprintf(rpt+strlen(rpt), "%s %s %2.2d %2.2d:%2.2d:%2.2d %4.4d", @@ -12777,17 +12791,12 @@ next_command:; ret= Xorriso_option_temp_mem_limit(xorriso, arg1, 0); } else if(strcmp(cmd,"test")==0) { /* This option does not exist. */ - char buf[SfileadrL]; + time_t t; - (*idx)+= 1; - ret= Xorriso_libburn_adr(xorriso, arg1, buf, 0); - if(ret>0) - sprintf(xorriso->info_text, " %s -> %s\n", arg1, buf); - else if(ret==0) - sprintf(xorriso->info_text, " not a libburn drive: %s\n", arg1); - else - sprintf(xorriso->info_text, " severe error with: %s\n", arg1); - Xorriso_info(xorriso, 0); + (*idx)++; + Decode_timestring(arg1, &t, 0); + sprintf(xorriso->result_line, "%.f\n", (double) t); + Xorriso_result(xorriso, 0); } else if(strcmp(cmd,"toc")==0) { Xorriso_option_toc(xorriso, 0); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 61217bcb..74860bb7 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.08.06.143922" +#define Xorriso_timestamP "2008.08.07.112529"