New options -not_paths, -not_leaf, -not_list, -not_mgt, -as mkisofs -m,

This commit is contained in:
Thomas Schmitt 2008-05-04 13:36:15 +00:00
parent 1666ca358e
commit e7cb508cd8
3 changed files with 147 additions and 117 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 "May, 1, 2008"
.TH XORRISO 1 "May, 4, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -584,7 +584,7 @@ should always be the same as with the first adding of disk_path as iso_rr_path.
If iso_rr_path does not exist yet, then it gets added. If disk_path does not
exist, then iso_rr_path gets deleted.
.br
-update_r is also a convenient compromise between -add addressing and -cp_r
-update_r is also a convenient compromise between -add addressing and -cpr
addressing: Its semantics is similar to -add and thus avoids the pitfalls
inherited from cp -r behavior. Its syntax resembles cp, though.
.TP
@ -914,6 +914,60 @@ or worse occured.
.TP
.B Settings for data insertion:
.TP
\fB\-not_mgt\fR code[:code[...]]
Control the behavior of the exclusion lists.
.br
Exclusion processing happens before disk_paths get mapped to the ISO image
and before disk files get compared with image files.
The absolute disk path of the source is matched against the -not_paths list.
The leafname of the disk path is matched against the patterns in the -not_leaf
list. If a match is detected then the disk path will not be regarded as an
existing file and not be added to the ISO image.
.br
Several codes are defined.
The _on/_off settings persist until they are revoked by their_off/_on
counterparts.
.br
"erase" empties the lists which were accumulated by -not_paths and -not_leaf.
.br
"reset" is like "erase" but also re-installs default behavior.
.br
"off" disables exclusion processing temporarily without invalidating
the lists and settings.
.br
"on" re-enables exclusion processing.
.br
"param_off" applies exclusion processing only to paths below disk_path
parameter of commands. I.e. explicitely given disk_paths are exempted
from exclusion processing.
.br
"param_on" applies exclusion processing to command parameters as well as
to files below such parameters.
.br
"subtree_off" with "param_on" excludes parameter paths only if they
match a -not_paths item exactly.
.br
"subtree_on" additionally excludes parameter paths which lead to a file
address below any -not_paths item.
.br
"ignore_off" treats excluded disk files as if they were missing. I.e. they
get reported with -compare and deleted from the image with -update.
.br
"ignore_on" keeps excluded files out of -compare or -update activities.
.TP
\fB\-not_paths\fR disk_path [***]
Add the given paths to the list of excluded absolute disk paths. If a given
path is relative, then the current -cdx is prepended to form an absolute path.
Eventual pattern matching happens at definition time and not when exclusion
checks are made.
.br
(Do not forget to end the list of disk_paths by "--")
.TP
\fB\-not_leaf\fR pattern
Add a single shell parser style pattern to the list of exclusions for
disk leafnames. These patterns are evaluated when the exclusion checks are
made.
.TP
\fB\-follow\fR occasion[:occasion[...]]
Enable or disable resolution of symbolic links and mountpoints under
disk_paths. This applies to actions -add, -du*x, -ls*x, -findx,
@ -1454,8 +1508,8 @@ Personality "\fBmkisofs\fR" accepts the options listed with:
.br
-as mkisofs -help --
.br
Among them: -R (always on), -J, -graft-points, -o, -path-list, -print-size, -V,
-v, -version, pathspecs as with xorriso -add. A lot of options are not
Among them: -R (always on), -J, -graft-points, -o, -path-list, -m, -print-size,
-V, -v, -version, pathspecs as with xorriso -add. A lot of options are not
supported and lead to failure of the mkisofs emulation. Some are ignored,
but better do not rely on this tolerance.
.br

View File

