2010-10-17 21:50:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
int _atoi ( char *s )
|
|
|
|
{
|
|
|
|
int i, n;
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
for ( i = 0; s[i]!= '\0'; ++i)
|
|
|
|
if ((s[i]<'0') || (s[i]>'9'))
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
n = 10 * n + s[i] - '0';
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cmd_kill(char process[])
|
|
|
|
{
|
|
|
|
|
|
|
|
unsigned proc;
|
|
|
|
int result;
|
|
|
|
|
|
|
|
if (NULL == process)
|
|
|
|
{
|
2010-10-21 01:58:36 +02:00
|
|
|
printf(" kill <PID>\n\r");
|
2010-10-17 21:50:55 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
proc = _atoi(process);
|
|
|
|
if ( 0 != proc )
|
|
|
|
{
|
|
|
|
result = kol_process_kill_pid(proc);
|
|
|
|
if (result < 0)
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|