Rev 1665 | Rev 3247 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1665 | Rev 1668 | ||
---|---|---|---|
1 | int _atoi ( char *s ) |
1 | int _atoi ( char *s ) |
2 | { |
2 | { |
3 | int i, n; |
3 | int i, n; |
4 | 4 | ||
5 | n = 0; |
5 | n = 0; |
6 | for ( i = 0; s[i]!= '\0'; ++i) |
6 | for ( i = 0; s[i]!= '\0'; ++i) |
7 | if ((s[i]<'0') || (s[i]>'9')) |
7 | if ((s[i]<'0') || (s[i]>'9')) |
8 | return 0; |
8 | return 0; |
9 | else |
9 | else |
10 | n = 10 * n + s[i] - '0'; |
10 | n = 10 * n + s[i] - '0'; |
11 | 11 | ||
12 | return n; |
12 | return n; |
13 | } |
13 | } |
14 | 14 | ||
15 | 15 | ||
16 | 16 | ||
17 | int cmd_kill(char process[]) |
17 | int cmd_kill(char process[]) |
18 | { |
18 | { |
19 | 19 | ||
20 | unsigned proc; |
20 | unsigned proc; |
21 | int result; |
21 | int result; |
22 | 22 | ||
23 | if (NULL == process) |
23 | if (NULL == process) |
24 | { |
24 | { |
25 | printf(" kill PID\n\r"); |
25 | printf(" kill |
26 | return FALSE; |
26 | return FALSE; |
27 | } |
27 | } |
28 | else |
28 | else |
29 | { |
29 | { |
30 | proc = _atoi(process); |
30 | proc = _atoi(process); |
31 | if ( 0 != proc ) |
31 | if ( 0 != proc ) |
32 | { |
32 | { |
33 | result = kol_process_kill_pid(proc); |
33 | result = kol_process_kill_pid(proc); |
34 | if (result < 0) |
34 | if (result < 0) |
35 | return FALSE; |
35 | return FALSE; |
36 | else |
36 | else |
37 | return TRUE; |
37 | return TRUE; |
38 | } |
38 | } |
39 | } |
39 | } |
40 | 40 | ||
41 | }>'0')> |
41 | }>'0')> |