Implemented -print-size

This commit is contained in:
Thomas Schmitt 2007-10-19 15:13:16 +00:00
parent cf46802aac
commit 51672f9bc1
4 changed files with 42 additions and 13 deletions

View File

@ -4126,7 +4126,26 @@ int Xorriso_option_print(struct XorrisO *xorriso, char *text, int flag)
/* Option -print-size */
int Xorriso_option_print_size(struct XorrisO *xorriso, int flag)
{
fprintf(stderr, ">>> LIBISOFS : -print-size\n");
int ret;
if(!xorriso->volset_change_pending) {
sprintf(xorriso->info_text,"-print-size: No image modifications pending");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
sprintf(xorriso->result_line,"Image size : 0\n");
Xorriso_result(xorriso,0);
return(2);
}
/* >>> care for modifying */
ret= Xorriso_write_growing(xorriso, 1);
if(ret<=0) {
sprintf(xorriso->info_text,"-print-size: Failed to set up virtual -commit");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
sprintf(xorriso->result_line,"Image size : %d\n", ret);
Xorriso_result(xorriso,0);
return(1);
}
@ -4580,7 +4599,7 @@ next_command:;
(*idx)++;
ret= Xorriso_option_gid(xorriso,arg1,0);
} else if(strcmp(cmd,"-graft-points")==0) {
} else if(strcmp(cmd,"-graft-points")==0 || strcmp(cmd,"-graft_points")==0) {
ret= Xorriso_option_graft_points(xorriso, 0);
} else if(strcmp(cmd,"-help")==0) {
@ -4650,7 +4669,7 @@ next_command:;
num2= 80;
ret= Xorriso_option_page(xorriso, num1, num2, 0);
} else if(strcmp(cmd,"-path-list")==0) {
} else if(strcmp(cmd,"-path-list")==0 || strcmp(cmd,"-path_list")==0) {
(*idx)++;
ret= Xorriso_option_path_list(xorriso, arg1, 0);
@ -4662,7 +4681,7 @@ next_command:;
(*idx)++;
ret= Xorriso_option_print(xorriso, arg1, 0);
} else if(strcmp(cmd,"-print-size")==0) {
} else if(strcmp(cmd,"-print-size")==0 || strcmp(cmd,"-print_size")==0) {
Xorriso_option_print_size(xorriso, 0);
} else if(strcmp(cmd,"-prompt")==0) {
@ -4961,7 +4980,6 @@ int Xorriso_main(int argc, char **argv)
#endif /* Xorriso_with_maiN */
int ret,i;
struct XorrisO *xorriso= NULL;

View File

@ -415,16 +415,21 @@ Dialog mode control:
Drive and media related inquiry actions:
-toc Show media specific table of content. (MMC toc, not ISO.)
-toc Show media specific table of content. This is the media
structure, not the ISO image directory tree. In case of
overwriteable media holding a valid ISO image, a single
session gets fabricated from the ISO image size info.
-devices Show list of available MMC drives. This is only possible as
-devices Show list of available MMC drives. This is only possible when
no ISO image changes are pending. After this option was
executed, there is no drive current and no image loaded.
Eventually one has to aquire any drive again.
Eventually one has to aquire a drive again.
> -print-size Print the foreseeable consumption by next -commit.
-print-size Print the foreseeable consumption of 2048 byte blocks
by next -commit. This can last a while as a -commit gets
prepared and only in last moment is revoked by this option.
> -tell_media_space Print available space on output media (minus already
-tell_media_space Print available space on output media (minus already
foreseeable consumption by next -commit.)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.19.140031"
#define Xorriso_timestamP "2007.10.19.151339"

View File

@ -254,6 +254,8 @@ int Xorriso_make_write_options(
}
/* @param flag bit0= do not write but only prepare and return size in sectors
*/
int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
{
int ret;
@ -297,10 +299,15 @@ int Xorriso_write_growing(struct XorrisO *xorriso, int flag)
{ret= 0; goto ex;}
}
if(flag&1) {
ret= burn_disc_get_sectors(disc);
goto ex;
}
ret= Xorriso_make_write_options(xorriso, drive, &burn_options, 0);
if(ret<=0)
goto ex;
isoburn_disc_write(burn_options, disc);
burn_write_opts_free(burn_options);
@ -748,4 +755,3 @@ int Xorriso_tell_media_space(struct XorrisO *xorriso, int flag)
return(free_space);
}