1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-29 21:47:30 +03:00

s3: Slightly simplify the logic of completion_remote_filter

This commit is contained in:
Volker Lendecke 2010-02-18 22:52:41 +01:00
parent 48d6ed7cac
commit 2beaa19029

View File

@ -4176,10 +4176,16 @@ static void completion_remote_filter(const char *mnt,
{ {
struct completion_remote *info = (struct completion_remote *)state; struct completion_remote *info = (struct completion_remote *)state;
if ((info->count < MAX_COMPLETIONS - 1) && if (info->count >= MAX_COMPLETIONS - 1) {
(strncmp(info->text, f->name, info->len) == 0) && return;
(strcmp(f->name, ".") != 0) && }
(strcmp(f->name, "..") != 0)) { if (strncmp(info->text, f->name, info->len) != 0) {
return;
}
if (ISDOT(f->name) || ISDOTDOT(f->name)) {
return;
}
if ((info->dirmask[0] == 0) && !(f->mode & aDIR)) if ((info->dirmask[0] == 0) && !(f->mode & aDIR))
info->matches[info->count] = SMB_STRDUP(f->name); info->matches[info->count] = SMB_STRDUP(f->name);
else { else {
@ -4197,7 +4203,8 @@ static void completion_remote_filter(const char *mnt,
return; return;
} }
if (f->mode & aDIR) { if (f->mode & aDIR) {
tmp = talloc_asprintf_append(tmp, "%s", CLI_DIRSEP_STR); tmp = talloc_asprintf_append(tmp, "%s",
CLI_DIRSEP_STR);
} }
if (!tmp) { if (!tmp) {
TALLOC_FREE(ctx); TALLOC_FREE(ctx);
@ -4222,7 +4229,6 @@ static void completion_remote_filter(const char *mnt,
} }
} }
info->count++; info->count++;
}
} }
static char **remote_completion(const char *text, int len) static char **remote_completion(const char *text, int len)