Date: Mon, 18 May 1998 15:16:58 +0200 (MET DST) From: Benny Holmgren <bigfoot@astrakan.hgs.se> To: Luke Kenneth Casson Leighton <lkcl@switchboard.net> Subject: Re: NIS+ enumeration of all database entries In-Reply-To: <Pine.LNX.3.96.980517174537.230U-100000@regent.cb1.com>
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.
--587222420-2117032264-895497204=:568
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.SUN.3.95.980518151358.607B@pyrus>
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.
I'll attach an example.
The synopsis for the routine is:
#include <rpcsvc/nis.h>
nis_result *nis_list(const nis_name name,
const u_long flags,
int (*callback)(const nis_name table_name,
const nis_object *object, const void *userdata),
const void *userdata)
--587222420-2117032264-895497204=:568
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="nis.c"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.SUN.3.95.980518151658.607C@pyrus>
Content-Description:
LyoNCiAqIExpbmsgd2l0aCAtbG5zbCANCiAqLw0KI2luY2x1ZGUgPHN0ZGlv
Lmg+DQojaW5jbHVkZSA8cnBjc3ZjL25pcy5oPg0KDQppbnQgbmlzX2NhbGxi
YWNrKGNoYXIgKnRhYmxlX25hbWUsIG5pc19vYmplY3QgKm9iamVjdCwgdm9p
ZCAqdXNlcmRhdGEpDQp7DQogICAgcHJpbnRmKCIlczolczolczolczolczol
czolc1xuIiwgDQoJICAgRU5UUllfVkFMKG9iamVjdCwgMCksDQoJICAgRU5U
UllfVkFMKG9iamVjdCwgMSksDQoJICAgRU5UUllfVkFMKG9iamVjdCwgMiks
DQoJICAgRU5UUllfVkFMKG9iamVjdCwgMyksDQoJICAgRU5UUllfVkFMKG9i
amVjdCwgNCksDQoJICAgRU5UUllfVkFMKG9iamVjdCwgNSksDQoJICAgRU5U
UllfVkFMKG9iamVjdCwgNikpOw0KICAgIHJldHVybigwKTsJLyogUmV0dXJu
aW5nIDEgc3RvcHMgZW51bWVyYXRpb24uICovDQp9DQoNCmludCBtYWluKGlu
dCBhcmdjLCBjaGFyICoqYXJndikNCnsNCiAgICBjaGFyICpuaXNuYW1lID0g
InBhc3N3ZC5vcmdfZGlyIjsNCg0KICAgICh2b2lkKW5pc19saXN0KG5pc25h
bWUsIEVYUEFORF9OQU1FLCBuaXNfY2FsbGJhY2ssIE5VTEwpOw0KICAgIHJl
dHVybigwKTsNCn0NCg==
--587222420-2117032264-895497204=:568--