/****************************************************/
/*        Runs PokerSquares in TransAmiga           */
/*                                                  */
/*    Hacked out of a script by Andy McArdle,       */
/* especially to keep users from accessing a Shell  */
/*                                                  */
/* You may have to change the variable "PokerPath"  */
/* to reflect where you've put the Poker executable */
/*                                                  */
/****************************************************/

options results

PokerPath = 'BBS:Doors/PokerSquares'

/* Keeping users out of the shell... */
options failat 99999
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F

call NewSTDERR('Mail:Logs/Trace/Poker.trans.trc')
/* trace r */

IF ~show('L',"rexxsupport.library") THEN
  IF ~addlib("rexxsupport.library",0,-30,0) THEN EXIT 20

OldStack = pragma(S,10000)

systeminfo 8 ; bbsline=result
userinfo a ; UName = result
id=time(s)

Logentry '-*- 'UName' is playing PokerSquares'
SetNodeLocation UName' is playing PokerSquares'
Transmit ""
Transmit "   [1;35mReady to play?[0;30m"
Transmit ""

call open(fp,'t:Poker_run.'id,'W')
call writeln(fp,'Failat 99999')
call writeln(fp,'cd 'PokerPath)
call writeln(fp,'PokerSquares "'UName'" FIFO')
call writeln(fp,'endshell >nil:')
call close(fp)

address command 'NewShell FIFO:trshell'id'/rwkecs from t:Poker_run.'id
address command 'BBS:Bin/TrShell -n'bbsline' -ftrshell'id
Call DELETE('t:Poker_run.'id)

Logentry '*-* 'UName' has finished with PokerSquares'

OldStack = pragma(S,OldStack)
EXIT

BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
  CLS
  transmit '[22C[31mÞ[1;33;41mÚÄÄÄ SECURITY VIOLATION!! ÄÄ¿[0;31mÝ'
  transmit '[22CÞ[1;33;41m³                           ³[0;31mÝ'
  transmit '[22CÞ[1;33;41m³     [0;34;41mCtrl-keys Verboten    [1;33m³[0;31mÝ'
  transmit '[22CÞ[1;33;41m³                           ³[0;31mÝ'
  transmit '[22CÞ[1;33;41mÀÄÄÄÄÄ LOGGING YOU OFF! ÄÄÄÄÙ[0;31mÝ[0m'
  settime 0
  IF ~OPEN(In,WarnFile,R) THEN Warn = 0
  ELSE DO
   Warn = readln(In)
   CLOSE(In)
  END
  Warn = Warn + 1
  OPEN(Out,WarnFile,W)
   call writeln(Out,Warn)
  CLOSE(Out)
EXIT

NewSTDERR:
 call CLOSE('STDERR')
 IF OPEN('STDERR',arg(1),W) THEN call pragma('*','STDERR')
 ELSE DO
  call pragma('*')
  call OPEN('STDERR','*',W)
 END
RETURN

