home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / lampdq.zip / LAMPDQ.EXC < prev    next >
Text File  |  1994-07-25  |  8KB  |  238 lines

  1. /* Pseudo-PDQ Interface Screen for OS/2 Extended Edition.       */
  2. /* Accepts requests for file transfer, handles CP messages, and */
  3. /* processes VM commands (sent as file transfer requests).      */
  4.  
  5. /* Larry Margolis, MARGOLI at YKTVMV                            */
  6.  
  7. if arg(1)='?' then do
  8.    say 'LAMPDQ is a pseudo-PDQ interface for use with OS/2 EE before the'
  9.    say 'ECF component is available.  See LAMPDQ NEWS on PCTOOLS for details.'
  10.    exit 100
  11. end
  12.  
  13. cmd='Command'; set='Command set'; res=set 'reserved'; nl='15'x
  14. parse source . . myname ft fm .
  15.  
  16. /* parse value qdisk('?') with . . . . . . bigdisk . */
  17. q = queued()
  18. address '' 'QUERY DISK MAX (LIFO'
  19. if rc = 0 then pull . 7 . bigdisk .
  20. else do; say 'You have no read/write disk space.'; exit 4; end
  21. do queued() - q; pull; end
  22.  
  23. trace -1; address 'XEDIT' set 'SCREEN 1'
  24. if rc=-3 then do              /* XEDIT not active */
  25.    push myname 'QUIT'
  26.    Address '' 'XEDIT' myname ft fm '(NOPROF NOMSG'
  27.    exit rc
  28. end
  29.  
  30. address 'XEDIT'
  31. parse value diag(8,'QUERY SET') with ,
  32.                    'MSG ' msgset ',' 'WNG ' wngset ',' ,
  33.                    'EMSG ' emsgset ',' 'IMSG ' imsgset ',' ,
  34.                    'VMCONIO ' vmcset ',' 'CPCONIO ' cpcset . ','
  35. parse value cpcset with cpcset . '15'x  /* Maybe necessary for non-Ykt */
  36. call initialize
  37. call cpset
  38. call init_screen
  39. cmd 'Preserve'
  40. set 'BRKKEY OFF'        /* Trap PA1, also. */
  41. address '' 'IDENTIFY (LIFO'
  42. if rc=0 then pull . . node .
  43. set 'msgmode on long'
  44. set 'msgline on 1' lscreen.5 'overlay'
  45. /*
  46. if left(node,3)='YKT' then do
  47.    'QUERY CMSLEVEL (LIFO'
  48.    if rc = 0 then do
  49.       pull cms .
  50.       if CMS <> 'VM/XA' then
  51.          set 'CPMSG OFF'      /* Don't ask XEDIT to trap CP messages. */
  52.    end
  53. end
  54. */
  55. lastcmd=''
  56. call pulliucv
  57. Do forever
  58.    cmdline=''
  59.    key='?'
  60.    address '' 'DESBUF'
  61.    cmd 'Read Cmdline tag'
  62.    Do queued()
  63.       parse pull tag rest
  64.       if tag='CMD' then cmdline=rest
  65.       else do
  66.          if tag='PFK' | tag='PAK' then key=tag || subword(rest,1,1)
  67.          else key=tag
  68.       end
  69.    end
  70.    call pulliucv
  71.    if key='PFK3' | key='PFK15' then leave
  72.    if key='PAK1' then do         /* CP mode, but restore CP settings first. */
  73.       call cprestore
  74.       Address '' 'CP'
  75.       call cpset
  76.       iterate
  77.    end
  78.    if cmdline<>'' then do
  79.       if cmdline='?' then do; cmd 'CMSG' lastcmd; iterate; end
  80. /*  Uncomment the following line for a trace of commands executed.  */
  81. /*    Address '' 'EXECIO 1 DISKW LAMPDQ TRACE A (VAR CMDLINE FINIS' */
  82.       parse var cmdline cmdname verb fn ft fm '(' opts
  83.       if cmdname='IND$FILE' then do  /* Special handling */
  84.          if verb fn ft = 'GET HOSTCMD' then do
  85.             ft='CMSUT1'; fm=bigdisk
  86.             call docmd opts, fn ft
  87.             opts='ASCII CRLF'
  88.          end
  89.          else if verb fn ft = 'GET MSGS' then do
  90.             ft='CMSUT1'; fm=bigdisk
  91.             call domsgs fn ft
  92.             opts='ASCII CRLF'
  93.          end
  94.          Address '' 'IND$FILE' verb fn ft fm '(' opts
  95.          conio=0
  96.          call pulliucv 'CMD'
  97.          iterate
  98.       end
  99.       if cmdname='LAMPDQ' then do  /* Special handling; used by CP78 */
  100.          if verb='HOSTCMD' then do
  101.             parse var cmdline . . hostcmd
  102.             call docmd hostcmd, 'HOSTCMD CMSUT1'
  103.          end
  104.          else if verb='MSGS' then call domsgs 'MSGS CMSUT1'
  105.          iterate
  106.       end
  107.       call cprestore
  108.       trace -1
  109.       'CMS' cmdline
  110.       call cpset
  111.       lastcmd=cmdline
  112.    end
  113.    else if key='ETK' then do /* Enter key pressed; no command entered: */
  114.       do i=1 to msgs         /* display any messages received.         */
  115.          cmd "msg" msgs.i
  116.       end
  117.       msgs=0
  118.    end
  119. end
  120. Address '' "WAKEUP ( RESEXT QUIET"
  121. Address '' "WAKEUP RESET ( QUIET"
  122. call cprestore
  123. Do i=1 to lscreen.5-2
  124.    res i 'OFF'
  125. End
  126. Do i=1 to msgs
  127.    cmd "msg" msgs.i
  128. end
  129. cmd 'Restore'
  130. if arg(1)='QUIT' then 'QUIT'
  131. exit
  132.  
  133. initialize:  Address ''
  134.    /**
  135.     ** initial WAKEUP processing
  136.     **/
  137.    issubset = cmsflag('SUBSET')
  138.    "NUCEXT WAKEUP"
  139.    if rc <> 0 then
  140.      if issubset then "NUCXLOAD WAKEUP ( SYSTEM SERVICE"
  141.      else "WAKEUP ( QUIET"
  142.    "WAKEUP (NOEXT QUIET"
  143.    "WAKEUP VERSION (QUIET"
  144.    if rc = 201 then do               /* too old for us */
  145.       wkrc = rc
  146.       "WAKEUP (RESEXT QUIET"
  147.       'SET CMSTYPE RT'
  148.       say ' Your copy of WAKEUP MODULE is out of date and unusable'
  149.       say ' with' myname'.  Obtain WAKEUP version 5.4.1 from VMTOOLS'
  150.       say ' (master disk at YKTVMZ).'
  151.       if arg(1)='QUIT' then address 'XEDIT' 'QUIT'
  152.       exit
  153.      end
  154.    msgs=0
  155.    return
  156.  
  157. docmd:  procedure expose conio conio. msgs msgs. bigdisk
  158.    parse arg cmd , fn ft .
  159.    trace -1
  160.    Address 'CMS' cmd                       /* Execute command */
  161.    conio=1; conio.1=rc
  162.    call pulliucv 'CMD'
  163.    Address '' 'EXECIO' conio 'DISKW' fn ft bigdisk'3 1 (STEM CONIO. FINIS'
  164.    drop conio.
  165.    return
  166.  
  167. domsgs:  procedure expose msgs msgs. bigdisk
  168.    parse arg fn ft .
  169.    if msgs=0 then do; msgs=1; msgs.1=' '; end
  170.    Address '' 'EXECIO' msgs 'DISKW' fn ft bigdisk'3 1 (STEM MSGS. FINIS'
  171.    drop msgs.; msgs=0
  172.    return
  173.  
  174. init_screen:
  175. cmd 'extract /lscreen/'
  176. Do i=1 to 5
  177.    res i 'nohigh'
  178. End
  179. res ' 6 nohigh                  LL                 AAAAAAAAAAAA      MMMM         MMM'
  180. res ' 7 nohigh                 LL                AA           AA    MM MM      MM MM'
  181. res ' 8 nohigh                LL                AA            AA   MM  MM    MM  MM'
  182. res ' 9 nohigh               LL                AA            AA   MM   MM  MM   MM'
  183. res '10 nohigh              LL                AAAAAAAAAAAAAAAA   MM    MMMM    MM'
  184. res '11 nohigh             LL   Lawrence     AA            AA   MM     MM     MM'
  185. res '12 nohigh            LL                AA    Alan    AA   MM            MM'
  186. res '13 nohigh           LL                AA            AA   MM  Margolis  MM'
  187. res '14 nohigh          LLLLLLLLLLLLL     AA            AA   MM            MM'
  188. res '15 nohigh'; res '16 nohigh'
  189. res '17 high                LaMail Interface Screen for OS/2 Extended Edition'
  190. res '18 nohigh'
  191. res '19 high                           IBM Unclassified  (Rel 0.3)'
  192. Do i=20 to lscreen.5-3
  193.    res i 'nohigh'
  194. End
  195. res lscreen.5-2 'high       Enter VM commands below, or press F3 to terminate LaMail interface.'
  196.    return
  197.  
  198. /*  *IUCV   - Unknown IUCV message type
  199.     *MSG    - CP MSG or MSGNOH command
  200.     *WNG    - CP WNG command
  201.     *EMSG   - SET EMSG IUCV
  202.     *IMSG   - SET IMSG IUCV
  203.     *SMSG   - SET SMSG IUCV
  204.     *CP     - SET CPCONIO IUCV
  205.     *VM     - SET VMCONIO IUCV
  206.     *SCIF   - SET SCIF IUCV
  207. */
  208. pullIUCV:  parse arg flag
  209.    do forever
  210.       Address '' 'WAKEUP +00:00:00 (IUCVMSG QUIET'
  211.       If rc = 2 then
  212.          if queued()=0 then leave
  213.          else do; parse pull line; type='QUEUED'; end
  214.       else Parse pull type uid line
  215.       If type='*MSG' | type='*WNG' | type='*SMSG' | flag<>'CMD' then do
  216.          msgs=msgs+1
  217.          if type='*MSG' | type='*WNG' | type='*SMSG' then
  218.             msgs.msgs='From' uid':' line
  219.          else        /* Asynchronous CP output; e.g., PUN FILE FROM...*/
  220.             msgs.msgs=line
  221.       end
  222.       else do
  223.          conio=conio+1
  224.          conio.conio=line
  225.       end
  226.    end
  227.    return
  228.  
  229. cpset:
  230. call diag 8,'SET MSG IUCV'nl'SET WNG IUCV'nl'SET EMSG IUCV'nl ,
  231.             'SET IMSG IUCV'nl'SET VMCONIO IUCV'nl'SET CPCONIO IUCV',1
  232. return
  233.  
  234. cprestore:
  235. call diag 8,'SET MSG' msgset nl'SET WNG' wngset nl'SET EMSG' emsgset nl ,
  236.       'SET IMSG' imsgset nl'SET VMCONIO' vmcset nl'SET CPCONIO' cpcset, 1
  237. return
  238.