aboutsummaryrefslogtreecommitdiffstats
path: root/usr/ps.c
blob: 7bfc0def79899ce1c05e8124effcbec28eeaf883 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "gbos.h"
/* ps: list live processes (pid, state, command). */
void main(void) {
    unsigned char i, buf[3];
    char name[9];
    for (i = 0; i < 8; i++) {
        if (psget(i, buf)) {              /* buf = {pid, state, prog} */
            putu(buf[0]); putc(' ');
            putc("-RrBZ"[buf[1]]); putc(' ');
            progname(buf[2], name);
            puts(name); nl();
        }
    }
}