Replaced some large local variables by other means in xorriso/opts_a_c.c

master
Thomas Schmitt 12 years ago
parent 165c82c394
commit 7e0165ff4c

@ -39,13 +39,11 @@
int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
{
int ret, sev;
char sfe[5*SfileadrL];
ret= Xorriso__text_to_sev(severity, &sev, 0);
if(ret<=0) {
sprintf(xorriso->info_text,
"-abort_on: Not a known severity name : %s",
Text_shellsafe(severity, sfe, 0));
sprintf(xorriso->info_text, "-abort_on: Not a known severity name : ");
Text_shellsafe(severity, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(ret);
}
@ -101,9 +99,13 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx, ret, was_failure= 0, fret, optc= 0, split;
char target[SfileadrL], source[SfileadrL], *ept, eff_path[SfileadrL];
char *target= NULL, *source= NULL, *ept, *eff_path= NULL;
char **optv= NULL, *rpt, *wpt;
Xorriso_alloc_meM(target, char, SfileadrL);
Xorriso_alloc_meM(source, char, SfileadrL);
Xorriso_alloc_meM(eff_path, char, SfileadrL);
ret= Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx,
&optc, &optv, ((!!xorriso->allow_graft_points)<<2)|2);
if(ret<=0)
@ -182,6 +184,9 @@ problem_handler:;
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_free_meM(target);
Xorriso_free_meM(source);
Xorriso_free_meM(eff_path);
Xorriso_opt_args(xorriso, "-add", argc, argv, *idx, &end_idx, &optc, &optv,
256);
if(ret<=0)
@ -524,7 +529,7 @@ int Xorriso_option_biblio_file(struct XorrisO *xorriso, char *name, int flag)
*/
int Xorriso_option_blank(struct XorrisO *xorriso, char *mode, int flag)
{
char drive_name[SfileadrL], *cmd= "-blank";
char *cmd= "-blank";
int aq_ret, ret, aq_flag= 2, mode_flag= 0, as_needed= 0, idx;
off_t size= 0;
@ -613,7 +618,6 @@ unusable_size:;
ret= Xorriso_blank_media(xorriso, mode_flag&3);
if(ret==0)
return(ret);
strcpy(drive_name, xorriso->outdev);
if(ret <= 0) { /* in case of success, above functions will have re-aquired */
aq_ret= Xorriso_reaquire_outdev(xorriso, 0); /* actually give up drive */
if(ret<aq_ret)
@ -631,9 +635,10 @@ int Xorriso_option_boot_image(struct XorrisO *xorriso, char *form,
{
int was_ok= 1, ret, isolinux_grub= 0, count;
unsigned int u;
char *formpt, *treatpt, eff_path[SfileadrL];
char *formpt, *treatpt, *eff_path= NULL;
double num;
Xorriso_alloc_meM(eff_path, char, SfileadrL);
formpt= form;
if(formpt[0]=='-')
formpt++;
@ -649,7 +654,7 @@ cannot_keep_or_patch:;
sprintf(xorriso->info_text,
"Loaded boot image has already been replaced. Cannot keep or patch it.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
if(isolinux_grub)
goto treatment_patch;
@ -683,13 +688,13 @@ treatment_patch:;
if(xorriso->boot_count > 0) {
ret= Xorriso_attach_boot_image(xorriso, 2); /* dispose boot images */
if(ret <= 0)
return(ret);
goto ex;
}
} else if(strcmp(treatpt, "next") == 0) {
ret= Xorriso_attach_boot_image(xorriso, 0);
if(ret <= 0)
return(ret);
goto ex;
} else if(strcmp(treatpt, "show_status")==0) {
sprintf(xorriso->result_line, "------------------------------------\n");
@ -715,7 +720,7 @@ treatment_patch:;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
xorriso->boot_image_cat_path, 2);
if(ret <= 0)
return(ret);
goto ex;
} else if(strncmp(treatpt, "cat_hidden=", 11) == 0) {
ret= Xorriso__hide_mode(treatpt + 11, 0);
@ -746,7 +751,7 @@ treatment_patch:;
sprintf(xorriso->info_text,
"Allowed with dir= are / , /isolinux . /boot/isolinux");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
{ret= 0; goto ex;}
}
strcpy(xorriso->boot_image_cat_path, xorriso->boot_image_bin_path);
strcat(xorriso->boot_image_bin_path, "isolinux.bin");
@ -755,7 +760,7 @@ treatment_patch:;
xorriso->keep_boot_image= 0;
xorriso->patch_isolinux_image= 1;
strcpy(xorriso->boot_image_bin_form, formpt);
return(1);
{ret= 1; goto ex;}
} else if(strcmp(formpt, "grub") == 0) {
@ -774,7 +779,7 @@ treatment_patch:;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
xorriso->boot_image_bin_path, 2);
if(ret <= 0)
return(ret);
goto ex;
xorriso->keep_boot_image= 0;
if(isolinux_grub) {
xorriso->patch_isolinux_image= 1;
@ -792,7 +797,7 @@ treatment_patch:;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 9,
xorriso->boot_image_bin_path, 2);
if(ret <= 0)
return(ret);
goto ex;
xorriso->keep_boot_image= 0;
xorriso->boot_efi_default= 1;
@ -800,27 +805,27 @@ treatment_patch:;
sprintf(eff_path, "-boot_image %s mips_path=", formpt);
ret= Xorriso_coordinate_system_area(xorriso, 1, 0, eff_path, 0);
if(ret <= 0)
return(ret);
goto ex;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 10,
eff_path, 2);
if(ret <= 0)
return(ret);
goto ex;
ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 0);
if(ret <= 0)
return(ret);
goto ex;
} else if(strncmp(treatpt, "mipsel_path=", 12) == 0) {
sprintf(eff_path, "-boot_image %s mipsel_path=", formpt);
ret= Xorriso_coordinate_system_area(xorriso, 2, 0, eff_path, 0);
if(ret <= 0)
return(ret);
goto ex;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, treatpt + 12,
eff_path, 2);
if(ret <= 0)
return(ret);
goto ex;
ret= Xorriso_add_mips_boot_file(xorriso, eff_path, 2);
if(ret <= 0)
return(ret);
goto ex;
} else if(strcmp(treatpt, "mips_discard") == 0 ||
strcmp(treatpt, "mipsel_discard") == 0 ||
@ -832,7 +837,7 @@ treatment_patch:;
sprintf(eff_path, "-boot_image %s sparc_path=", formpt);
ret= Xorriso_coordinate_system_area(xorriso, 3, 0, eff_path, 0);
if(ret <= 0)
return(ret);
goto ex;
strncpy(xorriso->ascii_disc_label, treatpt + 12,
Xorriso_disc_label_sizE - 1);
xorriso->ascii_disc_label[Xorriso_disc_label_sizE - 1] = 0;
@ -852,7 +857,7 @@ treatment_patch:;
"-boot_image %s : load_size too small (%s < 512)",
formpt, treatpt + 10);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
xorriso->boot_image_load_size= num;
@ -874,7 +879,7 @@ treatment_patch:;
"-boot_image %s sel_crit= : Wrong form. Need even number of hex digits.",
formpt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
} else if(strncmp(treatpt, "system_area=", 12) == 0) {
@ -882,11 +887,11 @@ treatment_patch:;
ret= Xorriso_coordinate_system_area(xorriso, 0, 2,
"-boot_image isolinux system_area=", 0);
if(ret <= 0)
return(ret);
goto ex;
}
ret= Xorriso_set_system_area_path(xorriso, treatpt + 12, 0);
if(ret <= 0)
return(ret);
goto ex;
} else if(strncmp(treatpt, "partition_table=", 16)==0) {
if(strcmp(treatpt + 16, "off") == 0) {
@ -898,7 +903,7 @@ treatment_patch:;
else
ret= Xorriso_coordinate_system_area(xorriso, 0, 1, eff_path, 0);
if(ret <= 0)
return(ret);
goto ex;
} else
was_ok= 0;
@ -910,7 +915,7 @@ treatment_patch:;
"-boot_image %s partition_offset= : Non-zero number too small (<16).",
formpt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
xorriso->partition_offset= u;
@ -921,7 +926,7 @@ treatment_patch:;
sprintf(xorriso->info_text,
"-boot_image %s partition_hd_cyl= : Number too large (>255).", formpt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
xorriso->partition_heads_per_cyl= u;
@ -932,7 +937,7 @@ treatment_patch:;
sprintf(xorriso->info_text,
"-boot_image %s partition_sec_hd= : Number too large (>63).", formpt);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
xorriso->partition_secs_per_head= u;
@ -950,7 +955,7 @@ treatment_patch:;
"-boot_image %s partition_cyl_align: unknown mode : %s",
formpt, treatpt + 20);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
{ret= 0; goto ex;}
}
} else if(strncmp(treatpt, "platform_id=", 12)==0) {
@ -963,7 +968,7 @@ treatment_patch:;
"-boot_image %s : platform_id too large (%s > 0xff)",
formpt, treatpt + 12);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
xorriso->boot_platform_id= u;
@ -981,7 +986,7 @@ treatment_patch:;
"-boot_image %s : Unknown media_type : %s",
formpt, treatpt + 10);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
} else if(strncmp(treatpt, "isohybrid=", 10) == 0 &&
@ -1005,7 +1010,7 @@ treatment_patch:;
sprintf(xorriso->info_text,
"Allowed with isohybrid= are: off , auto , on , force");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
return(0);
{ret= 0; goto ex;}
}
#else
@ -1030,9 +1035,12 @@ treatment_patch:;
sprintf(xorriso->info_text, "Unrecognized options with -boot_image: %s %s",
form, treatment);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
return(1);
ret= 1;
ex:
Xorriso_free_meM(eff_path);
return(ret);
}
@ -1061,111 +1069,126 @@ int Xorriso_option_calm_drive(struct XorrisO *xorriso, char *which, int flag)
/* Option -cd alias -cdi */
int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
{
char sfe[5*SfileadrL], path[SfileadrL], eff_path[SfileadrL];
char *path= NULL, *eff_path= NULL;
int ret;
Xorriso_alloc_meM(path, char, SfileadrL);
Xorriso_alloc_meM(eff_path, char, SfileadrL);
if (strlen(iso_rr_path)>sizeof(xorriso->wdi)) {
sprintf(xorriso->info_text,"-cdi: iso_rr_path too long (%d > %d)",
(int) strlen(iso_rr_path), (int) sizeof(xorriso->wdi)-1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
Xorriso_warn_of_wildcards(xorriso, iso_rr_path, 1);
sprintf(xorriso->info_text,"previous working directory:\n");
Xorriso_info(xorriso,0);
sprintf(xorriso->result_line,"%s/\n",Text_shellsafe(xorriso->wdi, sfe, 0));
Text_shellsafe(xorriso->wdi, xorriso->result_line, 0);
strcat(xorriso->result_line, "/\n");
Xorriso_result(xorriso,0);
if(strcmp(iso_rr_path,"/")==0 || iso_rr_path[0]==0) {
strcpy(xorriso->wdi,"");
Xorriso_option_pwdi(xorriso, 0);
return(1);
{ret= 1; goto ex;}
} else if(iso_rr_path[0]!='/') {
strcpy(path, xorriso->wdi);
if(Sfile_add_to_path(path,iso_rr_path,0)<=0)
return(-1);
{ret= -1; goto ex;}
} else {
if(Sfile_str(path,iso_rr_path,0)<=0)
return(-1);
{ret= -1; goto ex;}
}
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 1);
if(ret<0)
return(ret);
goto ex;
if(ret==0) {
sprintf(xorriso->info_text, "-cdi: not existing yet in ISO image : %s",
Text_shellsafe(path, sfe, 0));
sprintf(xorriso->info_text, "-cdi: not existing yet in ISO image : ");
Text_shellsafe(path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, path, eff_path, 2);
if(ret<=0)
return(ret);
goto ex;
} else if(ret!=2) {
sprintf(xorriso->info_text, "-cdi: not a directory : %s",
Text_shellsafe(eff_path, sfe, 0));
sprintf(xorriso->info_text, "-cdi: not a directory : ");
Text_shellsafe(eff_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
strcpy(xorriso->wdi, eff_path);
Xorriso_option_pwdi(xorriso, 0);
return(1);
ret= 1;
ex:;
Xorriso_free_meM(path);
Xorriso_free_meM(eff_path);
return(ret);
}
/* Option -cdx */
int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
{
char sfe[5*SfileadrL], path[SfileadrL], eff_path[SfileadrL];
char *path= NULL, *eff_path= NULL;
int ret;
Xorriso_alloc_meM(path, char, SfileadrL);
Xorriso_alloc_meM(eff_path, char, SfileadrL);
if (strlen(disk_path)>sizeof(xorriso->wdx)) {
sprintf(xorriso->info_text,"-cdx: disk_path too long (%d > %d)",
(int) strlen(disk_path), (int) sizeof(xorriso->wdx)-1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
Xorriso_warn_of_wildcards(xorriso, disk_path, 1|2);
sprintf(xorriso->info_text,"previous working directory on hard disk:\n");
Xorriso_info(xorriso,0);
sprintf(xorriso->result_line,"%s/\n",Text_shellsafe(xorriso->wdx, sfe, 0));
Text_shellsafe(xorriso->wdx, xorriso->info_text, 0);
strcat(xorriso->info_text, "/\n");
Xorriso_result(xorriso,0);
if(strcmp(disk_path,"/")==0) {
strcpy(xorriso->wdx,"");
Xorriso_option_pwdx(xorriso, 0);
return(1);
{ret= 1; goto ex;}
} else if(disk_path[0]!='/') {
strcpy(path, xorriso->wdx);
if(Sfile_add_to_path(path,disk_path,0)<=0)
return(-1);
{ret= -1; goto ex;}
} else {
if(Sfile_str(path,disk_path,0)<=0)
return(-1);
{ret= -1; goto ex;}
}
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, path, eff_path, 2|4);
if(ret<=0)
return(ret);
goto ex;
if(eff_path[0]) {
ret= Sfile_type(eff_path,1|4|8);
if(ret<0) {
Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,"-cdx: file not found : %s",
Text_shellsafe(eff_path, sfe, 0));
sprintf(xorriso->info_text,"-cdx: file not found : ");
Text_shellsafe(eff_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
if(ret!=2) {
Xorriso_msgs_submit(xorriso, 0, eff_path, 0, "ERRFILE", 0);
sprintf(xorriso->info_text,
"-cdx: not a directory : %s",
Text_shellsafe(eff_path, sfe, 0));
sprintf(xorriso->info_text, "-cdx: not a directory : ");
Text_shellsafe(eff_path, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
{ret= 0; goto ex;}
}
}
if(Sfile_str(xorriso->wdx,eff_path,0)<=0)
return(-1);
{ret= -1; goto ex;}
Xorriso_option_pwdx(xorriso, 0);
return(1);
ret= 1;
ex:;
Xorriso_free_meM(path);
Xorriso_free_meM(eff_path);
return(ret);
}
@ -1177,7 +1200,7 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
{
int ret;
char *name_pt= NULL, sfe[5 * SfileadrL], *local_charset;
char *name_pt= NULL, *local_charset;
iconv_t iconv_ret= (iconv_t) -1;
if(name != NULL)
@ -1194,8 +1217,9 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
iconv_ret= iconv_open(local_charset, name_pt);
if(iconv_ret == (iconv_t) -1) {
sprintf(xorriso->info_text,
"-%scharset: Cannot convert from character set %s",
flag & 2 ? "" : "in_", Text_shellsafe(name_pt, sfe, 0));
"-%scharset: Cannot convert from character set ",
flag & 2 ? "" : "in_");
Text_shellsafe(name_pt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
0);
return(0);
@ -1212,8 +1236,9 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
Xorriso_get_local_charset(xorriso, &local_charset, 0);
iconv_ret= iconv_open(local_charset, name_pt);
if(iconv_ret == (iconv_t) -1) {
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset %s",
flag & 1 ? "" : "out_", Text_shellsafe(name_pt, sfe, 0));
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset ",
flag & 1 ? "" : "out_");
Text_shellsafe(name_pt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
0);
return(0);
@ -1228,9 +1253,9 @@ int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
if(flag & 3) {
if(name_pt == NULL)
Xorriso_get_local_charset(xorriso, &name_pt, 0);
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
Text_shellsafe(name_pt, sfe, 0));
sprintf(xorriso->info_text, "Character set for %sconversion is now: ",
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "");
Text_shellsafe(name_pt, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
return(1);
@ -1734,31 +1759,33 @@ int Xorriso_option_close_filter_list(struct XorrisO *xorriso, int flag)
int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
{
int ret;
char newdev[SfileadrL];
char *newdev= NULL;
Xorriso_alloc_meM(newdev, char, SfileadrL);
if(!xorriso->volset_change_pending) {
sprintf(xorriso->info_text, "-commit: No image modifications pending");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(3);
{ret= 3; goto ex;}
}
if(!(flag&2)) {
ret= Xorriso_reassure(xorriso, "-commit",
"write the pending image changes to media", 0);
if(ret<=0)
return(2);
{ret= 2; goto ex;}
}
Xorriso_process_errfile(xorriso, 0, "burn session start", 0, 1);
ret= Xorriso_write_session(xorriso, 0);
Xorriso_process_errfile(xorriso, 0, "burn session end", 0, 1);
if(ret<=0)
return(ret);
goto ex;
Xorriso_write_session_log(xorriso, 0);
xorriso->volset_change_pending= 0;
xorriso->no_volset_present= 0;
if(flag&1)
return(1);
{ret= 1; goto ex;}
if(Sregex_string(&(xorriso->in_charset), xorriso->out_charset, 0) <= 0)
return(-1);
{ret= -1; goto ex;}
strcpy(newdev, xorriso->outdev);
if(xorriso->grow_blindly_msc2>=0)
ret= Xorriso_option_dev(xorriso, "", 3|4);
@ -1767,6 +1794,8 @@ int Xorriso_option_commit(struct XorrisO *xorriso, int flag)
xorriso->displacement_sign= 0;
ret= Xorriso_option_dev(xorriso, newdev, 3|4);
}
ex:;
Xorriso_free_meM(newdev);
return(ret);
}
@ -1803,7 +1832,10 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
{
int ret, mem_pci, zero= 0, result, follow_links;
double mem_lut= 0.0;
char *ipth, *argv[6], eff_origin[SfileadrL], eff_dest[SfileadrL];
char *ipth, *argv[6], *eff_origin= NULL, *eff_dest= NULL;
Xorriso_alloc_meM(eff_origin, char, SfileadrL);
Xorriso_alloc_meM(eff_dest, char, SfileadrL);
ipth= iso_path;
if(ipth[0]==0)
@ -1811,15 +1843,15 @@ int Xorriso_option_compare(struct XorrisO *xorriso, char *disk_path,
if(disk_path[0]==0) {
sprintf(xorriso->info_text, "-compare: Empty disk_path given");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
return(0);
{ret= 0; goto ex;}
}
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4|8);
if(ret<=0)
return(ret);
goto ex;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_dest, 2|8);
if(ret<=0)
return(ret);
goto ex;
if(xorriso->disk_excl_mode&8)
ret= Xorriso_path_is_excluded(xorriso, eff_origin, 1);
@ -1887,8 +1919,12 @@ report_outcome:;
if(flag&1)
Xorriso_result(xorriso,0);
if(ret<0)
return(ret);
return(1);
goto ex;
ret= 1;
ex:;
Xorriso_free_meM(eff_origin);
Xorriso_free_meM(eff_dest);
return(ret);
}
@ -1918,12 +1954,16 @@ int Xorriso_option_cp_clone(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx_dummy, ret, is_dir= 0, was_failure= 0, fret, pass;
char eff_origin[SfileadrL], eff_dest[SfileadrL], dest_dir[SfileadrL];
char leafname[SfileadrL];
char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
int optc= 0;
char **optv= NULL;
struct stat stbuf;
Xorriso_alloc_meM(eff_origin, char, SfileadrL);
Xorriso_alloc_meM(eff_dest, char, SfileadrL);
Xorriso_alloc_meM(dest_dir, char, SfileadrL);
Xorriso_alloc_meM(leafname, char, SfileadrL);
ret= Xorriso_cpmv_args(xorriso, "-cp_clone", argc, argv, idx,
&optc, &optv, eff_dest, 1);
if(ret<=0)
@ -2005,6 +2045,10 @@ problem_handler:;
ex:;
Xorriso_opt_args(xorriso, "-cp_clone",
argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
Xorriso_free_meM(eff_origin);
Xorriso_free_meM(eff_dest);
Xorriso_free_meM(dest_dir);
Xorriso_free_meM(leafname);
return(ret);
}
@ -2014,11 +2058,15 @@ int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy;
char eff_origin[SfileadrL], eff_dest[SfileadrL];
char dest_dir[SfileadrL], leafname[SfileadrL];
char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
int optc= 0;
char **optv= NULL;
Xorriso_alloc_meM(eff_origin, char, SfileadrL);
Xorriso_alloc_meM(eff_dest, char, SfileadrL);
Xorriso_alloc_meM(dest_dir, char, SfileadrL);
Xorriso_alloc_meM(leafname, char, SfileadrL);
ret= Xorriso_cpmv_args(xorriso, "-cpri", argc, argv, idx,
&optc, &optv, eff_dest, 1|2);
if(ret<=0)
@ -2071,6 +2119,10 @@ problem_handler:;
ex:;
Xorriso_opt_args(xorriso, "-cpri",
argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
Xorriso_free_meM(eff_origin);
Xorriso_free_meM(eff_dest);
Xorriso_free_meM(dest_dir);
Xorriso_free_meM(leafname);
return(ret);
}
@ -2083,14 +2135,17 @@ int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, ret, is_dir= 0, was_failure= 0, fret, end_idx_dummy, problem_count;
char eff_origin[SfileadrL], eff_dest[SfileadrL];
char dest_dir[SfileadrL], leafname[SfileadrL], sfe[5*SfileadrL];
char *eff_origin= NULL, *eff_dest= NULL, *dest_dir= NULL, *leafname= NULL;
char **eff_src_array= NULL, **eff_tgt_array= NULL;
int optc= 0;
char **optv= NULL;
struct stat stbuf;
Xorriso_alloc_meM(eff_origin, char, SfileadrL);
Xorriso_alloc_meM(eff_dest, char, SfileadrL);
Xorriso_alloc_meM(dest_dir, char, SfileadrL);
Xorriso_alloc_meM(leafname, char, SfileadrL);
ret= Xorriso_cpmv_args(xorriso, "-cp*x", argc, argv, idx,
&optc, &optv, eff_dest, 1|4);
if(ret<=0)
@ -2136,8 +2191,8 @@ int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
if(ret<0)
goto problem_handler;
if(ret==0) {
sprintf(xorriso->info_text, "-cpx: May not copy directory %s",
Text_shellsafe(eff_origin, sfe, 0));
sprintf(xorriso->info_text, "-cpx: May not copy directory ");
Text_shellsafe(eff_origin, xorriso->info_text, 1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto problem_handler;
}
@ -2201,6 +2256,10 @@ ex:;
Sfile_destroy_argv(&i, &eff_tgt_array, 0);
Xorriso_opt_args(xorriso, "-cp*x",
argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
Xorriso_free_meM(eff_origin);
Xorriso_free_meM(eff_dest);
Xorriso_free_meM(dest_dir);
Xorriso_free_meM(leafname);
return(ret);
}

@ -1 +1 @@
#define Xorriso_timestamP "2011.05.05.081436"
#define Xorriso_timestamP "2011.05.05.105152"

Loading…
Cancel
Save