Implemented option -devices

This commit is contained in:
Thomas Schmitt 2007-10-18 17:14:09 +00:00
parent 49b1637579
commit 05890b61d4
5 changed files with 151 additions and 46 deletions

View File

@ -630,13 +630,13 @@ int Sfile_make_argv(char *progname, char *line, int *argc, char ***argv,
l= strlen(buf);
if(pass==0){
if(argzaehl==line_start_argc && (flag&8))
if(buf[0]!='-' && buf[0]!=0)
if(buf[0]!='-' && buf[0]!=0 && buf[0]!='#')
l++;
if(l>maxl) maxl= l;
}else{
strcpy((*argv)[argzaehl],buf);
if(argzaehl==line_start_argc && (flag&8))
if(buf[0]!='-' && buf[0]!=0)
if(buf[0]!='-' && buf[0]!=0 && buf[0]!='#')
sprintf((*argv)[argzaehl],"-%s", buf);
}
argzaehl++;
@ -3395,13 +3395,18 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
return(1);
}
if(xorriso->volset_change_pending) {
ret= Xorriso_option_commit(xorriso, 1);
if(ret<=0)
return(ret);
if(xorriso->volset_change_pending && (flag&1)) {
sprintf(xorriso->info_text,
"%s: Image changes pending. -commit or -rollback first",
(flag&2) ? "-dev" : "-indev");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
if(adr[0]==0)
ret= Xorriso_give_up_drive(xorriso, flag&3);
else
ret= Xorriso_aquire_drive(xorriso, adr, flag&3);
if(ret<=0)
return(ret);
if(Sfile_str(xorriso->indev, adr, 0)<=0)
@ -3415,8 +3420,37 @@ int Xorriso_option_dev(struct XorrisO *xorriso, char *adr, int flag)
/* Option -devices */
int Xorriso_option_devices(struct XorrisO *xorriso, int flag)
{
fprintf(stderr, ">>> LIBISOBURN : -devices\n");
return(1);
int ret;
char sfe[4*SfileadrL];
if(xorriso->volset_change_pending) {
sprintf(xorriso->info_text,
"-devices: Image changes pending. -commit or -rollback first");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
xorriso->info_text[0]= 0;
if(xorriso->in_drive_handle!=NULL || xorriso->out_drive_handle!=NULL) {
if(xorriso->in_drive_handle == xorriso->out_drive_handle) {
sprintf(xorriso->info_text, "Gave up -dev %s",
Text_shellsafe(xorriso->indev, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}else {
if(xorriso->in_drive_handle) {
sprintf(xorriso->info_text, "Gave up -indev %s",
Text_shellsafe(xorriso->indev, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
if(xorriso->out_drive_handle) {
sprintf(xorriso->info_text, "Gave up -outdev %s",
Text_shellsafe(xorriso->outdev, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
}
Xorriso_give_up_drive(xorriso, 3);
}
ret= Xorriso_show_devices(xorriso, 0);
return(ret);
}
@ -4620,6 +4654,10 @@ next_command:;
} else if(strcmp(cmd,"-print-size")==0) {
Xorriso_option_print_size(xorriso, 0);
} else if(strcmp(cmd,"-prompt")==0) {
(*idx)++;
ret= Xorriso_option_prompt(xorriso, arg1, 0);
} else if(strcmp(cmd,"-prog")==0) {
(*idx)++;
ret= Xorriso_option_prog(xorriso, arg1, 0);

View File

@ -216,11 +216,13 @@ Aquiring source and target drive:
Only allowed as long as no ISO image was loaded and
altered, or after actions -rollback, or -commit.
Violation yields a SORRY event.
An empty address string gives up the current device
without aquiring a new one.
-indev address Set input drive and load eventual ISO image. Switch from
> -indev address Set input drive and load eventual ISO image. Switch from
growing to modifying. Same restrictions as with -dev
-outdev address Set output drive and switch from growing to modifying.
> -outdev address Set output drive and switch from growing to modifying.
>>> (Do we need the restrictions as with -dev ?
>>> I.e. do we need to know that we are doing modification
>>> before we call isoburn_prepare_*() ? )
@ -254,10 +256,10 @@ The commands in this section alter the ISO image and not the local filesystem.
Use the same paths on ISO unless -graft-points is set and
the paths have the form iso_rr_path=disk_path .
-path-list disk_path Like -add but read the pathspecs from file disk_path.
> -path-list disk_path Like -add but read the pathspecs from file disk_path.
One pathspec per line.
-cp_r disk_path [...] iso_rr_path
> -cp_r disk_path [...] iso_rr_path
Insert the given files or directory trees from filesystem
into the ISO image.
Use the same rules for generating the ISO addresses as
@ -277,31 +279,31 @@ The commands in this section alter the ISO image and not the local filesystem.
cat /mnt/file_part1 /mnt/file_part2 > $HOME/file
)
-rm iso_rr_path [...] Delete the given files from the ISO image.
> -rm iso_rr_path [...] Delete the given files from the ISO image.
-rm_r iso_rr_path [...]
> -rm_r iso_rr_path [...]
Delete the given files or directory trees from the ISO image.
-mv iso_rr_path [...] iso_rr_path
> -mv iso_rr_path [...] iso_rr_path
Rename the given file objects in the ISO tree to the last
argument in the list. Use the same rules as with shell command
mv.
-chown uid iso_rr_path [...] Equivalent to chown in the ISO image.
-chgrp gid iso_rr_path [...] Equivalent to chgrp in the ISO image.
-chmod mode iso_rr_path [...] Equivalent to chmod in the ISO image.
> -chown uid iso_rr_path [...] Equivalent to chown in the ISO image.
> -chgrp gid iso_rr_path [...] Equivalent to chgrp in the ISO image.
> -chmod mode iso_rr_path [...] Equivalent to chmod in the ISO image.
-alter_date type timestring iso_rr_path [...]
> -alter_date type timestring iso_rr_path [...]
Alter the date entries of a file in the ISO image. type is
one of "a", "m", "b" for access time, modification time,
both times.
>>> Can we set ctime ? Do we want to set ctime ?
-mkdir iso_rr_path [...] Create empty directories if they do not exist yet.
> -mkdir iso_rr_path [...] Create empty directories if they do not exist yet.
Existence as directory generates a WARNING event, existence as
other file is a SORRY.
-rmdir iso_rr_path [...] Delete empty directories.
> -rmdir iso_rr_path [...] Delete empty directories.
-- Mark end of particular action argument list.
@ -321,11 +323,11 @@ Writing the result:
and no new loading of image, rather execute option -end.
To suppress a final write, execute -rollback -end.
-eject "in"|"out"|"all" Eject the media in -indev, resp. -outdev, resp. both
> -eject "in"|"out"|"all" Eject the media in -indev, resp. -outdev, resp. both
drives.
Note: It is not possible yet to effectively eject disk files.
-blank mode Blank media resp. invalidate ISO image on media.
> -blank mode Blank media resp. invalidate ISO image on media.
This affects only the outdrive not the indrive.
If both drives are the same and if the ISO image was altered
then this command leads to a SORRY event.
@ -341,7 +343,7 @@ RockRidge info will be generated by the program unconditionally.
-J Generate Joliet info additional to Rock Ridge info.
-f Follow symbolic links.
> -f Follow symbolic links.
-uid uid User id to be used for all files when inserted into the
new ISO tree.
@ -353,7 +355,7 @@ RockRidge info will be generated by the program unconditionally.
Settings for result writing:
-V volid Specifies the volume ID. (I assume libisofs can do that)
> -V volid Specifies the volume ID. (I assume libisofs can do that)
-speed number[k|m|c|d] Set the burn speed. Default is 0 = maximum speed.
Speed can be given in media dependent numbers or as a
@ -364,15 +366,15 @@ Settings for result writing:
If there is no hint about the speed unit attached, then the
media in the outdrive will decide. Default unit is CD = 176.4k.
-dummy "on"|"off" If "on" simulate burning or refuse with SORRY event if
? -dummy "on"|"off" If "on" simulate burning or refuse with SORRY event if
no simulation is possible.
-fs number["k"|"m"] Set the size of the fifo buffer which smoothens the data
> -fs number["k"|"m"] Set the size of the fifo buffer which smoothens the data
stream from ISO image generation to media burning. Default
is 4 MiB. The number may be followed by letter "k" or"m"
which means unit is kiB (= 1024) or MiB (= 1024 kiB).
-close "on"|"off" If "on" then mark the written media as not appendable
? -close "on"|"off" If "on" then mark the written media as not appendable
any more (if possible at all with the given type of target
media).
This is the contrary of cdrskin -multi.
@ -390,7 +392,7 @@ Exception processing:
the setting by this option. Expect not many "ABORT" events to
be ignorable.
-overwrite "on"|"off" Allow or disallow to overwrite existing files in the
> -overwrite "on"|"off" Allow or disallow to overwrite existing files in the
ISO image by a file with the same user defined name. This is
the RockRidge name and not the plain ISO name.
With setting "off", RR name collisions cause SORRY-events.
@ -404,10 +406,10 @@ Dialog mode control:
-page len width Describe terminal to the text pager.
-use_readline "on"|"off" If "on" then use readline for dialog. Esle use
? -use_readline "on"|"off" If "on" then use readline for dialog. Esle use
plain stdin.
-reassure "on"|"off" If "on" then ask the user for "y" or "n" with any file
> -reassure "on"|"off" If "on" then ask the user for "y" or "n" with any file
before deleting or overwriting it in the ISO image.
@ -415,32 +417,35 @@ Drive and media related inquiry actions:
-toc Show media specific table of content. (MMC toc, not ISO.)
-devices Show list of available MMC drives.
-devices Show list of available MMC drives. This is only possible as
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.
-print-size Print the foreseeable consumption by next -commit.
> -print-size Print the foreseeable consumption by next -commit.
-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.)
Navigation in ISO image and disk filesystem:
-cd iso_rr_path Change the current working directory in the emerging ISO
> -cd iso_rr_path Change the current working directory in the emerging ISO
image as it is at the moment.
-cdx disk_path Change the current working directory on filesystem.
> -cdx disk_path Change the current working directory on filesystem.
-pwd Tell the current working directory in the ISO image.
-pwdx ... on local filesystem.
-ls pattern List files from the current working directory in the ISO
> -ls pattern List files from the current working directory in the ISO
image which match a shell pattern. (I.e. wildcards '*' '?')
-lsx pattern ... on local filesystem.
> -lsx pattern ... on local filesystem.
-ls_l pattern Equivalent for ls -l.
-ls_lx pattern ... on filesystem.
> -ls_l pattern Equivalent for ls -l.
> -ls_lx pattern ... on filesystem.
-find pattern Equivalent to find . -name pattern in the ISO image.
-findx pattern ... on filesystem.
> -find pattern Equivalent to find . -name pattern in the ISO image.
> -findx pattern ... on filesystem.
Scripting, dialog and program control features:
@ -464,7 +469,7 @@ Scripting, dialog and program control features:
output lines of -status:long_history. A line is put out only
if its start matches the filter text. No wildcards.
-status_history_max maximum number of history lines to be reported with
? -status_history_max maximum number of history lines to be reported with
-status "long_history".
-options_from_file fileaddress

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.10.18.144841"
#define Xorriso_timestamP "2007.10.18.171415"

View File

@ -195,8 +195,11 @@ int Xorriso_give_up_drive(struct XorrisO *xorriso, int flag)
burn_drive_info_free(dinfo);
xorriso->in_drive_handle= NULL;
if(in_is_out_too)
xorriso->indev[0]= 0;
if(in_is_out_too) {
xorriso->out_drive_handle= NULL;
xorriso->outdev[0]= 0;
}
}
if((flag&2) && xorriso->out_drive_handle!=NULL) {
dinfo= (struct burn_drive_info *) xorriso->out_drive_handle;
@ -635,3 +638,60 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
return(1);
}
int Xorriso_show_devices(struct XorrisO *xorriso, int flag)
{
char adr[BURN_DRIVE_ADR_LEN];
int i;
struct burn_drive_info *drive_list= NULL;
unsigned int drive_count;
char *respt, perms[8];
struct stat stbuf;
sprintf(xorriso->info_text, "Beginning to scan for devices ...\n");
Xorriso_info(xorriso,0);
burn_drive_clear_whitelist();
while(!burn_drive_scan(&drive_list, &drive_count)) {
Xorriso_process_msg_queues(xorriso,0);
usleep(100000);
}
Xorriso_process_msg_queues(xorriso,0);
if(drive_count <= 0) {
/* >>> was a drive_list created at all ? */
/* >>> must it be freed ? */
sprintf(xorriso->info_text, "No drives found");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
sprintf(xorriso->info_text, "Full drive scan done\n");
Xorriso_info(xorriso,0);
respt= xorriso->result_line;
for(i= 0; i < drive_count; i++) {
if(burn_drive_get_adr(&(drive_list[i]), adr)<=0)
strcpy(adr, "-get_adr_failed-");
Xorriso_process_msg_queues(xorriso,0);
if(stat(adr,&stbuf)==-1) {
sprintf(perms,"errno=%d",errno);
} else {
strcpy(perms,"------");
if(stbuf.st_mode&S_IRUSR) perms[0]= 'r';
if(stbuf.st_mode&S_IWUSR) perms[1]= 'w';
if(stbuf.st_mode&S_IRGRP) perms[2]= 'r';
if(stbuf.st_mode&S_IWGRP) perms[3]= 'w';
if(stbuf.st_mode&S_IROTH) perms[4]= 'r';
if(stbuf.st_mode&S_IWOTH) perms[5]= 'w';
}
sprintf(respt, "%d -dev '%s' %s : '%-8.8s' '%s' \n",
i, adr, perms, drive_list[i].vendor, drive_list[i].product);
Xorriso_result(xorriso,0);
}
burn_drive_info_free(drive_list);
Xorriso_process_msg_queues(xorriso,0);
return(1);
}

View File

@ -35,6 +35,8 @@ int Xorriso__text_to_sev(char *severity_name, int *severity_number,int flag);
int Xorriso_toc(struct XorrisO *xorriso, int flag);
int Xorriso_show_devices(struct XorrisO *xorriso, int flag);
#endif /* Xorrisoburn_includeD */