Adapted -report_system_area to changed output format of libisofs

This commit is contained in:
Thomas Schmitt 2014-04-13 07:19:37 +00:00
parent e32159ac00
commit 1bfd24f856
2 changed files with 11 additions and 17 deletions

View File

@ -1425,17 +1425,17 @@ ex:;
int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag) int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag)
{ {
int ret; int ret, line_count, i;
char *text = NULL, *cpt, *npt; char **lines = NULL;
IsoImage *image; IsoImage *image;
if(strcmp(form, "help") == 0) { if(strcmp(form, "help") == 0) {
ret= iso_image_report_system_area(NULL, &text, 1); ret= iso_image_report_system_area(NULL, &lines, &line_count, 1);
} else if(strcmp(form, "") == 0 || strcmp(form, "plain") == 0) { } else if(strcmp(form, "") == 0 || strcmp(form, "plain") == 0) {
ret= Xorriso_get_volume(xorriso, &image, 0); ret= Xorriso_get_volume(xorriso, &image, 0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;
ret= iso_image_report_system_area(image, &text, 0); ret= iso_image_report_system_area(image, &lines, &line_count, 0);
} else if(strncmp(form, "gpt_crc_of:", 11) == 0) { } else if(strncmp(form, "gpt_crc_of:", 11) == 0) {
ret = Xorriso_gpt_crc(xorriso, form + 11, 0); ret = Xorriso_gpt_crc(xorriso, form + 11, 0);
goto ex; goto ex;
@ -1448,31 +1448,25 @@ int Xorriso_report_system_area(struct XorrisO *xorriso, char *form, int flag)
} }
if(ret < 0) if(ret < 0)
goto ex; goto ex;
if(text == NULL || ret == 0) { if(lines == 0 || ret == 0) {
strcpy(xorriso->info_text, "No System Area was loaded"); strcpy(xorriso->info_text, "No System Area was loaded");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 2; goto ex; ret= 2; goto ex;
} }
if(text[0] == 0) { if(line_count == 0) {
strcpy(xorriso->info_text, "System Area only contains 0-bytes"); strcpy(xorriso->info_text, "System Area only contains 0-bytes");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 2; goto ex; ret= 2; goto ex;
} }
for(npt= cpt= text; npt != NULL; cpt= npt + 1) { for(i = 0; i < line_count ; i++) {
npt= strchr(cpt, '\n'); sprintf(xorriso->result_line, "%s\n", lines[i]);
if(npt == NULL)
strcpy(xorriso->result_line, cpt);
else {
strncpy(xorriso->result_line, cpt, npt - cpt + 1);
xorriso->result_line[npt - cpt + 1]= 0;
}
Xorriso_result(xorriso,0); Xorriso_result(xorriso,0);
} }
ret= 1; ret= 1;
ex:; ex:;
if(text != NULL) if(lines != NULL)
free(text); iso_image_report_system_area(NULL, &lines, &line_count, 1 << 15);
return(ret); return(ret);
} }

View File

@ -1 +1 @@
#define Xorriso_timestamP "2014.04.12.130150" #define Xorriso_timestamP "2014.04.13.071908"