Subversion Repositories Kolibri OS

Rev

Rev 8662 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. int cmd_pkill(char param[])
  3. {
  4.     int i = 1, n = 0; int process_count = 0;
  5.     char *buf1k = NULL;
  6.     unsigned PID=0;
  7.    
  8.     if(!strlen(param)){
  9.         printf(CMD_PKILL_HELP);
  10.         return TRUE;
  11.         }
  12.    
  13.     buf1k = malloc(1024);
  14.     if (buf1k == NULL){
  15.         return FALSE;        
  16.     }
  17.  
  18.         while (i != n) {
  19.             n = kol_process_info(i, buf1k);
  20.         if(!strnicmp(buf1k+10, param, 10)){
  21.             memcpy(&PID, buf1k+30 ,sizeof(unsigned));
  22.             if(kol_process_kill_pid(PID)){
  23.                 printf(CMD_PKILL_NOT_KILL, PID);
  24.             }else{
  25.                 printf(CMD_PKILL_KILL, PID);
  26.             }
  27.             process_count++;
  28.         }
  29.         i++;
  30.     }
  31.  
  32.     if(!process_count){
  33.         printf(CMD_PKILL_NOT_FOUND);
  34.     }
  35.  
  36.     free(buf1k);
  37.     return TRUE;
  38. }