Switch statement

This commit is contained in:
call-cc 2020-06-02 21:36:45 -04:00
parent 9c7fec7479
commit 8adf3476da
1 changed files with 10 additions and 12 deletions

View File

@ -7,23 +7,21 @@ main(int argc, char *argv[])
{
int sig = 0;
pid_t pid;
if(argc == 2)
switch(argc)
{
case 2:
sig = 15;
pid = atoi(argv[1]);
}
else if(argc == 3)
{
break;
case 3:
sig = abs(atoi(argv[1]));
pid = abs(atoi(argv[2]));
printf("Here 2\n");
}
else
{
printf("Specify who to kill\n %i",argc);
puts("Here 2");
break;
default:
fprintf(stderr, "Specify who to kill\n");
return 1;
}
kill(pid,sig);
return 0;
}