4 export I_WANT_A_BROKEN_PS
12 cat >/tmp/awk.xxx$$ <<'!'
14 state["D"] = "Spinwait";
18 state["O"] = "Running";
20 state["T"] = "Stopped";
21 state["Z"] = "Zombie";
23 state["X"] = "Moribund";
28 t = state[substr(s, 1, 1)];
34 # rsc 36706 starttime 0:00.17 1076 Is+ -bash (bash)
40 if(start ~ /^[A-Z][a-z][a-z]$/){
41 start = start "-" $i; i++
47 if(ENVIRON["all"] == "yes"){
56 sub(/\.[0-9][0-9]$/, "", cputime); # drop .hundredths of second
57 if(cputime ~ /..:..:../){ # convert hh:mm:ss into mm:ss
58 split(cputime, a, ":");
59 cputime = sprintf("%d:%02d", a[1]*60+a[2], a[3]);
61 if(start ~ /..:..:../){ # drop :ss
62 sub(/:..$/, "", start);
64 printf("%-8s %11d %8s %8s %8dK %-8s %s\n",
65 user, pid, start, cputime, mem, statestr(stat), cmd);
69 case "${SYSNAME:-`uname`}" in
71 /bin/ps -aA -o 'user,pid,stime,time,vsz,s,args' | sed 1d |
72 nawk -f /tmp/awk.xxx$$ | sort -n +1
75 /bin/ps -axww -o 'user,pid,start,time,vsz,stat,command' | sed 1d |
76 awk -f /tmp/awk.xxx$$ | sort -n +1