Semi-permanent emulation by start names xorrisofs,genisofs,mkisofs,genioimage

This commit is contained in:
Thomas Schmitt 2008-07-07 10:29:38 +00:00
parent 7159d372b0
commit 2277038d67
4 changed files with 59 additions and 4 deletions

View File

@ -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;i<m->rc_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; i<argc; i++) {
if(strcmp(argv[i], "-version")==0) {
sprintf(xorriso->result_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)<argc)
xorriso->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;

View File

@ -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);

View File

@ -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);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.07.07.095531"
#define Xorriso_timestamP "2008.07.07.102941"