home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / hostmode / hostmdm.ksc < prev    next >
Text File  |  2020-01-01  |  2KB  |  92 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. ; The following code was added to accomodate the new Windows multi-user
  14. ; friendly directory layouts introduced with version 1.1.21.  We have
  15. ; check several locations for the directories that hostmode uses and
  16. ; create them in \v(appdata) if the do not exist at all.
  17.  
  18. if directory \v(exedir)USERS {
  19.     asg _hostroot \v(exedir)
  20.     forward FOUNDDIRS
  21. }
  22. if directory \v(startup)INCOMING {
  23.     asg _hostroot \v(startup)
  24.     forward FOUNDDIRS
  25. }
  26.  
  27. if directory \v(appdata)USERS {
  28.     asg _hostroot \v(appdata)
  29. }
  30.  
  31. :FOUNDDIRS
  32.  
  33. asg _configfile \freplace(\m(_hostroot)host.cfg,/,\\)
  34.  
  35. def MAKEVAR2 {
  36.     if def \%2 _assign \%1 \%2 \%3 \%4 \%5 \%6 \%7 \%8 \%9
  37.     else _assign \%1
  38. }
  39. def MAKEVAR {
  40.     if = \findex(=,\%1,1) 0 end
  41.     asg \%9 _\freplace(\%1,=,\32)
  42.     makevar2 \%9
  43. }
  44. def SPLIT {
  45.     asg x1 \%1
  46.     asg x2 \%2
  47. }
  48. open read \m(_configfile)
  49. if fail forward noconfig
  50. while true { read \%a, if fail break, makevar {\%a} }
  51.  
  52. :NOCONFIG
  53.  
  54. ; Don't give a SET MODEM TYPE command if it will not change the
  55. ; current modem type.  If we do, it wipes out any prior customizations.
  56.  
  57. if def _modem {
  58.     if not equal \v(modem) \m(_modem) {
  59.         set modem type \m(_modem)
  60.         if fail stop 1 "\m(_modem)" - Invalid modem type
  61.     }
  62. }
  63. if def _commport {
  64.     split \m(_commport)     ; This can be one or two words
  65.     if def x2 set port \ftrim(\m(x1)) \ftrim(\m(x2))
  66.     else set port \m(_commport)
  67.     if fail stop 1 "\m(_commport)" - Invalid port
  68. } else {
  69.     set tapi line
  70.     if fail stop 1 "\m(_commport)" - Invalid port
  71.     asg _commport tapi
  72. }
  73.  
  74. if def _comspeed {
  75.     set speed \m(_comspeed)
  76.     if fail stop 1 "\m(_comspeed)" - Invalid speed
  77. }
  78. if not eq "\v(connection)" "serial" {
  79.     stop 1 "\v(line)" - Inappropriate connection type: "\v(connection)"
  80. }
  81.  
  82. ; Break out of loop if there is a nonrecoverable error, otherwise continue.
  83.  
  84. while 1 {
  85.     answer
  86.     if > \v(dialstatus) 0 if < \v(dialstatus) 22 stop 1 Fatal modem error
  87.     if = \v(dialstatus) 0 take host.ksc
  88.     echo Type Ctrl-C to exit...          ; Give user a chance to cancel
  89.     sleep 2
  90. }
  91.  
  92.