diff --git a/libisoburn/trunk/test/xorriso.1 b/libisoburn/trunk/test/xorriso.1 index 408f4b65..9e6c48b6 100644 --- a/libisoburn/trunk/test/xorriso.1 +++ b/libisoburn/trunk/test/xorriso.1 @@ -523,11 +523,11 @@ foreseeable consumption by next -commit.) .TP .B Navigation in ISO image and disk filesystem: .TP -> \fB\-cd\fR iso_rr_path +\fB\-cd\fR iso_rr_path Change the current working directory in the emerging ISO image as it is at the moment. .TP -> \fB\-cdx\fR disk_path +\fB\-cdx\fR disk_path Change the current working directory on filesystem. .TP \fB\-pwd\fR diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index f24cb3f3..4f7dcf9c 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -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); + 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(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); - } - 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); } diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index ce8f88da..965a4a31 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.21.151124" +#define Xorriso_timestamP "2007.10.21.185248" diff --git a/libisoburn/trunk/test/xorrisoburn.c b/libisoburn/trunk/test/xorrisoburn.c index ad08579a..f01b102f 100644 --- a/libisoburn/trunk/test/xorrisoburn.c +++ b/libisoburn/trunk/test/xorrisoburn.c @@ -431,6 +431,7 @@ 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) + bit1= work purely literally, do not use libisofs @return <0 = internal error , 0 = not found , 1 = found simple node , 2 = found directory */ @@ -443,9 +444,11 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path, struct iso_tree_node *node= NULL; char path[SfileadrL], *apt, *npt, sfe[4*SfileadrL], *cpt; - ret= Xorriso_get_volume(xorriso, &volume, 0); - if(ret<=0) - return(ret); + if(!(flag&2)) { + ret= Xorriso_get_volume(xorriso, &volume, 0); + if(ret<=0) + return(ret); + } if(Sfile_str(path, img_path, 0)<=0) return(-1); @@ -479,50 +482,48 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path, if(strcmp(apt,".")==0) continue; if(strcmp(apt,"..")==0) { - node= (struct iso_tree_node *) dir; - if(node==NULL) { - 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); + if(!(flag&2)) { + node= (struct iso_tree_node *) dir; + if(node==NULL) { +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); + } + dir= iso_tree_node_get_parent(node); } - dir= iso_tree_node_get_parent(node); - /* truncate eff_path */; cpt= strrchr(eff_path, '/'); - if(cpt==NULL) { - sprintf(xorriso->info_text, - "Internal error: less '/' than parent directories in %s", - Text_shellsafe(img_path, sfe, 0)); - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); - return(-1); - } + if(cpt==NULL) /* ??? if not flag&2 then this is a bug */ + goto bonked_root; *cpt= 0; continue; } ret= Sfile_add_to_path(eff_path, apt, 0); if(ret<=0) { - sprintf(xorriso->info_text, - "Effective path in ISO image gets much too long (%d)", + sprintf(xorriso->info_text, "Effective path gets much too long (%d)", strlen(eff_path)+strlen(apt)+1); if(!(flag&1)) Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); return(0); } - dir= (struct iso_tree_node_dir *) node; - node= iso_tree_volume_path_to_node(volume,eff_path); - if(node==NULL) { - sprintf(xorriso->info_text, "Cannot find in ISO image: %s", - Text_shellsafe(eff_path, sfe, 0)); - if(!(flag&1)) - Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); - return(0); + if(!(flag&2)) { + dir= (struct iso_tree_node_dir *) node; + node= iso_tree_volume_path_to_node(volume,eff_path); + if(node==NULL) { + sprintf(xorriso->info_text, "Cannot find in ISO image: %s", + Text_shellsafe(eff_path, sfe, 0)); + if(!(flag&1)) + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0); + return(0); + } + if(dir==NULL) /* could be false with "/dir/.." */ + dir= iso_tree_node_get_parent(node); + is_dir= LIBISO_ISDIR(node); } - if(dir==NULL) /* could be false with "/dir/.." */ - dir= iso_tree_node_get_parent(node); - is_dir= LIBISO_ISDIR(node); } return(1+!!is_dir); } diff --git a/libisoburn/trunk/test/xorrisoburn.h b/libisoburn/trunk/test/xorrisoburn.h index e9cdd90a..151b2294 100644 --- a/libisoburn/trunk/test/xorrisoburn.h +++ b/libisoburn/trunk/test/xorrisoburn.h @@ -58,6 +58,7 @@ int Xorriso_rmi(struct XorrisO *xorriso, char *path, int flag); int Xorriso_ls(struct XorrisO *xorriso, int flag); /* @param flag bit0= do not produce problem events (unless internal error) + bit1= work purely literally, do not use libisofs @return <0 = internal error , 0 = not found , 1 = found simple node , 2 = found directory */