home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beijing Paradise BBS Backup
/
PARADISE.ISO
/
software
/
BBSDOORW
/
NETCLB35.ZIP
/
NETCLB35.EXE
/
EXAMPLES
/
BINLIST.C
next >
Wrap
C/C++ Source or Header
|
1996-01-03
|
3KB
|
98 lines
/***************************************************************************/
/* File: BINLIST.C */
/* */
/* Function: List all users from the bindery. */
/* */
/* Usage: binlist */
/* */
/* Functions Called: GetPreferredConnectionID */
/* GetDefaultConnectionID */
/* SetPreferredConnectionID */
/* GetPrimaryConnectionID */
/* ISShellLoaded */
/* ScanBinderyObject */
/* ReadPropertyValue */
/* */
/***************************************************************************/
#include <conio.h>
#include <dos.h>
#ifndef TURBOC
#include <search.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "netware.h"
#define FALSE 0
#define TRUE (!FALSE)
/**********************************************************************/
void main()
{
long object_id;
int object_type;
char object_name[OBJECT_LENGTH];
int prefserver;
int thisserver;
char wildname[] = "*";
int ret_code,rcode;
byte has_props,security,object_flag;
char property_value[129];
byte more_segs,prop_flag;
if (IsShellLoaded() != SUCCESS)
{
printf("*** No netware shell loaded ***\n");
exit(255);
}
if ((prefserver = GetPreferredConnectionID()) == 0)
{
if ((thisserver = GetDefaultConnectionID()) == 0)
thisserver = GetPrimaryConnectionID();
SetPreferredConnectionID( thisserver );
}
else
thisserver = prefserver;
ret_code = 0;
object_id = 0xffffffff;
while( ret_code == 0 )
{
ret_code = ScanBinderyObject( USER, wildname , &object_id ,
&object_type,object_name,
&has_props,&security,&object_flag);
if (ret_code != 0)
{
if (ret_code == 0xfc)
printf("No more user names\n");
else
printf("ScanBinderyObject failed: %d\n",ret_code);
}
else
{
if (has_props == 0)
property_value[0] = '\0';
else
{
rcode = ReadPropertyValue( USER , object_name , IDENT ,
0x01 , property_value ,
&more_segs , &prop_flag );
if (rcode != 0)
property_value[0] = '\0';
}
printf("%s - %s\n",object_name,property_value);
}
}
if (thisserver != prefserver) /* reset preferred server */
SetPreferredConnectionID( prefserver );
}