Implemented new option -temp_mem_limit

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

View File

@ -1787,7 +1787,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->dialog= 0;
m->search_mode= 0;
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->result_page_length= 0;
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))
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));
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.",
" -mark text If text is not empty it will get put out each time an",
" 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_help text Use text as this program's name and perform -help",
" -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 */
int Xorriso_option_toc(struct XorrisO *xorriso, int flag)
{
@ -5083,6 +5113,10 @@ next_command:;
} else if(strcmp(cmd,"-tell_media_space")==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. */
char line[4096],**hargv= NULL;
int hargc, i;