Re: NIS+ enumeration of all database entries

Luke Kenneth Casson Leighton (lkcl@switchboard.net)
Mon, 18 May 1998 13:49:18 +0000 (GMT)

Date:	Mon, 18 May 1998 13:49:18 +0000 (GMT)
From:	Luke Kenneth Casson Leighton <lkcl@switchboard.net>
To:	Benny Holmgren <bigfoot@astrakan.hgs.se>
Subject: Re: NIS+ enumeration of all database entries
In-Reply-To: <Pine.SUN.3.95.980518150749.568A-200000@pyrus>

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

---1614665192-1449209447-895499358=:230
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.SUN.3.95.980518151358.607B@pyrus>

On Mon, 18 May 1998, Benny Holmgren wrote:

> On Mon, 18 May 1998, Luke Kenneth Casson Leighton wrote:
>
> > how, in NIS+, do you enumerate all the entries in a database table?
>
> The nis_list() function does that. It can be used in two ways, either
> passing a function pointer to a callback routine which is called for each
> entry or without a callback routine which returns all the entries in one
> result structure. The first way is better for large tables ofcourse.

hm... thanks.

ok, how do you enumerate a (large) list, efficiently, one at a time, but
not with a callback?

i would like to implement:

startnisppwent()
nextnisppwent()
endnisppwent().

but sadly i am informed that nis_first_entry() and nis_next_entry() are
slow. these would be the preferred option, however, to fit this
interface.

the alternative is to do a nis_list() of absolutely everything in
startnispwent(), have a struct which contains the result, an int of the
size and an enumeration int. on each call to nextnispwent() you return
result[enum_int++] until enum_int == max_size. in endnispwent() you call
nis_freeresult().

luke

---1614665192-1449209447-895499358=:230--