New option -list_delimiter

This commit is contained in:
Thomas Schmitt 2008-09-05 09:54:38 +00:00
parent 0be7fe3329
commit 0987770afa
6 changed files with 137 additions and 43 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Sep 02, 2008"
.TH XORRISO 1 "Sep 05, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -346,10 +346,19 @@ characters. Rock Ridge fulfills this demand.
Commands are either actions or settings. They consist of a command word,
followed by zero or more parameter words. If the list of parameter words
is of variable length (indicated by "[...]" or "[***]") then it has to be
terminated by either the word "--" or the end of argument list or an end of
an input line.
It is not an error if "--" appears after the parameters of a command
with a fixed list length.
terminated by either the list delimiter, or the end of argument list, or an
end of an input line.
.PP
At program start the \fBlist delimiter\fR is the word "--". This may be changed
by option -list_delimiter in order to allow "--" as argument in a list of
variable length. It is advised to reset the delimiter to "--" immediately
afterwards.
.br
For brevity the list delimiter is referred as "--" throughout this text.
.br
The list delimiter is silently tolerated if it appears after the parameters of
a command with a fixed list length. It is handled as normal text if it
appears among the arguments of such a command.
.PP
.B Pattern expansion
is a property of some particular commands and not a general
@ -966,10 +975,6 @@ other file causes a FAILURE event.
\fB\-rmdir\fR iso_rr_path [***]
Delete empty directories.
.TP
\fB\-\-\fR
.br
Mark end of particular action argument list.
.TP
\fB\-rollback\fR
Discard the manipulated ISO image and reload it from -indev.
.TP
@ -2090,6 +2095,11 @@ if its start matches the filter text. No wildcards.
\fB\-status_history_max\fR number
Set maximum number of history lines to be reported with -status "long_history".
.TP
\fB\-list_delimiter\fR word
Set the list delimiter to be used instead of "--". It has to be a single word,
must not be empty, not longer than 80 characters, and must not contain
quotation marks.
.TP
\fB\-temp_mem_limit\fR number["k"|"m"]
Set the maximum size of temporary memory to be used for image dependent
buffering. Currently this applies to pattern expansion only.

View File

