PROC 0 CMD()                                /* PC */
CONTROL ASIS
/*   PC CLIST - J.F. Chandler - 1992 April                                 */
/*   (Modified December to use TERMINALS instead of TERMINALR)             */
 
/*   Intended to be executed from inside Kermit with SYSCMD set ON.        */
/*   Syntax:  %PC CMD('kermit subcommand text')                            */
/*   The PC Kermit is placed in server mode via TERMINALS, then the "cmd"  */
/*   is executed, and then a FINISH is executed.  NOTE: the PC Kermit      */
/*   should have SERVER TIMEOUT set to a relatively small value.           */
 
/*   Special case:  %PC CMD('PRINT file')                                  */
/*   The printer is enabled via ANSI escape sequence, the file is then     */
/*   displayed, and the printer is disabled.                               */
 
SET &L = &LENGTH(&STR(&CMD))
IF &L = 0 THEN DO
  WRITE Syntax error
  EXIT CODE(99)
  END
IF &SUBSTR(&L,&CMD)=&STR(,) THEN DO
  WRITE Syntax error
  EXIT CODE(99)
  END
SET &I = 2
DO WHILE &I < &L && &SUBSTR(&I,&CMD)^=&STR( )
  SET &I = &I + 1
  END
IF &I >= &L THEN DO
  WRITE Syntax error
  EXIT CODE(99)
  END
SET &I1 = &I - 1
IF &SUBSTR(1:&I1,&CMD)=&STR(PRINT) THEN DO
  SET &OPEN_CMD = &STR(XECHO ^[[5i)      /* Enable printer */
  SET &CMD = &STR(XTYPE&SUBSTR(&I:&L,&CMD)
  SET &CLO_CMD = &STR(XECHO ^[[4i)       /* Disable printer */
  END
ELSE DO
  SET &OPEN_CMD = &STR(XECHO ^[[?34h    ^[[?34h) /* start server (extra) */
  SET &CLO_CMD = &STR(FINISH)
  END
KERMIT
KERMIT &OPEN_CMD
KERMIT &CMD
SET &R = &LASTCC
KERMIT &CLO_CMD
IF &R = 2  THEN WRITE Transfer cancelled
IF &R = 5  THEN WRITE Bad packet count or chksum
IF &R = 6  THEN WRITE Invalid packet syntax
IF &R = 7  THEN WRITE Invalid packet type
IF &R = 8  THEN WRITE Lost a packet
IF &R = 9  THEN WRITE Micro sent a NAK
IF &R = 10 THEN WRITE Micro aborted
IF &R = 12 THEN WRITE File not found
IF &R = 13 THEN WRITE Disk or file is full
IF &R = 14 THEN WRITE Disk I/O error
IF &R = 15 THEN WRITE Missing operand
IF &R = 17 THEN WRITE Syntax error
IF &R = 19 THEN WRITE Records truncated
IF &R = 20 THEN WRITE Bad communication line
IF &R = 22 THEN WRITE File too short
IF &R = 23 THEN WRITE Missing start-of-packet
EXIT CODE(&R)
--------------------------------------------------------------
PROC 1 DSN LIST()                          /* KERMAIL */
CONTROL ASIS
 
/* Purpose:                                                             */
/*    Deliver mail received from MS-Kermit via TSO-Kermit               */
 
/* Function:                                                            */
/*    TSO-Kermit calls KERMAIL once with  DSN of "." to ensure          */
/*    that KERMAIL exists.  In this case, KERMAIL returns with RC=0.    */
/*    Then when TSO-Kermit has received the mail file from the PC, it   */
/*    calls KERMAIL with the correct DSN.  KERMAIL now dispatches the   */
/*    mail file.                                                        */
 
IF &DSN=&STR(.) THEN EXIT CODE(0)
/*   send file as mail... */
DELETE &DSN
EXIT CODE (0)
--------------------------------------------------------------
PROC 1 DSN LIST()                          /* KERMPRT */
CONTROL ASIS
 
/* Purpose:                                                             */
/*    Print file received from MS-Kermit via TSO-Kermit                 */
 
/* Function:                                                            */
/*    TSO-Kermit calls KERMPRT once with  DSN of "." to ensure          */
/*    that KERMPRT exists.  In this case, KERMPRT returns with RC=0.    */
/*    Then when TSO-Kermit has received the file from the PC, it        */
/*    calls KERMPRT with the correct DSN.  KERMPRT now prints the file. */
 
IF &DSN=&STR(.) THEN EXIT CODE(0)
/*   print the file ... */
DELETE &DSN
EXIT CODE (0)
