summaryrefslogtreecommitdiff
path: root/source4/client
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-04-24 00:16:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:14 -0500
commit6ab33938d5239e8688440f65e802f627622d301b (patch)
tree7c2253d8e3252ccd973b2d2d36754d0d0e196d7a /source4/client
parentf380d365eaad89db2c46331a3fa2d5d8600aeba1 (diff)
downloadsamba-6ab33938d5239e8688440f65e802f627622d301b.tar.gz
samba-6ab33938d5239e8688440f65e802f627622d301b.tar.bz2
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/client')
-rw-r--r--source4/client/client.c17
-rw-r--r--source4/client/tree.c7
2 files changed, 12 insertions, 12 deletions
diff --git a/source4/client/client.c b/source4/client/client.c
index b016632fbd..4e84987b40 100644
--- a/source4/client/client.c
+++ b/source4/client/client.c
@@ -286,9 +286,9 @@ BOOL mask_match(struct smbcli_state *c, const char *string, const char *pattern,
char *p2, *s2;
BOOL ret;
- if (strcmp(string,"..") == 0)
+ if (ISDOTDOT(string))
string = ".";
- if (strcmp(pattern,".") == 0)
+ if (ISDOT(pattern))
return False;
if (is_case_sensitive)
@@ -497,8 +497,8 @@ static void do_list_helper(struct clilist_file_info *f, const char *mask, void *
do_list_fn(ctx, f);
}
if (do_list_recurse &&
- !strequal(f->name,".") &&
- !strequal(f->name,"..")) {
+ !ISDOT(f->name) &&
+ !ISDOTDOT(f->name)) {
char *mask2;
char *p;
@@ -838,7 +838,7 @@ static void do_mget(struct smbclient_context *ctx, struct clilist_file_info *fin
char *mget_mask;
char *saved_curdir;
- if (strequal(finfo->name,".") || strequal(finfo->name,".."))
+ if (ISDOT(finfo->name) || ISDOTDOT(finfo->name))
return;
if (finfo->attrib & FILE_ATTRIBUTE_DIRECTORY)
@@ -1327,8 +1327,9 @@ static int file_find(struct smbclient_context *ctx, struct file_list **list, con
if (!dir) return -1;
while ((dname = readdirname(dir))) {
- if (!strcmp("..", dname)) continue;
- if (!strcmp(".", dname)) continue;
+ if (ISDOT(dname) || ISDOTDOT(dname)) {
+ continue;
+ }
if (asprintf(&path, "%s/%s", directory, dname) <= 0) {
continue;
@@ -2725,7 +2726,7 @@ static void completion_remote_filter(struct clilist_file_info *f, const char *ma
{
completion_remote_t *info = (completion_remote_t *)state;
- if ((info->count < MAX_COMPLETIONS - 1) && (strncmp(info->text, f->name, info->len) == 0) && (strcmp(f->name, ".") != 0) && (strcmp(f->name, "..") != 0)) {
+ if ((info->count < MAX_COMPLETIONS - 1) && (strncmp(info->text, f->name, info->len) == 0) && (!ISDOT(f->name)) && (!ISDOTDOT(f->name))) {
if ((info->dirmask[0] == 0) && !(f->attrib & FILE_ATTRIBUTE_DIRECTORY))
info->matches[info->count] = strdup(f->name);
else {
diff --git a/source4/client/tree.c b/source4/client/tree.c
index 9776ce2ef7..758bb1982a 100644
--- a/source4/client/tree.c
+++ b/source4/client/tree.c
@@ -239,8 +239,7 @@ static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
/* Get stats on the file/dir and see what we have */
- if ((strcmp(dirp->name, ".") != 0) &&
- (strcmp(dirp->name, "..") != 0)) {
+ if (!ISDOT(dirp->name) && !ISDOTDOT(dirp->name)) {
strncpy(path1, path, sizeof(path1));
strncat(path1, "/", sizeof(path) - strlen(path));
@@ -414,8 +413,8 @@ static void cb_itemsignal( GtkWidget *item,
if (dirp->smbc_type != SMBC_FILE &&
dirp->smbc_type != SMBC_IPC_SHARE &&
- (strcmp(dirp->name, ".") != 0) &&
- (strcmp(dirp->name, "..") !=0)){
+ (!ISDOT(dirp->name)) &&
+ (!ISDOTDOT(dirp->name))){
subtree = gtk_tree_new();
gtk_tree_item_set_subtree(GTK_TREE_ITEM(aitem), subtree);