"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/opts_p_z.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

opts_p_z.c  (xorriso-1.5.2):opts_p_z.c  (xorriso-1.5.4)
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images. /* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2018 Thomas Schmitt, <scdbackup@gmx.net> Copyright 2007-2020 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
This file contains the implementation of options -p* to -z* as mentioned This file contains the implementation of options -p* to -z* as mentioned
in man page or info file derived from xorriso.texi. in man page or info file derived from xorriso.texi.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
#endif #endif
skipping to change at line 145 skipping to change at line 145
"-paste_in : bytecount zero, negative or much too large (%s)", count); "-paste_in : bytecount zero, negative or much too large (%s)", count);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0); return(0);
} }
bytecount= num; bytecount= num;
sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f", sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f",
disk_path, iso_rr_path, disk_path, iso_rr_path,
(double) startbyte, (double) (startbyte+bytecount)); (double) startbyte, (double) (startbyte+bytecount));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
Xorriso_pacifier_reset(xorriso, 0);
ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount, ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount,
iso_rr_path, 0); iso_rr_path, 0);
Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
xorriso->pacifier_total, "", 1 | 4 | 8 | 32);
return(ret); return(ret);
} }
/* Option -path_list , -quoted_path_list */ /* Option -path_list , -quoted_path_list */
/* @param flag bit0= -quoted_path_list /* @param flag bit0= -quoted_path_list
bit1= mkisofs mode: Use / as target for pathspecs without = bit1= mkisofs mode: Use / as target for pathspecs without =
*/ */
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag) int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{ {
int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0; int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0;
skipping to change at line 1368 skipping to change at line 1371
} }
sprintf(xorriso->info_text, "Slept for %f seconds", sprintf(xorriso->info_text, "Slept for %f seconds",
Sfile_microtime(0) - start_time); Sfile_microtime(0) - start_time);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1); return(1);
} }
/* Commands -speed , -read_speed */ /* Commands -speed , -read_speed */
/* @param flag bit0= -read_speed rather than -speed /* @param flag bit0= -read_speed rather than -speed
*/ */
int Xorriso_option_speed(struct XorrisO *xorriso, char *speed, int flag) int Xorriso_option_speed(struct XorrisO *xorriso, char *speed_in, int flag)
{ {
int is_cd= 1, unit_found= 0, ret, profile_number, intspeed= 1; int is_cd= 1, unit_found= 0, ret, profile_number, intspeed= 1, for_force= 0;
double num= -2.0; double num= -2.0;
char *cpt, profile_name[80]; char *cpt, profile_name[80], *speed;
speed= speed_in;
if(strncmp(speed, "soft_corr:", 10) == 0 && (flag & 1)) {
sscanf(speed + 10, "%lf", &num);
if(num > 1.0e9 || num < 0.0) {
sprintf(xorriso->info_text,
"-read_speed soft_corr: Value too small or too large (0 to 1e9): '%s'",
speed + 10);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
xorriso->read_speed_corr= num;
return(1);
}
if(strncmp(speed, "soft_force:", 11) == 0 && (flag & 1)) {
for_force= 1;
speed+= 11;
}
if(speed[0] == 0 || strcmp(speed, "any") == 0 || strcmp(speed, "max") == 0) { if(speed[0] == 0 || strcmp(speed, "any") == 0 || strcmp(speed, "max") == 0) {
intspeed= 0; intspeed= 0;
} else if(strcmp(speed, "min") == 0) { } else if(strcmp(speed, "min") == 0) {
intspeed= -1; intspeed= -1;
} else if(strcmp(speed, "none") == 0) { } else if(strcmp(speed, "none") == 0) {
intspeed= -2; intspeed= -2;
} else { } else {
sscanf(speed,"%lf",&num); sscanf(speed,"%lf",&num);
if(num <= 0) if(num <= 0)
intspeed= num; intspeed= num;
} }
if(intspeed <= 0) { if(intspeed <= 0)
if(flag & 1) goto set_speed_and_exit;
xorriso->read_speed= intspeed;
else
xorriso->write_speed= intspeed;
return(1);
}
for(cpt= speed+strlen(speed)-1; cpt>=speed; cpt--) for(cpt= speed+strlen(speed)-1; cpt>=speed; cpt--)
if(isdigit(*cpt) || *cpt=='.') if(isdigit(*cpt) || *cpt=='.')
break; break;
cpt++; cpt++;
if(*cpt=='k' || *cpt=='K') { if(*cpt=='k' || *cpt=='K') {
/* is merchand kilobyte, stays merchand kilobyte */ /* is merchand kilobyte, stays merchand kilobyte */
unit_found= 1; unit_found= 1;
} else if(*cpt=='m' || *cpt=='M') { } else if(*cpt=='m' || *cpt=='M') {
skipping to change at line 1432 skipping to change at line 1449
if(is_cd) if(is_cd)
goto cd_speed; goto cd_speed;
else if (ret == 3) else if (ret == 3)
goto bd_speed; goto bd_speed;
else else
goto dvd_speed; goto dvd_speed;
} }
if(num> 2.0e9) { if(num> 2.0e9) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-speed: Value too large or not recognizable: '%s'", speed); "%s: Value too large or not recognizable: '%s'",
flag & 1 ? "-read_speed" : "-speed", speed);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0); return(0);
} }
intspeed= num; intspeed= num;
if(intspeed < num) if(intspeed < num)
intspeed++; intspeed++;
if(flag & 1)
xorriso->read_speed= intspeed; set_speed_and_exit:;
else if(flag & 1) {
if(for_force)
xorriso->read_speed_force= intspeed;
else
xorriso->read_speed= intspeed;
} else {
xorriso->write_speed= intspeed; xorriso->write_speed= intspeed;
}
return(1); return(1);
} }
/* Option -split_size */ /* Option -split_size */
int Xorriso_option_split_size(struct XorrisO *xorriso, char *size, int flag) int Xorriso_option_split_size(struct XorrisO *xorriso, char *size, int flag)
{ {
double num; double num;
num= Scanf_io_size(size, 0); num= Scanf_io_size(size, 0);
if(num > xorriso->file_size_limit && xorriso->file_size_limit > 0) { if(num > xorriso->file_size_limit && xorriso->file_size_limit > 0) {
skipping to change at line 1489 skipping to change at line 1513
/* Option -status_history_max */ /* Option -status_history_max */
int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num, int Xorriso_option_status_history_max(struct XorrisO *xorriso, int num,
int flag) int flag)
{ {
if(num>=0 && num<1000000) if(num>=0 && num<1000000)
xorriso->status_history_max= num; xorriso->status_history_max= num;
return(1); return(1);
} }
/* Option -stdio_sync "on"|"off"|"end"|size */ /* Option -stdio_sync "on"|"off"|"end"|size */
int Xorriso_option_stdio_sync(struct XorrisO *xorriso, char *rythm, int flag) int Xorriso_option_stdio_sync(struct XorrisO *xorriso, char *rhythm, int flag)
{ {
double num; double num;
if(strcmp(rythm, "default") == 0 || strcmp(rythm, "on") == 0) { if(strcmp(rhythm, "default") == 0 || strcmp(rhythm, "on") == 0) {
num= 0; num= 0;
} else if(strcmp(rythm, "off") == 0) { } else if(strcmp(rhythm, "off") == 0) {
num= -1; num= -1;
} else if(strcmp(rythm, "end") == 0) { } else if(strcmp(rhythm, "end") == 0) {
num= 1; num= 1;
} else { } else {
num = Scanf_io_size(rythm, 0) / 2048; num = Scanf_io_size(rhythm, 0) / 2048;
if(num < 32 || num > 512 * 1024) { if(num < 32 || num > 512 * 1024) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-stdio_sync : Bad size. Use: 64k to 1g, \"on\", \"off\", \"end\""); "-stdio_sync : Bad size. Use: 64k to 1g, \"on\", \"off\", \"end\"");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0); return(0);
} }
} }
xorriso->stdio_sync= num; xorriso->stdio_sync= num;
xorriso->stdio_sync_is_default= 0; xorriso->stdio_sync_is_default= 0;
return(1); return(1);
skipping to change at line 1652 skipping to change at line 1676
ret= Xorriso_option_toc(xorriso, toc_flag | 0); ret= Xorriso_option_toc(xorriso, toc_flag | 0);
} else { } else {
sprintf(xorriso->info_text, "-toc_of: Unknown drive code "); sprintf(xorriso->info_text, "-toc_of: Unknown drive code ");
Text_shellsafe(which, xorriso->info_text, 1); Text_shellsafe(which, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
ret= 0; ret= 0;
} }
return(ret); return(ret);
} }
/* Command -truncate_overwritable */
int Xorriso_option_truncate_overwritable(struct XorrisO *xorriso,
char *adr_mode, char *adr_value,
char *adjust, int flag)
{
int ret;
ret= Xorriso_truncate_overwritable(xorriso, adr_mode, adr_value, adjust, 0);
return(ret);
}
/* Option -uid */ /* Option -uid */
int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag) int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag)
{ {
int ret; int ret;
xorriso->do_global_uid= 0; xorriso->do_global_uid= 0;
if(uid[0]==0 || strcmp(uid,"-")==0) if(uid[0]==0 || strcmp(uid,"-")==0)
return(1); return(1);
ret= Xorriso_convert_uidstring(xorriso, uid, &(xorriso->global_uid), 0); ret= Xorriso_convert_uidstring(xorriso, uid, &(xorriso->global_uid), 0);
if(ret>0) if(ret>0)
skipping to change at line 2153 skipping to change at line 2188
} }
ret= Xorriso_set_ignore_aclea(xorriso, 0); ret= Xorriso_set_ignore_aclea(xorriso, 0);
if(ret <= 0) if(ret <= 0)
return(ret); return(ret);
return(1); return(1);
} }
/* Option -zisofs */ /* Option -zisofs */
int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag) int Xorriso_option_zisofs(struct XorrisO *xorriso, char *mode, int flag)
{ {
int was_level, was_blocksize, ret, l; int was_level, was_blocksize, was_v2_enabled, was_blocksize_v2;
double num; int was_zisofs_susp_z2;
char *cpt, *npt, text[16]; uint64_t was_max_total_blocks, was_max_file_blocks, was_block_number_target;
int ret, l, i, sticky, set_isofs_params= 0;
double num, was_bpt_discard_free_ratio;
char *cpt, *npt;
was_level= xorriso->zlib_level; was_level= xorriso->zlib_level;
was_blocksize= xorriso->zisofs_block_size; was_blocksize= xorriso->zisofs_block_size;
was_v2_enabled= xorriso->zisofs_v2_enabled;
was_max_total_blocks= xorriso->zisofs_max_total_blocks;
was_max_file_blocks= xorriso->zisofs_max_file_blocks;
was_blocksize_v2= xorriso->zisofs_v2_block_size;
was_block_number_target= xorriso->zisofs_block_number_target;
was_bpt_discard_free_ratio= xorriso->zisofs_bpt_discard_free_ratio;
was_zisofs_susp_z2= xorriso->zisofs_susp_z2;
npt= cpt= mode; npt= cpt= mode;
for(cpt= mode; npt!=NULL; cpt= npt+1) { for(cpt= mode; npt!=NULL; cpt= npt+1) {
npt= strchr(cpt,':'); npt= strchr(cpt,':');
if(npt==NULL) if(npt==NULL)
l= strlen(cpt); l= strlen(cpt);
else else
l= npt-cpt; l= npt-cpt;
if(l==0) if(l==0)
goto unknown_mode; goto unknown_mode;
skipping to change at line 2182 skipping to change at line 2228
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-zisofs: Wrong zlib compression level '%s' (allowed 0...9)", "-zisofs: Wrong zlib compression level '%s' (allowed 0...9)",
cpt + 6); cpt + 6);
goto sorry_ex; goto sorry_ex;
} }
xorriso->zlib_level= num; xorriso->zlib_level= num;
} else if(strncmp(cpt, "ziso_used=", 10) == 0 || } else if(strncmp(cpt, "ziso_used=", 10) == 0 ||
strncmp(cpt, "osiz_used=", 10) == 0 || strncmp(cpt, "osiz_used=", 10) == 0 ||
strncmp(cpt, "gzip_used=", 10) == 0 || strncmp(cpt, "gzip_used=", 10) == 0 ||
strncmp(cpt, "gunzip_used=", 12) == 0) { strncmp(cpt, "gunzip_used=", 12) == 0 ||
strncmp(cpt, "bpt_ratio_used=", 15) == 0 ||
strncmp(cpt, "bpt_used=", 9) == 0) {
/* (ignored info from -status) */; /* (ignored info from -status) */;
} else if(strncmp(cpt, "block_size=", 11)==0) { } else if(strncmp(cpt, "block_size=", 11)==0) {
num= 0.0; Xorriso__parse_size_param(cpt, 11, l, &num);
if(l > 11 && l < 27) {
strncpy(text, cpt + 11, l - 11);
text[l - 11]= 0;
num= Scanf_io_size(text, 0);
}
if (num != (1 << 15) && num != (1 << 16) && num != (1 << 17)) { if (num != (1 << 15) && num != (1 << 16) && num != (1 << 17)) {
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"-zisofs: Unsupported block size (allowed 32k, 64k, 128k)"); "-zisofs: Unsupported block size (allowed 32k, 64k, 128k)");
goto sorry_ex; goto sorry_ex;
} }
xorriso->zisofs_block_size= num; xorriso->zisofs_block_size= num;
} else if(strncmp(cpt, "by_magic=", 8)==0) { } else if(strncmp(cpt, "by_magic=", 9)==0) {
if(strncmp(cpt + 9, "on", l - 9) == 0) if(strncmp(cpt + 9, "on", l - 9) == 0) {
xorriso->zisofs_by_magic= 1; xorriso->zisofs_by_magic= 1;
else } else if(strncmp(cpt + 9, "v2", l - 9) == 0) {
xorriso->zisofs_by_magic= 2;
} else if(strncmp(cpt + 9, "off", l - 9) == 0) {
xorriso->zisofs_by_magic= 0; xorriso->zisofs_by_magic= 0;
} else {
sprintf(xorriso->info_text,
"-zisofs: Unrecognized by_magic mode (allowed: on, off, v2)");
goto sorry_ex;
}
} else if(strncmp(cpt, "version_2=", 10) == 0) {
if(strncmp(cpt + 10, "off", l - 10) == 0) {
xorriso->zisofs_v2_enabled= 0;
} else if(strncmp(cpt + 10, "as_needed", l - 10) == 0) {
xorriso->zisofs_v2_enabled= 1;
} else if(strncmp(cpt + 10, "on", l - 10) == 0) {
xorriso->zisofs_v2_enabled= 2;
} else {
sprintf(xorriso->info_text,
"-zisofs: Unrecognized version_2 mode (allowed: on, off, as_needed)");
goto sorry_ex;
}
} else if(strncmp(cpt, "max_bpt=", 8) == 0) {
Xorriso__parse_size_param(cpt, 8, l, &num);
if(num < 1024.0 || num > 128.0 * 1024.0 * 1024.0 * 1024.0) {
sprintf(xorriso->info_text,
"-zisofs: Unsupported block pointer pool size (allowed: 1k to 128g)");
goto sorry_ex;
}
sticky= 0;
if(xorriso->zisofs_max_total_blocks == xorriso->zisofs_max_file_blocks)
sticky= 1;
xorriso->zisofs_max_total_blocks= num / 8.0;
if(xorriso->zisofs_max_total_blocks < xorriso->zisofs_max_file_blocks ||
sticky)
xorriso->zisofs_max_file_blocks= xorriso->zisofs_max_total_blocks;
} else if(strncmp(cpt, "max_bpt_f=", 10) == 0) {
Xorriso__parse_size_param(cpt, 10, l, &num);
if(num < 1024.0 || num > 128.0 * 1024.0 * 1024.0 * 1024.0) {
sprintf(xorriso->info_text,
"-zisofs: Unsupported block pointer list size (allowed: 1k to 128g)");
goto sorry_ex;
}
xorriso->zisofs_max_file_blocks= num / 8.0;
if(xorriso->zisofs_max_file_blocks > xorriso->zisofs_max_total_blocks)
xorriso->zisofs_max_total_blocks= xorriso->zisofs_max_file_blocks;
} else if(strncmp(cpt, "block_size_v2=", 14) == 0) {
Xorriso__parse_size_param(cpt, 14, l, &num);
for(i= 15 ; i <= 20; i++)
if(num == (1 << i))
break;
if(i > 20) {
sprintf(xorriso->info_text,
"-zisofs: Unsupported block size (allowed 32k, 64k, 128k, ... 1024k)");
goto sorry_ex;
}
xorriso->zisofs_v2_block_size= num;
} else if(strncmp(cpt, "bpt_target=", 11) == 0) {
Xorriso__parse_size_param(cpt, 11, l, &num);
xorriso->zisofs_block_number_target= num;
} else if(strncmp(cpt, "bpt_free_ratio=", 15) == 0) {
Xorriso__parse_size_param(cpt, 15, l, &num);
/* 0 means to libisofs "do not change" */
if(num == 0.0)
num= -1.0;
if(num != -1.0 && (num <= 0.0 || num > 1.0)) {
sprintf(xorriso->info_text,
"-zisofs: Unsupported free blockpointer ratio (allowed -1 or 0.0 to 1.0)");
goto sorry_ex;
}
xorriso->zisofs_bpt_discard_free_ratio = num;
} else if(strncmp(cpt, "susp_z2=", 8) == 0) {
if(strncmp(cpt + 8, "off", l - 8) == 0) {
xorriso->zisofs_susp_z2= 0;
} else if(strncmp(cpt + 8, "on", l - 8) == 0) {
xorriso->zisofs_susp_z2= 1;
} else {
sprintf(xorriso->info_text,
"-zisofs: Unrecognized susp_z2 mode (allowed: on, off)");
goto sorry_ex;
}
Xorriso_set_zisofs_params(xorriso, 2);
} else if(strncmp(cpt, "default", l)==0) { } else if(strncmp(cpt, "default", l)==0) {
xorriso->zlib_level= xorriso->zlib_level_default; xorriso->zlib_level= xorriso->zlib_level_default;
xorriso->zisofs_block_size= xorriso->zisofs_block_size_default; xorriso->zisofs_block_size= xorriso->zisofs_block_size_default;
xorriso->zisofs_by_magic= 0; xorriso->zisofs_by_magic= 0;
xorriso->zisofs_v2_enabled= 0;
xorriso->zisofs_max_total_blocks= xorriso->zisofs_max_total_blocks_default;
xorriso->zisofs_max_file_blocks= xorriso->zisofs_max_file_blocks_default;
xorriso->zisofs_v2_block_size= xorriso->zisofs_v2_block_size_default;
xorriso->zisofs_block_number_target= -1;
xorriso->zisofs_bpt_discard_free_ratio=
xorriso->zisofs_bpt_discard_free_ratio_default;
xorriso->zisofs_susp_z2= xorriso->zisofs_susp_z2_default;
Xorriso_set_zisofs_params(xorriso, 2);
} else { } else {
unknown_mode:; unknown_mode:;
if(l<SfileadrL) if(l<SfileadrL)
sprintf(xorriso->info_text, "-zisofs: unknown mode '%s'", cpt); sprintf(xorriso->info_text, "-zisofs: unknown mode '%s'", cpt);
else else
sprintf(xorriso->info_text, "-zisofs: oversized mode parameter (%d)",l); sprintf(xorriso->info_text, "-zisofs: oversized mode parameter (%d)",l);
sorry_ex: sorry_ex:
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
xorriso->zlib_level= was_level; xorriso->zlib_level= was_level;
xorriso->zisofs_block_size= was_blocksize; xorriso->zisofs_block_size= was_blocksize;
xorriso->zisofs_v2_enabled= was_v2_enabled;
xorriso->zisofs_max_total_blocks= was_max_total_blocks;
xorriso->zisofs_max_file_blocks= was_max_file_blocks;
xorriso->zisofs_v2_block_size= was_blocksize_v2;
xorriso->zisofs_block_number_target= was_block_number_target;
xorriso->zisofs_bpt_discard_free_ratio= was_bpt_discard_free_ratio;
xorriso->zisofs_susp_z2 = was_zisofs_susp_z2;
Xorriso_set_zisofs_params(xorriso, 2);
return(0); return(0);
} }
if(strncmp(cpt, "by_magic=", 9) != 0 &&
strncmp(cpt, "susp_z2=", 8) != 0)
set_isofs_params= 1;
} }
ret= Xorriso_set_zisofs_params(xorriso, 0); ret= 1;
if(set_isofs_params)
ret= Xorriso_set_zisofs_params(xorriso, 1);
return(ret); return(ret);
} }
 End of changes. 28 change blocks. 
34 lines changed or deleted 186 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)