|
|
|
@ -3262,7 +3262,7 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
|
|
|
|
|
strcpy(xorriso->wdi,"");
|
|
|
|
|
Xorriso_option_pwdi(xorriso, 0);
|
|
|
|
|
return(1);
|
|
|
|
|
} if(iso_rr_path[0]!='/') {
|
|
|
|
|
} else if(iso_rr_path[0]!='/') {
|
|
|
|
|
strcpy(path, xorriso->wdi);
|
|
|
|
|
if(Sfile_add_to_path(path,iso_rr_path,0)<=0)
|
|
|
|
|
return(-1);
|
|
|
|
@ -3271,37 +3271,16 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
|
|
|
|
|
return(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef NIX
|
|
|
|
|
int l;
|
|
|
|
|
|
|
|
|
|
if(Sfile_str(xorriso->wdi,path,0)<=0)
|
|
|
|
|
return(-1);
|
|
|
|
|
ret= Xorriso_ls(xorriso, 2); /* check existence */
|
|
|
|
|
if(ret<=0) {
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"-cdi: not found or not a directory : %s",
|
|
|
|
|
Text_shellsafe(iso_rr_path, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
l= strlen(xorriso->wdi);
|
|
|
|
|
while(l>0)
|
|
|
|
|
if(xorriso->wdi[l-1]=='/')
|
|
|
|
|
xorriso->wdi[--l]= 0;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
#else
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 0);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(ret);
|
|
|
|
|
if(ret!=2) {
|
|
|
|
|
sprintf(xorriso->info_text, "-cdi: not a directory : %s",
|
|
|
|
|
Text_shellsafe(iso_rr_path, sfe, 0));
|
|
|
|
|
Text_shellsafe(eff_path, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
strcpy(xorriso->wdi, eff_path);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Xorriso_option_pwdi(xorriso, 0);
|
|
|
|
|
return(1);
|
|
|
|
@ -3311,8 +3290,8 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
|
|
|
|
|
/* Option -cdx */
|
|
|
|
|
int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
|
|
|
|
{
|
|
|
|
|
char sfe[4*SfileadrL];
|
|
|
|
|
int ret, l;
|
|
|
|
|
char sfe[4*SfileadrL], path[SfileadrL], eff_path[SfileadrL];;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
if (strlen(disk_path)>sizeof(xorriso->wdx)) {
|
|
|
|
|
sprintf(xorriso->info_text,"-cdx: disk_path too long (%d > %d)",
|
|
|
|
@ -3328,29 +3307,36 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
|
|
|
|
strcpy(xorriso->wdx,"");
|
|
|
|
|
Xorriso_option_pwdx(xorriso, 0);
|
|
|
|
|
return(1);
|
|
|
|
|
} else if(disk_path[0]!='/') {
|
|
|
|
|
strcpy(path, xorriso->wdi);
|
|
|
|
|
if(Sfile_add_to_path(path,disk_path,0)<=0)
|
|
|
|
|
return(-1);
|
|
|
|
|
} else {
|
|
|
|
|
if(Sfile_str(path,disk_path,0)<=0)
|
|
|
|
|
return(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret= 1;
|
|
|
|
|
ret= Sfile_type(disk_path,1|4|8);
|
|
|
|
|
if(ret<0) {
|
|
|
|
|
sprintf(xorriso->info_text,"-cdx: file not found :\n%s",disk_path);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
if(ret!=2) {
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"-cdx: file is not a directory :\n%s",disk_path);
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 2);
|
|
|
|
|
if(ret<=0)
|
|
|
|
|
return(ret);
|
|
|
|
|
if(eff_path[0]) {
|
|
|
|
|
ret= Sfile_type(eff_path,1|4|8);
|
|
|
|
|
if(ret<0) {
|
|
|
|
|
sprintf(xorriso->info_text,"-cdx: file not found : %s",
|
|
|
|
|
Text_shellsafe(eff_path, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
if(ret!=2) {
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"-cdx: not a directory : %s",
|
|
|
|
|
Text_shellsafe(eff_path, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(Sfile_str(xorriso->wdx,disk_path,0)<=0)
|
|
|
|
|
if(Sfile_str(xorriso->wdx,eff_path,0)<=0)
|
|
|
|
|
return(-1);
|
|
|
|
|
l= strlen(xorriso->wdx);
|
|
|
|
|
while(l>0)
|
|
|
|
|
if(xorriso->wdx[l-1]=='/')
|
|
|
|
|
xorriso->wdx[--l]= 0;
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
Xorriso_option_pwdx(xorriso, 0);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|