|
|
|
@ -94,6 +94,7 @@ int Xorriso_option_acl(struct XorrisO *xorriso, char *mode, int flag)
|
|
|
|
|
/* Option -add */
|
|
|
|
|
/* @param flag bit0=do not report the added item
|
|
|
|
|
bit1=do not reset pacifier, no final pacifier message
|
|
|
|
|
bit2= prepend ISO working directory in any case
|
|
|
|
|
*/
|
|
|
|
|
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
int *idx, int flag)
|
|
|
|
@ -134,12 +135,16 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
}
|
|
|
|
|
*wpt= 0;
|
|
|
|
|
}
|
|
|
|
|
if(split==0) {
|
|
|
|
|
if(split==0)
|
|
|
|
|
strcpy(target, source);
|
|
|
|
|
} else if(target[0]!='/') {
|
|
|
|
|
if(flag & 4) {
|
|
|
|
|
ret= Sfile_prepend_path(xorriso->wdi, target, 0);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
if(ret<=0) {
|
|
|
|
|
sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
|
|
|
|
|
(int) (strlen(xorriso->wdi)+strlen(target)+1));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, target, eff_path, 2);
|
|
|
|
@ -1887,6 +1892,102 @@ int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, int flag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -cp_clone */
|
|
|
|
|
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];
|
|
|
|
|
int optc= 0;
|
|
|
|
|
char **optv= NULL;
|
|
|
|
|
struct stat stbuf;
|
|
|
|
|
|
|
|
|
|
ret= Xorriso_cpmv_args(xorriso, "-cp_clone", argc, argv, idx,
|
|
|
|
|
&optc, &optv, eff_dest, 1);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto ex;
|
|
|
|
|
if(ret == 1 && optc > 1) {
|
|
|
|
|
nondir_exists:;
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"-cp_clone: Copy address already exists and is not a directory: ");
|
|
|
|
|
Text_shellsafe(eff_dest, xorriso->info_text, 1);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
|
{ret= 0; goto ex;}
|
|
|
|
|
}
|
|
|
|
|
strcpy(dest_dir, eff_dest);
|
|
|
|
|
if(optc == 1) {
|
|
|
|
|
ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0);
|
|
|
|
|
if(ret >= 0) {
|
|
|
|
|
if(S_ISDIR(stbuf.st_mode))/* target directory exists */
|
|
|
|
|
is_dir= 1;
|
|
|
|
|
else
|
|
|
|
|
goto nondir_exists;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
is_dir= 1;
|
|
|
|
|
ret= Xorriso_mkdir(xorriso, dest_dir, 1 | 2);
|
|
|
|
|
if(ret < 0)
|
|
|
|
|
{ret= -(ret != -1); goto ex;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Pass 0 checks whether the way is clear, pass 1 does the cloning */
|
|
|
|
|
for(pass= 0; pass < 2; pass++) {
|
|
|
|
|
for(i= 0; i<optc; i++) {
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi,
|
|
|
|
|
optv[i], eff_origin, !!pass);
|
|
|
|
|
if(ret<=0 || xorriso->request_to_abort)
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
if(is_dir) {
|
|
|
|
|
ret= Sfile_leafname(eff_origin, leafname, 0);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
strcpy(eff_dest, dest_dir);
|
|
|
|
|
ret= Sfile_add_to_path(eff_dest, leafname, 0);
|
|
|
|
|
if(ret<=0) {
|
|
|
|
|
sprintf(xorriso->info_text, "Effective path gets much too long (%d)",
|
|
|
|
|
(int) (strlen(eff_dest)+strlen(leafname)+1));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret= Xorriso_iso_lstat(xorriso, eff_dest, &stbuf, 0);
|
|
|
|
|
if(pass == 0) {
|
|
|
|
|
if(ret >= 0) {
|
|
|
|
|
sprintf(xorriso->info_text, "Cloning: Copy address already exists: ");
|
|
|
|
|
Text_shellsafe(eff_dest, xorriso->info_text, 1);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
}
|
|
|
|
|
} else if(ret == -1) {
|
|
|
|
|
ret= Xorriso_clone_tree(xorriso, NULL, eff_origin, eff_dest, 0);
|
|
|
|
|
if(ret <= 0)
|
|
|
|
|
goto problem_handler;
|
|
|
|
|
sprintf(xorriso->info_text, "Cloned in ISO image: ");
|
|
|
|
|
Text_shellsafe(eff_origin, xorriso->info_text, 1);
|
|
|
|
|
strcat(xorriso->info_text, " to ");
|
|
|
|
|
Text_shellsafe(eff_dest, xorriso->info_text, 1);
|
|
|
|
|
strcat(xorriso->info_text, "\n");
|
|
|
|
|
Xorriso_info(xorriso, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
continue; /* regular bottom of loop */
|
|
|
|
|
problem_handler:;
|
|
|
|
|
was_failure= 1;
|
|
|
|
|
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
|
|
|
|
|
if(fret>=0)
|
|
|
|
|
continue;
|
|
|
|
|
goto ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ret= !was_failure;
|
|
|
|
|
ex:;
|
|
|
|
|
Xorriso_opt_args(xorriso, "-cp_clone",
|
|
|
|
|
argc, argv, *idx, &end_idx_dummy, &optc, &optv, 256);
|
|
|
|
|
return(ret);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -cpr alias -cpri */
|
|
|
|
|
int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
int *idx, int flag)
|
|
|
|
|