New command -concat
This commit is contained in:
@ -2177,6 +2177,80 @@ int Xorriso_option_compliance(struct XorrisO *xorriso, char *mode,
|
||||
}
|
||||
|
||||
|
||||
/* Command -concat */
|
||||
int Xorriso_option_concat(struct XorrisO *xorriso,
|
||||
int argc, char **argv, int *idx, int flag)
|
||||
{
|
||||
int ret, end_idx, optc= 0, progc= 0, iso_rr_start, prog_end_idx= -1;
|
||||
char **optv= NULL, **progv= NULL, *delimiter_mem= NULL;
|
||||
|
||||
/* Must be done before any goto ex; */
|
||||
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
|
||||
iso_rr_start= *idx + 2;
|
||||
|
||||
if(xorriso->allow_restore <= 0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-concat: image content copies are not enabled by option -osirrox");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
if(end_idx - *idx < 3) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-concat: Not enough arguments. Need mode, target, iso_rr_path.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
if(strcmp(argv[*idx], "pipe") == 0) {
|
||||
if(end_idx - *idx < 5) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-concat pipe: Not enough arguments. Need delimiter, program path, delimiter, iso_rr_path.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
|
||||
Xorriso_alloc_meM(delimiter_mem, char, strlen(xorriso->list_delimiter) + 1);
|
||||
strcpy(delimiter_mem, xorriso->list_delimiter);
|
||||
strcpy(xorriso->list_delimiter, argv[*idx + 1]);
|
||||
ret= Xorriso_opt_args(xorriso, "-concat pipe", argc , argv, *idx + 2,
|
||||
&prog_end_idx, &progc, &progv, 4 | 128);
|
||||
strcpy(xorriso->list_delimiter, delimiter_mem);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(progc <= 0) {
|
||||
sprintf(xorriso->info_text, "-concat pipe: No program path given.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
iso_rr_start= prog_end_idx + 1;
|
||||
}
|
||||
ret= Xorriso_opt_args(xorriso, "-concat", argc , argv, iso_rr_start, &end_idx,
|
||||
&optc, &optv, 128);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(optc <= 0) {
|
||||
sprintf(xorriso->info_text, "-concat: No iso_rr_paths given.");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
|
||||
ret= 0; goto ex;
|
||||
}
|
||||
ret= Xorriso_concat(xorriso, argv[*idx], argv[*idx + 1],
|
||||
progc, progv, optc, optv, 0);
|
||||
ex:;
|
||||
if(progv != NULL) {
|
||||
if(delimiter_mem != NULL)
|
||||
strcpy(xorriso->list_delimiter, argv[*idx + 2]);
|
||||
Xorriso_opt_args(xorriso, "-concat", argc, argv, *idx + 2, &prog_end_idx,
|
||||
&progc, &progv, 256);
|
||||
if(delimiter_mem != NULL)
|
||||
strcpy(xorriso->list_delimiter, delimiter_mem);
|
||||
}
|
||||
Xorriso_opt_args(xorriso, "-concat", argc, argv, iso_rr_start, &end_idx,
|
||||
&optc, &optv, 256);
|
||||
Xorriso_free_meM(delimiter_mem);
|
||||
*idx= end_idx;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
/* Option -copyright_file */
|
||||
int Xorriso_option_copyright_file(struct XorrisO *xorriso, char *name, int flag)
|
||||
{
|
||||
|
Reference in New Issue
Block a user