Running ttsession: 



(We're at a shell, denoted here with `csh1' prompt)



"Show the ttsession (if any) started due to running openwindows."



csh1% ps -a | grep ttsession

 256 console S 0:02 ttsession -s

 10271 pts/2 R 0:00 grep ttsession



"Take a look at the session id of the ttsession started due to 
running openwindows."



csh1% xprop -root | grep _SUN_TT_SESSION

_SUN_TT_SESSION(STRING) = "01 256 1342177279 1 0 24151 
129.144.153.7 2"



"Check this shell's _SUN_TT_SESSION environment variable."



csh1% echo $_SUN_TT_SESSION

_SUN_TT_SESSION: Undefined variable



"So right now, any application calling ttopen() would use the 
ttsession started due to running openwindows. Lets now create a 
separate ttsession for experimentation."



csh1% ttsession -c csh

ttsession: starting



"Another ttsession has now been started, and has run a new shell 
(denoted here with `csh2' prompt) for us."



csh2% ps -a | grep ttsession

 256 console S 0:02 ttsession -s

 10279 pts/2 S 0:01 ttsession -c csh

 10288 pts/2 R 0:00 grep ttsession



"In this new shell, _SUN_TT_SESSION will be set"



csh2% echo $_SUN_TT_SESSION

01 10279 1342177284 1 0 24151 129.144.153.7 2



"Hence any children of this shell will see this setting and use 
the newly created ttsession"





csh2% ttsnoop &

[1] 10285

csh2% ttsample1 &

[2] 10286



"Now ttsnoop and ttsample1 are using the newly created ttsession. 
We can now experiment in this new session ... If we terminate this 
new ttsession, say by killing it or exiting the child shell we're 
in..."



csh2% exit



"We end up back in our original shell"



csh1% 



"At this point if ttsample1 and/or ttsnoop were left running, they 
may produce errors since their ttsession has disappeared."
