New option -append_partition, -as mkisofs -append_partition
This commit is contained in:
@ -255,6 +255,55 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
/* Option -append_partition */
|
||||
int Xorriso_option_append_partition(struct XorrisO *xorriso, char *partno_text,
|
||||
char *type_text, char *image_path, int flag)
|
||||
{
|
||||
int partno = 0, type_code= -1, i;
|
||||
unsigned int unum;
|
||||
char *tpt;
|
||||
static char *part_type_names[] = {"FAT12", "FAT16", "Linux", NULL};
|
||||
static int part_type_codes[] = { 0x01, 0x06, 0x83};
|
||||
|
||||
sscanf(partno_text, "%d", &partno);
|
||||
if(partno < 1 || partno > 4) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-append_partition: Partition number '%s' is out of range (1...4)",
|
||||
partno_text);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
for(i= 0; part_type_names[i] != NULL; i++)
|
||||
if(strcmp(part_type_names[i], type_text) == 0)
|
||||
break;
|
||||
if(part_type_names[i] != NULL)
|
||||
type_code= part_type_codes[i];
|
||||
if(type_code < 0) {
|
||||
tpt= type_text;
|
||||
if(strncmp(tpt, "0x", 2) == 0)
|
||||
tpt+= 2;
|
||||
else
|
||||
goto bad_type;
|
||||
unum= 0xffffffff;
|
||||
sscanf(tpt, "%X", &unum);
|
||||
if(unum > 0xff) {
|
||||
bad_type:;
|
||||
sprintf(xorriso->info_text,
|
||||
"-append_partition: Partition type '%s' is out of range (0x00...0xff)",
|
||||
type_text);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
type_code= unum;
|
||||
}
|
||||
|
||||
if(Sfile_str(xorriso->appended_partitions[partno - 1], image_path, 0) <= 0)
|
||||
return(-1);
|
||||
xorriso->appended_part_types[partno - 1]= type_code;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -application_id */
|
||||
int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
|
||||
int flag)
|
||||
|
Reference in New Issue
Block a user