From 0029fd4c8793ff7cd6f13a006d222222e8737ff4 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 28 Oct 2007 16:54:29 +0000 Subject: [PATCH] Implemented option -mkdir --- libisoburn/trunk/test/xorriso.1 | 2 +- libisoburn/trunk/test/xorriso.c | 18 ++++++----- libisoburn/trunk/test/xorriso_timestamp.h | 2 +- libisoburn/trunk/test/xorrisoburn.c | 37 +++++++++++++++++++++-- libisoburn/trunk/test/xorrisoburn.h | 8 +++-- 5 files changed, 54 insertions(+), 13 deletions(-) diff --git a/libisoburn/trunk/test/xorriso.1 b/libisoburn/trunk/test/xorriso.1 index c3e2644d..ae17d2ef 100644 --- a/libisoburn/trunk/test/xorriso.1 +++ b/libisoburn/trunk/test/xorriso.1 @@ -297,7 +297,7 @@ Alter the date entries of a file in the ISO image. type is one of "a", "m", "b" for access time, modification time, both times. .TP -> \fB\-mkdir\fR iso_rr_path [...] +\fB\-mkdir\fR iso_rr_path [...] Create empty directories if they do not exist yet. Existence as directory generates a WARNING event, existence as other file cause a SORRY event. diff --git a/libisoburn/trunk/test/xorriso.c b/libisoburn/trunk/test/xorriso.c index 6f0c724d..3c446545 100644 --- a/libisoburn/trunk/test/xorriso.c +++ b/libisoburn/trunk/test/xorriso.c @@ -4100,17 +4100,21 @@ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag) int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag) { - int i, end_idx; + int i, end_idx, ret, was_failure= 0; end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0); - fprintf(stderr, ">>> LIBISOFS : -mkdiri "); - for(i= *idx; i0 && !was_failure); } diff --git a/libisoburn/trunk/test/xorriso_timestamp.h b/libisoburn/trunk/test/xorriso_timestamp.h index ff2f9529..40688781 100644 --- a/libisoburn/trunk/test/xorriso_timestamp.h +++ b/libisoburn/trunk/test/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2007.10.28.125501" +#define Xorriso_timestamP "2007.10.28.165516" diff --git a/libisoburn/trunk/test/xorrisoburn.c b/libisoburn/trunk/test/xorrisoburn.c index 2e14d57a..985c22be 100644 --- a/libisoburn/trunk/test/xorrisoburn.c +++ b/libisoburn/trunk/test/xorrisoburn.c @@ -1394,8 +1394,7 @@ ex:; } -int Xorriso_rename(struct XorrisO *xorriso, - char origin[], char dest[], int flag) +int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag) { int ret, ol, dest_ret; char sfe[4*SfileadrL], eff_dest[SfileadrL], dir_adr[SfileadrL], *cpt; @@ -1508,3 +1507,37 @@ int Xorriso_rename(struct XorrisO *xorriso, } +/* @param flag bit0= do not produce info message on success + @return 1=success, + 0=was already directory, -1=was other type, -2=other error +*/ +int Xorriso_mkdir(struct XorrisO *xorriso, char *path, int flag) +{ + int ret; + char eff_path[SfileadrL], sfe[4*SfileadrL]; + + ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 1); + if(ret<0) + return(-2); + if(ret>0) { + sprintf(xorriso->info_text,"-mkdir: Address already existing %s", + Text_shellsafe(eff_path, sfe, 0)); + Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, + (ret==2 ? "WARNING" : "SORRY"), 0); + return(-1+(ret==2)); + } + ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 2); + if(ret<0) + return(-2); + ret= Xorriso_graft_in(xorriso, NULL, eff_path, 1); + if(ret<=0) + return(-2); + if(!(flag&1)) { + sprintf(xorriso->info_text, "Created directory in ISO image: %s\n", + Text_shellsafe(eff_path,sfe,0)); + Xorriso_info(xorriso, 0); + } + return(1); +} + + diff --git a/libisoburn/trunk/test/xorrisoburn.h b/libisoburn/trunk/test/xorrisoburn.h index 0ddc3526..c4942461 100644 --- a/libisoburn/trunk/test/xorrisoburn.h +++ b/libisoburn/trunk/test/xorrisoburn.h @@ -69,8 +69,12 @@ int Xorriso_ls(struct XorrisO *xorriso, int flag); int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path, char eff_path[], int flag); -int Xorriso_rename(struct XorrisO *xorriso, - char origin[], char dest[], int flag); +int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest,int flag); + +/* @param flag bit0= do not produce info message on success + @return 1=success, 0=was already directory, -1=was other type, -2=bad path +*/ +int Xorriso_mkdir(struct XorrisO *xorriso, char *img_path, int flag); #endif /* Xorrisoburn_includeD */