home *** CD-ROM | disk | FTP | other *** search
- /* 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: 25 Oct 1989 21:28:32 $
- ** $Revision: 1.2 $
- **
- */
-
- #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);
- }
-