From 52d89cc7cc7625269c20f638e4759ea95c517034 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 7 Jul 2008 10:29:38 +0000 Subject: [PATCH] Semi-permanent emulation by start names xorrisofs,genisofs,mkisofs,genioimage --- xorriso/xorriso.c | 39 +++++++++++++++++++++++++++++++++++-- xorriso/xorriso.h | 12 +++++++++++- xorriso/xorriso_private.h | 10 ++++++++++ xorriso/xorriso_timestamp.h | 2 +- 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/xorriso/xorriso.c b/xorriso/xorriso.c index 797bf6b6..f9de87ce 100644 --- a/xorriso/xorriso.c +++ b/xorriso/xorriso.c @@ -2805,6 +2805,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) if(getcwd(m->initial_wdx,sizeof(m->initial_wdx)-1)==NULL) m->initial_wdx[0]= 0; m->no_rc= 0; + m->permanent_emulation= 0; m->rc_filename_count= Xorriso_rc_nuM; for(i=0;irc_filename_count-1;i++) @@ -2932,6 +2933,11 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag) goto failure; if(strcmp(leafname, "osirrox")==0) m->allow_restore= 1; + else if(strcmp(leafname, "xorrisofs")==0 || strcmp(leafname, "genisofs")==0 || + strcmp(leafname, "mkisofs")==0 || strcmp(leafname, "genisoimage")==0) { + m->permanent_emulation= -1; /* becomeis +1 before argument interpretation */ + Xorriso_protect_stdout(*xorriso, 0); + } ret= Exclusions_new(&(m->disk_exclusions), 0); if(ret<=0) goto failure; @@ -7509,7 +7515,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom, } #endif - adr[0]= indev[0]= 0; + adr[0]= indev[0]= msc[0]= 0; for(i= 0; iresult_line, @@ -7779,6 +7785,22 @@ ex:; } +int Xorriso_as_genisofs(struct XorrisO *xorriso, int argc, char **argv, + int *idx, int flag) +{ + int end_idx, ret, idx_count, old_idx; + + old_idx= *idx; + end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1); + (*idx)= end_idx; + idx_count= end_idx-old_idx; + if(end_idx<=0 || old_idx>=argc) + return(1); + ret= Xorriso_genisofs(xorriso, "genisofs", end_idx-old_idx, argv+old_idx, 0); + return(ret); +} + + /* @param boss_iter Opaque handle to be forwarded to actions in ISO image Set to NULL if calling this function from outside ISO world @param flag bit2= -follow: this is not a command parameter @@ -8302,7 +8324,8 @@ int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv, goto ex; } else if(strcmp(argv[*idx], "mkisofs")==0 || strcmp(argv[*idx], "genisoimage")==0 || - strcmp(argv[*idx], "genisofs")==0) { + strcmp(argv[*idx], "genisofs")==0 || + strcmp(argv[*idx], "xorrisofs")==0) { ret= Xorriso_genisofs(xorriso, argv[*idx], end_idx-(*idx)-1, argv+(*idx)+1, 0); if(ret<=0) @@ -12176,6 +12199,16 @@ return: } next_command:; + if(xorriso->permanent_emulation==1) { + ret= Xorriso_as_genisofs(xorriso, argc, argv, idx, 0); + if(ret<=0) + goto eval_any_problems; + if((*idx)permanent_emulation= 0; + else + {ret= 1; goto ex;} + } + xorriso->prepended_wd= 0; xorriso->request_to_abort= xorriso->request_not_to_ask= 0; Xorriso_set_problem_status(xorriso, "", 0); @@ -13030,6 +13063,8 @@ int Xorriso_main(int argc, char **argv) /* Interpret program arguments */ i= 1; + if(xorriso->permanent_emulation<0) + xorriso->permanent_emulation= -xorriso->permanent_emulation; ret= Xorriso_interpreter(xorriso,argc,argv,&i,0); if(ret==3) goto end_sucessfully; diff --git a/xorriso/xorriso.h b/xorriso/xorriso.h index 3ffb38be..41c69652 100644 --- a/xorriso/xorriso.h +++ b/xorriso/xorriso.h @@ -19,7 +19,17 @@ struct XorrisO; /* --------------------- Fundamental Management ------------------- */ /* Create a new xorriso object and tell it the program name to be used - with messages. + with messages and for decision of special behavior. + @param xorriso returns the newly created XorrisO object + @param progname typically argv[0] of main(). Some leafnames of the progname + path have special meaning and trigger special behavior: + "osirrox" allows image-to-disk copying: -osirrox "on" + "xorrisofs" activates permanent mkisofs emulation + "genisofs" alias of "xorrisofs" + "mkisofs" alias of "xorrisofs" + "genisoimage" alias of "xorrisofs" + @parm flag unused yet, submit 0 + @return >0 success , <=0 failure, no object created */ int Xorriso_new(struct XorrisO ** xorriso, char *progname, int flag); diff --git a/xorriso/xorriso_private.h b/xorriso/xorriso_private.h index 36e89d4c..501fa8c3 100644 --- a/xorriso/xorriso_private.h +++ b/xorriso/xorriso_private.h @@ -71,6 +71,14 @@ struct XorrisO { /* the global context of xorriso */ char initial_wdx[SfileadrL]; int no_rc; + /* Permanent emulations: + 0=xorriso mode + +/- 1=mkisofs mode + Negative value is made positive before interpretation of command line + arguments, positive value is in effect from creation of XorrisO object + */ + int permanent_emulation; + /** List of startupfiles */ char rc_filenames[Xorriso_rc_nuM][SfileadrL]; int rc_filename_count; @@ -439,6 +447,8 @@ int Xorriso_reassure_restore(struct XorrisO *xorriso, char *path, int flag); int Xorriso_auto_chmod(struct XorrisO *xorriso, char *disk_path, int flag); +int Xorriso_protect_stdout(struct XorrisO *xorriso, int flag); + int Sfile_str(char target[SfileadrL], char *source, int flag); diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 708fe3ba..d824c1a8 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2008.07.07.095531" +#define Xorriso_timestamP "2008.07.07.102941"