#!/bin/sh
#
# tpsExtAppStarter - start an arbitrary application for a process
#
# Passed in the pid and name of the process


PROCESS_PID=$1
PROCESS_NAME=$2

# Example of starting gdb from an xterm
#
# echo "xterm +ls -e gdb $PROCESS_PID $PROCESS_NAME" > /tmp/tpsStart.out
#
#( 							\
#    cd /home/gmd/dev/myApp; 		\
#    xterm +ls -e gdb $PROCESS_NAME $PROCESS_PID 	\
#)

# Example starting xxgdb as an X window app
#
#( 							\
#    cd /home/gmd/dev/myApp; 		\
#    xxgdb $PROCESS_NAME $PROCESS_PID 	\
#)

# Example starting ddd as an X window app
#
# ( 							\
#    cd /home/gmd/dev/myApp; 		\
#    ddd $PROCESS_NAME $PROCESS_PID 	\
#)

F="/tmp/treeps.info.$$"

echo > $F
echo "You invoked the treeps External Application Starter program " >> $F
echo "called tpsExtAppStarter " >> $F
echo >> $F
echo "     with     pid  = $PROCESS_PID " >> $F
echo "     and      name = $PROCESS_NAME" >> $F
echo >> $F
echo "This script just prints this message and exits. It's sole purpose in life is to" >> $F
echo "give you a template for you to create your own scripts. Either modify"  >> $F
echo "this script(usually found in /usr/local/bin) or copy it to your ~/bin directory"  >> $F
echo "and modify it there. If you do the latter then make sure your ~/bin directory"  >> $F
echo "is before /usr/local/bin in your PATH environmental variable." >> $F
echo >> $F
echo "You can make program specific scripts using conditional logic " >> $F
echo "triggered by the PROCESS_NAME which is passed in arg position 2." >> $F
echo "The processes PID is passed in argument position 1 and can be used" >> $F
echo "to start a debugger, send signals or perform some other function that" >> $F
echo "requires the PID as an argument." >> $F
echo >> $F
echo >> $F

if [ -z "$PAGER" ]
then
	xterm +ls -e more -18 $F
else
	xterm +ls -e $PAGER $F
fi

rm $F

