00001
00002
00003
00004 #include <stdlib.h>
00005 #include <ctype.h>
00006
00007 extern "C" {
00008 #define KILLONLY
00009 #include "kill.c"
00010 }
00011
00012 int main(int argc, char* argv[])
00013 {
00014 unsigned short pid;
00015 unsigned int sig;
00016 if (argc!=3)
00017 {
00018 fprintf(stderr,"Syntax: kill -[<signum>|<signame>] <pid>\n");
00019 return(1);
00020 }
00021 if (isalpha(argv[1][2]))
00022 {
00023 if (strcmp(argv[1],"-SIGINT")==0 || strcmp(argv[1],"-INT")==0)
00024 sig = SIGINT;
00025 else if (strcmp(argv[1],"-SIGTERM")==0 || strcmp(argv[1],"-TERM")==0)
00026 sig = SIGTERM;
00027 else
00028 {
00029 fprintf(stderr,"kill: signal %s is not recognized\n", argv[1]);
00030 exit(1);
00031 }
00032 }
00033 else
00034 sig = -atoi(argv[1]);
00035 pid = (unsigned short)atoi(argv[2]);
00036
00037 kill(pid,sig);
00038 printf("\n");
00039 }
00040