home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
setdrv.exe
/
SETDRIVE.C
next >
Wrap
C/C++ Source or Header
|
1994-09-29
|
2KB
|
87 lines
/****************************************************************************
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
****************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nwcalls.h>
#include <nwnet.h>
void main (int argc, char *argv[])
{
NWCONN_HANDLE newConn;
NWCCODE ccode;
int i;
char userName[100], password[100];
if (argc != 4)
{
printf ("\nUsage: SETDRIVE drivenumber server directory\n");
printf ("drivenumber A=1, B=2, etc...\n");
printf ("server name of server directory exists on\n");
printf ("directory path of directory\n");
return;
}
strupr (argv[2]);
strupr (argv[3]);
ccode = NWCallsInit (NULL,NULL);
if (ccode) return;
ccode = NWAttachToFileServer (argv[2], 0, &newConn);
if ((ccode != 0) && (ccode != 0x8800))
{
printf ("\nNWAttachToFileServer returned error %04X\n",
ccode);
return;
}
if (ccode == 0x8800)
{
ccode = NWGetConnectionIDFromName (strlen (argv[2]), argv[2], &newConn);
}
else
{
printf ("\nLogging into %s\nUser Name: ", argv[2]);
gets (userName);
printf ("Password: ");
gets (password);
strupr (userName);
strupr (password);
ccode = NWLoginToFileServer (newConn, userName, OT_USER, password);
if (ccode)
{
printf ("\nNWLoginToFileServer returned error %04X\n",
ccode);
return;
}
}
ccode = NWSetDriveBase (atoi (argv[1]), newConn, 0, argv[3], 0);
if (ccode)
{
printf ("\nNWSetDriveBase returned error %04X\n",
ccode);
return;
}
}