Implemented -find actions chown_r, chgrp_r, chmod_r, alter_date_r, find
This commit is contained in:
parent
1b86589999
commit
64adef0837
@ -2,7 +2,7 @@
|
|||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH XORRISO 1 "December 31, 2007"
|
.TH XORRISO 1 "January 1, 2008"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
@ -590,6 +590,44 @@ where "A0" is year 2000, "B0" is 2010, etc.
|
|||||||
\fB\-alter_date_r\fR type timestring iso_rr_path [***]
|
\fB\-alter_date_r\fR type timestring iso_rr_path [***]
|
||||||
Like -alter_date but affecting all files below eventual directories.
|
Like -alter_date but affecting all files below eventual directories.
|
||||||
.TP
|
.TP
|
||||||
|
\fB\-find\fR iso_rr_path [-name pattern] [-exec action [params]] --
|
||||||
|
A very restricted substitute for shell command find in the ISO image.
|
||||||
|
It performs an action on matching file objects at or below iso_rr_path.
|
||||||
|
.br
|
||||||
|
Optional -name pattern is not expanded but used for comparison with
|
||||||
|
the particular file names of the eventual directory tree underneath
|
||||||
|
iso_rr_path. If no -name pattern is given, then any file name matches.
|
||||||
|
.br
|
||||||
|
If a file matches then the action is performed. Default action is "echo",
|
||||||
|
i.e. to print the address of the found file. Other actions are certain
|
||||||
|
xorriso commands which get performed on the found files. These commands
|
||||||
|
may have specific parameters. See also their particular descriptions.
|
||||||
|
.br
|
||||||
|
"chown" and "chown_r" change the ownership and get the user id as param.
|
||||||
|
E.g.: -find -exec chown thomas
|
||||||
|
.br
|
||||||
|
"chgrp" and "chgrp_r" change the group attribute and get the group id as param.
|
||||||
|
E.g.: -find -exec chgrp_r staff
|
||||||
|
.br
|
||||||
|
"chmod" and "chmod_r" change access permissions and get a mode string as param.
|
||||||
|
E.g.: -find -exec chmod a-w,a+r
|
||||||
|
.br
|
||||||
|
"alter_date" changes the timestamps.
|
||||||
|
It gets a type character and a timestring as params.
|
||||||
|
.br
|
||||||
|
E.g.: -find -exec alter_date_r "m" "Dec 30 19:34:12 2007"
|
||||||
|
.br
|
||||||
|
"lsdl" prints file information like shell command ls -dl. It gets no params.
|
||||||
|
E.g.: -find -exec lsdl
|
||||||
|
.br
|
||||||
|
"find" performs another run of -find on the matching file address. It accepts
|
||||||
|
the same params as -find, except iso_rr_path.
|
||||||
|
.br
|
||||||
|
E.g.: -find -name '???' -exec find -name '[abc]*' -exec chmod a-w,a+r
|
||||||
|
.br
|
||||||
|
If not used as last command in the line then the argument list
|
||||||
|
needs to get terminated by "--".
|
||||||
|
.TP
|
||||||
\fB\-mkdir\fR iso_rr_path [...]
|
\fB\-mkdir\fR iso_rr_path [...]
|
||||||
Create empty directories if they do not exist yet.
|
Create empty directories if they do not exist yet.
|
||||||
Existence as directory generates a WARNING event, existence as
|
Existence as directory generates a WARNING event, existence as
|
||||||
@ -987,35 +1025,6 @@ List size of directories and files in the local filesystem
|
|||||||
which match one of the patterns.
|
which match one of the patterns.
|
||||||
Similar to shell command du -sk.
|
Similar to shell command du -sk.
|
||||||
.TP
|
.TP
|
||||||
\fB\-find\fR iso_rr_path [-name pattern] [-exec action [params]] --
|
|
||||||
A very restricted substitute for shell command find in the ISO image.
|
|
||||||
It performs an action on matching file objects at or below iso_rr_path.
|
|
||||||
.br
|
|
||||||
Optional -name pattern is not expanded but used for comparison with
|
|
||||||
the particular file names of the eventual directory tree underneath
|
|
||||||
iso_rr_path. If no -name pattern is given, then any file name matches.
|
|
||||||
.br
|
|
||||||
If a file matches then the action is performed. Default action is "echo",
|
|
||||||
i.e. to print the address of the found file. Other actions are certain
|
|
||||||
xorriso commands which get performed on the found files. These commands
|
|
||||||
may have specific parameters. See also their particular descriptions.
|
|
||||||
.br
|
|
||||||
"chown" changes the ownership and gets the user id as param.
|
|
||||||
.br
|
|
||||||
"chgrp" changes the group attribute and gets the group id as param.
|
|
||||||
.br
|
|
||||||
"chmod" changes access permissions and gets a mode string as param.
|
|
||||||
Like: a-w,a+r
|
|
||||||
.br
|
|
||||||
"alter_date" changes the timestamps.
|
|
||||||
It gets a type character and a timestring as params.
|
|
||||||
Like: "m" "Dec 30 19:34:12 2007"
|
|
||||||
.br
|
|
||||||
"lsdl" prints file information like shell command ls -dl. It gets no params.
|
|
||||||
.br
|
|
||||||
If not used as last command in the line then the argument list
|
|
||||||
needs to get terminated by "--".
|
|
||||||
.TP
|
|
||||||
\fB\-findx\fR disk_path [-name pattern] --
|
\fB\-findx\fR disk_path [-name pattern] --
|
||||||
Like -find but operating on local filesystem and not on the ISO image.
|
Like -find but operating on local filesystem and not on the ISO image.
|
||||||
This action is subject to the settings of -follow.
|
This action is subject to the settings of -follow.
|
||||||
|
214
test/xorriso.c
214
test/xorriso.c
@ -25,17 +25,50 @@ or
|
|||||||
/* Command line oriented batch and dialog tool which creates, loads,
|
/* Command line oriented batch and dialog tool which creates, loads,
|
||||||
manipulates and burns ISO 9660 filesystem images.
|
manipulates and burns ISO 9660 filesystem images.
|
||||||
|
|
||||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||||
|
|
||||||
Initial code of this program was derived from program src/askme.c out
|
Initial code of this program was derived from program src/askme.c out
|
||||||
of scdbackup-0.8.8, Copyright 2007 Thomas Schmitt, BSD-License.
|
of scdbackup-0.8.8, Copyright 2007 Thomas Schmitt, BSD-License.
|
||||||
|
|
||||||
Provided under GPL version 2, with the announcement that this might
|
Provided under GPL version 2, with the announcement that this might
|
||||||
get changed in future. I would prefer BSD or a modifyied LGPL with no
|
get changed in future. I would prefer BSD or a modified LGPL with no
|
||||||
option to choose any kind of future GPL version.
|
option to choose any kind of future GPL version.
|
||||||
(This announcement affects only future releases of xorriso.
|
(This announcement affects only future releases of xorriso.
|
||||||
If you obtain a copy licensed as "GPL version 2" then this license is
|
If you obtain a copy licensed as "GPL version 2" then this license is
|
||||||
not revocable for that particular copy, of course.)
|
not revocable for that particular copy, of course.)
|
||||||
|
|
||||||
|
|
||||||
|
Overview of xorriso architecture:
|
||||||
|
|
||||||
|
libburn provides the ability to read and write data.
|
||||||
|
|
||||||
|
libisofs interprets and manipulates ISO 9660 directory trees. It generates
|
||||||
|
the output stream which is handed over to libburn.
|
||||||
|
|
||||||
|
libisoburn encapsulates the connectivity issues between libburn and
|
||||||
|
libisofs. It also enables multi-session emulation on overwritable media
|
||||||
|
and random access file objects.
|
||||||
|
xorriso is intended as reference application of libisoburn.
|
||||||
|
|
||||||
|
xorrisoburn.[ch] encapsulate any usage of the libraries by xorriso.
|
||||||
|
|
||||||
|
xorriso.h exposes the public functions of xorriso which are intended
|
||||||
|
to be used by programs which link with xorriso.o. These functions are
|
||||||
|
direct equivalents of the xorriso interpreter commands.
|
||||||
|
There is also the API for handling event messages.
|
||||||
|
|
||||||
|
xorriso_private.h is not to be included by other software. It encapsulates
|
||||||
|
the inner interfaces of xorriso.
|
||||||
|
|
||||||
|
xorriso.c provides the command interpreter as described in xorriso.1.
|
||||||
|
It performs any activity that does not demand a reference to a symbol
|
||||||
|
of the library APIs. This includes:
|
||||||
|
- Interpretation of user input from arguments, dialog, and scripting.
|
||||||
|
- Output of result text and event messages.
|
||||||
|
- POSIX filesystem operations.
|
||||||
|
- Public functions which perform the particular xorriso commands.
|
||||||
|
- The main() function, if enabled by #define Xorriso_with_maiN.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PROG_VERSION "0.0.0"
|
#define PROG_VERSION "0.0.0"
|
||||||
@ -2459,14 +2492,19 @@ struct FindjoB {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 0= echo
|
/* 0= echo
|
||||||
1= rm
|
>>> 1= rm
|
||||||
2= rm_r
|
>>> 2= rm_r
|
||||||
3= mv target
|
>>> 3= mv target
|
||||||
4= chown user
|
4= chown user
|
||||||
5= chgrp group
|
5= chgrp group
|
||||||
6= chmod mode
|
6= chmod mode_and mode_or
|
||||||
7= alter_date type date
|
7= alter_date type date
|
||||||
8= lsdl
|
8= lsdl
|
||||||
|
9= chown_r user
|
||||||
|
10= chgrp_r group
|
||||||
|
11= chmod_r mode_and mode_or
|
||||||
|
12= alter_date_r type date
|
||||||
|
13= find
|
||||||
*/
|
*/
|
||||||
int action;
|
int action;
|
||||||
char *target;
|
char *target;
|
||||||
@ -2475,6 +2513,7 @@ struct FindjoB {
|
|||||||
mode_t mode_and, mode_or;
|
mode_t mode_and, mode_or;
|
||||||
int type; /* see Xorriso_set_time flag */
|
int type; /* see Xorriso_set_time flag */
|
||||||
time_t date;
|
time_t date;
|
||||||
|
struct FindjoB *subjob;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2496,6 +2535,7 @@ int Findjob_new(struct FindjoB **o, char *start_path, int flag)
|
|||||||
m->group= 0;
|
m->group= 0;
|
||||||
m->type= 0;
|
m->type= 0;
|
||||||
m->date= 0;
|
m->date= 0;
|
||||||
|
m->subjob= NULL;
|
||||||
m->start_path= strdup(start_path);
|
m->start_path= strdup(start_path);
|
||||||
if(m->start_path==NULL)
|
if(m->start_path==NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
@ -2521,12 +2561,27 @@ int Findjob_destroy(struct FindjoB **o, int flag)
|
|||||||
#endif
|
#endif
|
||||||
free(m->name_expr);
|
free(m->name_expr);
|
||||||
}
|
}
|
||||||
|
Findjob_destroy(&(m->subjob), 0);
|
||||||
free((char *) m);
|
free((char *) m);
|
||||||
*o= NULL;
|
*o= NULL;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag)
|
||||||
|
{
|
||||||
|
if(o->start_path!=NULL)
|
||||||
|
free(o->start_path);
|
||||||
|
if(start_path!=NULL) {
|
||||||
|
o->start_path= strdup(start_path);
|
||||||
|
if(o->start_path==NULL)
|
||||||
|
return(-1);
|
||||||
|
} else
|
||||||
|
o->start_path= NULL;
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
|
int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
|
||||||
{
|
{
|
||||||
char regexpr[2*SfileadrL+2];
|
char regexpr[2*SfileadrL+2];
|
||||||
@ -2585,7 +2640,8 @@ int Findjob_get_action(struct FindjoB *o, int flag)
|
|||||||
int Findjob_get_action_parms(struct FindjoB *o, char **target,
|
int Findjob_get_action_parms(struct FindjoB *o, char **target,
|
||||||
uid_t *user, gid_t *group,
|
uid_t *user, gid_t *group,
|
||||||
mode_t *mode_and, mode_t *mode_or,
|
mode_t *mode_and, mode_t *mode_or,
|
||||||
int *type, time_t *date, int flag)
|
int *type, time_t *date, struct FindjoB **subjob,
|
||||||
|
int flag)
|
||||||
{
|
{
|
||||||
*target= o->target;
|
*target= o->target;
|
||||||
*user= o->user;
|
*user= o->user;
|
||||||
@ -2594,6 +2650,7 @@ int Findjob_get_action_parms(struct FindjoB *o, char **target,
|
|||||||
*mode_or= o->mode_or;
|
*mode_or= o->mode_or;
|
||||||
*type= o->type;
|
*type= o->type;
|
||||||
*date= o->date;
|
*date= o->date;
|
||||||
|
*subjob= o->subjob;
|
||||||
return(o->action);
|
return(o->action);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2607,37 +2664,103 @@ int Findjob_set_action_target(struct FindjoB *o, int action, char *target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag)
|
int Findjob_set_action_chown(struct FindjoB *o, uid_t user,int flag)
|
||||||
{
|
{
|
||||||
o->action= 4;
|
int ret;
|
||||||
o->user= user;
|
|
||||||
|
if(flag&1) {
|
||||||
|
o->action= 0;
|
||||||
|
Findjob_destroy(&(o->subjob), 0);
|
||||||
|
ret= Findjob_new(&(o->subjob), "", 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(-1);
|
||||||
|
Findjob_set_action_chown(o->subjob, user, 0);
|
||||||
|
o->action= 9;
|
||||||
|
} else {
|
||||||
|
o->action= 4;
|
||||||
|
o->user= user;
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag)
|
int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag)
|
||||||
{
|
{
|
||||||
o->action= 5;
|
int ret;
|
||||||
o->group= group;
|
|
||||||
|
if(flag&1) {
|
||||||
|
o->action= 0;
|
||||||
|
Findjob_destroy(&(o->subjob), 0);
|
||||||
|
ret= Findjob_new(&(o->subjob), "", 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(-1);
|
||||||
|
Findjob_set_action_chgrp(o->subjob, group, 0);
|
||||||
|
o->action= 10;
|
||||||
|
} else {
|
||||||
|
o->action= 5;
|
||||||
|
o->group= group;
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
int Findjob_set_action_chmod(struct FindjoB *o,
|
int Findjob_set_action_chmod(struct FindjoB *o,
|
||||||
mode_t mode_and, mode_t mode_or, int flag)
|
mode_t mode_and, mode_t mode_or, int flag)
|
||||||
{
|
{
|
||||||
o->action= 6;
|
int ret;
|
||||||
o->mode_and= mode_and;
|
|
||||||
o->mode_or= mode_or;
|
if(flag&1) {
|
||||||
|
o->action= 0;
|
||||||
|
Findjob_destroy(&(o->subjob), 0);
|
||||||
|
ret= Findjob_new(&(o->subjob), "", 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(-1);
|
||||||
|
Findjob_set_action_chmod(o->subjob, mode_and, mode_or, 0);
|
||||||
|
o->action= 11;
|
||||||
|
} else {
|
||||||
|
o->action= 6;
|
||||||
|
o->mode_and= mode_and;
|
||||||
|
o->mode_or= mode_or;
|
||||||
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag)
|
int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag)
|
||||||
{
|
{
|
||||||
o->action= 7;
|
int ret;
|
||||||
o->type= type;
|
|
||||||
o->date= date;
|
if(flag&1) {
|
||||||
|
o->action= 0;
|
||||||
|
Findjob_destroy(&(o->subjob), 0);
|
||||||
|
ret= Findjob_new(&(o->subjob), "", 0);
|
||||||
|
if(ret<=0)
|
||||||
|
return(-1);
|
||||||
|
Findjob_set_action_ad(o->subjob, type, date, 0);
|
||||||
|
o->action= 12;
|
||||||
|
} else {
|
||||||
|
o->action= 7;
|
||||||
|
o->type= type;
|
||||||
|
o->date= date;
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Findjob_set_action_subjob(struct FindjoB *o, int action,
|
||||||
|
struct FindjoB *subjob, int flag)
|
||||||
|
{
|
||||||
|
o->action= action;
|
||||||
|
Findjob_destroy(&(o->subjob), 0);
|
||||||
|
o->subjob= subjob;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6624,7 +6747,7 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
|||||||
int *idx, int flag)
|
int *idx, int flag)
|
||||||
{
|
{
|
||||||
int ret, i, end_idx, type= 0;
|
int ret, i, end_idx, type= 0;
|
||||||
struct FindjoB *job= NULL;
|
struct FindjoB *job, *first_job= NULL, *new_job;
|
||||||
char *start_path, sfe[5*SfileadrL], *cpt;
|
char *start_path, sfe[5*SfileadrL], *cpt;
|
||||||
struct stat dir_stbuf;
|
struct stat dir_stbuf;
|
||||||
uid_t user= 0;
|
uid_t user= 0;
|
||||||
@ -6636,11 +6759,12 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
|||||||
start_path= ".";
|
start_path= ".";
|
||||||
if(end_idx > *idx && start_path[0]!=0)
|
if(end_idx > *idx && start_path[0]!=0)
|
||||||
start_path= argv[*idx];
|
start_path= argv[*idx];
|
||||||
ret= Findjob_new(&job, start_path, 0);
|
ret= Findjob_new(&first_job, start_path, 0);
|
||||||
if(ret<=0) {
|
if(ret<=0) {
|
||||||
Xorriso_no_findjob(xorriso, "-find[ix]", 0);
|
Xorriso_no_findjob(xorriso, "-find[ix]", 0);
|
||||||
{ret= -1; goto ex;}
|
{ret= -1; goto ex;}
|
||||||
}
|
}
|
||||||
|
job= first_job;
|
||||||
|
|
||||||
for(i= *idx+1; i<end_idx; i++) {
|
for(i= *idx+1; i<end_idx; i++) {
|
||||||
if(strcmp(argv[i], "-name")==0) {
|
if(strcmp(argv[i], "-name")==0) {
|
||||||
@ -6681,32 +6805,44 @@ not_enough_arguments:;
|
|||||||
Findjob_set_action_target(job, 3, argv[i], 0);
|
Findjob_set_action_target(job, 3, argv[i], 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if(strcmp(cpt, "chown")==0) {
|
} else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
|
ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
Findjob_set_action_chown(job, user, 0);
|
ret= Findjob_set_action_chown(job, user, strlen(cpt)>5);
|
||||||
} else if(strcmp(cpt, "chgrp")==0) {
|
if(ret<=0) {
|
||||||
|
Xorriso_no_findjob(xorriso, "-find -exec chown_r", 0);
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
|
} else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
|
ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
Findjob_set_action_chgrp(job, group, 0);
|
ret= Findjob_set_action_chgrp(job, group, strlen(cpt)>5);
|
||||||
} else if(strcmp(cpt, "chmod")==0) {
|
if(ret<=0) {
|
||||||
|
Xorriso_no_findjob(xorriso, "-find -exec chgrp_r", 0);
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
|
} else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
|
ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
|
||||||
argv[i], &mode_and, &mode_or,0);
|
argv[i], &mode_and, &mode_or, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
Findjob_set_action_chmod(job, mode_and, mode_or, 0);
|
ret= Findjob_set_action_chmod(job, mode_and, mode_or, strlen(cpt)>5);
|
||||||
} else if(strcmp(cpt, "alter_date")==0) {
|
if(ret<=0) {
|
||||||
|
Xorriso_no_findjob(xorriso, "-find -exec chmod_r", 0);
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
|
} else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){
|
||||||
if(i+2>=end_idx)
|
if(i+2>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
i+= 2;
|
i+= 2;
|
||||||
@ -6714,9 +6850,22 @@ not_enough_arguments:;
|
|||||||
argv[i-1], argv[i], &type, &date, 0);
|
argv[i-1], argv[i], &type, &date, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
Findjob_set_action_ad(job, type, date, 0);
|
ret= Findjob_set_action_ad(job, type, date, strlen(cpt)>10);
|
||||||
|
if(ret<=0) {
|
||||||
|
Xorriso_no_findjob(xorriso, "-find -exec alter_date_r", 0);
|
||||||
|
goto ex;
|
||||||
|
}
|
||||||
} else if(strcmp(cpt, "lsdl")==0) {
|
} else if(strcmp(cpt, "lsdl")==0) {
|
||||||
Findjob_set_action_target(job, 8, NULL, 0);
|
Findjob_set_action_target(job, 8, NULL, 0);
|
||||||
|
|
||||||
|
} else if(strcmp(cpt, "find")==0) {
|
||||||
|
ret= Findjob_new(&new_job, "", 0);
|
||||||
|
if(ret<=0) {
|
||||||
|
Xorriso_no_findjob(xorriso, "-find[ix]", 0);
|
||||||
|
{ret= -1; goto ex;}
|
||||||
|
}
|
||||||
|
Findjob_set_action_subjob(job, 13, new_job, 0);
|
||||||
|
job= new_job;
|
||||||
} else {
|
} else {
|
||||||
sprintf(xorriso->info_text, "-find -exec: unknown action %s",
|
sprintf(xorriso->info_text, "-find -exec: unknown action %s",
|
||||||
Text_shellsafe(argv[i], sfe, 0));
|
Text_shellsafe(argv[i], sfe, 0));
|
||||||
@ -6731,11 +6880,12 @@ sorry_ex:;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(flag&1)
|
if(flag&1)
|
||||||
ret= Xorriso_findx(xorriso, job, "", start_path, &dir_stbuf, 0, NULL, 0);
|
ret= Xorriso_findx(xorriso, first_job, "", start_path, &dir_stbuf, 0, NULL,
|
||||||
|
0);
|
||||||
else
|
else
|
||||||
ret= Xorriso_findi(xorriso, job, NULL, start_path, &dir_stbuf, 0, 0);
|
ret= Xorriso_findi(xorriso, first_job, NULL, start_path, &dir_stbuf, 0, 0);
|
||||||
ex:;
|
ex:;
|
||||||
Findjob_destroy(&job, 0);
|
Findjob_destroy(&first_job, 0);
|
||||||
(*idx)= end_idx;
|
(*idx)= end_idx;
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@ -7973,7 +8123,7 @@ int Xorriso_option_version(struct XorrisO *xorriso, int flag)
|
|||||||
sprintf(xorriso->result_line,
|
sprintf(xorriso->result_line,
|
||||||
"xorriso %s : RockRidge filesystem manipulator\n", PROG_VERSION);
|
"xorriso %s : RockRidge filesystem manipulator\n", PROG_VERSION);
|
||||||
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
||||||
"Copyright (C) 2007, Thomas Schmitt <scdbackup@gmx.net>, libburnia project\n");
|
"Copyright (C) 2008, Thomas Schmitt <scdbackup@gmx.net>, libburnia project\n");
|
||||||
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
||||||
"Version timestamp : %s\n",Xorriso_timestamP);
|
"Version timestamp : %s\n",Xorriso_timestamP);
|
||||||
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
sprintf(xorriso->result_line+strlen(xorriso->result_line),
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* Command line oriented batch and dialog tool which creates, loads,
|
/* Command line oriented batch and dialog tool which creates, loads,
|
||||||
manipulates and burns ISO 9660 filesystem images.
|
manipulates and burns ISO 9660 filesystem images.
|
||||||
|
|
||||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||||
|
|
||||||
Provided under GPL version 2.
|
Provided under GPL version 2.
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* Command line oriented batch and dialog tool which creates, loads,
|
/* Command line oriented batch and dialog tool which creates, loads,
|
||||||
manipulates and burns ISO 9660 filesystem images.
|
manipulates and burns ISO 9660 filesystem images.
|
||||||
|
|
||||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||||
|
|
||||||
Provided under GPL version 2.
|
Provided under GPL version 2.
|
||||||
|
|
||||||
@ -310,8 +310,28 @@ int Findjob_get_action(struct FindjoB *o, int flag);
|
|||||||
int Findjob_get_action_parms(struct FindjoB *o, char **target,
|
int Findjob_get_action_parms(struct FindjoB *o, char **target,
|
||||||
uid_t *user, gid_t *group,
|
uid_t *user, gid_t *group,
|
||||||
mode_t *mode_and, mode_t *mode_or,
|
mode_t *mode_and, mode_t *mode_or,
|
||||||
int *type, time_t *date, int flag);
|
int *type, time_t *date, struct FindjoB **subjob,
|
||||||
|
int flag);
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
|
int Findjob_set_action_target(struct FindjoB *o, int action, char *target,
|
||||||
|
int flag);
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
|
int Findjob_set_action_chgrp(struct FindjoB *o, gid_t group, int flag);
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
|
int Findjob_set_action_chmod(struct FindjoB *o,
|
||||||
|
mode_t mode_and, mode_t mode_or, int flag);
|
||||||
|
|
||||||
|
/* @param flag bit0= recursive
|
||||||
|
*/
|
||||||
|
int Findjob_set_action_ad(struct FindjoB *o, int type, time_t date, int flag);
|
||||||
|
|
||||||
|
int Findjob_set_start_path(struct FindjoB *o, char *start_path, int flag);
|
||||||
|
|
||||||
|
|
||||||
#endif /* Xorriso_private_includeD */
|
#endif /* Xorriso_private_includeD */
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2007.12.31.135330"
|
#define Xorriso_timestamP "2008.01.01.123118"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
a command line oriented batch and dialog tool which creates, loads,
|
a command line oriented batch and dialog tool which creates, loads,
|
||||||
manipulates and burns ISO 9660 filesystem images.
|
manipulates and burns ISO 9660 filesystem images.
|
||||||
|
|
||||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||||
|
|
||||||
Provided under GPL version 2.
|
Provided under GPL version 2.
|
||||||
*/
|
*/
|
||||||
@ -2820,7 +2820,7 @@ int Xorriso_set_time(struct XorrisO *xorriso, char *in_path, time_t t,
|
|||||||
|
|
||||||
int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||||
char *abs_path, char *show_path,
|
char *abs_path, char *show_path,
|
||||||
struct iso_tree_node *node, int flag)
|
struct iso_tree_node *node, int depth, int flag)
|
||||||
{
|
{
|
||||||
int ret, type, action= 0;
|
int ret, type, action= 0;
|
||||||
uid_t user= 0;
|
uid_t user= 0;
|
||||||
@ -2828,9 +2828,11 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
time_t date= 0;
|
time_t date= 0;
|
||||||
mode_t mode_or= 0, mode_and= ~1;
|
mode_t mode_or= 0, mode_and= ~1;
|
||||||
char *target, sfe[5*SfileadrL];
|
char *target, sfe[5*SfileadrL];
|
||||||
|
struct FindjoB *subjob;
|
||||||
|
struct stat dir_stbuf;
|
||||||
|
|
||||||
action= Findjob_get_action_parms(job, &target, &user, &group,
|
action= Findjob_get_action_parms(job, &target, &user, &group,
|
||||||
&mode_and, &mode_or, &type, &date, 0);
|
&mode_and, &mode_or, &type, &date, &subjob, 0);
|
||||||
if(action<0)
|
if(action<0)
|
||||||
action= 0;
|
action= 0;
|
||||||
|
|
||||||
@ -2854,6 +2856,9 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
ret= Xorriso_set_time(xorriso, abs_path, date, type&7);
|
ret= Xorriso_set_time(xorriso, abs_path, date, type&7);
|
||||||
} else if(action==8) { /* lsdl */
|
} else if(action==8) { /* lsdl */
|
||||||
ret= Xorriso_ls_filev(xorriso, "", 1, &abs_path, (off_t) 0, 1|2|8);
|
ret= Xorriso_ls_filev(xorriso, "", 1, &abs_path, (off_t) 0, 1|2|8);
|
||||||
|
} else if(action>=9 && action<=13) { /* actions which have own findjobs */
|
||||||
|
Findjob_set_start_path(subjob, abs_path, 0);
|
||||||
|
ret= Xorriso_findi(xorriso, subjob, NULL, abs_path, &dir_stbuf, depth, 0);
|
||||||
} else {
|
} else {
|
||||||
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
|
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
|
||||||
Xorriso_result(xorriso, 0);
|
Xorriso_result(xorriso, 0);
|
||||||
@ -2924,7 +2929,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
Xorriso_result(xorriso, 0);
|
Xorriso_result(xorriso, 0);
|
||||||
#else
|
#else
|
||||||
ret= Xorriso_findi_action(xorriso, job, path, dir_path,
|
ret= Xorriso_findi_action(xorriso, job, path, dir_path,
|
||||||
(struct iso_tree_node *) dir_node, 0);
|
(struct iso_tree_node *) dir_node, depth, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
#endif /* ! NIX */
|
#endif /* ! NIX */
|
||||||
@ -2964,7 +2969,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|4);
|
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|4);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
goto ex;
|
goto ex;
|
||||||
ret= Xorriso_findi_action(xorriso, job, abs_path, path, node, 0);
|
ret= Xorriso_findi_action(xorriso, job, abs_path, path, node, depth, 0);
|
||||||
if(ret<=0) {
|
if(ret<=0) {
|
||||||
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
|
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
a command line oriented batch and dialog tool which creates, loads,
|
a command line oriented batch and dialog tool which creates, loads,
|
||||||
manipulates and burns ISO 9660 filesystem images.
|
manipulates and burns ISO 9660 filesystem images.
|
||||||
|
|
||||||
Copyright 2007 Thomas Schmitt, <scdbackup@gmx.net>
|
Copyright 2007-2008 Thomas Schmitt, <scdbackup@gmx.net>
|
||||||
|
|
||||||
Provided under GPL version 2.
|
Provided under GPL version 2.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user