@ -1857,115 +1857,6 @@ int Lstring_destroy_all(struct LstrinG **lstring, int flag)
}
/*
@param flag Bitfield for control purposes
bit0= return first lstring which begins with text
bit1= do not rewind list before starting to search
bit2= advance to lstring->next before starting to search
*/
int Lstring_find_text(struct LstrinG *lstring, char *text,
struct LstrinG **found, int flag)
{
struct LstrinG *s;
if(lstring==NULL)
return(0);
if(!(flag&2))
for(s= lstring; s->prev!=NULL; s= s->prev);
else
s= lstring;
if(flag&4)
if(s!=NULL)
s= s->next;
if(flag&1) {
for(;s!=NULL;s= s->next)
if(strncmp(s->text,text,strlen(text))==0)
{*found= s; return(1);}
} else {
for(;s!=NULL;s= s->next)
if(strcmp(s->text,text)==0)
{*found= s; return(1);}
}
return(0);
}
/*
@param flag Bitfield for control purposes
bit0= return first lstring which begins with text
bit1= do not rewind list before starting to search
bit2= advance to lstring->next before starting to search
*/
int Lstring_is_listed(struct LstrinG *lstring, char *text, int flag)
{
struct LstrinG *s;
int ret;
ret= Lstring_find_text(lstring,text,&s,flag&7);
return(ret);
}
int Lstring_copy_all(source,target,flag)
struct LstrinG *source;
struct LstrinG **target;
int flag;
{
struct LstrinG *s,*t;
if(source==NULL)
return(0);
for(s= source; s->prev!=NULL; s= s->prev);
t= *target;
if(t!=NULL)
for(;t->next!=NULL;t=t->next);
for(;s!=NULL;s= s->next){
if(Lstring_new(&t,s->text,t,0)<=0)
return(-1);
if((*target)==NULL)
*target= t;
}
return(1);
}
int Lstring_append(struct LstrinG *entry, char *text, int flag)
{
struct LstrinG *target= NULL,*newby;
if(entry!=NULL)
for(target= entry; target->next!=NULL; target= target->next);
if(Lstring_new(&newby,text,target,0)<=0)
return(-1);
return(1);
}
int Lstring_revert(struct LstrinG **start, int flag)
{
struct LstrinG *current,*last,*tr,*next;
if((*start)==NULL)
return(0);
for(current= *start; current!=NULL; current= next) {
next= current->next;
last= current;
tr= current->next;
current->next= current->prev;
current->prev= tr;
}
last->prev= (*start)->next;
(*start)->next= NULL;
*start= last;
return(1);
}
/* Not imported from stic/src/sregex.c :
int Lstring_from_separator_list(result,list_text,link,sep,flag)
*/
int Lstring_append_binary(struct LstrinG **entry, char *data, int data_len,
int flag)
{
@ -7046,7 +6937,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int argc, char **argv, int flag)
{
int ret, i, k, was_path= 0, was_other_option= 0, mem_graft_points;
int do_print_size= 0, idx_offset= 0, fd;
int do_print_size= 0, idx_offset= 0, fd, idx;
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
char *ept, *add_pt, eff_path[SfileadrL];
@ -7074,6 +6965,9 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
" -J, -joliet Generate Joliet directory information",
" -no-pad Do not pad output",
" -o FILE, -output FILE Set output file name",
" -m GLOBFILE, -exclude GLOBFILE",
" Exclude file name",
" -exclude-list FILE File with list of file names to exclude",
" -pad Pad output by 300k (default)",
" -path-list FILE File with list of pathnames to process",
" -print-size Print estimated filesystem size and exit",
@ -7106,7 +7000,6 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
fsync(fd);
Xorriso_option_version(xorriso, 0);
/* >>> this would need a ban to write images to stdout */;
} else if(strcmp(argv[i], "-o")==0 || strcmp(argv[i], "-output")==0) {
if(i+1>=argc)
goto not_enough_args;
@ -7233,6 +7126,25 @@ not_enough_args:;
ret= Xorriso_option_publisher(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-m")==0 || strcmp(argv[i], "-exclude")==0 ||
strcmp(argv[i], "-x")==0 || strcmp(argv[i], "-old-exclude")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
if(strchr(argv[i], '/')!=NULL) {
idx= i;
ret= Xorriso_option_not_paths(xorriso, i+1, argv, &idx, 0);
} else
ret= Xorriso_option_not_leaf(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-exclude-list")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_option_not_leaf(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-quiet")==0) {
/* was already handled in first argument scan */;
@ -9111,7 +9023,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" 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.",
"",
" -update disk_path iso_rr_path",
@ -9172,6 +9084,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Add the given paths to the list of excluded absolute paths.",
" -not_leaf pattern",
" Add the given pattern to the list of leafname exclusions.",
" -not_list disk_path",
" Read lines from disk_path and use as -not_paths (with \"/\")",
" or as -not_leaf (without \"/\").",
" -not_mgt \"reset\"|\"on\"|\"off\"|\"param_on\"|\"subtree_on\"|\"ignore_on\"",
" Control effect of exclusion lists.",
" -follow \"on\"|\"pattern:param:link:mount:limit=#\"|\"default\"|\"off\"",
@ -9758,6 +9673,61 @@ cannot_add:;
}
/* Option -not_list */
int Xorriso_option_not_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret, linecount= 0, insertcount= 0, null= 0;
FILE *fp= NULL;
char *argpt, sfe[5*SfileadrL], line[SfileadrL];
Xorriso_pacifier_reset(xorriso, 0);
if(adr[0]==0) {
sprintf(xorriso->info_text,"Empty file name given with -not_list");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "WARNING", 0);
return(0);
}
fp= Afile_fopen(adr,"rb",((!!xorriso->packet_output)<<6));
if(fp==NULL)
return(0);
while(1) {
if(Sfile_fgets(line,sizeof(line),fp)==NULL) {
ret= 1;
if(ferror(fp)) {
Xorriso_msgs_submit(xorriso, 0, "Error on reading text line",
errno, "FAILURE", 0);
ret= 0;
}
goto ex;
}
linecount++;
if(line[0]==0)
continue;
if(strchr(line, '/')!=NULL) {
argpt= line;
null= 0;
ret= Xorriso_option_not_paths(xorriso, 1, &argpt, &null, 0);
} else
ret= Xorriso_option_not_leaf(xorriso, line, 0);
if(ret<=0)
goto ex;
insertcount++;
}
ret= 1;
ex:;
if(fp!=NULL)
fclose(fp);
if(ret<=0) {
sprintf(xorriso->info_text, "Aborted reading of file %s in line number %d",
Text_shellsafe(adr, sfe, 0), linecount);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
sprintf(xorriso->info_text, "Added %d exclusion list items from file %s\n",
insertcount, Text_shellsafe(adr, sfe, 0));
Xorriso_info(xorriso,0);
return(ret);
}
/* Option -not_mgt */
int Xorriso_option_not_mgt(struct XorrisO *xorriso, char *setting, int flag)
{
@ -10059,6 +10029,8 @@ problem_handler:;
}
ret= 1;
ex:;
if(fp!=NULL)
fclose(fp);
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(ret<=0) {
@ -11064,6 +11036,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_not_leaf(xorriso, arg1, 0);
} else if(strcmp(cmd,"not_list")==0) {
(*idx)++;
ret= Xorriso_option_not_list(xorriso, arg1, 0);
} else if(strcmp(cmd,"not_mgt")==0) {
(*idx)++;
ret= Xorriso_option_not_mgt(xorriso, arg1, 0);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.05.03.223204"
#define Xorriso_timestamP "2008.05.04.133525"