kolibrios-gitea/programs/system/shell/cmd/cmd_ps.c
Nasarus 3256dedea8 Shell 0.4.4 (All)
git-svn-id: svn://kolibrios.org@1665 a494cfbc-eb01-0410-851d-a64ba20cac60
2010-10-17 19:50:55 +00:00

33 lines
418 B
C

int cmd_ps(char param[])
{
int i, n;
char *buf1k;
unsigned PID;
unsigned *p;
short *s;
short STATE;
buf1k = malloc(1024);
if (NULL == buf1k)
return FALSE;
for (i = 1;;i++)
{
n = kol_process_info(i, buf1k);
p = buf1k+30;
PID = *p;
s = buf1k+50;
STATE = *s;
if ( 9 != STATE)
printf (" %7d %s\n\r", PID, buf1k+10);
if (i == n)
break;
}
free(buf1k);
return TRUE;
}