"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xorriso/opts_i_o.c" between
xorriso-1.4.6.tar.gz and xorriso-1.4.8.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_i_o.c  (xorriso-1.4.6):opts_i_o.c  (xorriso-1.4.8)
skipping to change at line 539 skipping to change at line 539
eff_origin); eff_origin);
Xorriso_info(xorriso,0); Xorriso_info(xorriso,0);
} }
ret= 1; ret= 1;
ex:; ex:;
Xorriso_free_meM(eff_origin); Xorriso_free_meM(eff_origin);
Xorriso_free_meM(eff_dest); Xorriso_free_meM(eff_dest);
return(ret); return(ret);
} }
/* Options -map_l , -compare_l , -update_l , -extract_l */ /* Command -map_l , -compare_l , -update_l , -extract_l , -update_lxi ,
-update_li
*/
/* @param flag bit4= do not establish and dispose xorriso->di_array /* @param flag bit4= do not establish and dispose xorriso->di_array
for update_l for update_l
bit8-11= mode 0= -map_l bit8-11= mode 0= -map_l
1= -compare_l 1= -compare_l
2= -update_l 2= -update_l
3= -extract_l 3= -extract_l
4= -update_lxi
5= -update_li
*/ */
int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_map_l(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag) int *idx, int flag)
{ {
int ret, end_idx, optc= 0, was_failure= 1, i, fret, mode, problem_count; int ret, end_idx, optc= 0, was_failure= 1, i, j, fret, mode, problem_count;
int ns_flag= 2|4, nt_flag= 2, opt_args_flag= 2; int ns_flag= 2|4, nt_flag= 2, opt_args_flag= 2, arg2c= 0, opt2c= 0;
int new_opt2c;
char *source_prefix= NULL, *target_prefix= NULL, *cmd, **optv= NULL; char *source_prefix= NULL, *target_prefix= NULL, *cmd, **optv= NULL;
char *eff_source= NULL, *eff_target= NULL, *source_pt, *s_wd, *t_wd; char *eff_source= NULL, *eff_target= NULL, *s_wd, *t_wd;
char **eff_src_array= NULL, **eff_tgt_array= NULL; char **eff_src_array= NULL, **eff_tgt_array= NULL, **opt2v= NULL;
char **arg2v= NULL;
cmd= "-map_l"; cmd= "-map_l";
s_wd= xorriso->wdx; s_wd= xorriso->wdx;
t_wd= xorriso->wdi; t_wd= xorriso->wdi;
Xorriso_pacifier_reset(xorriso, 0); Xorriso_pacifier_reset(xorriso, 0);
mode= (flag>>8) & 15; mode= (flag>>8) & 15;
if(mode==1) if(mode==1)
cmd= "-compare_l"; cmd= "-compare_l";
else if(mode==2) else if(mode==2)
cmd= "-update_l"; cmd= "-update_l";
else if(mode==3) { else if(mode == 3 || mode == 5) {
cmd= "-extract_l"; if(mode == 5)
cmd= "-update_li";
else
cmd= "-extract_l";
ns_flag= 2; ns_flag= 2;
s_wd= xorriso->wdi; s_wd= xorriso->wdi;
nt_flag= 2|4; nt_flag= 2|4;
t_wd= xorriso->wdx; t_wd= xorriso->wdx;
opt_args_flag= 0; opt_args_flag= 0;
} else if(mode == 4) {
cmd= "-update_lxi";
} }
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2); end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1|2);
if(end_idx - (*idx) < 3) { if(end_idx - (*idx) < 3) {
sprintf(xorriso->info_text, "%s: Not enough arguments given (%d < 3)", cmd, sprintf(xorriso->info_text, "%s: Not enough arguments given (%d < 3)", cmd,
end_idx - (*idx)); end_idx - (*idx));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
ret= 0; goto ex; ret= 0; goto ex;
} }
skipping to change at line 600 skipping to change at line 611
if(ret<=0) if(ret<=0)
goto ex; goto ex;
ret= Xorriso_normalize_img_path(xorriso, t_wd, argv[(*idx)+1], ret= Xorriso_normalize_img_path(xorriso, t_wd, argv[(*idx)+1],
target_prefix, nt_flag); target_prefix, nt_flag);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
ret= Xorriso_opt_args(xorriso, cmd, argc, argv, (*idx)+2, &end_idx, ret= Xorriso_opt_args(xorriso, cmd, argc, argv, (*idx)+2, &end_idx,
&optc, &optv, opt_args_flag); &optc, &optv, opt_args_flag);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
if(mode == 4) {
/* Convert pattern from disk to iso_rr */
arg2c= end_idx - *idx - 2;
Xorriso_alloc_meM(arg2v, char *, arg2c);
for(i = 0; i < arg2c; i++)
arg2v[i]= NULL;
arg2c= 0;
for(i = (*idx) + 2; i < end_idx; i++) {
ret= Xorriso_normalize_img_path(xorriso, s_wd, argv[i],
eff_source, ns_flag);
if(ret<=0)
goto ex;
ret= Xorriso__exchange_prefix(source_prefix, target_prefix,
eff_source, eff_target, 0);
if(ret <= 0)
continue;
Xorriso_alloc_meM(arg2v[arg2c], char, strlen(eff_target) + 1);
strcpy(arg2v[arg2c], eff_target);
arg2c++;
}
/* Expand wildcards in iso_rr, do not include unmatched patterns */
ret= Xorriso_opt_args(xorriso, cmd, arg2c, arg2v, 0, &i,
&opt2c, &opt2v, (1 << 10) | (1 << 7));
if(ret<=0)
goto ex;
/* Convert from iso_rr path to disk path */
new_opt2c= 0;
for(i = 0; i < opt2c; i++) {
ret= Xorriso__exchange_prefix(target_prefix, source_prefix,
opt2v[i], eff_source, 0);
free(opt2v[i]);
opt2v[i]= NULL;
if(ret <= 0)
continue;
Xorriso_alloc_meM(opt2v[new_opt2c], char, strlen(eff_source) + 1);
strcpy(opt2v[new_opt2c], eff_source);
new_opt2c++;
}
opt2c= new_opt2c;
/* Merge both results */
if(opt2c > 0) {
Sfile_destroy_argv(&arg2c, &arg2v, 0);
Xorriso_alloc_meM(arg2v, char *, optc + opt2c);
for(i = 0; i < optc + opt2c; i++)
arg2v[i]= NULL;
arg2c= 0;
for(i= 0; i < optc; i++) {
ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i],
eff_source, ns_flag);
if(ret<=0)
goto ex;
Xorriso_alloc_meM(arg2v[arg2c], char, strlen(eff_source) + 1);
strcpy(arg2v[arg2c], eff_source);
arg2c++;
}
for(i= 0; i < opt2c; i++) {
for(j= 0; j < optc; j++)
if(strcmp(opt2v[i], arg2v[j]) == 0)
break;
if(j < optc)
continue;
arg2v[arg2c++]= opt2v[i];
opt2v[i]= NULL;
}
Sfile_destroy_argv(&optc, &optv, 0);
optv= arg2v;
arg2v= NULL;
optc= arg2c;
arg2c= 0;
}
}
if(mode == 3 && if(mode == 3 &&
(xorriso->do_restore_sort_lba || !(xorriso->ino_behavior & 4))) { (xorriso->do_restore_sort_lba || !(xorriso->ino_behavior & 4))) {
eff_src_array= calloc(optc, sizeof(char *)); eff_src_array= calloc(optc, sizeof(char *));
eff_tgt_array= calloc(optc, sizeof(char *)); eff_tgt_array= calloc(optc, sizeof(char *));
if(eff_src_array == NULL || eff_tgt_array == NULL) { if(eff_src_array == NULL || eff_tgt_array == NULL) {
Xorriso_no_malloc_memory(xorriso, NULL, 0); Xorriso_no_malloc_memory(xorriso, NULL, 0);
ret= -1; goto ex; ret= -1; goto ex;
} }
for(i= 0; i < optc; i++) for(i= 0; i < optc; i++)
eff_src_array[i]= eff_tgt_array[i]= NULL; eff_src_array[i]= eff_tgt_array[i]= NULL;
} }
if(mode == 2 && !((xorriso->ino_behavior & 2) || (flag & 16) || if((mode == 2 || mode == 4) &&
xorriso->di_array != NULL)) { !((xorriso->ino_behavior & 2) || (flag & 16) ||
xorriso->di_array != NULL)) {
/* Create all-image node array sorted by isofs.di */ /* Create all-image node array sorted by isofs.di */
ret= Xorriso_make_di_array(xorriso, 0); ret= Xorriso_make_di_array(xorriso, 0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
} }
for(i= 0; i<optc; i++) { for(i= 0; i<optc; i++) {
ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i], ret= Xorriso_normalize_img_path(xorriso, s_wd, optv[i],
eff_source, ns_flag); eff_source, ns_flag);
if(ret<=0) if(ret<=0)
goto ex; goto ex;
strcpy(eff_target, target_prefix); ret= Xorriso__exchange_prefix(source_prefix, target_prefix,
source_pt= eff_source; eff_source, eff_target, 0);
if(source_prefix[0]) { if(ret == 0) {
if(strncmp(source_prefix, eff_source, strlen(source_prefix))!=0) { sprintf(xorriso->info_text, "%s: disk_path ", cmd);
sprintf(xorriso->info_text, "%s: disk_path ", cmd); Text_shellsafe(eff_source, xorriso->info_text, 1);
Text_shellsafe(eff_source, xorriso->info_text, 1); strcat(xorriso->info_text, " does not begin with disk_prefix ");
strcat(xorriso->info_text, " does not begin with disk_prefix "); Text_shellsafe(source_prefix, xorriso->info_text, 1);
Text_shellsafe(source_prefix, xorriso->info_text, 1); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 1);
ret= 0; goto ex;
}
source_pt+= strlen(source_prefix);
} }
strcat(eff_target, source_pt); if(ret <= 0)
goto ex;
if(mode==0) if(mode==0)
ret= Xorriso_option_map(xorriso, eff_source, eff_target, 2); ret= Xorriso_option_map(xorriso, eff_source, eff_target, 2);
else if(mode==1) else if(mode==1)
ret= Xorriso_option_compare(xorriso, eff_source, eff_target, 2|8); ret= Xorriso_option_compare(xorriso, eff_source, eff_target, 2|8);
else if(mode==2) else if(mode == 2 || mode == 4)
ret= Xorriso_option_update(xorriso, eff_source, eff_target, 2 | 8 | 16); ret= Xorriso_option_update(xorriso, eff_source, eff_target, 2 | 8 | 16);
else if(mode==3) { else if(mode==3) {
if(eff_src_array != NULL) { if(eff_src_array != NULL) {
eff_src_array[i]= strdup(eff_source); eff_src_array[i]= strdup(eff_source);
eff_tgt_array[i]= strdup(eff_target); eff_tgt_array[i]= strdup(eff_target);
if(eff_src_array[i] == NULL || eff_tgt_array[i] == NULL) { if(eff_src_array[i] == NULL || eff_tgt_array[i] == NULL) {
Xorriso_no_malloc_memory(xorriso, &(eff_src_array[i]), 0); Xorriso_no_malloc_memory(xorriso, &(eff_src_array[i]), 0);
ret= -1; goto ex; ret= -1; goto ex;
} }
} else { } else {
ret= Xorriso_option_extract(xorriso, eff_source, eff_target, 2 | 4); ret= Xorriso_option_extract(xorriso, eff_source, eff_target, 2 | 4);
} }
} else if(mode == 5) {
ret= Xorriso_option_update(xorriso, eff_target, eff_source, 2 | 8 | 16);
} }
if(ret>0 && !xorriso->request_to_abort) if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */ continue; /* regular bottom of loop */
was_failure= 1; was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2); fret= Xorriso_eval_problem_status(xorriso, ret, 1 | 2);
if(fret>=0) if(fret>=0)
continue; continue;
goto ex; goto ex;
} }
skipping to change at line 686 skipping to change at line 768
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array, ret= Xorriso_restore_sorted(xorriso, optc, eff_src_array, eff_tgt_array,
&problem_count, 0); &problem_count, 0);
if(ret <= 0 || problem_count > 0) if(ret <= 0 || problem_count > 0)
was_failure= 1; was_failure= 1;
} }
if(mode==0) if(mode==0)
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count, Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1); xorriso->pacifier_total, "", 1);
else if(mode==1 || mode==2) else if(mode==1 || mode==2 || mode == 4 || mode == 5)
Xorriso_pacifier_callback(xorriso, "content bytes read", Xorriso_pacifier_callback(xorriso, "content bytes read",
xorriso->pacifier_count, 0, "", 1 | 8 | 32); xorriso->pacifier_count, 0, "", 1 | 8 | 32);
else if(mode==3) else if(mode==3)
Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count, Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
xorriso->pacifier_total, "", 1|4); xorriso->pacifier_total, "", 1|4);
ex:; ex:;
Xorriso_destroy_node_array(xorriso, 0); Xorriso_destroy_node_array(xorriso, 0);
i= optc; i= optc;
Sfile_destroy_argv(&i, &eff_src_array, 0); Sfile_destroy_argv(&i, &eff_src_array, 0);
i= optc; i= optc;
Sfile_destroy_argv(&i, &eff_tgt_array, 0); Sfile_destroy_argv(&i, &eff_tgt_array, 0);
Xorriso_free_meM(source_prefix); Xorriso_free_meM(source_prefix);
Xorriso_free_meM(target_prefix); Xorriso_free_meM(target_prefix);
Xorriso_free_meM(eff_source); Xorriso_free_meM(eff_source);
Xorriso_free_meM(eff_target); Xorriso_free_meM(eff_target);
(*idx)= end_idx; (*idx)= end_idx;
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv, 256); Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv, 256);
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &opt2c, &opt2v,
256);
if(arg2c > 0)
Sfile_destroy_argv(&arg2c, &arg2v, 0);
else if(arg2v != NULL)
Xorriso_free_meM(arg2v);
if(ret<=0) if(ret<=0)
return(ret); return(ret);
return(!was_failure); return(!was_failure);
} }
/* Option -mark */ /* Option -mark */
int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag) int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
{ {
if(mark[0]==0) if(mark[0]==0)
xorriso->mark_text[0]= 0; xorriso->mark_text[0]= 0;
 End of changes. 14 change blocks. 
24 lines changed or deleted 113 lines changed or added

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