home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c-kermit / ckeracu.ini < prev    next >
Text File  |  2020-01-01  |  3KB  |  85 lines

  1. COMMENT - Check for existence of ACU directory
  2. ;
  3. assign _acudir \v(home)ckermit.kad   ; This should actually be system wide,
  4.                                      ; but overidden by environment.
  5. if not exist \m(_acudir) goto noacu  ; And names are \v(system) dependent.
  6.  
  7. COMMENT - Have acu directory, so read it and define related macros
  8. ;
  9. echo { ACU directory is \m(_acudir)}
  10.  
  11. def max_acus 25               ; Adjust this if you have more than 25 entries!
  12. open read \m(_acudir)         ; Open ACU directory file
  13. xif fail { -
  14.     echo Can't open \m(_acudir), -
  15.     goto noacu -
  16. }
  17.  
  18. declare \&a[\m(max_acus)]     ; Declare array for acu directory entries
  19. for \%i 1 \m(max_acus) 1 { -  ; Read entries into array
  20.     read \&a[\%i], -
  21.     if fail goto acudone -
  22. }
  23. close read                    ; Didn't reach the end
  24. echo -                        ; Close the file and print useful message
  25.   \?Too many entries in ACU directory:
  26. echo { Maximum is \m(max_acus).}
  27. echo { Change definition of max_acus in \v(cmdfile) to allow more. }
  28. echo { ACU directory disabled.}
  29. goto noacu
  30.  
  31. :ACUDONE                      ; We have the ACU directory in memory
  32. asg \&a[0] \feval(\%i - 1)    ; Keep size of array in zeroth element
  33.  
  34. COMMENT - ACUMATCH macro. Arguments:
  35. ;
  36. ; \%1 = modem type
  37. ; \%2 = speed
  38. ; \%3 = acu modem type
  39. ; \%4 = acu speed
  40. ; \%5 = acu line
  41. def acumatch if not = \v(argc) 6 end 1 ACUMATCH missing arguments,-
  42.   if not eq "\%1" "\%3" return,-
  43.   if not eq "\%2" "\%4" return,-
  44.   return \%5
  45.  
  46. COMMENT - GETACU macro. Arguments:
  47. ;
  48. ; \%1 = modem type
  49. ; \%2 = speed
  50. ;
  51. define GETACU if not = \v(argc) 3 end 1 Usage: GETACU modem speed,-
  52.   set case off,-          ; Ignore alphabetic case
  53.   for \%i 1 \&a[0] 1 { -  ; Loop thru ACU directory
  54.     asg \%3 \fexec(acumatch \%1 \%2 \&a[\%i]),-
  55.     if not def \%3 continue,-
  56.     set line \%3,- ; this should "lock" the line according to system rules
  57.     if success break - ; If it works, we're done
  58.   },-
  59.   if not > \%i \&a[0] return \%3 ; Return the ACU line name
  60.  
  61. COMMENT - ACUCALL macro.  Arguments:
  62. ;
  63. ; \%1 = modem type
  64. ; \%2 = device name
  65. ; \%3 = speed
  66. ; \%4 = phone number
  67. ;
  68. ; This is an ACU-aware version of the CALL macro from the ckermit.ini
  69. ; file.  It will use an ACU directory to find a dial line that is available
  70. ; when the line name in the service directory is ACU.  It then uses CALL
  71. ; to do the actual calling.
  72. ;
  73. define ACUCALL if < \v(argc) 5 end 1 Usage: ACUCALL modem device speed number,-
  74.   set modem \%1,-
  75.   if fail end 1 unknown modem type: \%1,-
  76.   xif equal \%2 ACU { -
  77.     getacu \%1 \%3,-
  78.     if def \v(return) asg \%2 \v(return), -
  79.     else end 1 ACU type \%1 at speed \%3 unavailable.,-
  80.   },-
  81.   echo ACUCALL setting line to \%2,- ; tell user what ACU we picked
  82.   call \%1 \%2 \%3 {\%4}             ; phone numbers often have spaces in them.
  83.  
  84. :NOACU
  85.