~ubuntu-branches/ubuntu/lucid/samba/lucid-proposed

« back to all changes in this revision

Viewing changes to source/client/clitar.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-07-21 17:53:23 UTC
  • mfrom: (0.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050721175323-m3oh6aoigywohfnq
Tags: 3.0.14a-6ubuntu1
Resynchronise with Debian, resolving merge conflicts (#12360)

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
static BOOL tar_excl=True;
88
88
/* use regular expressions for search on file names */
89
89
static BOOL tar_re_search=False;
90
 
#ifdef HAVE_REGEX_H
91
 
regex_t *preg;
92
 
#endif
93
90
/* Do not dump anything, just calculate sizes */
94
91
static BOOL dry_run=False;
95
92
/* Dump files with System attribute */
797
794
                DEBUG(5, ("...tar_re_search: %d\n", tar_re_search));
798
795
 
799
796
                if ((!tar_re_search && clipfind(cliplist, clipn, exclaim)) ||
800
 
#ifdef HAVE_REGEX_H
801
 
                                (tar_re_search && !regexec(preg, exclaim, 0, NULL, 0))) {
802
 
#else
803
797
                                (tar_re_search && mask_match_list(exclaim, cliplist, clipn, True))) {
804
 
#endif
805
798
                        DEBUG(3,("Skipping file %s\n", exclaim));
806
799
                        return;
807
800
                }
1150
1143
                /* Well, now we have a header, process the file ...            */
1151
1144
                /* Should we skip the file? We have the long name as well here */
1152
1145
                skip = clipn && ((!tar_re_search && clipfind(cliplist, clipn, finfo.name) ^ tar_excl) ||
1153
 
#ifdef HAVE_REGEX_H
1154
 
                                        (tar_re_search && !regexec(preg, finfo.name, 0, NULL, 0)));
1155
 
#else
1156
1146
                                        (tar_re_search && mask_match_list(finfo.name, cliplist, clipn, True)));
1157
 
#endif
1158
1147
 
1159
1148
                DEBUG(5, ("Skip = %i, cliplist=%s, file=%s\n", skip, (cliplist?cliplist[0]:NULL), finfo.name));
1160
1149
                if (skip) {
1748
1737
        }
1749
1738
 
1750
1739
        if (Optind+1<argc && tar_re_search) {  /* Doing regular expression seaches */
1751
 
#ifdef HAVE_REGEX_H
1752
 
                int errcode;
1753
 
 
1754
 
                if ((preg = (regex_t *)SMB_MALLOC(65536)) == NULL) {
1755
 
 
1756
 
                        DEBUG(0, ("Could not allocate buffer for regular expression search\n"));
1757
 
                        return;
1758
 
                }
1759
 
 
1760
 
                if (errcode = regcomp(preg, argv[Optind + 1], REG_EXTENDED)) {
1761
 
                        char errstr[1024];
1762
 
                        size_t errlen;
1763
 
 
1764
 
                        errlen = regerror(errcode, preg, errstr, sizeof(errstr) - 1);
1765
 
                        DEBUG(0, ("Could not compile pattern buffer for re search: %s\n%s\n", argv[Optind + 1], errstr));
1766
 
                        return;
1767
 
                }
1768
 
#endif
1769
 
 
1770
1740
                clipn=argc-Optind-1;
1771
1741
                cliplist=argv+Optind+1;
1772
1742
                newOptind += clipn;
1791
1761
                }
1792
1762
 
1793
1763
        } else {
1794
 
                if (tar_type=='c' && (dry_run || strcmp(argv[Optind], "/dev/null")==0)) {
1795
 
                        if (!dry_run) {
1796
 
                                DEBUG(0,("Output is /dev/null, assuming dry_run\n"));
1797
 
                                dry_run = True;
1798
 
                        }
 
1764
                if (tar_type=='c' && dry_run) {
1799
1765
                        tarhandle=-1;
1800
1766
                } else if ((tar_type=='x' && (tarhandle = sys_open(argv[Optind], O_RDONLY, 0)) == -1)
1801
1767
                                        || (tar_type=='c' && (tarhandle=sys_creat(argv[Optind], 0644)) < 0)) {