New option -add_plainly

This commit is contained in:
Thomas Schmitt 2008-01-20 20:03:48 +00:00
parent f85b1a5f21
commit 707a397762
5 changed files with 81 additions and 8 deletions

View File

@ -271,6 +271,10 @@ To prevent a fatal intermingling of ISO image and text messages, all result
texts get redirected to stderr if -*dev "-" or "stdio:/dev/fd/1" is among texts get redirected to stderr if -*dev "-" or "stdio:/dev/fd/1" is among
the start arguments of the program. the start arguments of the program.
.br .br
Standard output is currently suitable for creating a single new session
per program run without dialog. Use in other situations is discouraged
and several restrictions apply:
.br
It is not allowed to use standard output as pseudo drive if it was not It is not allowed to use standard output as pseudo drive if it was not
among the start arguments. Do not try to fool this ban via backdoor addresses among the start arguments. Do not try to fool this ban via backdoor addresses
to stdout. to stdout.
@ -394,7 +398,10 @@ This is only allowed as long as no changes are pending in the currently
loaded ISO image. Eventually one has to perform -commit or -rollback first. loaded ISO image. Eventually one has to perform -commit or -rollback first.
Violation yields a SORRY event. Violation yields a SORRY event.
.br .br
An empty address string gives up the current device Special address string "-" means standard output, to which several restrictions
apply. See above paragraph "Libburn drives".
.br
An empty address string "" gives up the current device
without aquiring a new one. without aquiring a new one.
.TP .TP
\fB\-indev\fR address \fB\-indev\fR address
@ -412,7 +419,10 @@ empty ISO image with no changes pending is created. It can either be populated
by help of -add or it can be discarded silently if -dev or -indev are by help of -add or it can be discarded silently if -dev or -indev are
performed afterwards. performed afterwards.
.br .br
An empty address string gives up the current output drive Special address string "-" means standard output, to which several restrictions
apply. See above paragraph "Libburn drives".
.br
An empty address string "" gives up the current output drive
without aquiring a new one. No writing is possible without an output drive. without aquiring a new one. No writing is possible without an output drive.
.TP .TP
\fB\-ban_stdio_write\fR \fB\-ban_stdio_write\fR
@ -507,6 +517,21 @@ If -pathspecs is set to "off" then eventual -disk_pattern expansion applies.
The resulting words are used as both, iso_rr_path and disk path. Eventually The resulting words are used as both, iso_rr_path and disk path. Eventually
-cdx gets prepended. -cdx gets prepended.
.TP .TP
\fB\-add_plainly\fR mode
If set to mode "unknown" then any command word that does not begin with "-" and
is not recognized as known command will be subject to a virtual -add command.
I.e. it will be used as pathspec or as disk_path and added to the image.
Eventually -disk_pattern expansion applies to disk_paths.
.br
Mode "dashed" is similar to "unknown" but also adds unrecognized command
words even if they begin with "-".
.br
Mode "any" announces that all further words are to be added as pathspecs
or disk_paths. This does not work in dialog mode.
.br
Mode "none" is the default. It prevents any words from being understood
as files to add, if they are not parameters to appropriate commands.
.TP
\fB\-path_list\fR disk_path \fB\-path_list\fR disk_path
Like -add but read the parameter words from file disk_path. Like -add but read the parameter words from file disk_path.
One pathspec resp. disk_path pattern per line. One pathspec resp. disk_path pattern per line.

View File