@ -3322,6 +3322,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->did_something_useful= 0;
m->add_plainly= 0;
m->split_size= 0;
strcpy(m->list_delimiter, "--");
m->do_joliet= 0;
m->do_follow_pattern= 1;
m->do_follow_param= 0;
@ -4759,6 +4760,7 @@ int Xorriso_check_media_list_job(struct XorrisO *xorriso,
char *report, int flag)
{
int all, ret;
char default_report[161];
struct CheckmediajoB *dflt= NULL;
all= !(flag&1);
@ -4825,9 +4827,11 @@ int Xorriso_check_media_list_job(struct XorrisO *xorriso,
{ret= 0; goto ex;}
ret= 1;
ex:;
strcat(report, " --");
strcat(report, xorriso->list_delimiter);
Checkmediajob_destroy(&dflt, 0);
if(ret > 0 && strcmp(report, "-check_media_defaults reset=now --") == 0)
sprintf(default_report, "-check_media_defaults reset=now %s",
xorriso->list_delimiter);
if(ret > 0 && strcmp(report, default_report) == 0)
return(2);
return(ret);
}
@ -4857,6 +4861,12 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
sprintf(line,"-no_rc\n");
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= strcmp(xorriso->list_delimiter, "--") == 0;
sprintf(line,"-list_delimiter %s\n", xorriso->list_delimiter);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= 0;
if(xorriso->dialog)
sprintf(line,"-dialog on\n");
@ -4900,7 +4910,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(xorriso->check_media_default == NULL) {
is_default= 1;
sprintf(line, "-check_media_defaults --\n");
sprintf(line, "-check_media_defaults reset=now %s\n",
xorriso->list_delimiter);
} else {
ret= Xorriso_check_media_list_job(xorriso, xorriso->check_media_default,
line, no_defaults);
@ -5006,7 +5017,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
ret= Exclusions_get_descrs(xorriso->disk_exclusions, &paths, &leafs, 0);
if(ret>0) {
for(; paths!=NULL; paths= paths->next) {
sprintf(line,"-not_paths %s --\n", Text_shellsafe(paths->text, sfe, 0));
sprintf(line, "-not_paths %s %s\n",
Text_shellsafe(paths->text, sfe, 0), xorriso->list_delimiter);
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
for(; leafs!=NULL; leafs= leafs->next) {
@ -5018,10 +5030,10 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
is_default= (xorriso->file_size_limit ==
Xorriso_default_file_size_limiT);
if(xorriso->file_size_limit <= 0)
sprintf(line, "-file_size_limit off --\n");
sprintf(line, "-file_size_limit off %s\n", xorriso->list_delimiter);
else
sprintf(line, "-file_size_limit %.f --\n",
(double) xorriso->file_size_limit);
sprintf(line, "-file_size_limit %.f %s\n",
(double) xorriso->file_size_limit, xorriso->list_delimiter);
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -6254,7 +6266,7 @@ int Xorriso_end_idx(struct XorrisO *xorriso,
int i, warned= 0;
for(i= idx; i<argc; i++) {
if(strcmp(argv[i], "--")==0)
if(strcmp(argv[i], xorriso->list_delimiter)==0)
break;
if(!((flag&1) || warned))
warned= Xorriso_warn_of_wildcards(xorriso, argv[i], flag&2);
@ -6271,8 +6283,8 @@ int Xorriso_end_idx(struct XorrisO *xorriso,
same value as with the call which might have allocated memory.
@param xorriso The environment object
@param argc Length of argv
@param argv The vector with arguments, eventual "--" and then eventual
unrelated words
@param argv The vector with arguments, eventual list_delimiter ("--")
and then eventual unrelated words
@param idx Start index in argv of the argument list
@param optc Length of the effective possibly expanded option vector
@param optv The option vector. Maybe a pointer into argv or maybe
@ -9595,11 +9607,12 @@ int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
if(end_idx<=0 || (*idx)>=argc) {
if(idx_count<1)
sprintf(xorriso->info_text,
"-as : Not enough arguments given. Needed: whom do_what --");
"-as : Not enough arguments given. Needed: whom do_what %s",
xorriso->list_delimiter);
else
sprintf(xorriso->info_text,
"-as %s : Not enough arguments given. Needed: do_what --",
argv[*idx]);
"-as %s : Not enough arguments given. Needed: do_what %s",
argv[*idx], xorriso->list_delimiter);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
}
@ -11417,14 +11430,21 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -tell_media_space",
" Print foreseeable available space on output media",
"",
"Options with variable length path list [...] need the list delimiter text",
"as end mark if they are followed by another option. By default this delimiter",
"is \"--\". In dialog and with options read from files, the line end serves",
"as such a mark. With program arguments this mark can be omitted only with",
"the last option in the list of arguments.",
"For brevity the list delimiter is referred as \"--\" throughout this text.",
"",
" -list_delimiter text Set the list delimiter to be used instead of \"--\"",
" It has to be a single word, must not be empty, not longer",
" than 80 characters, may mot contain quotation marks.",
"",
"Manipulation options:",
"disk_path is a path to an object in the local filesystem tree.",
"iso_rr_path is the Rock Ridge name of a file object in the ISO image.",
"pathspec is either a disk_path or (if allowed) a pair: iso_rr_path=disk_path",
"Options with variable length path list [...] need \"--\" as end mark",
"if they are followed by another option. In dialog and with options read from",
"files, the line end serves as such a mark. With program arguments this mark",
"can be omitted only with the last option in the list of arguments.",
"Options marked by [***] have variable argument length and perform pattern",
"expansion if enabled by -iso_rr_pattern resp. -disk_pattern.",
"",
@ -11501,7 +11521,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Create empty directories if they do not exist yet.",
" -rmdir iso_rr_path [***]",
" Delete empty directories.",
" -- Mark end of particular action argument list.",
" -- Default list delimiter marking the end of action argument",
" list. It may be changed by option -list_delimiter.",
"",
" -not_paths disk_path [***]",
" Add the given paths to the list of excluded absolute paths.",
@ -11647,7 +11668,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -check_media_defaults [options] --",
" Preset options for runs of -check_media and -extract_cut.",
"",
"Compatibility emulation (argument list may be ended by --):",
"Compatibility emulation (argument list may be ended by list delimiter --):",
" -as mkisofs [-help|-version|-o|-R|-J|-V|-P|-f|-m|-exclude-list|-no-pad|",
" -M|-C|-graft-points|-path-list|pathspecs]",
" Perform some mkisofs gestures, understand pathspecs as mkisofs",
@ -11815,6 +11836,47 @@ int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag)
}
/* Option -list_delimiter */
int Xorriso_option_list_delimiter(struct XorrisO *xorriso, char *text,
int flag)
{
int ret, argc;
char **argv= NULL;
if(text[0] == 0) {
sprintf(xorriso->info_text,
"-list_delimiter: New delimiter text is empty");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
if(strlen(text) > 80) {
sprintf(xorriso->info_text,
"-list_delimiter: New delimiter text is too long");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
ret= Sfile_make_argv(xorriso->progname, text, &argc, &argv, 4);
if(ret > 0) {
if(argc > 2) {
sprintf(xorriso->info_text,
"-list_delimiter: New delimiter text contains more than one word");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
Sfile_make_argv(xorriso->progname, text, &argc, &argv, 2);
if(argc > 2)
return(0);
}
if(strchr(text, '"') != NULL || strchr(text, '\'') != NULL) {
sprintf(xorriso->info_text,
"-list_delimiter: New delimiter text contains quotation marks");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
strcpy(xorriso->list_delimiter, text);
return(1);
}
/* Option -list_formats */
int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag)
{
@ -12537,8 +12599,9 @@ no_memory:;
ret= Exclusions_add_not_paths(xorriso->disk_exclusions,
num_descr, descr, optc, optv, 0);
if(ret<=0) {
sprintf(xorriso->info_text,"Cannot add path list: -not_paths %s%s --",
Text_shellsafe(argv[*idx], sfe, 0), (num_descr>1 ? " ..." : ""));
sprintf(xorriso->info_text,"Cannot add path list: -not_paths %s%s %s",
Text_shellsafe(argv[*idx], sfe, 0), (num_descr>1 ? " ..." : ""),
xorriso->list_delimiter);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
ex:;
@ -13647,7 +13710,7 @@ int Xorriso_normalize_command(struct XorrisO *xorriso, char *original_cmd,
}
strcpy(cmd_data, original_cmd);
*cmd= cmd_data;
if(strcmp(*cmd, "--")==0)
if(strcmp(*cmd, xorriso->list_delimiter)==0)
return(1);
while((*cmd)[0]=='-') {
if((*cmd)[1]==0)
@ -13674,14 +13737,14 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
static char arg0_commands[][40]= {
"ban_stdio_write","commit","commit_eject","devices","end","help",
"list_formats","no_rc","print_size","pwd","pwdi","pwdx",
"rollback","rollback_end","tell_media_space","toc","version","--",
"rollback","rollback_end","tell_media_space","toc","version",
""
};
static char arg1_commands[][40]= {
"abort_on","add_plainly","blank","cd","cdi","cdx","close","dev",
"dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
"format","fs","gid","grow_blindly",
"history","indev","joliet","mark","not_leaf",
"history","indev","joliet","list_delimiter","mark","not_leaf",
"not_list","not_mgt","options_from_file","osirrox","outdev","overwrite",
"padding","path_list","pathspecs","pkt_output","print","prompt",
"prog","publisher","reassure","report_about","rom_toc_scan",
@ -13722,8 +13785,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
if(ret<0)
return(ret);
was_dashed= (ret>0);
if(cmd[0]=='#' || cmd[0]==0) {
/* ignore comment line and empty option */;
if(cmd[0]=='#' || cmd[0]==0 || strcmp(cmd, xorriso->list_delimiter) == 0) {
/* ignore: comment line , empty option , orphaned list delimiter */
return(1);
}
for(i=0; arg0_commands[i][0]!=0; i++)
@ -14060,6 +14123,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_joliet(xorriso, arg1, 0);
} else if(strcmp(cmd, "list_delimiter") == 0) {
(*idx)++;
ret= Xorriso_option_list_delimiter(xorriso, arg1, 0);
} else if(strcmp(cmd,"list_formats")==0) {
ret= Xorriso_option_list_formats(xorriso, 0);
@ -14318,7 +14385,7 @@ next_command:;
(*idx)++;
ret= Xorriso_option_volid(xorriso,arg1,0);
} else if(strcmp(cmd,"--")==0){
} else if(strcmp(cmd, xorriso->list_delimiter)==0){
/* tis ok */;
} else if(was_dashed) {
@ -14481,7 +14548,9 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
int i, ret, was_dashed, num2, arg_count;
int was_report_about= 0, was_abort_on= 0, was_return_with= 0;
char *cmd, *original_cmd, cmd_data[5*SfileadrL], *arg1, *arg2;
char mem_list_delimiter[81];
strcpy(mem_list_delimiter, xorriso->list_delimiter);
for(i=1+(flag&1);i<argc;i++) {
original_cmd= cmd= argv[i];
was_dashed= 0;
@ -14489,7 +14558,7 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
was_dashed= Xorriso_normalize_command(xorriso, original_cmd, i,
cmd_data, sizeof(cmd_data), &cmd, 0);
if(was_dashed<0)
return(-1);
{ret= -1; goto ex;}
arg1= "";
if(i+1<argc)
@ -14504,16 +14573,16 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
i++;
Xorriso_option_prog_help(xorriso,arg1,0);
xorriso->did_something_useful= 1;
return(0);
{ret= 0; goto ex;}
} else if(strcmp(cmd,"help")==0) {
Xorriso_option_help(xorriso,0);
xorriso->did_something_useful= 1;
return(0);
{ret= 0; goto ex;}
}
} else if(i==1 && strcmp(cmd,"no_rc")==0) {
ret= Xorriso_option_no_rc(xorriso, 0);
if(ret<=0)
return(ret);
goto ex;
} else if((strcmp(cmd,"dev")==0 || strcmp(cmd,"outdev")==0 ||
strcmp(cmd,"indev")==0) &&
@ -14559,13 +14628,22 @@ protect_stdout:;
strcmp(arg1, "genisofs")==0 || strcmp(arg1, "xorrisofs")==0)
goto protect_stdout;
} else if(strcmp(cmd, "list_delimiter") == 0) {
i++;
ret= Xorriso_option_list_delimiter(xorriso, arg1, 0);
if(ret <= 0)
goto ex;
} else {
ret= Xorriso_count_args(xorriso, argc-i, argv+i, &arg_count, 1);
if(ret==1)
i+= arg_count;
}
}
return(1);
ret= 1;
ex:;
strcpy(xorriso->list_delimiter, mem_list_delimiter);
return(ret);
}

View File

@ -451,6 +451,10 @@ int Xorriso_option_iso_rr_pattern(struct XorrisO *xorriso, char *mode,
/* Option -joliet "on"|"off" */
int Xorriso_option_joliet(struct XorrisO *xorriso, char *mode, int flag);
/* Option -list_delimiter */
int Xorriso_option_list_delimiter(struct XorrisO *xorriso, char *text,
int flag);
/* Option -list_formats */
int Xorriso_option_list_formats(struct XorrisO *xorriso, int flag);

View File

@ -98,6 +98,8 @@ struct XorrisO { /* the global context of xorriso */
int add_plainly;
off_t split_size;
char list_delimiter[81];
/* >>> put libisofs aspects here <<< */
int do_joliet;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.09.04.100158"
#define Xorriso_timestamP "2008.09.05.095344"

View File

@ -6699,7 +6699,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
"Closed media with data detected. Need blank or appendable media.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
if(burn_disc_erasable(drive)) {
sprintf(xorriso->info_text, "Try --blank_fast\n");
sprintf(xorriso->info_text, "Try -blank as_needed\n");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "HINT", 0);
}
} else if(disc_state == BURN_DISC_EMPTY) {