1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +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;
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) {
return;
}
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))
info->matches[info->count] = SMB_STRDUP(f->name);
else {
@ -4197,7 +4203,8 @@ static void completion_remote_filter(const char *mnt,
return;
}
if (f->mode & aDIR) {
tmp = talloc_asprintf_append(tmp, "%s", CLI_DIRSEP_STR);
tmp = talloc_asprintf_append(tmp, "%s",
CLI_DIRSEP_STR);
}
if (!tmp) {
TALLOC_FREE(ctx);
@ -4223,7 +4230,6 @@ static void completion_remote_filter(const char *mnt,
}
info->count++;
}
}
static char **remote_completion(const char *text, int len)
{