@ -2848,6 +2848,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->wdi[0]= 0; m->wdi[0]= 0;
strcpy(m->wdx, m->initial_wdx); strcpy(m->wdx, m->initial_wdx);
m->did_something_useful= 0; m->did_something_useful= 0;
m->add_plainly= 0;
m->do_joliet= 0; m->do_joliet= 0;
m->do_follow_pattern= 1; m->do_follow_pattern= 1;
m->do_follow_param= 0; m->do_follow_param= 0;
@ -3939,6 +3940,14 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
(xorriso->wdx[0] ? Text_shellsafe(xorriso->wdx,sfe,0) : "'/'")); (xorriso->wdx[0] ? Text_shellsafe(xorriso->wdx,sfe,0) : "'/'"));
Xorriso_status_result(xorriso,filter,fp,flag&2); Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->add_plainly==0);
sprintf(line,"-add_plainly %s\n",
(xorriso->add_plainly == 1 ? "unknown" :
xorriso->add_plainly == 2 ? "dashed" :
xorriso->add_plainly == 3 ? "any" : "none"));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->do_iso_rr_pattern==1); is_default= (xorriso->do_iso_rr_pattern==1);
sprintf(line,"-iso_rr_pattern %s\n", sprintf(line,"-iso_rr_pattern %s\n",
(xorriso->do_iso_rr_pattern == 1 ? "on" : (xorriso->do_iso_rr_pattern == 1 ? "on" :
@ -6052,6 +6061,26 @@ ex:;
} }
/* Option -add_plainly "none"|"unknown" */
int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode,int flag)
{
if(strcmp(mode, "none")==0)
xorriso->add_plainly= 0;
if(strcmp(mode, "unknown")==0)
xorriso->add_plainly= 1;
else if(strcmp(mode, "dashed")==0)
xorriso->add_plainly= 2;
else if(strcmp(mode, "any")==0)
xorriso->add_plainly= 3;
else {
sprintf(xorriso->info_text, "-add_plainly: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
return(1);
}
/* Option -alter_date , -alter_date_r */ /* Option -alter_date , -alter_date_r */
/* @param flag bit0=recursive (-alter_date_r) /* @param flag bit0=recursive (-alter_date_r)
*/ */
@ -7068,6 +7097,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -add pathspec [...] | disk_path [***]", " -add pathspec [...] | disk_path [***]",
" Insert the given files or directory trees from", " Insert the given files or directory trees from",
" filesystem into the ISO image. Much like mkisofs.", " filesystem into the ISO image. Much like mkisofs.",
" -add_plainly \"none\"|\"unknown\"|\"dashed\"|\"any\"",
" Whether to add lonely arguments as pathspec resp. disk_path.",
" -path-list disk_path", " -path-list disk_path",
" Like -add but read the pathspecs from file disk_path.", " Like -add but read the pathspecs from file disk_path.",
" -pathspecs \"on\"|\"off\" Allow or disallow pathspecs of form ", " -pathspecs \"on\"|\"off\" Allow or disallow pathspecs of form ",
@ -8288,6 +8319,10 @@ next_command:;
cmd= argv[*idx]; cmd= argv[*idx];
else else
cmd= ""; cmd= "";
if(xorriso->add_plainly==3 && cmd[0] && !xorriso->is_dialog) {
(*idx)++;
goto add_plain_argument;
}
was_dashed= 0; was_dashed= 0;
if(cmd[0]=='-' && cmd[1]!='-' && cmd[1]!=0) { if(cmd[0]=='-' && cmd[1]!='-' && cmd[1]!=0) {
was_dashed= 1; was_dashed= 1;
@ -8315,6 +8350,10 @@ next_command:;
} else if(strcmp(cmd,"add")==0) { } else if(strcmp(cmd,"add")==0) {
ret= Xorriso_option_add(xorriso, argc, argv, idx, 0); ret= Xorriso_option_add(xorriso, argc, argv, idx, 0);
} else if(strcmp(cmd,"add_plainly")==0) {
(*idx)++;
ret= Xorriso_option_add_plainly(xorriso, arg1, 0);
} else if(strcmp(cmd,"alter_date")==0 || strcmp(cmd,"alter_date_r")==0) { } else if(strcmp(cmd,"alter_date")==0 || strcmp(cmd,"alter_date_r")==0) {
(*idx)+= 2; (*idx)+= 2;
ret= Xorriso_option_alter_date(xorriso, arg1, arg2, argc, argv, idx, ret= Xorriso_option_alter_date(xorriso, arg1, arg2, argc, argv, idx,
@ -8646,6 +8685,8 @@ next_command:;
/* tis ok */; /* tis ok */;
} else if(was_dashed) { } else if(was_dashed) {
if(xorriso->add_plainly>1)
goto add_plain_argument;
unknown_option:; unknown_option:;
sprintf(xorriso->info_text, sprintf(xorriso->info_text,
"=== Not a known option:\n"); "=== Not a known option:\n");
@ -8655,12 +8696,13 @@ unknown_option:;
{ret= 0; goto eval_any_problems;} {ret= 0; goto eval_any_problems;}
} else { } else {
goto unknown_option; if(xorriso->add_plainly<=0)
goto unknown_option;
add_plain_argument:;
(*idx)--;
ret= Xorriso_option_add(xorriso, (*idx)+1, argv, idx, 0);
(*idx)++;
/* >>> ??? pathspecs for option -add */;
sprintf(xorriso->info_text, "Ignored argument : '%s'", cmd);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
} }
eval_any_problems: eval_any_problems:

View File

@ -153,6 +153,11 @@ int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag);
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv, int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag); int *idx, int flag);
/* Option -add_plainly "on"|"off" */
int Xorriso_option_add_plainly(struct XorrisO *xorriso, char *mode,
int flag);
/* Option -alter_date, alter_date_r */ /* Option -alter_date, alter_date_r */
/* @param flag bit0=recursive (-alter_date_r) /* @param flag bit0=recursive (-alter_date_r)
*/ */

View File

@ -63,6 +63,7 @@ struct XorrisO { /* the global context of xorriso */
char wdx[SfileadrL]; char wdx[SfileadrL];
int did_something_useful; int did_something_useful;
int add_plainly;
/* >>> put libisofs aspects here <<< */ /* >>> put libisofs aspects here <<< */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.01.20.131050" #define Xorriso_timestamP "2008.01.20.200254"