home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. CD ROM (Annual Premium Edition)
/
premium.zip
/
premium
/
IBMOS2_2
/
MAILMIND.ZIP
/
NETDELNM.C
< prev
next >
Wrap
Text File
|
1992-03-11
|
2KB
|
82 lines
/* netdelnm.c - delete NETBIOS name
* Thomas A. Marciniak, M.D. = ytm@nihccpc1.bitnet
* Division of Cancer Prevention & Control, NCI
*/
/* Revision history:
* 1.01 ytm 01/31/91 eliminate post routine
* 1.00 ytm 01/31/91 first release
*/
/* Program notes:
* Current versions are specific for TurboC.
*/
#include <local.h> /* standard definitions */
#include "netbios.h"
/* status structure */
#define STATUS_NONAME 100
#define STATUS_UNKNOWN 0xff
#define STATUS_STRUCT struct status
typedef STATUS_STRUCT
{
word wCode;
string sText;
};
STATUS_STRUCT aStatus[] =
{
{0, "OK"},
{21, "not found"},
{STATUS_NONAME, "NO name!"},
{STATUS_UNKNOWN, "?"}
};
/* globals */
NCB Ncb;
/* function prototypes */
short main(short argc, string argv[]);
void NetDelName(string sName);
/* delete a name from NETBIOS */
void NetDelName(string sName)
{
memset(&Ncb, 0, sizeof(NCB));
Ncb.NCB_COMMAND = DELETE_NAME_WAIT;
strcpy(Ncb.NCB_NAME, sName);
Ncb.NCB_CMD_CPLT = STATUS_UNKNOWN;
_ES = FP_SEG(&Ncb);
_BX = FP_OFF(&Ncb);
_AX = 0x0100;
geninterrupt(0x5c);
} /* NetDelName */
/* main */
short main(short argc, string argv[])
{
char caName[NETBIOS_NAME_LEN];
short i;
string s, t;
word wStatus = STATUS_NONAME;
printf("Netdelnm v1.01\n");
memset(&Ncb, 0, sizeof(NCB));
memset(caName, 0, NETBIOS_NAME_LEN);
if (argc > 1)
{
strcpy(caName, argv[1]);
for (s = caName, t = s + NETBIOS_NAME_LEN - 1; s < t; s++)
*s = ((*s) ? toupper(*s) : ' ');
printf("Deleting %s\n", caName);
NetDelName(caName);
wStatus = Ncb.NCB_CMD_CPLT;
}
for (i = 0; *(aStatus[i].sText) != '?'; i++)
if (aStatus[i].wCode == wStatus) break;
printf("Netdelnm status: %s (%d)\n", aStatus[i].sText, Ncb.NCB_CMD_CPLT);
return(i);
} /* main */