[prev in list] [next in list] [prev in thread] [next in thread]
List: rsync
Subject: Re: --include option
From: "AVLIET.NL.ORACLE.COM" <AVLIET () nl ! oracle ! com>
Date: 1997-08-25 7:01:22
[Download RAW message or body]
Content-Transfer-Encoding:7bit
Content-Type:text/plain; charset="US-ASCII"
Shane,
Below is a shell script which will patch 1.6.2 rsync to have an include option.
Have fun!
---
Arrie van der Vliet
Netherlands Performance Group,
Oracle Europe, Rijnzathe 6, 3454 PV De Meern, The Netherlands.
Phone: +31 30 6694669 Fax: +31 30 6665041 / +31 30 6665603
Email: avliet@nl.oracle.com
============ PATCH.sh (path 1.6.2 rsync ) ====
cat << __EOF__ > exclude.c.patch
--- exclude.c
34a35,40
> #ifdef USE_INCLUDE
> #define FALSE 0
> #define TRUE (~FALSE)
> static int exclude_flag;
> static int matched_flag = FALSE;
> #endif /* USE_INCLUDE */
36c42
< static int check_one_exclude(char *name,char *pattern)
---
> static int check_one_name(char *name,char *pattern)
38a45,48
> #ifdef USE_INCLUDE
> int matched = FALSE;
> int negate = FALSE;
> #endif /* USE_INCLUDE */
43c53,58
< if (!name[0]) return 0;
---
> #ifdef USE_INCLUDE
> if (*pattern == '!'){
> negate = TRUE;
> pattern++;
> }
> #endif /* USE_INCLUDE */
45,54c60,75
< if (is_regex(pattern)) {
< if (fnmatch(pattern, name, 0) == 0)
< return 1;
< } else {
< int l1 = strlen(name);
< int l2 = strlen(pattern);
< if (l2 <= l1 &&
< strcmp(name+(l1-l2),pattern) == 0 &&
< (l1==l2 || name[l1-(l2+1)] == '/'))
< return 1;
---
> if (name[0]) {
> if (is_regex(pattern)) {
> if (fnmatch(pattern, name, 0) == 0) {
> matched = TRUE;
> goto final;
> }
> } else {
> int l1 = strlen(name);
> int l2 = strlen(pattern);
> if (l2 <= l1 &&
> strcmp(name+(l1-l2),pattern) == 0 &&
> (l1==l2 || name[l1-(l2+1)] == '/')) {
> matched = TRUE;
> goto final;
> }
> }
57c78,81
< return 0;
---
> final:
> matched_flag = matched;
> if (negate && matched) {
> matched_flag = FALSE;
58a83,87
> if (verbose > 2)
> fprintf(FERROR,"match \"%s\", pat=\"%s\" (neg=%d,stop=%d) = %d\n",
> name,pattern,negate,matched_flag);
> return matched;
> }
61c90
< int check_exclude(char *name,char **local_exclude_list)
---
> int check_name(char *name,char **local_exclude_list)
65,69c94,100
< if (exclude_list) {
< for (n=0; exclude_list[n]; n++)
< if (check_one_exclude(name,exclude_list[n]))
< return 1;
< }
---
> /* if there is an exclude list, check them */
> if (exclude_list || local_exclude_list) {
> if (exclude_list) {
> for (n=0; exclude_list[n]; n++)
> if (check_one_name(name,exclude_list[n]))
> return matched_flag;
> }
71,74c102,107
< if (local_exclude_list) {
< for (n=0; local_exclude_list[n]; n++)
< if (check_one_exclude(name,local_exclude_list[n]))
< return 1;
---
> if (local_exclude_list) {
> for (n=0; local_exclude_list[n]; n++)
> if (check_one_name(name,local_exclude_list[n]))
> return matched_flag;
> }
> return FALSE;
76,77c109,110
<
< return 0;
---
> /* no exclude list, --> include FILE */
> return TRUE;
__EOF__
cat << __EOF__ > flist.c.patch
--- flist.c
56,59c56,59
< if (check_exclude(fname,local_exclude_list)) {
< if (verbose > 2)
< fprintf(FERROR,"excluding file %s\n",fname);
< return 0;
---
> if (check_name(fname,local_exclude_list)) {
> if (verbose >= 2)
> fprintf(FERROR,"including file %s\n",fname);
> return 1;
61c61,63
< return 1;
---
> if (verbose >= 2)
> fprintf(FERROR,"excluding file %s\n",fname);
> return 0;
258a261,263
> #ifdef USE_INCLUDE
> if (!S_ISDIR(st.st_mode))
> #endif /* USE_INCLUDE */
__EOF__
cat << __EOF__ > main.c.patch
--- main.c
420a421,424
> #ifdef USE_INCLUDE
> fprintf(f," --include FILE include file FILE\n");
> fprintf(f," --include-from FILE include files listed in FILE\n");
> #else /* USE_INCLUDE */
422a427
> #endif /* USE_INCLUDE */
440a446,449
> #ifdef USE_INCLUDE
> {"include", 1, 0, OPT_EXCLUDE},
> {"include-from",1, 0, OPT_EXCLUDE_FROM},
> #else /* USE_INCLUDE */
442a452
> #endif /* USE_INCLUDE */
__EOF__
echo "patching ..."
for file in *.patch
do
patch < $file
done
echo "done"
Content-Type:message/rfc822
Date: 21 Aug 97 18:32:43
From:"Shane Y. Gibson <shaneg@sco.com>" <rsync@arvidsjaur.anu.edu.au>
To:Multiple.ofcmail,recipients.ofcmail,of.ofcmail,list.ofcmail,<rsync@arvidsjaur.anu.edu.au>
Subject:--include option
Reply-to:shaneg@sco.com
Return-Path:rsync@arvidsjaur.anu.edu.au
Errors-To:listproc-errors@arvidsjaur.anu.edu.au
Originator:rsync@samba.anu.edu.au
Sender:rsync@arvidsjaur.anu.edu.au
Precedence: bulk
X-Listprocessor-Version:6.0c -- ListProcessor by Anastasios Kotsikonas
X-Comment:Discussion of rsync package
X-Mailer:ScoMail 3.0.Bd
MIME-Version: 1.0
Content-Transfer-Encoding:7bit
Content-Type:text/plain; charset="US-ASCII"
All,
A while ago (maybe a week?) there was some discussion
about an "include files" option. I can't remember who
posted but, someone mentioned that they did get an
"include" option working. If this is so, could you
please let me know?
I'm looking at taking that and seeing if I can get a
"--include FILE" option (where FILE is a list of files
to include in the rsync push). This is something that
would be of great value to me...
v/r
Shane
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shane Gibson shaneg@sco.com (408) 429-4445
"...tiny little purple fishes run laughing through your
fingers, and you want to take them with you, to the
heartland of the winter..."
--cream--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic