New options -show_stream, -show_stream_r, -exec show_stream

This commit is contained in:
2009-04-06 13:20:05 +00:00
parent c74440e27b
commit fb25ceaeb0
5 changed files with 140 additions and 11 deletions

View File

@@ -6638,8 +6638,10 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
} else if(action == 27) {
ret= Xorriso_path_setfattr(xorriso, (void *) node, show_path,
target, strlen(text_2), text_2, 0);
} else if(action == 28) {
} else if(action == 28) { /* set_filter */
ret= Xorriso_set_filter(xorriso, (void *) node, show_path, target, 1 | 2);
} else if(action == 29) { /* show_stream */
ret= Xorriso_show_stream(xorriso, (void *) node, show_path, 1 | 2);
} else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0);
@@ -10279,3 +10281,78 @@ int Xorriso_status_extf(struct XorrisO *xorriso, char *filter, FILE *fp,
}
return(1);
}
int Xorriso_show_stream(struct XorrisO *xorriso, void *in_node,
char *path, int flag)
{
int ret, lba;
IsoNode *node;
IsoFile *file;
IsoStream *stream= NULL, *input_stream;
IsoExternalFilterCommand *cmd;
char type_text[16], *source_path= NULL;
node= (IsoNode *) in_node;
if(node == NULL) {
ret= Xorriso_get_node_by_path(xorriso, path, NULL, &node, 0);
if(ret <= 0)
goto ex;
}
if(!LIBISO_ISREG(node))
{ret= 2; goto ex;}
file= (IsoFile *) node;
input_stream= iso_file_get_stream(file);
Text_shellsafe(path, xorriso->result_line, 0);
while(1) {
stream= input_stream;
input_stream= iso_stream_get_input_stream(stream, 0);
if(input_stream == NULL)
break;
ret= iso_stream_get_external_filter(stream, &cmd, 0);
if(ret < 0) {
Xorriso_process_msg_queues(xorriso,0);
Xorriso_report_iso_error(xorriso, "", ret,
"Error when inquiring filter command of node", 0, "FAILURE", 1);
ret= 0; goto ex;
}
strcat(xorriso->result_line, " < ");
strncpy(type_text, stream->class->type, 4);
type_text[4]= 0;
Text_shellsafe(type_text, xorriso->result_line, 1);
if(ret > 0) {
strcat(xorriso->result_line, ".");
Text_shellsafe(cmd->name, xorriso->result_line, 1);
}
if(strlen(xorriso->result_line) > SfileadrL) {
Xorriso_result(xorriso, 0);
xorriso->result_line[0]= 0;
}
}
strcat(xorriso->result_line, " < ");
strncpy(type_text, stream->class->type, 4);
type_text[4]= 0;
if(strcmp(type_text, "fsrc") == 0) {
ret= Xorriso__file_start_lba(node, &lba, 0);
if(ret > 0 && lba > 0)
strcpy(type_text, "image");
else
strcpy(type_text, "disk");
}
Text_shellsafe(type_text, xorriso->result_line, 1);
source_path= iso_stream_get_source_path(stream, 0);
if(source_path != NULL) {
strcat(xorriso->result_line, ".");
Text_shellsafe(source_path, xorriso->result_line, 1);
}
strcat(xorriso->result_line, "\n");
Xorriso_result(xorriso, 0);
ret= 1;
ex:;
if(source_path != NULL)
free(source_path);
return(ret);
}