home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / k95 / 1120 / hostmdm.ksc < prev    next >
Text File  |  2020-01-01  |  2KB  |  71 lines

  1. ; Kermit 95 host mode listener for dialin connections.
  2. ;
  3. ;   Version 1.0, Feb 1996.
  4. ;   Version 2.0, Jan 1997, avoid undoing prior modem customizations.
  5. ;   Version 3.0, Jun 1997, adds support for TAPI.
  6. ;   Version 4.0, Jul 2001, allow empty _commport variable, multiple configs.
  7. ;
  8. if < \v(xvers) 1112 stop 1 \v(cmdfil): K-95 1.1.12 or higher is required.
  9.  
  10. local x1 x2 split
  11. undef x2
  12.  
  13. asg _configfile host.cfg
  14.  
  15. def MAKEVAR2 {
  16.     if def \%2 _assign \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9
  17.     else _assign \%1
  18. }
  19. def MAKEVAR {
  20.     if = \findex(=,\%1,1) 0 end
  21.     asg \%9 _\freplace(\%1,=,\32)
  22.     makevar2 \%9
  23. }
  24. def SPLIT {
  25.     asg x1 \%1
  26.     asg x2 \%2
  27. }
  28. open read \m(_configfile)
  29. if fail forward noconfig
  30. while true { read \%a, if fail break, makevar {\%a} }
  31.  
  32. :NOCONFIG
  33.  
  34. ; Don't give a SET MODEM TYPE command if it will not change the
  35. ; current modem type.  If we do, it wipes out any prior customizations.
  36.  
  37. if def _modem {
  38.     if not equal \v(modem) \m(_modem) {
  39.         set modem type \m(_modem)
  40.         if fail stop 1 "\m(_modem)" - Invalid modem type
  41.     }
  42. }
  43. if def _commport {
  44.     split \m(_commport)     ; This can be one or two words
  45.     if def x2 set port \ftrim(\m(x1)) \ftrim(\m(x2))
  46.     else set port \m(_commport)
  47.     if fail stop 1 "\m(_commport)" - Invalid port
  48. } else {
  49.     set tapi line
  50.     if fail stop 1 "\m(_commport)" - Invalid port
  51.     asg _commport tapi
  52. }
  53.  
  54. if def _comspeed {
  55.     set speed \m(_comspeed)
  56.     if fail stop 1 "\m(_comspeed)" - Invalid speed
  57. }
  58. if not eq "\v(connection)" "serial" {
  59.     stop 1 "\v(line)" - Inappropriate connection type: "\v(connection)"
  60. }
  61.  
  62. ; Break out of loop if there is a nonrecoverable error, otherwise continue.
  63.  
  64. while 1 {
  65.     answer
  66.     if > \v(dialstatus) 0 if < \v(dialstatus) 22 stop 1 Fatal modem error
  67.     if = \v(dialstatus) 0 take host.ksc
  68.     echo Type Ctrl-C to exit...          ; Give user a chance to cancel
  69.     sleep 2
  70. }
  71.