1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

Needed a callback arg on cli_list ...

(This used to be commit d45e667a74fc2fcbf69c4819d480269c03dbfae4)
This commit is contained in:
Richard Sharpe 2001-01-05 13:11:29 +00:00
parent e70b103fff
commit dca808cbc4
5 changed files with 15 additions and 15 deletions

View File

@ -473,7 +473,7 @@ static int do_list_queue_empty(void)
/****************************************************************************
a helper for do_list
****************************************************************************/
static void do_list_helper(file_info *f, const char *mask)
static void do_list_helper(file_info *f, const char *mask, void *state)
{
if (f->mode & aDIR) {
if (do_list_dirs && do_this_one(f)) {
@ -537,7 +537,7 @@ void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec,
*/
pstring head;
pstrcpy(head, do_list_queue_head());
cli_list(cli, head, attribute, do_list_helper);
cli_list(cli, head, attribute, do_list_helper, NULL);
remove_do_list_queue_head();
if ((! do_list_queue_empty()) && (fn == display_finfo))
{
@ -561,7 +561,7 @@ void do_list(const char *mask,uint16 attribute,void (*fn)(file_info *),BOOL rec,
}
else
{
if (cli_list(cli, mask, attribute, do_list_helper) == -1)
if (cli_list(cli, mask, attribute, do_list_helper, NULL) == -1)
{
DEBUG(0, ("%s listing %s\n", cli_errstr(cli), mask));
}

View File

@ -148,7 +148,7 @@ static int interpret_long_filename(int level,char *p,file_info *finfo)
do a directory listing, calling fn on each file found
****************************************************************************/
int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
void (*fn)(file_info *, const char *))
void (*fn)(file_info *, const char *, void *), void *state)
{
int max_matches = 512;
/* NT uses 260, OS/2 uses 2. Both accept 1. */
@ -300,7 +300,7 @@ int cli_list(struct cli_state *cli,const char *Mask,uint16 attribute,
for (p=dirlist,i=0;i<total_received;i++) {
p += interpret_long_filename(info_level,p,&finfo);
fn(&finfo, Mask);
fn(&finfo, Mask, state);
}
/* free up the dirlist buffer */

View File

@ -78,7 +78,7 @@ static struct smbw_dir *cur_dir;
/*****************************************************
add a entry to a directory listing
*******************************************************/
static void smbw_dir_add(struct file_info *finfo, const char *mask)
static void smbw_dir_add(struct file_info *finfo, const char *mask, void * NULL)
{
DEBUG(5,("%s\n", finfo->name));
@ -238,7 +238,7 @@ int smbw_dir_open(const char *fname)
}
#endif
if (cli_list(&srv->cli, mask, aHIDDEN|aSYSTEM|aDIR,
smbw_dir_add) < 0) {
smbw_dir_add, NULL) < 0) {
errno = smbw_errno(&srv->cli);
goto failed;
}

View File

@ -157,7 +157,7 @@ struct cli_state *connect_one(char *share)
static char *resultp;
static file_info *finfo;
void listfn(file_info *f, const char *s)
void listfn(file_info *f, const char *s, void *state)
{
if (strcmp(f->name,".") == 0) {
resultp[0] = '+';
@ -172,7 +172,7 @@ void listfn(file_info *f, const char *s)
static void get_short_name(struct cli_state *cli,
char *name, fstring short_name)
{
cli_list(cli, name, aHIDDEN | aDIR, listfn);
cli_list(cli, name, aHIDDEN | aDIR, listfn, NULL);
if (finfo) {
fstrcpy(short_name, finfo->short_name);
strlower(short_name);
@ -202,12 +202,12 @@ static void testpair(struct cli_state *cli, char *mask, char *file)
fstrcpy(short_name, "");
finfo = NULL;
if (old_list) {
cli_list_old(cli, mask, aHIDDEN | aDIR, listfn);
cli_list_old(cli, mask, aHIDDEN | aDIR, listfn, NULL);
} else {
get_short_name(cli, file, short_name);
finfo = NULL;
fstrcpy(res1, "---");
cli_list(cli, mask, aHIDDEN | aDIR, listfn);
cli_list(cli, mask, aHIDDEN | aDIR, listfn, NULL);
}
res2 = reg_test(mask, file, short_name);

View File

@ -2112,7 +2112,7 @@ static void run_opentest(int dummy)
printf("finished open test 1\n");
}
static void list_fn(file_info *finfo, const char *name)
static void list_fn(file_info *finfo, const char *name, void *state)
{
}
@ -2149,9 +2149,9 @@ static void run_dirtest(int dummy)
t1 = end_timer();
printf("Matched %d\n", cli_list(&cli, "a*.*", 0, list_fn));
printf("Matched %d\n", cli_list(&cli, "b*.*", 0, list_fn));
printf("Matched %d\n", cli_list(&cli, "xyzabc", 0, list_fn));
printf("Matched %d\n", cli_list(&cli, "a*.*", 0, list_fn, NULL));
printf("Matched %d\n", cli_list(&cli, "b*.*", 0, list_fn, NULL));
printf("Matched %d\n", cli_list(&cli, "xyzabc", 0, list_fn, NULL));
printf("dirtest core %g seconds\n", end_timer() - t1);