home *** CD-ROM | disk | FTP | other *** search
/ On Hand / On_Hand_From_Softbank_1994_Release_2_Disc_1_1994.iso / 00190 / s / scripts.lib / DISCONCT.SCR < prev    next >
Text File  |  1993-08-18  |  3KB  |  143 lines

  1. !
  2. !  Copyright (c) 1993
  3. !  by CompuServe Incorporated, Columbus, Ohio
  4. !
  5. !  The information in this software is subject to change without
  6. !  notice and should not be construed as a commitment by CompuServe.
  7. !
  8. !  DISCONCT:
  9. !    Handles all network/modem disconnections
  10. !    %LOCAL  = 1 if hanging up while network script running
  11. !        = 2 if hanging up before connection
  12. !
  13. !+V
  14. ! "3.1"
  15. !-V
  16.  
  17. WaitTime = 10;
  18. attempts = 0;
  19.  
  20. CompuServe = 1;
  21. SprintNet = 2;
  22. CSIRnet = 16;
  23. Datex_J = 19;
  24. Direct = 26;
  25.  
  26. DirectConnect = (%Network = Direct) or (%DialType = 2);
  27.  
  28. ifndef %LOCAL = 0;
  29. if %LOCAL = 1 goto Do_Local_Hangup;
  30. if %LOCAL = 2 goto Send_Hangup;
  31.  
  32. if %Network = CompuServe goto Start_Wait;
  33. if %Network = Direct goto Start_Wait;
  34. if %Network = Datex_J goto Hangup_Datex_J;
  35. if %Network = SprintNet goto Hangup_SprintNet;
  36. if %Network = CSIRnet goto Hangup_CSIRnet;
  37. goto Do_Local_Hangup;
  38.  
  39. Start_Wait:
  40.     wait
  41.         "Host Name:"    goto Send_Bye,
  42.         "User ID:"    goto Send_Host,
  43.         %mdm_Failure    goto Hangup_Complete
  44.     until 80;
  45.     goto Do_Local_Hangup;
  46.  
  47. Send_Bye:
  48.     send "BYE^M";
  49.     if DirectConnect goto Hangup_Complete;
  50.     goto Wait_NO_CARRIER;
  51.  
  52. Send_Host:
  53.     send "/HOST^M";
  54.     goto Start_Wait;
  55.  
  56. Hangup_SprintNet:
  57.     show "Disconnecting from SprintNet";
  58.     wait
  59.         "disconnected"  goto Send_Sprint_Hangup
  60.     until 60;
  61.     goto Do_Local_Hangup;
  62.  
  63. Send_Sprint_Hangup:
  64.     wait until 3;
  65.     send "HANGUP^M";
  66.     goto Wait_NO_CARRIER;
  67.  
  68. Hangup_CSIRnet:
  69.     show "Disconnecting from CSIR-Net";
  70.     wait until 40;
  71.     send "Z";
  72.     goto Wait_NO_CARRIER;
  73.  
  74. Hangup_Datex_J:
  75.     show "Disconnecting from Datex-J";
  76.     wait 
  77.         "Host Name:"    goto Send_OFF,  
  78.         "CLR"        goto Clear_PAD
  79.     until 100;
  80.     ! fall through...
  81.  
  82. Clear_PAD:
  83.     wait until 60;
  84.     send "*9#";
  85.     goto Wait_NO_CARRIER;
  86.  
  87. Send_OFF:
  88.     send "OFF" & %CR;
  89.     goto Hangup_Datex_J;
  90.  
  91. Wait_NO_CARRIER:
  92.     if DirectConnect goto Hangup_Complete;
  93.     wait
  94.         %mdm_Failure    goto Hangup_Complete
  95.     until 30;
  96.  
  97.     sendm %mdm_EscapeCode;
  98.  
  99.     wait
  100.         %mdm_Failure    goto Hangup_Complete,
  101.         %mdm_Ack    goto Send_Hangup
  102.     until 20;
  103.     ! fall through...
  104.  
  105. Do_Local_Hangup:
  106.     if DirectConnect goto Hangup_Direct;
  107.  
  108.     wait until 2 * WaitTime;
  109.     sendm %mdm_EscapeCode;
  110.  
  111.     wait
  112.         %mdm_Ack    goto End_Escape_Wait,
  113.         %mdm_Failure    goto Hangup_Complete
  114.     until 20;
  115.     goto Send_Hangup;
  116.  
  117. End_Escape_Wait:
  118.     wait until WaitTime;
  119.     ! fall through...
  120.  
  121. Send_Hangup:
  122.     sendm %mdm_Prefix;
  123.     sendm %mdm_Hangup;
  124.     sendm %mdm_Suffix;
  125.     attempts = attempts + 1;
  126.  
  127.     wait
  128.         %mdm_Ack    goto Hangup_Complete,
  129.         %mdm_Failure    goto Hangup_Complete
  130.     until 15;
  131.  
  132.     if attempts = 2 goto Hangup_Complete;
  133.     goto Do_Local_Hangup;
  134.  
  135. Hangup_Direct:
  136.     sendm "###";
  137. Hangup_Complete:
  138.     Result = %Cancel;
  139.     if %LOCAL > 0  goto Exit_Script;
  140.     call %Dir & "last.scr" () : Result;
  141. Exit_Script:
  142.     exit Result;
  143.