:
#	@(#) whodo.sh 1.2 87/10/14 
#	@(#) whodo.sh 1.1 86/10/14 
#
#	Copyright (C) Microsoft Corporation, 1985
#
#	This Module contains Proprietary Information of Microsoft
#	Corporation and AT&T, and should be treated as Confidential.
#
:
#	@(#)whodo.sh	1.4
#***	/etc/whodo -- combines info from who(1) and ps(1)
#

PATH=/bin:/usr/bin
trap  "rm -f /tmp/$$*" 1 2 3
ps -a>/tmp/$$b&
date
who -s >/tmp/$$a
ed - /tmp/$$a<<\!
g/^/s/^\(........\) *\(........\) *.......\(.*\)/\2 \1 \3/
g/console/s//co     /
g/tty\([^ ]*\)/s//\1   /
w
!
uname
wait
if [ -s /tmp/$$b ] 
then
ed - /tmp/$$b<<\! >/dev/null 2>/dev/null
1d
g/<defunct>/d
g/^/s/^\(......\) *\([^ ][^ ]*\)\(.*\)/\2-    \1    \3/
g/-sh$/s/-/+/
g/-rsh$/s/-/*/
w
!
fi
sort /tmp/$$a /tmp/$$b >/tmp/$$c
ed - /tmp/$$c<<\!
g/^..+/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1,.j
g/^..\*/s/.....//\
s/\([0-9]\)  *.*/\1/\
.-1s/ /r/\
j
g/^\([^ ][^ ]*\)- /s//  \1/
1,$p
Q
!
rm -f /tmp/$$*
