From 7d681c3b31f18827372e95fcb51116f550d1a365 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 24 Oct 2007 17:53:54 +0000 Subject: [PATCH] Made -cd useable with no image loaded --- test/xorriso.c | 13 ++++++++++--- test/xorriso_timestamp.h | 2 +- test/xorrisoburn.c | 20 +++++++++----------- test/xorrisoburn.h | 8 +++++--- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/test/xorriso.c b/test/xorriso.c index 99ba5739..c33660ba 100644 --- a/test/xorriso.c +++ b/test/xorriso.c @@ -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); diff --git a/test/xorriso_timestamp.h b/test/xorriso_timestamp.h index 53627029..2cb01757 100644 --- a/test/xorriso_timestamp.h +++ b/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.24.105424" +#define Xorriso_timestamP "2007.10.24.175337" diff --git a/test/xorrisoburn.c b/test/xorrisoburn.c index 46cffb9f..36965331 100644 --- a/test/xorrisoburn.c +++ b/test/xorrisoburn.c @@ -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; diff --git a/test/xorrisoburn.h b/test/xorrisoburn.h index 151b2294..09a4da97 100644 --- a/test/xorrisoburn.h +++ b/test/xorrisoburn.h @@ -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);