From a62f6af50a8596531f23b34af625d8a7ea19189d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 18 Oct 2011 16:22:16 +0000 Subject: [PATCH] Enabled xorrecord dev=- --- xorriso/emulators.c | 16 ++++++++++++++++ xorriso/emulators.h | 3 +++ xorriso/parse_exec.c | 34 ++++++++++++++++++++++++++++------ xorriso/xorriso_timestamp.h | 2 +- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/xorriso/emulators.c b/xorriso/emulators.c index b80c1cc5..79fc2a9b 100644 --- a/xorriso/emulators.c +++ b/xorriso/emulators.c @@ -29,6 +29,22 @@ #include "xorrisoburn.h" +int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv, + int flag) +{ + int i; + + for(i= 0; i < argc; i++) { + if(strcmp(argv[i], "dev=-") == 0 || + strcmp(argv[i], "dev=stdio:/dev/fd/1") == 0 || + strcmp(argv[i], "-dev=-") == 0 || + strcmp(argv[i], "-dev=stdio:/dev/fd/1") == 0) + return(1); + } + return(0); +} + + int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag) { static char helptext[][80]= { diff --git a/xorriso/emulators.h b/xorriso/emulators.h index c6799f67..841535ca 100644 --- a/xorriso/emulators.h +++ b/xorriso/emulators.h @@ -18,6 +18,9 @@ int Xorriso_cdrskin(struct XorrisO *xorriso, char *whom, int argc, char **argv, int Xorriso_cdrskin_help(struct XorrisO *xorriso, int flag); +int Xorriso_cdrskin_uses_stdout(struct XorrisO *xorriso, int argc, char **argv, + int flag); + int Xorriso_as_cdrskin(struct XorrisO *xorriso, int argc, char **argv, int *idx, int flag); diff --git a/xorriso/parse_exec.c b/xorriso/parse_exec.c index b54c63fd..cac25df0 100644 --- a/xorriso/parse_exec.c +++ b/xorriso/parse_exec.c @@ -1647,9 +1647,19 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv, ret= Xorriso_option_no_rc(xorriso, 0); if(ret<=0) error_seen= 1; - } else if(xorriso->argument_emulation >= 1 && - xorriso->argument_emulation <= 2) { {ret= 1; goto ex;} + } else if(xorriso->argument_emulation == 1) { /* mkisofs emulation */ + if(xorriso->dev_fd_1 < 0) + goto protect_stdout; + {ret= 1; goto ex;} + + } else if(xorriso->argument_emulation == 2) { /* cdrecord emulation */ + if(xorriso->dev_fd_1 < 0) + if(Xorriso_cdrskin_uses_stdout(xorriso, argc - 1 - (flag & 1), + argv + 1 + (flag & 1), 0)) + goto protect_stdout; + {ret= 1; goto ex;} + } else if((strcmp(cmd,"dev")==0 || strcmp(cmd,"outdev")==0 || strcmp(cmd,"indev")==0) && (strcmp(arg1,"stdio:/dev/fd/1")==0 || strcmp(arg1,"-")==0) && @@ -1670,6 +1680,8 @@ protect_stdout:; sprintf(xorriso->info_text, "Disabling use of libreadline."); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0); } + if(xorriso->argument_emulation >= 1 && xorriso->argument_emulation <=2) + {ret= 1; goto ex;} } else if(strcmp(cmd,"abort_on")==0 && was_dashed == 1) { i++; @@ -1693,12 +1705,22 @@ protect_stdout:; } else if(strcmp(cmd,"as")==0 && was_dashed == 1) { ret= Xorriso_count_args(xorriso, argc - i, argv + i, &arg_count, 1); - if(ret == 1) + if(ret == 1) { i+= arg_count; - if(was_dashed == 1) - if(strcmp(arg1, "mkisofs")==0 || strcmp(arg1, "genisoimage")==0 || - strcmp(arg1, "genisofs")==0 || strcmp(arg1, "xorrisofs")==0) + + if((strcmp(arg1, "cdrecord")==0 || strcmp(arg1, "wodim")==0 || + strcmp(arg1, "cdrskin")==0 || strcmp(arg1, "xorrecord")==0) && + xorriso->dev_fd_1 < 0) + if(Xorriso_cdrskin_uses_stdout(xorriso, arg_count - 1, + argv + i - arg_count + 2, 0)) + goto protect_stdout; + } + if(was_dashed == 1) { + if((strcmp(arg1, "mkisofs")==0 || strcmp(arg1, "genisoimage")==0 || + strcmp(arg1, "genisofs")==0 || strcmp(arg1, "xorrisofs")==0) && + xorriso->dev_fd_1 < 0) goto protect_stdout; + } } else if(strcmp(cmd, "list_delimiter") == 0) { /* Needed for interpreting other args. Gets reset after prescan. */ diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 42b16a07..75f2a0bf 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2011.10.14.094257" +#define Xorriso_timestamP "2011.10.18.162119"