diff options
author | James Peach <jpeach@samba.org> | 2006-04-24 00:16:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:04:14 -0500 |
commit | 6ab33938d5239e8688440f65e802f627622d301b (patch) | |
tree | 7c2253d8e3252ccd973b2d2d36754d0d0e196d7a /source4/torture/masktest.c | |
parent | f380d365eaad89db2c46331a3fa2d5d8600aeba1 (diff) | |
download | samba-6ab33938d5239e8688440f65e802f627622d301b.tar.gz samba-6ab33938d5239e8688440f65e802f627622d301b.tar.xz samba-6ab33938d5239e8688440f65e802f627622d301b.zip |
r15186: Introduce ISDOT and ISDOTDOT macros for testing whether a filename is
"." for "..". These express the intention better that strcmp or strequal
and improve searchability via cscope/ctags.
(This used to be commit 7e4ad7e8e5ec266b969e3075c4ad7f021571f24e)
Diffstat (limited to 'source4/torture/masktest.c')
-rw-r--r-- | source4/torture/masktest.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index c37efc0472d..6e2678ed80f 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -20,6 +20,7 @@ #include "includes.h" #include "system/filesys.h" +#include "system/dir.h" #include "libcli/libcli.h" #include "libcli/raw/libcliraw.h" #include "system/time.h" @@ -41,9 +42,9 @@ static BOOL reg_match_one(struct smbcli_state *cli, const char *pattern, const c /* oh what a weird world this is */ if (old_list && strcmp(pattern, "*.*") == 0) return True; - if (strcmp(pattern,".") == 0) return False; + if (ISDOT(pattern)) return False; - if (strcmp(file,"..") == 0) file = "."; + if (ISDOTDOT(file)) file = "."; return ms_fnmatch(pattern, file, cli->transport->negotiate.protocol)==0; } @@ -101,9 +102,9 @@ static BOOL f_info_hit; static void listfn(struct clilist_file_info *f, const char *s, void *state) { - if (strcmp(f->name,".") == 0) { + if (ISDOT(f->name)) { resultp[0] = '+'; - } else if (strcmp(f->name,"..") == 0) { + } else if (ISDOTDOT(f->name)) { resultp[1] = '+'; } else { resultp[2] = '+'; @@ -227,9 +228,9 @@ static void test_mask(int argc, char *argv[], } file[l+l2] = 0; - if (strcmp(file+l,".") == 0 || - strcmp(file+l,"..") == 0 || - strcmp(mask+l,"..") == 0) continue; + if (ISDOT(file+l) || ISDOTDOT(file+l) || ISDOTDOT(mask+l)) { + continue; + } if (strspn(file+l, ".") == strlen(file+l)) continue; |