Implemented new option -temp_mem_limit

This commit is contained in:
Thomas Schmitt 2007-10-31 10:34:52 +00:00
parent b3dfaf0c34
commit 5f8937f14e
6 changed files with 52 additions and 11 deletions

View File

@ -543,12 +543,12 @@ Tell the current working directory on local filesystem.
.TP .TP
\fB\-ls\fR pattern [...] \fB\-ls\fR pattern [...]
List files from the current working directory in the ISO List files from the current working directory in the ISO
image which match a shell pattern (i.e. wildcards '*' '?' '[a-z]'). image which match shell patterns (i.e. with wildcards '*' '?' '[a-z]').
Note that this resembles rather shell command ls -d than command ls. Note that this resembles rather shell command ls -d than command ls.
.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. which match shell patterns.
.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.
@ -629,6 +629,12 @@ Copy output of a channel to the given file.
If text is not empty it will get put out each time an If text is not empty it will get put out each time an
action has been completed. action has been completed.
.TP .TP
\fB\-temp_mem_limit\fR number["k"|"m"]
Set the maximum size of temporary memory to be used for image dependent
buffering. Currently this applies to pattern expansion only.
.br
Default is 16m = 16 MiB, minimum 64k = 64 kiB, maximum 1024m = 1 GiB.
.TP
\fB\-prog\fR text \fB\-prog\fR text
Use text as this program's name in subsequent messages Use text as this program's name in subsequent messages
.TP .TP

View File

@ -1787,7 +1787,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->dialog= 0; m->dialog= 0;
m->search_mode= 0; m->search_mode= 0;
m->structured_search= 1; m->structured_search= 1;
m->temp_mem_limit= 16*1024.0*1024.0; m->temp_mem_limit= 16*1024*1024;
m->use_stdin= 0; m->use_stdin= 0;
m->result_page_length= 0; m->result_page_length= 0;
m->result_page_width= 80; m->result_page_width= 80;
@ -2764,6 +2764,15 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults)) if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->temp_mem_limit==16*1024*1024);
if((xorriso->temp_mem_limit/1024/1024)*1024*1024==xorriso->temp_mem_limit)
sprintf(line,"-temp_mem_limit %dm\n", xorriso->temp_mem_limit/1024/1024);
else
sprintf(line,"-fs %dk\n", xorriso->temp_mem_limit/1024);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
sprintf(line,"-prog %s\n",Text_shellsafe(xorriso->progname,sfe,0)); sprintf(line,"-prog %s\n",Text_shellsafe(xorriso->progname,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -3934,6 +3943,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" for the consolidated -pkt_output stream.", " for the consolidated -pkt_output stream.",
" -mark text If text is not empty it will get put out each time an", " -mark text If text is not empty it will get put out each time an",
" option is completed.", " option is completed.",
" -temp_mem_limit number[\"k\"|\"m\"]",
" Set the maximum size for pattern expansion. (Default is 16m)",
" -prog text Use text as this program's name in subsequent messages", " -prog text Use text as this program's name in subsequent messages",
" -prog_help text Use text as this program's name and perform -help", " -prog_help text Use text as this program's name and perform -help",
" -status mode|filter Report the current settings of persistent options.", " -status mode|filter Report the current settings of persistent options.",
@ -4713,6 +4724,25 @@ int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag)
} }
/* Option -temp_mem_limit */
int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size,
int flag)
{
double num;
num= Scanf_io_size(size, 0);
if(num < 64.0 * 1024.0 || num > 1024.0 * 1024.0 * 1024.0) {
sprintf(xorriso->info_text,
"-temp_mem_limit: wrong size %.f (allowed: %.f - %.f)",
num, 64.0 * 1024.0, 1024.0 * 1024.0 * 1024.0);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
xorriso->temp_mem_limit= num;
return(1);
}
/* Option -toc */ /* Option -toc */
int Xorriso_option_toc(struct XorrisO *xorriso, int flag) int Xorriso_option_toc(struct XorrisO *xorriso, int flag)
{ {
@ -5083,6 +5113,10 @@ next_command:;
} else if(strcmp(cmd,"-tell_media_space")==0) { } else if(strcmp(cmd,"-tell_media_space")==0) {
Xorriso_option_tell_media_space(xorriso, 0); Xorriso_option_tell_media_space(xorriso, 0);
} else if(strcmp(cmd,"-temp_mem_limit")==0) {
(*idx)++;
ret= Xorriso_option_temp_mem_limit(xorriso, arg1, 0);
} else if(strcmp(cmd,"-test")==0) { /* This option does not exist. */ } else if(strcmp(cmd,"-test")==0) { /* This option does not exist. */
char line[4096],**hargv= NULL; char line[4096],**hargv= NULL;
int hargc, i; int hargc, i;

View File

@ -219,11 +219,8 @@ int Xorriso_option_j_capital(struct XorrisO *xorriso, int flag);
/* Options -ls alias -lsi and ls_l alias ls_li */ /* Options -ls alias -lsi and ls_l alias ls_li */
/* @param flag bit0= long format (-ls_l) */ /* @param flag bit0= long format (-ls_l) */
int Xorriso_option_lsi(struct XorrisO *xorriso, char *pattern, int flag); int Xorriso_option_lsi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag);
/* Options -lsx and -ls_lx */
/* @param flag bit0= long format (-ls_l) */
int Xorriso_option_lsi(struct XorrisO *xorriso, char *pattern, int flag);
/* Option -logfile */ /* Option -logfile */
int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel, int Xorriso_option_logfile(struct XorrisO *xorriso, char *channel,
@ -310,6 +307,10 @@ int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num1,
/* Option -tell_media_space */ /* Option -tell_media_space */
int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag); int Xorriso_option_tell_media_space(struct XorrisO *xorriso, int flag);
/* Option -temp_mem_limit */
int Xorriso_option_temp_mem_limit(struct XorrisO *xorriso, char *size,
int flag);
/* Option -toc */ /* Option -toc */
int Xorriso_option_toc(struct XorrisO *xorriso, int flag); int Xorriso_option_toc(struct XorrisO *xorriso, int flag);

View File

@ -115,7 +115,7 @@ struct XorrisO { /* the global context of xorriso */
( 3= like 2 : but report first content level of matching directories ) ( 3= like 2 : but report first content level of matching directories )
4= actually not structured but unique find mode (with search_mode 4) 4= actually not structured but unique find mode (with search_mode 4)
*/ */
double temp_mem_limit; int temp_mem_limit;
int use_stdin; /* use raw stdin even if readline support is compiled */ int use_stdin; /* use raw stdin even if readline support is compiled */
int result_page_length; int result_page_length;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.30.214242" #define Xorriso_timestamP "2007.10.31.103338"

View File

@ -1784,7 +1784,7 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
if(ret<=0) if(ret<=0)
return(ret); return(ret);
root_dir= iso_volume_get_root(volume); root_dir= iso_volume_get_root(volume);
if(dir==NULL) { if(root_dir==NULL) {
Xorriso_process_msg_queues(xorriso,0); Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"While expanding pattern : Cannot obtain root node of ISO image"); "While expanding pattern : Cannot obtain root node of ISO image");