home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
RUNNING.ZIP
/
SLAY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-02-12
|
1KB
|
71 lines
/* slay.c
**
** Copyright (c) 1989, Christopher Laforet
** All Rights Reserved
**
** Started: 25 October 1989
**
** Revision Information:
**
** $Logfile: D:/os2/running/vcs/slay.c_v $
** $Date: 12 Feb 1990 04:04:24 $
** $Revision: 1.3 $
**
*/
#define LINT_ARGS
#define INCL_DOS
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <os2.h>
#include "running.h"
int main(int argc,char *argv[])
{
USHORT usPID;
UCHAR *chPtr;
BOOL fQuit = 0;
fprintf(stderr,"SLAY (v %u.%02u of %s) : Slays an OS/2 Process by PID\n",MAJOR_VERSION,MINOR_VERSION,__DATE__);
fprintf(stderr,"Copyright (c) 1989, Christopher Laforet. Released to the Public Domain.\n\n");
if (argc > 1 && argc < 3)
{
if (strlen(argv[1]) < 5)
{
chPtr = argv[1];
while (*chPtr)
{
if (!isxdigit((int)*chPtr))
{
fQuit = 1;
break;
}
++chPtr;
}
if (!fQuit)
{
sscanf(argv[1],"%x",&usPID);
if (DosKillProcess(DKP_PROCESS,usPID))
{
fprintf(stderr,"Unable to slay PID %04x\n\n",usPID);
return(1);
}
else
{
fprintf(stderr,"Process (PID %04x) has been slain\n\n",usPID);
return(0);
}
}
}
}
fprintf(stderr,"Usage is SLAY process_pid\n");
fprintf(stderr," where process_pid is a hexadecimal number\n\n");
return(0);
}