#!/bin/sh
#* ----------------------------------------------------------------------
#*               Proprietary and Confidential Information
#*
#* This material contains, and is part of a computer software program
#* which is, proprietary and confidential information owned by COMPUTER
#* ASSOCIATES INTERNATIONAL, INC.  The program, including this material,
#* may not be duplicated, disclosed or reproduced in whole or in part for
#* any purpose without the express written authorization of COMPUTER
#* ASSOCIATES. All authorized reproductions must be marked with this
#* legend.
#*
#*                          Copyright (c) 1992-2005
#*             Computer Associates International, Incorporated
#*                          All rights reserved
#*
#* ----------------------------------------------------------------------
#*  SCCS Module Control Stamp
#* ----------------------------------------------------------------------
#
#* "@(#)unips	1.15  03/22/05 17:53:50" 
#* "Copyright (C) 1992-2005 Computer Associates International, Inc.  All rights reserved."
#

# The purpose of this script is to present a consistent `ps' command output
# stream. The model for this was the hp 'ps -ef' command which outputs data
# in the following format:
#      UID   PID  PPID  C    STIME TTY      TIME COMMAND
#     root     0     0  0  Dec 31  ?        0:41 swapper
#  doejo01 16369 16368  0 16:56:59 ?        0:02 /usr/vue/bin/hpterm -display xx
#
#  Therefore, the important tokens to preserve positionally and content wise
#  are 1-3. Since start time (STIME) can be either 1 or 2 tokens the
#  remainder of the line can vary with respect to what token is mapped to
#  what, so it is only important to make sure that the command name is
#  output after class (C, aka priority). If the C (class) field goes to
#  three digits, it will join with PPID so we must make sure that it 
#  is separated.
 

if [ -f /usr/bin/nawk ]; then
  AWK=/usr/bin/nawk
else
  AWK=/usr/bin/awk
fi

SYSTYPE=`$CASHCOMP/bin/casystyp`

case $SYSTYPE in
   AIX)
   	ps -eo "%u %p %P %a"  | cut -c1-1000 ;;
   alpha)
   	/sbin/ps ajxww ;;
   Linux)
	ps xScalw | ${AWK} '{print $2 " " $3 " " $4 " " $5 " " $10 " " $11 " " $12 " " $13 " " $14}' ;;
   SunOS4)
        ps -egajxw | ${AWK} '{ printf "%s\t%s\t%s\t%s\n", $8,$2,$1,$10}' ;;
   IRIX)
	rel=`uname -r`
	if [ "$rel" = "6.2" -o "$rel" = "6.3" -o "$rel" = "6.4" ]; then
		ps -ef | ${AWK} ' {  var1 = substr($0,1,15); var2 = substr($0,16,5); var3 = substr($0,21); print var1 " " var2 " " var3; } ' 
	else
		ps -ef | ${AWK} ' { var1 = substr($0,1,19); var2 = substr($0,20,10); var3 = substr($0,30); print var1 " " var2 " " var3; } ' 
	fi
	;;
   *)
   ps -ef | ${AWK} ' {  var1 = substr($0,1,15); var2 = substr($0,16,5); var3 = substr($0,21); print var1 " " var2 " " var3; } ' ;;

esac

exit $?
