home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
nwlog.exe
/
NWLOGIN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-11
|
1KB
|
60 lines
/* This will only login to a bindery server */
#include <stdio.h>
#include <string.h>
#include <alloc.h>
#include <conio.h>
#include <nwcalls.h>
void main (int argc, char *argv[])
{
NWCONN_HANDLE connHandle;
NWCCODE ccode;
char server[100], user[100], password[100];
int i;
if (argc != 3)
{
printf ("Usage: NWLOGIN <server name> <user name>");
return;
}
ccode = NWCallsInit (NULL,NULL);
if (ccode) return;
strcpy (server, strupr (argv[1]));
strcpy (user, strupr (argv[2]));
ccode = NWAttachToFileServer (argv[1], 0, &connHandle);
if ((ccode != 0) && (ccode != 0x8800))
{
printf ("NWAttachToFileServer returned error %04X\n", ccode);
return;
}
printf ("Password: ");
i = 0;
do
{
password[i] = getch ();
putch ('*');
i++;
} while (password[i-1] != '\r');
password[i-1] = '\x0';
printf ("\n\n");
ccode = NWLoginToFileServer (connHandle, user, OT_USER, password);
if (ccode)
{
printf ("NWLoginToFileServer returned %X\n", ccode);
return;
}
printf ("You are logged into server %s\n", argv[1]);
}