Made -cd useable with no image loaded

This commit is contained in:
Thomas Schmitt 2007-10-24 17:53:54 +00:00
parent dbd99babd9
commit 7d681c3b31
4 changed files with 25 additions and 18 deletions

View File

@ -3283,10 +3283,17 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag)
return(-1);
}
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 0);
if(ret<=0)
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 1);
if(ret<0)
return(ret);
if(ret!=2) {
if(ret==0) {
sprintf(xorriso->info_text, "-cdi: not existing yet in ISO image : %s",
Text_shellsafe(eff_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 2);
if(ret<=0)
return(ret);
} else if(ret!=2) {
sprintf(xorriso->info_text, "-cdi: not a directory : %s",
Text_shellsafe(eff_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.24.105424"
#define Xorriso_timestamP "2007.10.24.175337"

View File

@ -430,15 +430,15 @@ int Xorriso_get_volume(struct XorrisO *xorriso, struct iso_volume **volume,
/* @param eff_path returns resulting effective path.
Must provide at least SfileadrL bytes of storage.
@param flag bit0= do not produce problem events (unless internal error)
@param flag bit0= do not produce problem events (unless faulty path format)
bit1= work purely literally, do not use libisofs
@return <0 = internal error , 0 = not found ,
@return -1 = faulty path format, 0 = not found ,
1 = found simple node , 2 = found directory
*/
int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
char eff_path[], int flag)
{
int ret, is_dir= 1, done= 0;
int ret, is_dir= 0, done= 0;
struct iso_volume *volume;
struct iso_tree_node_dir *dir= NULL;
struct iso_tree_node *node= NULL;
@ -460,9 +460,8 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
if(path[0]!='/') {
sprintf(xorriso->info_text,
"Unsupported relative addressing in iso_rr_path '%s'", img_path);
if(!(flag&1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
return(0);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
return(-1);
}
for(npt= apt; !done; apt= npt+1) {
@ -488,10 +487,9 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
bonked_root:;
sprintf(xorriso->info_text,
"Relative addressing in path exceeds root directory: %s",
Text_shellsafe(path, sfe, 0));
if(!(flag&1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
Text_shellsafe(img_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(-1);
}
dir= iso_tree_node_get_parent(node);
}
@ -508,7 +506,7 @@ bonked_root:;
strlen(eff_path)+strlen(apt)+1);
if(!(flag&1))
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
return(-1);
}
if(!(flag&2)) {
dir= (struct iso_tree_node_dir *) node;

View File

@ -57,10 +57,12 @@ int Xorriso_rmi(struct XorrisO *xorriso, char *path, int flag);
/* @param flag bit0= long format , bit1= only check for directory existence */
int Xorriso_ls(struct XorrisO *xorriso, int flag);
/* @param flag bit0= do not produce problem events (unless internal error)
/* @param eff_path returns resulting effective path.
Must provide at least SfileadrL bytes of storage.
@param flag bit0= do not produce problem events (unless faulty path format)
bit1= work purely literally, do not use libisofs
@return <0 = internal error , 0 = not found ,
1 = found simple node , 2 = found directory
@return -1 = faulty path format, 0 = not found ,
1 = found simple node , 2 = found directory
*/
int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
char eff_path[], int flag);