home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
remcmd.zip
/
REMCMDC3.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-05-10
|
3KB
|
99 lines
/* Rexx */
Parse Source . . WhoAmI
sigstr = 'Signal On Syntax;Signal Off Error;Signal Off Failure;'
Signal On Syntax
/* This exec executes any valid Rexx instruction group sent from a */
/* partner LU */
Address "CMD" "@Echo Off"
If RxFuncQuery('APPC') Then
Call RxFuncAdd 'APPC','SAAAPPC','APPCSRV'
If RxFuncQuery('RXRSOE2F') Then
Do
Call RxFuncAdd 'rxydbautilinit','ydbautil','rxydbautilinit'
call rxydbautilinit
End
If RxFuncQuery('SQLDBS') Then
Call RxFuncAdd 'SQLDBS', 'SQLAR', 'SQLDBS'
If RxFuncQuery('SQLEXEC') Then
Call RxFuncAdd 'SQLEXEC', 'SQLAR', 'SQLEXEC'
appcrc=Appc('Receive_Allocate','REMCMDC3','Inf.')
If appcrc = 0 Then
Do
tpid = inf.0
convid = inf.1
incoming_user = inf.4
partlu = inf.6
partmode = inf.7
End
Else
Do
Say 'Receive_Allocate failed with rc =' xlatrxap(appcrc)
Exit
End
appcrc = Appc('Receive_Wait',tpid, Convid, 'Mapped', 'CmdStr.',10000)
If appcrc <> 0 Then
Do
Say 'Receive_Wait failed with rc =' xlatrxap(appcrc)
Call Appc 'Tp_Ended', tpid
Exit
End
cmdstr.2 = Cryption(cmdstr.2)
Parse Var cmdstr.2 upmid upmpw .
rxupmrcu = RxUpm('Logon',upmid,upmpw,'Local',,'User')
rxupmrca = RxUpm('Logon',upmid,upmpw,'Local',,'Admin')
If rxupmrcu <> 0 | rxupmrca <> 0 Then
Do
Call Appc 'Send_Error', tpid, convid, 'Mapped', 'Program'
Call Appc 'Tp_Ended', tpid
Exit
End
/* Create an un-named pipe and get its read & write handles */
rxrc = rxcreatepipe('h.',32765)
hread = h.1
hwrite = h.2
/* Re-direct standard out & error to pipe's write handle */
call rxsose2h hwrite
tid = rxcreaterexxthread('remcmdc4', partlu, partmode, hread, hwrite)
Restart_From_Here:
appcrc = Appc('Receive_Wait',tpid, Convid, 'Mapped', 'CmdStr.',10000)
Do While Appcrc = 0
cmdstr = ''
/*****************************
Do While Appcrc = 0 & cmdstr.0 <> 1 /* Accumulate the pieces */
cmdstr.2 = Cryption(cmdstr.2)
cmdstr = cmdstr||cmdstr.2
appcrc = Appc('Receive_Wait',tpid, Convid, 'Mapped', 'CmdStr.',10000)
End
*****************************/
cmdstr = cryption(cmdstr.2)
Say 'Command String:';Say ' 'cmdstr;Say 'Command Result:';Say
Interpret sigstr||cmdstr
Say ' '
appcrc = Appc('Receive_Wait',tpid, Convid, 'Mapped', 'CmdStr.',10000)
End
Call Appc 'Tp_Ended', tpid
call rxkillthread tid
Exit
Syntax:
Say 'Command "'cmdstr'"'
Say 'Failed with syntax error ('rc')' ErrorText(rc)
Signal Restart_From_Here
Cryption:
Return BitXor(Arg(1),Copies('ff'x,Length(Arg(1))))