-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverkill.c
More file actions
29 lines (29 loc) · 721 Bytes
/
overkill.c
File metadata and controls
29 lines (29 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "headers.h"
#include "overkill.h"
void kill_all_backg(char *argu)
{
char *ptr = (char *)malloc(sizeof(char) * 2000);
ptr = strtok(argu, " \t");
if (ptr != NULL)
{
printf("\x1B[1;31mError : can't enter arguments with overkill command !!!\x1B[0m\n");
prestat = 'f';
return;
}
else if (ptr == NULL)
{
if (total_back_process == 0)
{
printf("\x1B[1;31mAlready no background process !!!\x1B[0m\n");
return;
}
else if (total_back_process >= 1)
{
for (int i = 0; i < total_back_process; i++)
{
kill(pid_arr[i], SIGKILL);
}
}
}
return;
}