home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
renfil.exe
/
RENDOS.C
next >
Wrap
Text File
|
1995-06-05
|
4KB
|
121 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.
****************************************************************************
**
** File:RENFILE.C
**
** Desc: This program will rename a DOS file. The file can be renamed in
** the same path it was originally in or it can be renamed and moved
** to a new path on the server.
**
**
** Programmers:
** Ini Who Firm
** ------------------------------------------------------------------
** ARM A. Ray Maxwell Novell Developer Support.
**
** History:
**
** ------------------------------------------------------------------
** 03-24-95 ARM First code.
*/
/***************************************************************************
** Include headers, macros, function prototypes, etc.
*/
/*------------------------------------------------------------------
** ANSI
*/
#include <stdlib.h> /* exit(), atol() */
#include <stdio.h> /* printf() */
#include <string.h> /* strcpy() */
#include <conio.h> /* clrscr() */
#include <mem.h> /* memset() */
/*------------------------------------------------------------------
** NetWare
*/
#include <nwcalls.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nwcalls.h>
/****************************************************************************
** Program Start
*/
void main(int argc, char *argv[])
{
NWDIR_HANDLE dirHandle;
NWCONN_HANDLE connHandle;
NWCCODE ccode;
char path[256];
char newName[32];
char pathString[256] = "";
char serverName[48];
if(argc < 3)
{
clrscr();
printf("Usage: rendos <server\\path> <path\\file name>\n");
printf(" server\path : servername\\volume:dir\\dir...\\old file name\n");
printf(" file name : volume:dir\\dir...\\new file name\n");
exit(1);
}
strcpy(pathString, strupr(argv[2]));
ccode = NWCallsInit(NULL, NULL);
if (ccode)
{
printf("\nNWCallsInit returned %04X\n", ccode);
exit(1);
}
strupr(argv[1]);
ccode = NWParseNetWarePath(
/* > path being parsed */ argv[1],
/* < server conn Handle */ &connHandle,
/* < directory Handle */ &dirHandle,
/* < new path relative to dir Handle */ path);
if (ccode)
{
printf("\nNWParseNetWarePath returned %04X\n", ccode);
exit(1);
}
ccode=NWRenameFile(
/* > connection handle */ connHandle,
/* > Old Dir Handle */ 0,
/* > Old File Name */ path,
/* > serch Attributes */ 0,
/* > New Dir Handle */ 0,
/* < new file name */ pathString);
if (ccode)
{
printf("Unable to rename \"%s\ error code=%X.\n",argv[2],ccode);
exit(1);
}
}