home *** CD-ROM | disk | FTP | other *** search
/ 3,500 Cliparts Vectoriels 2 / 3500_V2.iso / compu / csi302f / scripts.lib / disconct.scr < prev    next >
Text File  |  1997-01-30  |  3KB  |  167 lines

  1. !
  2. !  Copyright (c) 1996
  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.8.3F"
  15. !-V
  16.  
  17. WaitTime = 80;
  18. attempts = 0;
  19.  
  20. CompuServe = 1;
  21. SprintNet = 2;
  22. CSIRnet = 16;
  23. Datex_J = 19;
  24. Internet = 25;
  25. Direct = 40;
  26. Result = %Success;
  27. ifndef %BreakChar = "#";
  28. define %State = 10;
  29.  
  30. DirectConnect = (%Network = Direct) or (%DialType = 2);
  31.  
  32. ifndef %LOCAL = 0;
  33. if %LOCAL = 1 goto Do_Local_Hangup;
  34. if %LOCAL = 2 goto Send_Hangup;
  35.  
  36. if %Network = Internet goto Exit_Script;
  37. if %Network = CompuServe goto Start_Wait;
  38. if %Network = Direct goto Start_Wait;
  39. if %Network = Datex_J goto Hangup_Datex_J;
  40. if %Network = SprintNet goto Hangup_SprintNet;
  41. if %Network = CSIRnet goto Hangup_CSIRnet;
  42. goto Do_Local_Hangup;
  43.  
  44. Start_Wait:
  45.     wait
  46.         "XPAD:"     goto Hangup_Complete,
  47.         "ITI:"      goto Hangup_Complete,
  48.         "Host Name:"    goto Send_Bye,
  49.         "User ID:"  goto Send_Host,
  50.         "Disconnected from host" goto PPP_Hangup,
  51.         "UIC:"      goto Send_UIC,
  52.         %mdm_Failure    goto Hangup_Complete
  53.     until WaitTime;
  54.     goto Do_Local_Hangup;
  55.  
  56. Send_Bye:
  57.     send "BYE^M";
  58.     if DirectConnect goto Hangup_Complete;
  59.     goto Wait_NO_CARRIER;
  60.  
  61. PPP_Hangup:
  62.     if DirectConnect goto Hangup_Complete;
  63.     goto Start_Wait;
  64.  
  65. Send_Host:
  66.     send "/HOST^M";
  67.     goto Start_Wait;
  68.  
  69. Send_UIC:
  70.     send "^C";
  71.     wait until 30;
  72.     goto Start_Wait;
  73.  
  74. Hangup_SprintNet:
  75.     show "DΘconnexion de SprintNet";
  76.     wait
  77.         "disconnected"  goto Send_Sprint_Hangup
  78.     until 60;
  79.     goto Do_Local_Hangup;
  80.  
  81. Send_Sprint_Hangup:
  82.     wait until 3;
  83.     send "HANGUP^M";
  84.     goto Wait_NO_CARRIER;
  85.  
  86. Hangup_CSIRnet:
  87.     show "DΘconnexion de CSIR-Net";
  88.     wait until 40;
  89.     send "Z";
  90.     goto Wait_NO_CARRIER;
  91.  
  92. Hangup_Datex_J:
  93.     show "DΘconnexion de Datex-J";
  94.     wait 
  95.         "Host Name:"    goto Send_OFF,  
  96.         "CLR"       goto Clear_PAD
  97.     until 100;
  98.     ! fall through...
  99.  
  100. Clear_PAD:
  101.     wait until 60;
  102.     send "*9#";
  103.     goto Wait_NO_CARRIER;
  104.  
  105. Send_OFF:
  106.     send "OFF" & %CR;
  107.     goto Hangup_Datex_J;
  108.  
  109. Wait_NO_CARRIER:
  110.     if DirectConnect goto Hangup_Complete;
  111.     wait
  112.         "BYE^M"     goto Hangup_Complete,
  113.         %mdm_Failure    goto Hangup_Complete
  114.     until 30;
  115.  
  116.     sendm %mdm_EscapeCode;
  117.  
  118.     wait
  119.         %mdm_Failure    goto Hangup_Complete,
  120.         %mdm_Ack    goto Send_Hangup
  121.     until 20;
  122.     ! fall through...
  123.  
  124. Do_Local_Hangup:
  125.     if DirectConnect goto Hangup_Direct;
  126.     define %State = 11;
  127.  
  128.     wait until 20;
  129.     sendm %mdm_EscapeCode;
  130.  
  131.     wait
  132.         %mdm_Ack    goto End_Escape_Wait,
  133.         %mdm_Failure    goto Hangup_Complete
  134.     until 20;
  135.     goto Send_Hangup;
  136.  
  137. End_Escape_Wait:
  138.     wait until 10;
  139.     ! fall through...
  140.  
  141. Send_Hangup:
  142.     sendm %mdm_Prefix;
  143.     sendm %mdm_Hangup;
  144.     sendm %mdm_Suffix;
  145.     attempts = attempts + 1;
  146.  
  147.     wait
  148.         %mdm_Ack    goto Hangup_Complete,
  149.         %mdm_Failure    goto Hangup_Complete
  150.     until 15;
  151.  
  152.     if attempts = 2 goto Hangup_Complete;
  153.     goto Do_Local_Hangup;
  154.  
  155. Hangup_Direct:
  156.     sendm %BreakChar;
  157.     sendm %BreakChar;
  158.     sendm %BreakChar;
  159. Hangup_Complete:
  160.     Result = %Cancel;
  161.     if %LOCAL > 0  goto Exit_Script;
  162.     call %Dir & "last.scr" () : Result;
  163. Exit_Script:
  164.     define %State = 12;
  165.     define %LOCAL = 0;
  166.     exit Result;
  167.