home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 August - Disc 1 / PCNET_CD_2006_08_1.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / bin / tkpppoe < prev    next >
Encoding:
Text File  |  2005-12-20  |  106.0 KB  |  2,916 lines

  1. #!/bin/sh
  2. # -*-Mode: TCL;-*-
  3. # LIC: GPL
  4.  
  5. #--------------------------------------------------------------
  6. #   tkpppoe
  7. #
  8. #   A graphical front-end for configuring and using rp-pppoe.
  9. #
  10. #   Copyright (C) 2001 by Roaring Penguin Software Inc.
  11. #   This file may be distributed under the terms of the GNU General Public
  12. #   License, Version 2, or (at your option) any later version.
  13. #
  14. #   The "Roaring Penguin" logo is a trademark of Roaring Penguin Software Inc.
  15. #
  16. #   http://www.roaringpenguin.com
  17. #
  18. #--------------------------------------------------------------
  19.  
  20. # $Id: tkpppoe.in,v 1.48 2005/08/09 02:49:14 dfs Exp $
  21.  
  22. # the next line restarts using wish \
  23. umask 022; \
  24. exec wish "$0" "$@" || clear; echo "*****"; echo "Cannot find 'wish' -- you need Tcl/Tk installed to run this program"; exit 1
  25.  
  26. # Try requiring msgcat (Tcl 8.1 and later)
  27.  
  28. set problem [catch {package require msgcat} err]
  29. if {!$problem} {
  30.     set problem [catch {::msgcat::mcload [file join "/usr/share" tkpppoe]} err]
  31. }
  32. if {$problem} {
  33.     puts "$problem - $err"
  34.     # Oops... leave as English
  35.     proc m { str } { return $str }
  36. } else {
  37.     proc m { str } { ::msgcat::mc $str }
  38. }
  39. # Set app name
  40. tk appname TkPPPoE
  41.  
  42. # Set this to one if you want to allow multiple instances of TkPPPoE
  43. set AllowMultipleInstances 0
  44.  
  45. # Check for other instances
  46. if {"[tk appname]" != "TkPPPoE"} {
  47.     # Must be another instance running...
  48.     if {!$AllowMultipleInstances} {
  49.     send TkPPPoE AnotherInstance
  50.     exit 0
  51.     }
  52. }
  53.  
  54. # Location of config directory
  55. set ConfigDir /etc/ppp/rp-pppoe-gui
  56.  
  57. # Are we running as root?
  58. set Admin 0
  59.  
  60. # Location of connection info file
  61. set ConnectionInfoFile [file join $ConfigDir connection-info]
  62.  
  63. # Location of password file
  64. set PasswordFile [file join $ConfigDir passwd]
  65.  
  66. # Location of "already run" file
  67. set AlreadyRunFile [file join $ConfigDir gui-already-run]
  68.  
  69. # Connection information
  70. set ConnectionInfo {}
  71.  
  72. # Connection options
  73. set OPTS(nonroot) 0
  74. set OPTS(sync) 1
  75.  
  76. # Location of wrapper
  77. set Wrapper "/usr/sbin/pppoe-wrapper"
  78.  
  79. # Timer token for UpdateConnectionState
  80. set UpdateToken {}
  81.  
  82. # Update interval in milliseconds
  83. set UpdateInterval 500
  84.  
  85. # Packet counters for signalling activity
  86. set Packets(in) 0
  87. set Packets(out) 0
  88. set Bytes(in) 0
  89. set Bytes(out) 0
  90. set MeasureTime 0
  91.  
  92. # Set up some options to make it look better
  93. option add *Button.borderWidth 1
  94. option add *Button.Pad 1
  95. option add *Menubutton.borderWidth 1
  96. option add *Menubutton.Pad 1
  97. option add *Entry.Background white
  98.  
  99. # Array holding help strings for windows
  100. array set HelpData {}
  101.  
  102. bind HelpWin <Enter> "HelpWindowEntered %W"
  103. bind HelpWin <Leave> "HelpWindowLeft %W"
  104.  
  105. proc AnotherInstance {} {
  106.     wm deiconify .
  107.     raise .
  108. }
  109.  
  110. #***********************************************************************
  111. # %PROCEDURE: HelpWindowEntered
  112. # %ARGUMENTS:
  113. #  w -- window
  114. # %RETURNS:
  115. #  Nothing
  116. # %DESCRIPTION:
  117. #  Looks for procedure in HelpData; evals it if found.
  118. #***********************************************************************
  119. proc HelpWindowEntered { w } {
  120.     global HelpData
  121.     if {[info exists HelpData($w)]} {
  122.     set cmd "$HelpData($w) Enter"
  123.     uplevel #0 $cmd
  124.     }
  125. }
  126.  
  127. #***********************************************************************
  128. # %PROCEDURE: HelpWindowLeft
  129. # %ARGUMENTS:
  130. #  w -- window
  131. # %RETURNS:
  132. #  Nothing
  133. # %DESCRIPTION:
  134. #  Looks for procedure in HelpData; evals it if found.
  135. #***********************************************************************
  136. proc HelpWindowLeft { w } {
  137.     global HelpData
  138.     if {[info exists HelpData($w)]} {
  139.     set cmd "$HelpData($w) Leave"
  140.     uplevel #0 $cmd
  141.     }
  142. }
  143.  
  144. #***********************************************************************
  145. # %PROCEDURE: RegisterHelpWindow
  146. # %ARGUMENTS:
  147. #  w -- window we need help about
  148. #  helptext -- the help text
  149. #  win -- window in which to put help messages
  150. # %RETURNS:
  151. #  Nothing
  152. # %DESCRIPTION:
  153. #  Sets things up so help text appears in "$win" when mouse enters "$w"
  154. #***********************************************************************
  155. proc RegisterHelpWindow {w helptext win} {
  156.     global HelpData
  157.     set tags [bindtags $w]
  158.     if {[lsearch -exact $tags HelpWin] < 0} {
  159.     lappend tags HelpWin
  160.     bindtags $w $tags
  161.     }
  162.     set HelpData($w) [list HelpInTextWin $helptext $win]
  163. }
  164.  
  165. #***********************************************************************
  166. # %PROCEDURE: HelpInTextWin
  167. # %ARGUMENTS:
  168. #  text -- help text
  169. #  tw -- window in which to write text
  170. #  what -- one of "Enter" or "Leave"
  171. # %RETURNS:
  172. #  Nothing
  173. # %DESCRIPTION:
  174. #  Clears out $tw; if $what is "Enter", puts $text in $tw.
  175. #***********************************************************************
  176. proc HelpInTextWin {text tw what} {
  177.     $tw configure -state normal
  178.     $tw delete 1.0 end
  179.     if {"$what" == "Enter"} {
  180.     $tw insert end $text
  181.     }
  182.     $tw configure -state disabled
  183. }
  184.  
  185.  
  186. #***********************************************************************
  187. # %PROCEDURE: drawLogo
  188. # %ARGUMENTS:
  189. #  c -- canvas to draw logo in
  190. #  bg -- background color of canvas
  191. #  pencolor -- color of the word "Penguin"
  192. # %RETURNS:
  193. #  Nothing
  194. # %DESCRIPTION:
  195. #  Draws Roaring Penguin logo in a Tcl canvas
  196. #***********************************************************************
  197. proc drawLogo { c bg {pengcolor #6699cc} } {
  198.     $c create polygon 372.249 5.182 361.23 5.519 \
  199.         346.164 8.892 316.482 20.023 305.463 17.774 296.468 \
  200.         19.573 288.935 24.97 282.864 33.177 267.348 55.102 \
  201.         254.531 77.814 236.204 125.26 225.635 174.844 \
  202.         221.026 226.113 213.605 228.025 208.658 232.634 \
  203.         225.523 240.28 250.708 243.316 282.752 242.416 \
  204.         320.079 238.818 330.985 193.17 338.181 146.735 \
  205.         338.743 99.963 335.483 76.577 329.524 53.191 345.602 \
  206.         48.131 353.135 45.995 359.768 41.048 342.679 43.184 \
  207.         324.689 40.036 334.583 28.905 348.3 18.674 372.249 \
  208.         5.182 -fill #000000 -outline {} -width 1 -tags logo
  209.  
  210.     $c create line 372.249 5.182 361.23 5.519 \
  211.         346.164 8.892 316.482 20.023 305.463 17.774 296.468 \
  212.         19.573 288.935 24.97 282.864 33.177 267.348 55.102 \
  213.         254.531 77.814 236.204 125.26 225.635 174.844 \
  214.         221.026 226.113 213.605 228.025 208.658 232.634 \
  215.         225.523 240.28 250.708 243.316 282.752 242.416 \
  216.         320.079 238.818 330.985 193.17 338.181 146.735 \
  217.         338.743 99.963 335.483 76.577 329.524 53.191 345.602 \
  218.         48.131 353.135 45.995 359.768 41.048 342.679 43.184 \
  219.         324.689 40.036 334.583 28.905 348.3 18.674 372.249 \
  220.         5.182  -tags logo
  221.  
  222.     $c create polygon 298.605 109.632 290.734 \
  223.         159.328 282.752 182.939 271.958 205.65 262.851 \
  224.         171.133 263.75 138.752 264.537 164.5 271.958 192.833 \
  225.         286.687 157.192 298.605 109.632 -fill #ffffff \
  226.         -outline {} -width 1  -tags logo
  227.  
  228.     $c create line 298.605 109.632 290.734 159.328 \
  229.         282.752 182.939 271.958 205.65 262.851 171.133 \
  230.         263.75 138.752 264.537 164.5 271.958 192.833 286.687 \
  231.         157.192 298.605 109.632  -tags logo
  232.  
  233.     $c create polygon 312.546 30.592 315.132 35.876 \
  234.         310.747 39.586 308.161 34.414 312.546 30.592 -fill \
  235.         #ffffff -outline {} -width 1  -tags logo
  236.  
  237.     $c create line 312.546 30.592 315.132 35.876 \
  238.         310.747 39.586 308.161 34.414 312.546 30.592  -tags logo
  239.  
  240.     $c create polygon 328.624 54.427 322.665 58.7 \
  241.         314.458 61.286 289.16 59.15 284.55 74.665 285.338 \
  242.         90.181 303.214 98.951 308.499 106.259 310.523 \
  243.         116.378 305.913 130.208 312.771 141.563 308.049 \
  244.         167.76 299.729 192.158 279.041 238.593 313.558 \
  245.         233.871 327.388 185.75 335.033 139.989 335.82 96.253 \
  246.         328.624 54.427 -fill #ffffff -outline {} -width 1  -tags logo
  247.  
  248.     $c create line 328.624 54.427 322.665 58.7 \
  249.         314.458 61.286 289.16 59.15 284.55 74.665 285.338 \
  250.         90.181 303.214 98.951 308.499 106.259 310.523 \
  251.         116.378 305.913 130.208 312.771 141.563 308.049 \
  252.         167.76 299.729 192.158 279.041 238.593 313.558 \
  253.         233.871 327.388 185.75 335.033 139.989 335.82 96.253 \
  254.         328.624 54.427  -tags logo
  255.  
  256.     $c create polygon 53.837 185.412 54.399 185.862 \
  257.         53.837 188.223 54.399 188.673 53.837 188.673 53.837 \
  258.         189.572 53.837 190.472 53.387 191.034 52.938 192.833 \
  259.         50.577 195.644 49.677 196.656 49.677 197.105 48.215 \
  260.         198.455 47.316 198.904 46.866 198.904 44.505 200.816 \
  261.         43.606 200.366 42.594 201.265 42.144 201.715 41.245 \
  262.         202.277 40.795 202.727 40.345 202.277 39.783 202.277 \
  263.         36.972 203.177 36.522 203.177 36.073 203.177 35.623 \
  264.         203.627 34.723 203.627 34.161 203.627 34.161 204.076 \
  265.         30.901 204.526 28.54 205.538 26.291 205.088 25.729 \
  266.         205.088 24.829 205.088 24.38 204.526 23.93 204.526 \
  267.         23.48 204.526 22.918 205.088 22.918 206.437 22.918 \
  268.         206.887 22.918 207.337 22.468 207.337 22.468 208.798 \
  269.         22.018 209.248 22.018 211.16 22.018 211.609 21.569 \
  270.         213.521 21.119 215.769 21.569 216.781 20.669 218.13 \
  271.         20.669 219.592 20.669 220.042 20.107 220.941 20.107 \
  272.         221.953 20.107 223.752 19.657 225.664 19.208 226.113 \
  273.         19.657 227.013 18.308 230.835 17.858 240.167 17.296 \
  274.         248.15 17.296 249.05 16.846 250.062 15.947 250.062 \
  275.         15.048 250.062 15.048 250.511 12.686 251.86 12.237 \
  276.         251.86 11.675 251.411 11.675 250.511 11.675 246.689 \
  277.         11.225 245.339 11.225 243.878 10.775 240.617 11.225 \
  278.         239.268 11.225 238.818 10.775 238.256 10.325 237.357 \
  279.         10.325 236.007 9.876 232.634 9.876 231.735 9.876 \
  280.         231.285 9.876 230.835 9.876 230.386 9.876 229.824 \
  281.         9.426 229.374 9.426 226.113 9.876 226.113 9.876 \
  282.         225.664 9.426 224.202 9.426 223.752 9.426 223.302 \
  283.         10.325 221.953 9.426 220.941 9.426 219.592 9.426 \
  284.         219.142 9.426 218.58 9.426 217.681 9.426 217.231 \
  285.         9.426 216.781 8.864 216.332 8.864 214.42 8.864 \
  286.         213.97 8.414 213.521 8.414 210.148 8.414 209.248 \
  287.         7.964 207.899 8.414 205.988 8.414 204.526 7.065 \
  288.         201.265 7.515 200.816 9.426 201.715 10.325 201.265 \
  289.         10.775 200.816 10.775 198.904 11.225 198.005 11.225 \
  290.         197.555 10.775 197.555 9.876 196.094 9.426 194.744 \
  291.         7.515 194.295 6.615 193.845 6.053 193.845 5.153 \
  292.         193.283 3.804 191.484 3.804 190.022 3.804 189.572 \
  293.         3.804 189.123 3.242 188.673 3.242 186.762 3.804 \
  294.         185.412 4.254 184.85 4.704 184.4 7.964 180.24 10.325 \
  295.         178.779 11.225 178.779 12.237 177.879 14.036 176.98 \
  296.         15.497 175.968 21.569 173.607 22.918 173.157 23.48 \
  297.         173.157 24.38 172.707 24.829 172.707 29.102 171.808 \
  298.         29.551 171.808 30.001 171.358 31.35 170.796 31.913 \
  299.         171.358 32.362 170.796 39.783 171.358 40.345 170.796 \
  300.         42.144 171.358 47.766 174.619 48.778 176.418 49.227 \
  301.         176.418 49.677 176.98 50.127 176.98 51.588 178.329 \
  302.         52.038 179.228 52.488 180.69 52.038 181.14 52.038 \
  303.         181.59 52.488 182.039 52.938 182.039 53.387 182.601 \
  304.         53.837 183.051 53.837 183.501 53.837 185.412 -fill \
  305.         $pengcolor -outline {} -width 1  -tags logo
  306.  
  307.     $c create polygon 42.594 222.853 43.156 221.953 \
  308.         41.694 222.403 39.783 224.202 39.783 224.764 39.783 \
  309.         225.214 40.345 225.214 41.245 224.202 41.694 223.752 \
  310.         42.594 222.853 -fill $pengcolor -outline {} -width 1  -tags logo
  311.  
  312.     $c create polygon 58.559 234.096 59.009 234.096 \
  313.         59.009 234.546 58.559 234.995 58.559 235.445 57.21 \
  314.         236.907 56.648 237.806 52.938 241.067 52.038 241.629 \
  315.         52.038 242.079 51.026 242.529 50.577 242.978 50.127 \
  316.         242.978 49.227 244.44 45.405 246.239 44.055 246.689 \
  317.         43.606 246.689 43.606 247.251 42.144 247.251 41.694 \
  318.         247.7 40.795 247.7 38.434 248.15 36.522 248.15 \
  319.         35.173 247.7 34.161 246.689 33.711 246.239 32.812 \
  320.         244.44 32.362 241.629 32.812 239.718 32.812 239.268 \
  321.         33.711 234.995 36.522 229.824 35.623 228.474 35.623 \
  322.         227.013 36.522 225.664 37.534 224.202 38.883 222.853 \
  323.         41.694 220.492 42.594 219.592 43.156 219.592 43.606 \
  324.         219.142 45.405 217.681 45.967 217.681 46.416 217.231 \
  325.         48.778 215.769 52.038 214.87 53.387 214.42 54.849 \
  326.         214.87 55.299 214.87 56.198 215.769 56.198 217.681 \
  327.         56.198 218.58 54.399 221.953 53.837 222.853 53.837 \
  328.         223.302 53.387 223.752 50.577 226.113 49.677 226.563 \
  329.         47.316 228.474 43.156 230.386 41.245 230.835 40.795 \
  330.         230.835 40.345 230.835 39.333 230.835 38.883 230.835 \
  331.         38.883 229.824 39.783 229.374 40.795 228.474 41.694 \
  332.         228.025 42.594 227.575 45.967 227.013 46.866 226.563 \
  333.         50.127 224.764 51.588 223.302 52.488 221.953 52.488 \
  334.         220.492 52.488 219.142 51.026 218.13 49.677 218.13 \
  335.         48.778 218.13 47.766 219.142 47.316 219.142 47.316 \
  336.         219.592 46.866 219.592 45.967 220.941 44.505 221.953 \
  337.         44.055 222.403 43.606 222.853 42.594 223.752 41.694 \
  338.         225.664 41.245 225.664 41.245 226.113 40.345 226.563 \
  339.         39.333 227.575 39.333 228.474 38.434 229.374 36.522 \
  340.         233.197 35.623 236.457 35.623 237.357 35.623 238.256 \
  341.         35.173 241.067 35.623 242.079 36.522 243.428 37.534 \
  342.         243.878 37.984 244.44 38.434 244.89 38.883 244.89 \
  343.         39.783 245.339 43.156 245.339 45.967 244.44 49.227 \
  344.         242.529 50.127 241.629 50.577 241.067 54.399 238.818 \
  345.         54.399 238.256 54.399 237.806 56.198 236.907 58.559 \
  346.         234.096 -fill $pengcolor -outline {} -width 1  -tags logo
  347.  
  348.     $c create polygon 92.289 248.6 92.739 249.05 \
  349.         92.289 249.05 91.84 249.05 90.94 248.6 90.378 248.6 \
  350.         89.478 247.7 89.029 247.251 88.129 246.689 87.117 \
  351.         245.789 85.768 244.89 85.318 244.44 85.768 244.44 \
  352.         85.318 242.529 84.756 242.079 84.756 240.617 84.756 \
  353.         240.167 84.756 239.718 84.756 239.268 83.857 236.457 \
  354.         83.407 234.096 83.407 233.197 83.407 231.735 83.407 \
  355.         223.302 83.407 221.391 82.957 220.941 82.508 221.953 \
  356.         80.596 226.113 80.146 226.563 80.146 227.013 79.697 \
  357.         228.025 79.135 228.474 79.697 228.474 76.324 234.096 \
  358.         75.874 234.995 75.424 236.457 74.975 236.457 74.975 \
  359.         236.907 74.975 237.357 74.075 239.268 73.513 239.718 \
  360.         73.063 240.167 72.613 241.067 72.164 242.529 71.714 \
  361.         242.529 71.714 243.878 70.252 245.789 69.803 246.689 \
  362.         68.903 246.689 68.903 247.251 67.891 247.7 66.542 \
  363.         247.7 66.092 247.7 65.643 247.7 65.08 247.251 65.08 \
  364.         246.689 65.08 245.789 64.631 242.079 65.08 242.079 \
  365.         64.631 241.629 65.08 241.067 65.08 238.818 64.631 \
  366.         237.806 64.631 236.457 64.631 234.546 64.631 233.197 \
  367.         64.631 232.634 64.631 232.185 64.631 231.735 64.631 \
  368.         228.924 64.631 227.575 64.631 225.664 64.631 225.214 \
  369.         64.631 224.764 64.631 223.302 64.631 217.231 65.08 \
  370.         216.332 65.643 215.769 69.803 214.87 70.252 215.32 \
  371.         70.252 216.332 70.252 217.681 70.252 218.58 69.803 \
  372.         219.142 69.803 220.492 69.353 220.941 69.353 221.391 \
  373.         68.903 221.953 68.903 225.664 68.453 226.563 68.453 \
  374.         228.025 68.453 228.474 67.891 228.924 67.891 230.835 \
  375.         68.453 236.457 68.453 237.806 68.453 238.818 68.453 \
  376.         240.617 68.453 241.067 68.903 241.067 68.903 241.629 \
  377.         69.353 241.629 70.702 241.067 70.702 240.617 71.264 \
  378.         240.167 71.264 239.268 72.164 238.256 73.063 236.457 \
  379.         74.525 234.546 74.975 233.197 76.324 230.835 77.336 \
  380.         229.824 78.235 227.575 78.235 227.013 78.685 226.563 \
  381.         78.685 225.664 79.135 225.214 79.697 224.764 79.697 \
  382.         224.202 80.146 222.403 81.046 220.941 81.945 217.681 \
  383.         82.957 215.769 85.318 214.87 85.768 214.87 87.567 \
  384.         214.42 87.567 215.769 87.117 216.332 87.567 216.781 \
  385.         88.129 219.592 87.567 219.592 87.567 220.492 87.567 \
  386.         221.391 87.567 224.764 87.567 225.664 87.567 226.113 \
  387.         87.117 226.113 87.117 227.575 87.567 229.374 88.579 \
  388.         235.445 89.029 239.268 89.029 239.718 89.029 241.067 \
  389.         89.478 242.529 89.478 242.978 89.928 243.878 89.928 \
  390.         244.44 90.378 244.89 90.94 246.239 92.289 248.6 \
  391.         -fill $pengcolor -outline {} -width 1  -tags logo
  392.  
  393.     $c create polygon 117.587 220.492 118.037 \
  394.         222.403 117.587 222.853 117.587 224.764 116.687 \
  395.         226.113 116.687 227.013 116.238 228.025 114.776 \
  396.         229.374 113.877 231.285 112.865 231.735 109.154 \
  397.         234.995 106.343 236.457 105.444 237.357 103.982 \
  398.         237.806 103.083 238.256 102.633 238.818 102.183 \
  399.         238.818 101.172 239.268 99.822 239.718 98.361 \
  400.         239.268 97.461 239.718 96.562 239.268 96.0 238.818 \
  401.         95.55 238.818 94.201 236.907 94.201 235.445 94.201 \
  402.         233.646 94.65 233.197 94.65 232.634 95.1 232.185 \
  403.         95.1 231.735 95.55 231.735 96.0 230.386 97.461 \
  404.         228.025 97.461 227.575 98.361 226.563 99.822 224.764 \
  405.         101.172 223.302 101.172 222.853 102.633 221.391 \
  406.         103.083 220.941 104.432 219.592 103.982 218.58 \
  407.         103.982 217.231 103.982 216.781 103.982 215.32 \
  408.         104.432 214.42 103.982 210.148 103.982 209.698 \
  409.         103.982 209.248 104.432 208.798 104.432 207.899 \
  410.         104.432 205.988 104.432 205.538 104.994 203.177 \
  411.         104.994 202.277 104.994 201.265 104.994 200.816 \
  412.         104.994 200.366 104.994 199.916 105.894 199.467 \
  413.         106.343 198.904 106.793 198.455 107.243 198.904 \
  414.         108.255 198.904 108.255 199.467 108.705 199.467 \
  415.         108.705 202.727 108.255 204.076 108.255 205.538 \
  416.         108.255 205.988 107.805 205.988 107.805 206.887 \
  417.         107.805 209.698 107.243 210.71 106.793 212.059 \
  418.         106.343 214.87 106.343 215.32 106.343 215.769 \
  419.         105.894 217.681 106.343 217.681 106.793 217.681 \
  420.         107.243 217.231 108.705 215.32 109.604 215.32 \
  421.         110.054 214.42 110.054 213.97 110.616 213.97 110.616 \
  422.         214.42 111.965 214.87 112.415 214.87 112.865 215.32 \
  423.         114.326 216.332 116.238 217.681 116.687 218.58 \
  424.         117.137 219.592 117.587 220.042 117.587 220.492 \
  425.         -fill $pengcolor -outline {} -width 1  -tags logo
  426.  
  427.     $c create polygon 123.658 258.944 123.658 \
  428.         259.394 123.658 260.293 123.658 261.755 123.658 \
  429.         262.654 123.658 263.104 123.209 266.364 123.209 \
  430.         267.376 122.759 269.175 122.309 269.737 121.859 \
  431.         271.087 121.859 271.536 121.859 271.986 121.297 \
  432.         271.986 121.297 272.548 120.847 273.448 120.398 \
  433.         273.448 120.398 273.897 118.486 276.259 118.037 \
  434.         276.708 117.587 277.608 117.137 278.17 116.687 \
  435.         278.17 115.675 278.62 115.675 279.069 113.427 \
  436.         280.419 112.865 280.981 112.415 280.981 111.965 \
  437.         281.43 110.054 282.33 109.154 282.33 108.705 282.78 \
  438.         108.255 282.78 107.805 283.229 104.994 283.792 \
  439.         104.432 283.792 103.982 283.792 103.533 283.792 \
  440.         103.083 283.792 102.633 283.792 102.183 283.792 \
  441.         101.172 283.792 100.722 283.792 99.822 283.792 98.81 \
  442.         283.792 96.562 282.33 96.0 282.78 95.1 281.88 94.201 \
  443.         281.43 91.84 279.969 92.289 279.519 92.289 278.62 \
  444.         93.751 279.069 93.751 279.519 94.201 279.519 94.65 \
  445.         279.969 95.1 279.969 96.0 280.981 98.81 281.88 \
  446.         101.172 281.88 101.621 281.88 102.633 281.88 103.083 \
  447.         281.88 103.533 281.88 104.432 281.43 104.994 281.88 \
  448.         105.444 281.43 106.793 281.43 107.805 280.981 \
  449.         108.705 280.419 109.154 280.419 109.604 279.969 \
  450.         110.054 279.969 110.616 279.969 111.066 279.519 \
  451.         112.865 278.17 113.427 277.608 113.877 277.608 \
  452.         113.877 277.158 114.326 277.158 114.326 276.708 \
  453.         114.776 276.259 115.226 276.259 116.238 274.347 \
  454.         116.687 274.347 116.687 273.897 117.587 272.998 \
  455.         117.587 272.548 118.037 271.986 119.498 267.826 \
  456.         120.398 265.015 120.398 262.204 119.948 259.843 \
  457.         119.948 259.394 119.948 258.944 119.498 257.482 \
  458.         118.486 254.222 118.037 253.772 117.587 251.86 \
  459.         115.675 249.05 115.226 248.6 114.776 248.15 113.877 \
  460.         247.251 111.965 246.239 111.515 246.239 110.616 \
  461.         246.239 110.054 246.239 109.154 246.239 107.243 \
  462.         247.251 106.343 247.251 105.444 247.7 104.994 247.7 \
  463.         103.083 248.15 102.183 248.6 101.621 248.6 101.172 \
  464.         249.05 100.722 249.499 99.822 250.062 98.361 250.062 \
  465.         97.461 249.499 97.012 249.499 96.562 249.05 96.562 \
  466.         248.6 97.012 248.15 99.822 245.789 100.272 245.339 \
  467.         101.621 244.44 101.621 243.878 102.183 243.428 \
  468.         102.633 243.428 102.633 242.978 103.982 241.629 \
  469.         103.982 241.067 103.982 240.617 103.982 240.167 \
  470.         105.444 239.268 108.705 236.907 108.705 236.457 \
  471.         109.154 236.457 110.054 235.445 111.066 234.546 \
  472.         112.415 234.096 112.865 233.646 113.427 233.646 \
  473.         113.877 233.646 113.877 234.096 114.326 234.995 \
  474.         114.776 235.445 114.776 236.457 114.326 237.357 \
  475.         113.427 238.818 112.415 239.268 112.415 240.167 \
  476.         111.965 240.167 111.515 240.617 110.054 241.629 \
  477.         110.054 242.079 109.604 242.529 108.705 242.978 \
  478.         110.054 242.978 113.427 242.079 114.326 242.529 \
  479.         115.226 242.978 116.687 244.44 119.048 246.689 \
  480.         119.498 247.7 119.498 248.15 119.948 248.6 119.948 \
  481.         249.05 120.398 249.05 120.398 249.499 120.847 \
  482.         249.499 120.847 250.062 121.297 250.511 121.297 \
  483.         251.411 121.859 252.31 122.759 252.872 122.759 \
  484.         254.222 122.759 254.671 123.658 258.494 123.658 \
  485.         258.944 -fill $pengcolor -outline {} -width 1  -tags logo
  486.  
  487.     $c create polygon 147.607 215.769 148.506 215.32 \
  488.         148.506 217.231 148.506 217.681 148.506 218.13 \
  489.         148.956 218.58 148.506 220.492 148.506 220.941 \
  490.         148.506 222.853 148.956 224.764 148.956 226.113 \
  491.         148.506 226.563 148.956 226.563 148.506 228.924 \
  492.         148.956 229.824 148.956 231.285 148.506 232.185 \
  493.         148.956 232.634 148.956 233.646 149.405 234.995 \
  494.         148.956 234.995 149.405 235.445 149.405 236.907 \
  495.         149.405 237.357 149.968 238.818 150.867 240.167 \
  496.         150.867 240.617 151.317 242.079 152.216 243.428 \
  497.         153.228 245.339 154.128 245.789 155.027 246.239 \
  498.         156.939 245.789 157.388 246.239 156.489 246.689 \
  499.         155.027 247.7 154.128 247.7 153.228 247.7 152.216 \
  500.         247.7 151.767 247.7 150.867 247.251 150.417 246.239 \
  501.         149.405 246.239 148.056 245.339 147.607 244.44 \
  502.         147.157 243.428 145.695 241.629 145.695 240.617 \
  503.         145.245 240.167 145.245 239.718 144.796 238.256 \
  504.         144.346 236.907 144.346 235.445 143.784 234.546 \
  505.         143.784 233.197 143.784 232.185 143.784 230.835 \
  506.         143.334 229.824 143.784 229.374 143.334 229.374 \
  507.         143.334 228.474 142.884 230.386 141.985 231.735 \
  508.         140.973 233.197 140.523 234.096 140.523 234.546 \
  509.         140.523 234.995 139.624 236.457 139.174 237.806 \
  510.         138.162 239.718 137.263 241.067 136.813 242.079 \
  511.         135.913 242.978 134.452 244.89 134.002 245.789 \
  512.         133.552 245.789 132.091 246.689 131.191 247.251 \
  513.         129.73 248.15 129.28 248.15 128.38 247.7 128.38 \
  514.         248.15 126.919 247.7 126.019 247.251 125.12 246.239 \
  515.         125.12 245.339 124.67 244.89 124.67 244.44 124.67 \
  516.         243.428 124.67 242.529 124.67 241.067 124.67 239.718 \
  517.         125.12 239.268 124.67 239.268 124.67 238.256 125.12 \
  518.         237.806 125.12 237.357 125.12 236.907 125.12 236.007 \
  519.         125.12 234.096 125.57 233.197 125.57 232.185 126.019 \
  520.         232.185 126.019 231.285 126.019 230.386 126.019 \
  521.         229.374 126.469 228.474 126.469 227.013 126.469 \
  522.         225.214 126.019 225.214 126.469 225.214 126.019 \
  523.         223.302 126.019 221.953 126.019 220.492 125.57 \
  524.         220.042 125.12 219.592 124.108 219.142 123.209 \
  525.         219.142 121.859 220.042 121.297 220.042 120.398 \
  526.         220.941 119.498 221.391 119.048 221.391 118.486 \
  527.         221.953 118.037 221.953 118.037 221.391 118.486 \
  528.         220.941 119.498 220.042 120.847 219.142 122.759 \
  529.         217.681 124.108 216.781 125.12 215.769 126.469 \
  530.         214.87 126.919 214.87 127.481 214.87 128.38 214.87 \
  531.         128.83 214.87 129.73 214.87 129.73 215.769 130.292 \
  532.         215.769 130.742 216.781 130.742 217.681 130.292 \
  533.         219.142 130.292 221.953 130.292 223.302 130.292 \
  534.         224.202 129.73 225.214 129.28 227.013 128.83 227.575 \
  535.         129.28 227.575 129.28 228.474 128.83 229.374 129.28 \
  536.         229.824 129.28 230.386 128.83 231.735 128.38 234.096 \
  537.         128.38 234.995 127.931 236.457 127.931 239.268 \
  538.         127.931 240.167 127.931 241.629 128.83 242.978 \
  539.         129.28 243.878 129.73 244.44 130.742 244.44 131.191 \
  540.         244.44 132.091 244.44 133.103 243.878 134.002 \
  541.         242.978 134.902 242.079 135.351 241.067 135.913 \
  542.         240.167 136.363 239.268 136.813 238.818 137.263 \
  543.         237.806 137.712 236.907 138.162 235.445 138.724 \
  544.         234.546 139.174 233.646 139.624 232.634 140.523 \
  545.         230.835 140.973 228.924 141.535 227.013 142.435 \
  546.         225.664 142.884 223.302 143.334 221.391 143.334 \
  547.         220.941 143.334 219.142 144.346 217.681 144.796 \
  548.         216.781 145.695 216.332 146.595 216.332 147.607 \
  549.         215.769 -fill $pengcolor -outline {} -width 1  -tags logo
  550.  
  551.     $c create polygon 165.371 241.067 165.371 \
  552.         241.067 164.921 243.878 164.921 246.239 163.46 \
  553.         246.689 161.211 247.251 160.649 247.251 160.199 \
  554.         244.44 160.199 243.878 160.199 243.428 160.199 \
  555.         242.079 160.199 240.167 160.199 239.718 159.749 \
  556.         239.268 160.199 237.806 159.749 237.357 159.749 \
  557.         236.007 159.749 230.835 159.749 229.824 159.749 \
  558.         228.924 159.749 226.113 159.749 225.664 159.749 \
  559.         223.752 159.749 222.853 159.749 218.58 159.749 \
  560.         218.13 159.749 217.681 160.199 217.231 161.661 \
  561.         216.781 162.11 216.781 162.56 216.781 163.46 216.781 \
  562.         164.022 219.142 163.46 222.403 163.46 222.853 163.46 \
  563.         224.202 163.46 225.664 163.46 226.563 163.46 227.013 \
  564.         163.46 228.924 163.01 230.835 163.01 232.634 163.46 \
  565.         233.197 164.022 232.634 164.472 232.634 164.921 \
  566.         232.185 164.921 231.735 165.371 231.735 165.821 \
  567.         232.185 165.371 233.646 165.821 236.007 165.371 \
  568.         238.256 165.371 238.818 165.371 240.617 165.371 \
  569.         241.067 -fill $pengcolor -outline {} -width 1  -tags logo
  570.  
  571.     $c create polygon 165.821 214.42 166.833 215.32 \
  572.         166.271 215.32 165.821 216.332 165.371 216.332 \
  573.         165.371 216.781 165.821 217.681 165.821 218.13 \
  574.         165.371 219.142 165.371 220.042 164.921 222.853 \
  575.         165.371 224.764 164.921 225.664 165.371 227.575 \
  576.         165.371 228.474 164.921 228.474 164.472 227.575 \
  577.         164.472 226.113 164.022 224.764 164.472 224.202 \
  578.         164.472 223.752 164.472 222.403 164.921 214.87 \
  579.         164.472 213.521 164.472 212.959 164.472 212.509 \
  580.         164.022 212.509 163.46 212.509 163.01 212.959 162.56 \
  581.         212.959 161.661 212.959 161.211 212.059 161.211 \
  582.         211.609 160.649 211.609 160.199 209.698 160.649 \
  583.         208.349 163.46 206.437 164.472 206.437 165.821 \
  584.         207.899 165.821 208.349 166.833 210.148 166.833 \
  585.         210.71 165.821 211.609 165.371 212.059 165.371 \
  586.         212.959 165.821 213.97 165.821 214.42 -fill $pengcolor \
  587.         -outline {} -width 1  -tags logo
  588.  
  589.     $c create polygon 201.462 248.6 201.462 249.05 \
  590.         201.012 249.05 200.563 249.05 200.001 248.6 199.551 \
  591.         248.6 198.651 247.7 197.752 247.251 196.74 246.689 \
  592.         196.29 245.789 194.379 244.89 194.379 244.44 194.379 \
  593.         242.529 193.929 242.079 193.479 240.617 193.479 \
  594.         240.167 193.929 239.718 193.479 239.268 193.03 \
  595.         236.457 192.58 234.096 192.58 233.197 192.58 231.735 \
  596.         192.58 223.302 192.58 221.391 192.13 220.941 191.568 \
  597.         221.953 189.769 226.113 189.319 226.563 189.319 \
  598.         227.013 188.757 228.025 188.307 228.474 188.757 \
  599.         228.474 185.497 234.096 185.047 234.995 184.597 \
  600.         236.457 184.147 236.457 184.147 236.907 184.147 \
  601.         237.357 183.136 239.268 182.686 239.268 182.686 \
  602.         239.718 182.236 240.167 181.786 241.067 181.337 \
  603.         242.529 180.887 242.529 180.887 243.878 179.425 \
  604.         245.789 178.975 246.689 178.076 246.689 178.076 \
  605.         247.251 177.064 247.7 175.715 247.7 175.265 247.7 \
  606.         174.703 247.7 174.253 247.251 174.253 246.689 \
  607.         174.253 245.789 173.804 242.079 174.253 242.079 \
  608.         173.804 241.629 173.804 241.067 173.804 238.818 \
  609.         173.804 237.806 173.804 236.457 173.354 234.546 \
  610.         173.354 233.197 173.804 232.634 173.804 232.185 \
  611.         173.804 231.735 173.804 228.924 173.354 227.575 \
  612.         173.804 227.575 173.804 225.664 173.804 225.214 \
  613.         173.804 224.764 173.804 223.302 173.804 217.231 \
  614.         174.253 216.332 174.703 215.769 178.526 214.87 \
  615.         179.425 215.32 179.425 216.332 179.425 217.681 \
  616.         179.425 218.58 178.975 219.142 178.526 220.492 \
  617.         178.526 220.941 178.076 221.391 178.076 221.953 \
  618.         178.076 225.664 177.514 226.563 177.514 228.025 \
  619.         177.064 228.474 177.064 228.924 177.064 230.835 \
  620.         177.514 236.457 177.064 237.806 177.514 237.806 \
  621.         177.514 238.818 177.514 240.617 177.514 241.067 \
  622.         178.076 241.629 178.526 241.629 179.425 241.067 \
  623.         179.875 240.617 179.875 240.167 180.325 239.268 \
  624.         181.337 238.256 182.236 236.457 183.698 234.546 \
  625.         184.147 233.197 185.497 230.835 186.509 229.824 \
  626.         187.408 227.575 187.408 227.013 187.408 226.563 \
  627.         187.858 225.664 188.307 225.214 188.757 224.764 \
  628.         188.757 224.202 189.319 222.403 190.219 220.941 \
  629.         191.118 217.681 192.13 215.769 194.379 214.87 \
  630.         194.941 214.87 196.74 214.42 196.74 215.769 196.29 \
  631.         215.769 196.29 216.332 196.29 216.781 196.74 219.592 \
  632.         196.74 220.492 196.29 221.391 196.74 224.764 196.29 \
  633.         225.664 196.29 226.113 196.29 227.575 196.74 229.374 \
  634.         197.19 235.445 198.202 239.268 198.202 239.718 \
  635.         198.202 241.067 198.202 242.529 198.651 242.978 \
  636.         199.101 243.878 199.101 244.44 199.551 244.89 \
  637.         200.001 246.239 201.462 248.6 -fill $pengcolor -outline \
  638.         {} -width 1  -tags logo
  639.  
  640.     $c create polygon 71.714 185.412 71.714 110.869 \
  641.         81.496 110.869 82.845 110.981 83.969 111.431 85.094 \
  642.         112.106 86.105 113.118 86.893 114.467 87.567 116.041 \
  643.         88.017 117.39 88.242 118.065 88.467 118.852 88.579 \
  644.         119.639 88.804 120.538 88.916 121.438 89.029 122.337 \
  645.         89.141 123.349 89.254 124.361 89.366 125.485 89.366 \
  646.         126.61 89.478 127.734 89.478 128.971 89.478 130.208 \
  647.         89.478 131.444 89.478 132.456 89.478 133.468 89.478 \
  648.         134.48 89.366 135.492 89.254 136.391 89.254 137.291 \
  649.         89.141 138.19 89.029 139.09 88.916 139.877 88.804 \
  650.         140.664 88.691 141.451 88.579 142.238 88.354 143.362 \
  651.         88.129 144.374 87.904 145.386 87.567 146.398 87.342 \
  652.         147.297 87.005 148.197 86.668 148.984 86.218 149.771 \
  653.         87.005 151.233 87.342 152.02 87.68 152.919 87.904 \
  654.         153.931 88.129 154.943 88.129 155.505 88.354 156.854 \
  655.         88.354 157.641 88.354 158.428 88.467 159.328 88.467 \
  656.         160.34 88.467 161.352 88.467 162.476 88.579 163.6 \
  657.         88.579 164.837 88.579 166.186 88.579 166.973 88.691 \
  658.         167.873 88.804 168.885 88.916 169.897 89.029 171.021 \
  659.         89.029 172.258 89.029 173.719 89.029 175.068 89.029 \
  660.         176.305 89.029 177.542 89.141 178.554 89.141 179.566 \
  661.         89.141 180.353 89.141 181.14 89.254 181.814 89.366 \
  662.         182.714 89.478 183.051 89.478 185.412 83.857 185.412 \
  663.         83.857 184.738 83.744 183.951 83.744 183.276 83.744 \
  664.         182.489 83.744 180.803 83.857 179.791 83.857 178.891 \
  665.         83.857 177.879 83.857 176.867 83.857 175.743 83.857 \
  666.         174.619 83.857 173.27 83.857 172.033 83.744 170.908 \
  667.         83.744 170.009 83.632 169.109 83.632 168.322 83.52 \
  668.         166.973 83.407 166.524 83.407 166.186 83.407 165.062 \
  669.         83.407 164.05 83.295 163.151 83.295 162.251 83.295 \
  670.         161.464 83.182 160.789 82.957 159.553 81.945 158.203 \
  671.         80.596 157.754 76.886 157.754 76.886 185.412 71.714 \
  672.         185.412 -fill #000000 -outline {} -width 1  -tags logo
  673.  
  674.     $c create polygon 92.289 148.309 92.289 147.185 \
  675.         92.289 146.061 92.289 145.049 92.402 143.924 92.402 \
  676.         142.8 92.402 141.788 92.402 140.664 92.514 139.652 \
  677.         92.514 138.64 92.627 137.628 92.627 136.616 92.739 \
  678.         135.717 92.739 134.705 92.851 133.805 92.964 132.793 \
  679.         92.964 131.894 93.076 130.995 93.301 129.196 93.414 \
  680.         128.409 93.526 127.509 93.639 126.722 93.751 125.935 \
  681.         93.863 125.148 93.976 124.361 94.313 122.787 94.426 \
  682.         122.112 94.65 121.325 94.763 120.651 95.1 119.301 \
  683.         95.55 117.615 96.112 116.041 96.674 114.692 97.236 \
  684.         113.455 97.799 112.443 98.361 111.544 99.035 110.757 \
  685.         99.71 110.082 100.385 109.632 101.059 109.295 \
  686.         101.846 109.07 102.633 108.958 104.207 109.295 \
  687.         104.882 109.632 105.556 110.082 106.231 110.757 \
  688.         106.906 111.544 107.468 112.443 108.03 113.455 \
  689.         108.592 114.692 109.154 116.041 109.604 117.615 \
  690.         110.054 119.301 110.279 119.976 110.616 121.325 \
  691.         110.841 122.112 110.953 122.787 111.178 123.574 \
  692.         111.403 125.148 111.628 125.935 111.74 126.722 \
  693.         111.853 127.622 111.965 128.409 112.078 129.308 \
  694.         112.19 130.208 112.302 130.995 112.415 132.006 \
  695.         112.64 133.805 112.752 134.817 112.865 135.717 \
  696.         112.977 136.729 112.977 137.741 113.089 138.752 \
  697.         113.089 139.764 113.202 140.776 113.202 141.788 \
  698.         113.314 142.912 113.314 143.924 113.314 145.049 \
  699.         113.427 146.061 113.427 147.185 113.427 148.309 \
  700.         113.427 149.546 113.314 150.783 113.314 151.907 \
  701.         113.314 153.032 113.314 154.156 113.202 155.28 \
  702.         113.202 156.405 113.089 157.529 113.089 158.541 \
  703.         112.977 159.553 112.865 160.565 112.752 161.576 \
  704.         112.64 162.588 112.527 163.6 112.415 164.5 112.302 \
  705.         165.512 112.19 166.411 112.078 167.311 111.965 \
  706.         168.21 111.853 169.109 111.628 169.897 111.515 \
  707.         170.796 111.403 171.583 111.178 172.37 111.066 \
  708.         173.157 110.616 174.731 110.504 175.518 110.279 \
  709.         176.193 110.054 176.98 109.604 178.666 109.154 \
  710.         180.128 108.592 181.59 108.03 182.826 107.468 \
  711.         183.951 106.906 184.963 106.231 185.75 105.556 \
  712.         186.424 104.882 186.986 104.207 187.436 103.42 \
  713.         187.661 102.633 187.661 101.846 187.661 101.059 \
  714.         187.436 100.385 186.986 99.71 186.424 99.035 185.75 \
  715.         98.361 184.963 97.799 183.951 97.236 182.826 96.674 \
  716.         181.59 96.112 180.128 95.55 178.666 95.1 176.98 \
  717.         94.988 176.193 94.763 175.518 94.538 174.731 94.426 \
  718.         173.944 94.088 172.37 93.976 171.583 93.863 170.796 \
  719.         93.639 169.897 93.526 169.109 93.414 168.21 93.301 \
  720.         167.311 93.189 166.411 93.076 165.512 92.964 164.5 \
  721.         92.964 163.6 92.851 162.588 92.739 161.576 92.627 \
  722.         160.565 92.627 159.553 92.514 158.541 92.514 157.529 \
  723.         92.514 156.405 92.402 155.28 92.402 154.156 92.402 \
  724.         153.032 92.289 151.907 92.289 150.783 92.289 149.546 \
  725.         92.289 148.309 -fill #000000 -outline {} -width 1  -tags logo
  726.  
  727.     $c create polygon 121.859 110.869 127.481 \
  728.         110.869 134.902 185.412 129.28 185.412 127.931 \
  729.         171.808 120.847 171.808 119.948 185.412 114.326 \
  730.         185.412 121.859 110.869 -fill #000000 -outline {} \
  731.         -width 1  -tags logo
  732.  
  733.     $c create polygon 137.263 185.412 137.263 \
  734.         110.869 147.157 110.869 148.394 110.981 149.518 \
  735.         111.431 150.417 112.106 151.317 113.118 152.104 \
  736.         114.467 152.778 116.041 153.228 117.39 153.341 \
  737.         118.065 153.566 118.852 153.903 120.538 154.015 \
  738.         121.438 154.128 122.337 154.24 123.349 154.353 \
  739.         124.361 154.465 125.485 154.465 126.61 154.577 \
  740.         127.734 154.577 128.971 154.577 130.208 154.577 \
  741.         131.444 154.577 132.456 154.577 133.468 154.577 \
  742.         134.48 154.577 135.492 154.577 136.391 154.577 \
  743.         137.291 154.577 138.19 154.465 139.09 154.465 \
  744.         139.877 154.353 140.664 154.24 141.451 154.128 \
  745.         142.238 153.903 143.362 153.678 144.374 153.341 \
  746.         145.386 153.003 146.398 152.554 147.297 152.216 \
  747.         148.197 151.767 148.984 151.317 149.771 152.104 \
  748.         151.233 152.441 152.02 152.778 152.919 153.003 \
  749.         153.931 153.228 154.943 153.341 155.505 153.453 \
  750.         156.854 153.566 157.641 153.678 158.428 153.79 \
  751.         159.328 153.903 160.34 154.015 161.352 154.015 \
  752.         162.476 154.128 163.6 154.128 164.837 154.128 \
  753.         166.186 154.128 166.973 154.128 167.873 154.128 \
  754.         168.885 154.128 169.897 154.128 171.021 154.128 \
  755.         172.258 154.128 173.719 154.24 175.068 154.24 \
  756.         176.305 154.353 177.542 154.353 178.554 154.465 \
  757.         179.566 154.577 180.353 154.69 181.14 154.69 181.814 \
  758.         154.915 182.714 155.027 183.051 155.027 185.412 \
  759.         149.405 185.412 149.405 184.738 149.293 183.951 \
  760.         149.293 183.276 149.181 182.489 149.181 180.803 \
  761.         149.068 179.791 149.068 178.891 149.068 177.879 \
  762.         149.068 176.867 148.956 175.743 148.956 174.619 \
  763.         148.956 173.27 148.956 172.033 148.956 170.908 \
  764.         148.956 170.009 148.956 169.109 148.956 168.322 \
  765.         148.956 166.973 148.956 166.524 148.956 166.186 \
  766.         148.956 165.062 148.843 164.05 148.731 163.151 \
  767.         148.618 162.251 148.506 161.464 148.394 160.789 \
  768.         148.056 159.553 147.269 158.203 146.145 157.754 \
  769.         142.435 157.754 142.435 185.412 137.263 185.412 \
  770.         -fill #000000 -outline {} -width 1  -tags logo
  771.  
  772.     $c create polygon 158.4 185.412 158.4 110.869 \
  773.         164.022 110.869 164.022 185.412 158.4 185.412 -fill \
  774.         #000000 -outline {} -width 1  -tags logo
  775.  
  776.     $c create polygon 168.182 185.412 168.182 \
  777.         110.869 173.804 110.869 177.514 135.267 177.739 \
  778.         136.054 177.851 136.954 177.964 137.853 178.076 \
  779.         138.752 178.301 139.539 178.413 140.439 178.526 \
  780.         141.338 178.751 143.137 178.975 144.037 179.088 \
  781.         144.824 179.2 145.723 179.313 146.623 179.425 147.41 \
  782.         179.538 148.422 179.763 149.321 179.875 150.333 \
  783.         180.1 151.233 180.212 152.132 180.437 153.032 180.55 \
  784.         154.043 180.774 154.943 180.887 155.842 180.999 \
  785.         156.742 181.224 157.754 181.337 158.653 181.337 \
  786.         157.641 181.224 156.629 181.224 155.617 181.224 \
  787.         154.606 181.224 153.594 181.112 152.582 181.112 \
  788.         151.682 181.112 150.67 180.999 149.771 180.999 \
  789.         148.759 180.999 147.86 180.887 146.96 180.887 \
  790.         145.948 180.887 145.049 180.887 144.149 180.887 \
  791.         143.25 180.887 142.125 180.887 141.114 180.887 \
  792.         140.102 180.887 139.09 180.887 138.078 180.887 \
  793.         137.178 180.887 136.166 180.887 135.267 180.887 \
  794.         134.368 180.887 133.468 180.887 132.569 180.887 \
  795.         131.669 180.887 130.882 180.887 130.095 180.887 \
  796.         110.869 185.946 110.869 185.946 185.412 180.325 \
  797.         185.412 176.165 160.565 176.052 159.778 175.94 \
  798.         158.99 175.827 158.203 175.602 156.517 175.49 \
  799.         155.617 175.378 154.718 175.265 153.931 175.153 \
  800.         153.032 175.04 152.02 174.928 151.12 174.703 150.221 \
  801.         174.591 149.321 174.478 148.422 174.366 147.41 \
  802.         174.141 146.51 174.028 145.611 173.804 144.599 \
  803.         173.691 143.587 173.579 142.575 173.354 141.676 \
  804.         173.241 140.551 173.017 139.539 172.904 138.528 \
  805.         172.904 139.539 172.904 140.551 173.017 141.563 \
  806.         173.017 142.575 173.017 143.587 173.129 144.599 \
  807.         173.129 145.498 173.129 146.51 173.241 147.41 \
  808.         173.241 148.422 173.241 149.321 173.354 150.221 \
  809.         173.354 151.233 173.354 152.132 173.354 153.144 \
  810.         173.354 154.156 173.354 155.055 173.354 156.067 \
  811.         173.354 156.967 173.354 157.866 173.354 158.766 \
  812.         173.354 159.553 173.354 160.452 173.354 161.239 \
  813.         173.354 162.026 173.354 162.926 173.354 185.412 \
  814.         168.182 185.412 -fill #000000 -outline {} -width 1  -tags logo
  815.  
  816.     $c create polygon 206.184 185.412 205.622 \
  817.         175.968 205.397 177.092 205.172 178.217 204.948 \
  818.         179.228 204.61 180.128 204.385 181.027 204.048 \
  819.         181.814 203.823 182.489 203.486 183.164 203.149 \
  820.         183.838 202.811 184.4 202.024 185.75 201.125 186.762 \
  821.         200.113 187.436 199.101 187.661 198.089 187.549 \
  822.         197.19 186.986 196.29 186.087 195.391 184.85 194.941 \
  823.         184.176 194.491 183.389 194.042 182.489 193.592 \
  824.         181.477 193.255 180.465 192.805 179.341 192.467 \
  825.         178.217 192.13 176.98 191.905 176.193 191.68 175.406 \
  826.         191.568 174.619 191.456 173.832 191.231 172.932 \
  827.         191.118 172.145 191.006 171.246 190.781 169.559 \
  828.         190.669 168.66 190.556 167.648 190.444 166.748 \
  829.         190.331 165.736 190.219 164.725 190.106 163.825 \
  830.         189.994 162.926 189.994 162.026 189.882 161.127 \
  831.         189.769 160.227 189.769 159.215 189.657 158.316 \
  832.         189.544 157.304 189.544 156.405 189.432 155.393 \
  833.         189.432 154.381 189.319 153.369 189.319 152.357 \
  834.         189.319 151.345 189.319 150.333 189.319 149.321 \
  835.         189.319 148.197 189.319 146.96 189.319 145.948 \
  836.         189.319 144.824 189.319 143.7 189.319 142.688 \
  837.         189.432 141.563 189.432 140.551 189.544 139.539 \
  838.         189.544 138.528 189.544 137.516 189.657 136.504 \
  839.         189.769 135.492 189.769 134.592 189.882 133.581 \
  840.         189.994 132.681 189.994 131.782 190.106 130.882 \
  841.         190.219 129.983 190.331 129.083 190.556 127.397 \
  842.         190.669 126.61 190.781 125.823 191.006 124.923 \
  843.         191.118 124.136 191.231 123.462 191.568 121.887 \
  844.         191.793 121.213 191.905 120.426 192.13 119.751 \
  845.         192.58 117.952 193.142 116.378 193.704 114.917 \
  846.         194.266 113.567 194.941 112.443 195.616 111.431 \
  847.         196.29 110.532 196.965 109.857 197.752 109.295 \
  848.         198.426 108.845 199.214 108.62 200.001 108.508 \
  849.         201.799 108.958 202.699 109.407 203.374 110.194 \
  850.         204.161 111.094 204.835 112.218 205.51 113.567 \
  851.         206.184 115.141 206.634 116.491 206.859 117.165 \
  852.         206.971 117.952 207.421 119.526 207.534 120.426 \
  853.         207.758 121.325 207.871 122.225 207.983 123.124 \
  854.         208.096 124.136 208.208 125.036 208.321 126.047 \
  855.         208.433 127.172 208.545 128.184 208.658 129.308 \
  856.         208.77 130.32 208.77 131.557 208.883 132.681 208.995 \
  857.         133.805 204.273 133.805 204.161 132.681 203.936 \
  858.         131.557 203.711 130.432 203.486 129.533 203.261 \
  859.         128.633 202.924 127.734 202.699 126.947 202.362 \
  860.         126.385 201.35 124.586 200.001 124.024 199.438 \
  861.         124.136 198.989 124.361 198.426 124.923 197.977 \
  862.         125.598 197.527 126.497 197.077 127.622 196.628 \
  863.         128.971 196.29 130.545 196.178 131.219 195.953 \
  864.         132.681 195.84 133.356 195.728 134.143 195.616 \
  865.         134.93 195.503 135.829 195.278 137.516 195.278 \
  866.         138.303 195.166 139.315 195.166 140.214 195.053 \
  867.         141.114 195.053 142.125 194.941 143.137 194.941 \
  868.         144.149 194.941 145.161 194.941 146.173 194.941 \
  869.         147.297 194.941 148.309 194.941 149.546 194.941 \
  870.         150.67 194.941 151.907 194.941 152.919 195.053 \
  871.         154.043 195.053 155.168 195.166 156.18 195.166 \
  872.         157.192 195.278 158.091 195.391 159.103 195.391 \
  873.         160.002 195.503 160.902 195.616 161.801 195.728 \
  874.         162.588 195.84 163.375 196.065 164.162 196.178 \
  875.         164.949 196.29 165.736 196.628 167.198 197.077 \
  876.         168.547 197.527 169.672 197.977 170.571 198.426 \
  877.         171.246 198.989 171.808 199.438 172.145 200.001 \
  878.         172.258 200.9 171.92 201.575 171.246 202.249 170.009 \
  879.         202.811 168.547 203.149 167.76 203.374 166.973 \
  880.         203.598 166.186 203.823 165.399 204.048 164.5 \
  881.         204.273 163.488 204.385 162.476 204.498 161.464 \
  882.         204.61 160.34 204.723 159.103 200.001 159.103 \
  883.         200.001 145.049 209.445 145.049 209.445 185.412 \
  884.         206.184 185.412 -fill #000000 -outline {} -width 1  -tags logo
  885.  
  886.     $c create polygon 148.506 261.305 148.506 \
  887.         263.554 143.784 263.554 143.784 261.305 143.671 \
  888.         260.068 143.334 259.394 142.772 259.056 141.985 \
  889.         258.944 141.085 259.056 140.523 259.394 140.074 \
  890.         261.755 140.074 263.104 140.523 264.678 141.085 \
  891.         265.465 141.985 266.364 146.145 270.637 147.607 \
  892.         271.874 148.506 272.998 148.843 274.01 148.956 \
  893.         275.359 148.956 277.158 148.843 278.507 148.506 \
  894.         279.632 147.944 280.643 147.157 281.43 146.482 \
  895.         281.88 145.695 282.218 144.796 282.442 143.784 \
  896.         282.667 142.659 282.78 141.535 282.78 140.298 282.78 \
  897.         139.286 282.78 138.387 282.667 137.6 282.442 136.925 \
  898.         282.218 136.363 281.88 135.576 281.093 135.014 \
  899.         280.194 134.564 278.957 134.452 277.608 134.452 \
  900.         275.359 139.624 275.359 139.624 277.608 139.736 \
  901.         279.069 140.074 279.969 141.535 280.419 142.659 \
  902.         280.081 143.334 279.519 143.671 278.62 143.784 \
  903.         277.158 143.784 275.809 143.671 275.022 143.334 \
  904.         274.235 142.772 273.448 141.985 272.548 137.263 \
  905.         267.376 136.251 266.364 135.351 265.465 135.014 \
  906.         264.565 134.902 263.554 134.902 261.755 135.014 \
  907.         260.518 135.464 259.506 136.026 258.719 136.813 \
  908.         257.932 137.488 257.595 138.275 257.145 139.174 \
  909.         256.92 140.186 256.695 141.31 256.583 142.435 \
  910.         256.583 143.447 256.583 144.458 256.583 145.245 \
  911.         256.695 145.92 256.92 147.157 257.482 147.719 \
  912.         258.157 148.169 258.944 148.394 260.068 148.506 \
  913.         261.305 -fill #000000 -outline {} -width 1  -tags logo
  914.  
  915.     $c create polygon 165.821 270.187 165.821 \
  916.         276.708 165.821 277.833 165.708 278.957 165.483 \
  917.         279.856 165.259 280.643 164.921 281.318 164.472 \
  918.         281.88 163.909 282.218 163.235 282.555 162.448 \
  919.         282.667 161.548 282.78 160.536 282.78 159.3 282.78 \
  920.         158.175 282.78 157.051 282.78 156.151 282.667 \
  921.         155.364 282.555 154.69 282.218 154.128 281.88 \
  922.         153.678 281.318 153.341 280.643 153.116 279.856 \
  923.         152.891 278.845 152.778 277.833 152.778 276.708 \
  924.         152.778 270.187 152.778 269.063 152.891 268.051 \
  925.         153.116 267.264 153.341 266.589 154.128 265.465 \
  926.         155.364 264.678 156.151 264.453 157.051 264.228 \
  927.         158.063 264.116 159.3 264.116 160.424 264.116 \
  928.         161.548 264.228 162.448 264.453 163.235 264.678 \
  929.         163.909 265.015 164.472 265.465 164.921 265.915 \
  930.         165.483 267.264 165.708 268.051 165.821 269.063 \
  931.         165.821 270.187 -fill #000000 -outline {} -width 1  -tags logo
  932.  
  933.     $c create polygon 177.514 256.583 177.514 \
  934.         258.494 177.064 258.494 176.165 258.606 175.715 \
  935.         258.944 175.378 259.281 175.265 259.843 175.265 \
  936.         264.565 177.514 264.565 177.514 266.927 175.265 \
  937.         266.927 175.265 282.78 170.543 282.78 170.543 \
  938.         266.927 168.632 266.927 168.632 264.565 170.543 \
  939.         264.565 170.543 261.305 170.655 259.843 170.993 \
  940.         258.606 171.442 257.707 171.892 257.032 173.579 \
  941.         256.358 174.703 256.133 176.165 256.133 176.727 \
  942.         256.133 177.064 256.133 177.514 256.583 -fill \
  943.         #000000 -outline {} -width 1  -tags logo
  944.  
  945.     $c create polygon 185.946 259.843 185.946 \
  946.         264.565 188.757 264.565 188.757 266.927 185.946 \
  947.         266.927 185.946 278.62 186.171 279.407 186.509 \
  948.         279.969 187.071 280.306 187.858 280.419 188.307 \
  949.         280.419 188.757 280.419 188.757 282.78 188.645 \
  950.         282.78 188.307 282.78 187.183 282.78 186.509 282.78 \
  951.         185.159 282.78 183.923 282.555 182.911 282.33 \
  952.         182.236 281.88 181.786 281.206 181.561 280.419 \
  953.         181.337 279.407 181.337 278.17 181.337 266.927 \
  954.         179.425 266.927 179.425 264.565 181.337 264.565 \
  955.         181.337 261.305 185.946 259.843 -fill #000000 \
  956.         -outline {} -width 1  -tags logo
  957.  
  958.     $c create polygon 190.219 264.565 194.379 \
  959.         264.565 196.29 279.519 196.74 279.519 199.101 \
  960.         264.565 204.723 264.565 207.084 279.519 207.534 \
  961.         279.519 209.895 264.565 213.605 264.565 209.895 \
  962.         282.78 204.723 282.78 201.912 267.376 201.462 \
  963.         267.376 199.101 282.78 193.479 282.78 190.219 \
  964.         264.565 -fill #000000 -outline {} -width 1  -tags logo
  965.  
  966.     $c create polygon 229.121 269.175 229.121 282.78 \
  967.         224.848 282.78 224.848 280.981 224.061 281.768 \
  968.         223.049 282.33 221.925 282.667 220.688 282.78 \
  969.         219.564 282.78 218.44 282.555 217.54 282.33 216.866 \
  970.         281.88 216.528 281.318 216.191 280.531 216.079 \
  971.         279.632 215.966 278.62 215.966 275.359 216.079 \
  972.         274.347 216.978 272.998 217.877 272.548 218.44 \
  973.         272.211 219.114 271.986 219.789 271.761 220.688 \
  974.         271.536 221.588 271.424 222.6 271.311 223.724 \
  975.         271.199 224.848 271.087 224.848 269.175 224.736 \
  976.         267.826 224.399 266.927 223.612 266.477 222.487 \
  977.         266.364 221.7 266.477 221.138 266.927 220.688 \
  978.         268.726 220.688 269.175 216.416 269.175 216.528 \
  979.         267.938 216.753 266.702 217.203 265.69 217.877 \
  980.         265.015 218.44 264.678 219.114 264.453 219.901 \
  981.         264.228 220.801 264.116 221.925 264.116 223.049 \
  982.         264.116 224.061 264.116 225.073 264.116 225.86 \
  983.         264.228 226.535 264.453 227.659 265.015 228.334 \
  984.         265.69 228.783 266.702 229.008 267.938 229.121 \
  985.         269.175 -fill #000000 -outline {} -width 1  -tags logo
  986.  
  987.     $c create polygon 243.175 264.565 243.175 \
  988.         266.927 242.725 266.927 241.601 266.927 240.701 \
  989.         267.151 239.914 267.489 239.352 267.826 239.015 \
  990.         268.276 238.678 268.95 238.565 269.737 238.453 \
  991.         270.637 238.453 282.78 233.731 282.78 233.731 \
  992.         264.565 238.453 264.565 238.453 265.915 239.352 \
  993.         265.128 240.364 264.565 242.163 264.116 242.725 \
  994.         264.565 243.175 264.565 -fill #000000 -outline {} \
  995.         -width 1  -tags logo
  996.  
  997.     $c create polygon 258.129 270.187 258.129 \
  998.         274.347 249.696 274.347 249.696 278.17 249.809 \
  999.         279.294 250.146 279.969 250.708 280.643 251.607 \
  1000.         280.981 252.732 280.643 253.406 279.969 253.744 \
  1001.         279.294 253.969 278.17 253.969 276.708 258.129 \
  1002.         276.708 258.129 277.608 258.129 278.957 257.904 \
  1003.         280.081 257.454 281.093 256.779 281.88 256.217 \
  1004.         282.218 254.643 282.667 253.744 282.78 252.732 \
  1005.         282.78 251.607 282.78 250.371 282.78 249.359 282.78 \
  1006.         248.459 282.667 247.672 282.442 246.436 281.88 \
  1007.         245.986 281.318 245.649 280.643 245.424 279.856 \
  1008.         245.199 278.957 245.086 277.833 244.974 276.708 \
  1009.         244.974 270.187 245.086 269.063 245.199 268.051 \
  1010.         245.311 267.264 245.649 266.589 245.986 265.915 \
  1011.         246.436 265.465 246.998 265.015 247.672 264.678 \
  1012.         248.459 264.453 249.359 264.228 250.371 264.116 \
  1013.         251.607 264.116 252.732 264.116 253.744 264.228 \
  1014.         254.756 264.453 255.543 264.678 256.217 265.015 \
  1015.         256.779 265.465 257.229 265.915 257.566 266.589 \
  1016.         257.791 267.264 258.016 268.051 258.129 269.063 \
  1017.         258.129 270.187 -fill #000000 -outline {} -width 1  -tags logo
  1018.  
  1019.     $c create polygon 272.183 256.583 277.355 \
  1020.         256.583 277.355 282.78 272.183 282.78 272.183 \
  1021.         256.583 -fill #000000 -outline {} -width 1  -tags logo
  1022.  
  1023.     $c create polygon 295.569 268.726 295.569 282.78 \
  1024.         290.959 282.78 290.959 269.175 290.847 268.051 \
  1025.         290.509 267.376 289.947 266.702 289.048 266.364 \
  1026.         287.923 266.702 287.136 267.376 287.024 268.051 \
  1027.         287.136 269.175 287.136 282.78 282.527 282.78 \
  1028.         282.527 264.565 286.687 264.565 287.136 265.915 \
  1029.         288.036 265.128 289.048 264.565 290.172 264.228 \
  1030.         291.409 264.116 292.533 264.116 293.433 264.341 \
  1031.         294.107 264.565 294.669 265.015 295.344 266.477 \
  1032.         295.569 267.489 295.569 268.726 -fill #000000 \
  1033.         -outline {} -width 1  -tags logo
  1034.  
  1035.     $c create polygon 312.434 269.737 312.434 \
  1036.         270.637 308.274 270.637 308.274 269.175 308.161 \
  1037.         267.826 307.824 266.927 307.262 266.477 306.363 \
  1038.         266.364 305.576 266.477 305.013 266.927 304.676 \
  1039.         267.826 304.564 269.175 304.564 278.17 304.676 \
  1040.         279.294 305.013 279.969 306.363 280.981 307.262 \
  1041.         280.643 307.824 279.969 307.937 279.294 307.824 \
  1042.         278.17 307.824 276.259 312.434 276.259 312.434 \
  1043.         277.608 312.434 278.957 312.209 280.081 311.759 \
  1044.         281.093 311.085 281.88 310.523 282.218 309.173 \
  1045.         282.667 308.386 282.78 307.374 282.78 306.363 282.78 \
  1046.         305.238 282.78 304.226 282.78 303.327 282.667 \
  1047.         302.427 282.442 301.753 282.218 301.191 281.88 \
  1048.         300.853 281.318 300.516 280.643 300.179 279.856 \
  1049.         299.954 278.957 299.841 277.833 299.841 276.708 \
  1050.         299.841 270.187 299.841 269.063 299.954 268.051 \
  1051.         300.179 267.264 300.404 266.589 301.191 265.465 \
  1052.         302.427 264.678 303.327 264.453 304.226 264.228 \
  1053.         305.238 264.116 306.363 264.116 307.374 264.116 \
  1054.         308.386 264.228 309.173 264.453 309.96 264.678 \
  1055.         310.523 265.015 311.085 265.465 311.759 266.252 \
  1056.         312.209 267.264 312.434 268.388 312.434 269.737 \
  1057.         -fill #000000 -outline {} -width 1  -tags logo
  1058.  
  1059.     $c create polygon 316.706 279.069 320.866 \
  1060.         279.069 320.866 282.78 316.706 282.78 316.706 \
  1061.         279.069 -fill #000000 -outline {} -width 1  -tags logo
  1062.  
  1063.     $c create polygon 48.215 186.312 48.215 185.412 \
  1064.         47.766 184.4 47.766 183.501 47.316 183.501 47.316 \
  1065.         182.601 46.416 181.59 46.416 181.14 45.967 180.24 \
  1066.         45.405 179.791 44.955 179.228 44.055 178.329 43.606 \
  1067.         177.879 43.156 177.43 42.144 176.98 41.694 176.418 \
  1068.         41.245 175.968 38.883 175.068 36.972 174.169 36.522 \
  1069.         174.169 35.173 173.607 34.723 174.169 31.913 173.607 \
  1070.         31.913 174.169 29.551 173.607 29.551 174.169 28.54 \
  1071.         174.169 28.09 174.619 27.19 174.169 27.19 174.619 \
  1072.         26.741 174.619 25.729 175.068 23.93 175.518 22.918 \
  1073.         175.068 22.468 175.518 20.669 176.418 19.657 176.418 \
  1074.         15.048 178.779 14.036 179.228 12.686 180.24 12.237 \
  1075.         180.69 11.225 181.59 10.775 182.039 10.325 182.601 \
  1076.         10.775 182.601 10.325 184.4 10.775 184.85 11.225 \
  1077.         186.312 14.036 188.223 14.485 188.673 16.846 190.022 \
  1078.         17.296 190.472 17.296 191.034 15.947 191.933 15.048 \
  1079.         192.383 14.485 192.833 14.036 193.283 13.136 193.845 \
  1080.         12.237 194.295 12.686 195.644 12.686 196.094 12.237 \
  1081.         197.555 12.237 198.005 11.675 198.904 12.237 200.816 \
  1082.         12.237 202.277 12.237 204.526 11.675 205.988 12.237 \
  1083.         205.988 12.237 206.437 12.237 207.337 12.686 208.349 \
  1084.         12.686 209.248 13.136 209.698 12.686 211.16 13.136 \
  1085.         212.509 13.136 213.521 13.586 215.32 13.586 216.781 \
  1086.         13.586 217.681 14.036 220.492 14.485 222.403 15.048 \
  1087.         222.853 15.947 222.853 15.947 222.403 16.397 221.953 \
  1088.         16.846 216.781 17.296 215.32 17.858 211.609 18.308 \
  1089.         210.71 18.308 210.148 18.308 209.248 17.858 208.798 \
  1090.         17.858 207.899 18.308 206.437 18.308 205.538 18.308 \
  1091.         205.088 18.308 203.627 16.846 203.627 15.947 203.177 \
  1092.         15.947 202.727 15.947 202.277 16.397 201.715 16.846 \
  1093.         201.715 17.858 201.715 18.308 201.715 18.758 201.265 \
  1094.         18.308 200.816 17.858 199.916 18.308 198.455 17.858 \
  1095.         198.455 17.858 193.283 19.208 192.383 20.107 191.933 \
  1096.         21.569 191.484 22.018 191.484 22.918 192.383 22.918 \
  1097.         192.833 23.48 192.833 23.93 198.005 23.48 199.467 \
  1098.         23.93 202.277 25.279 202.277 29.551 202.727 30.001 \
  1099.         202.277 30.901 202.277 31.913 202.277 35.623 201.265 \
  1100.         36.522 201.265 36.972 200.816 37.984 200.816 38.883 \
  1101.         200.816 39.333 200.366 40.345 199.916 40.795 199.916 \
  1102.         42.594 198.455 44.055 198.005 44.055 197.555 44.505 \
  1103.         197.105 46.416 195.644 46.416 194.744 46.866 194.295 \
  1104.         47.316 193.845 47.766 193.283 47.316 192.833 48.215 \
  1105.         190.472 48.215 190.022 48.215 189.572 48.215 188.673 \
  1106.         48.215 187.211 48.215 186.762 48.215 186.312 -fill \
  1107.         $bg -outline {} -width 1  -tags logo
  1108.  
  1109.     $c create polygon 76.886 142.688 81.046 142.688 \
  1110.         82.508 142.35 83.407 140.889 83.632 140.327 83.969 \
  1111.         138.865 84.082 137.965 84.194 137.066 84.307 136.054 \
  1112.         84.307 134.93 84.307 133.805 84.307 132.456 84.194 \
  1113.         131.332 84.082 130.208 83.857 129.308 83.632 128.409 \
  1114.         83.407 127.734 82.395 126.272 81.046 125.823 76.886 \
  1115.         125.823 76.886 142.688 -fill $bg -outline {} -width \
  1116.         1  -tags logo
  1117.  
  1118.     $c create polygon 97.461 148.309 97.461 149.546 \
  1119.         97.461 150.783 97.461 152.02 97.574 153.144 97.574 \
  1120.         154.268 97.686 155.28 97.686 156.405 97.799 157.416 \
  1121.         97.799 158.316 97.911 159.328 98.023 160.227 98.136 \
  1122.         161.127 98.361 162.701 98.473 163.488 98.586 164.275 \
  1123.         98.698 164.949 98.81 165.736 99.373 167.535 99.822 \
  1124.         169.109 100.497 170.234 101.059 171.133 101.846 \
  1125.         171.583 102.633 171.808 104.095 171.133 104.769 \
  1126.         170.234 105.332 169.109 105.894 167.535 106.343 \
  1127.         165.736 106.456 164.949 106.681 164.275 106.793 \
  1128.         163.488 106.906 162.701 107.018 161.914 107.243 \
  1129.         160.227 107.355 159.328 107.355 158.316 107.468 \
  1130.         157.416 107.58 156.405 107.58 155.28 107.693 154.268 \
  1131.         107.693 153.144 107.693 152.02 107.693 150.783 \
  1132.         107.805 149.546 107.805 148.309 107.805 147.073 \
  1133.         107.693 145.836 107.693 144.711 107.693 143.587 \
  1134.         107.693 142.463 107.58 141.338 107.58 140.327 \
  1135.         107.468 139.315 107.355 138.303 107.355 137.403 \
  1136.         107.243 136.504 107.131 135.604 106.906 133.918 \
  1137.         106.793 133.131 106.681 132.456 106.456 131.669 \
  1138.         106.343 130.995 105.894 129.196 105.332 127.622 \
  1139.         104.769 126.497 104.095 125.598 103.42 125.148 \
  1140.         102.633 124.923 101.846 125.148 101.059 125.598 \
  1141.         100.497 126.497 99.822 127.622 99.373 129.196 98.81 \
  1142.         130.995 98.698 131.669 98.586 132.456 98.473 133.131 \
  1143.         98.361 133.918 98.248 134.817 98.023 136.504 97.911 \
  1144.         137.403 97.799 138.303 97.799 139.315 97.686 140.327 \
  1145.         97.686 141.338 97.574 142.463 97.574 143.587 97.461 \
  1146.         144.711 97.461 145.836 97.461 147.073 97.461 148.309 \
  1147.         -fill $bg -outline {} -width 1  -tags logo
  1148.  
  1149.     $c create polygon 122.309 156.292 126.919 \
  1150.         156.292 124.67 130.545 122.309 156.292 -fill $bg \
  1151.         -outline {} -width 1  -tags logo
  1152.  
  1153.     $c create polygon 142.435 142.688 146.145 \
  1154.         142.688 147.607 142.35 148.506 140.889 148.731 \
  1155.         140.327 149.068 138.865 149.181 137.965 149.293 \
  1156.         137.066 149.405 136.054 149.405 134.93 149.405 \
  1157.         133.805 149.405 132.456 149.405 131.332 149.405 \
  1158.         130.208 149.293 129.308 149.181 128.409 148.956 \
  1159.         127.734 148.056 126.272 146.595 125.823 142.435 \
  1160.         125.823 142.435 142.688 -fill $bg -outline {} -width \
  1161.         1  -tags logo
  1162.  
  1163.     $c create polygon 111.515 228.924 111.515 \
  1164.         227.575 111.066 225.664 108.705 221.391 108.255 \
  1165.         220.042 108.255 219.142 108.255 218.58 108.255 \
  1166.         218.13 107.805 217.681 106.793 218.58 104.994 \
  1167.         220.941 104.432 221.953 102.633 224.202 102.183 \
  1168.         224.764 101.621 225.214 99.822 228.474 97.461 \
  1169.         233.197 97.461 234.096 97.461 234.995 97.911 235.445 \
  1170.         98.361 236.007 99.822 236.457 102.633 236.457 \
  1171.         104.432 235.445 105.894 234.995 106.343 234.546 \
  1172.         106.793 234.546 107.805 233.646 110.616 230.835 \
  1173.         111.515 229.824 111.515 229.374 111.515 228.924 \
  1174.         -fill $bg -outline {} -width 1  -tags logo
  1175.  
  1176.     $c create polygon 161.211 269.175 160.986 \
  1177.         267.826 160.649 266.927 160.199 266.477 159.3 \
  1178.         266.364 158.4 266.477 157.838 266.927 157.613 \
  1179.         267.826 157.388 269.175 157.388 278.17 157.613 \
  1180.         279.294 157.838 279.969 159.3 280.981 160.199 \
  1181.         280.643 160.649 279.969 160.986 279.294 161.211 \
  1182.         278.17 161.211 269.175 -fill $bg -outline {} -width \
  1183.         1  -tags logo
  1184.  
  1185.     $c create polygon 224.848 273.448 223.836 \
  1186.         273.448 222.825 273.56 222.15 273.673 221.588 \
  1187.         273.897 220.913 274.684 220.688 275.809 220.688 \
  1188.         278.17 220.801 279.294 221.138 279.969 221.7 280.643 \
  1189.         222.487 280.981 223.612 280.643 224.399 279.969 \
  1190.         224.736 279.294 224.848 278.17 224.848 273.448 -fill \
  1191.         $bg -outline {} -width 1  -tags logo
  1192.  
  1193.     $c create polygon 253.969 269.175 253.744 \
  1194.         267.826 253.406 266.927 252.732 266.477 251.607 \
  1195.         266.364 250.708 266.477 250.146 266.927 249.696 \
  1196.         269.175 249.696 272.548 253.969 272.548 253.969 \
  1197.         269.175 -fill $bg -outline {} -width 1  -tags logo
  1198.  
  1199. }
  1200.  
  1201. #***********************************************************************
  1202. # %PROCEDURE: LoadConnectionInfo
  1203. # %ARGUMENTS:
  1204. #  None
  1205. # %RETURNS:
  1206. #  Nothing
  1207. # %DESCRIPTION:
  1208. #  Loads the connection information into the global ConnectionInfo variable
  1209. #***********************************************************************
  1210. proc LoadConnectionInfo {} {
  1211.     global ConnectionInfoFile ConnectionInfo PasswordFile
  1212.     set ConnectionInfo {}
  1213.     if {![file exists $ConnectionInfoFile]} {
  1214.     return
  1215.     }
  1216.     set problem [catch {
  1217.     set fp [open $ConnectionInfoFile "r"]
  1218.     while {1} {
  1219.         if {[gets $fp line] < 0} {
  1220.         break
  1221.         }
  1222.         set line [string trim $line]
  1223.         if {[string match "#*" $line]} {
  1224.         continue
  1225.         }
  1226.         if {"$line" == ""} {
  1227.         continue
  1228.         }
  1229.         set ConnectionInfo $line
  1230.         break
  1231.     }
  1232.     close $fp
  1233.     } err]
  1234.     if {$problem} {
  1235.     tk_dialog .err Error "[m {Error loading configuration file:}] $err" error 0 OK
  1236.     }
  1237.     # Try loading and merging passwords if the password file is readable
  1238.     set passwords {}
  1239.     if {![file readable $PasswordFile]} {
  1240.     return
  1241.     }
  1242.  
  1243.     set fp [open $PasswordFile "r"]
  1244.     while {1} {
  1245.     if {[gets $fp line] < 0} {
  1246.         break
  1247.     }
  1248.     set line [string trim $line]
  1249.     if {[string match "#*" $line]} {
  1250.         continue
  1251.     }
  1252.     if {"$line" == ""} {
  1253.         continue
  1254.     }
  1255.     set passwords $line
  1256.     break
  1257.     }
  1258.     close $fp
  1259.  
  1260.     # Merge passwords
  1261.     foreach thing $passwords {
  1262.     set name [value $thing ConnectionName]
  1263.     set password [value $thing Password]
  1264.     set conn [GetConnection $name]
  1265.     if {"$conn" != ""} {
  1266.         lappend conn Password $password
  1267.         ReplaceConnection $conn
  1268.     }
  1269.     }
  1270. }
  1271.  
  1272. #***********************************************************************
  1273. # %PROCEDURE: GetConnection
  1274. # %ARGUMENTS:
  1275. #  name -- name of connection
  1276. # %RETURNS:
  1277. #  key/value pair listing connection configuration, or "" if not found.
  1278. #***********************************************************************
  1279. proc GetConnection { name } {
  1280.     global ConnectionInfo
  1281.     foreach thing $ConnectionInfo {
  1282.     if {[value $thing ConnectionName] == "$name"} {
  1283.         return $thing
  1284.     }
  1285.     }
  1286.     return ""
  1287. }
  1288.  
  1289.  
  1290. #***********************************************************************
  1291. # %PROCEDURE: DeleteConnection
  1292. # %ARGUMENTS:
  1293. #  name -- name of connection
  1294. # %RETURNS:
  1295. #  Nothing, but deletes connection named "$name"
  1296. #***********************************************************************
  1297. proc DeleteConnection { name } {
  1298.     global ConnectionInfo ConfigDir
  1299.     set newInfo {}
  1300.     set found 0
  1301.     foreach thing $ConnectionInfo {
  1302.     if {[value $thing ConnectionName] == "$name"} {
  1303.         set found 1
  1304.     } else {
  1305.         lappend newInfo $thing
  1306.     }
  1307.     }
  1308.     if {!$found} {
  1309.     return
  1310.     }
  1311.     set ConnectionInfo $newInfo
  1312.     SaveConnectionInfo
  1313.  
  1314.     # Delete the config file
  1315.     set fname [file join $ConfigDir conf.$name]
  1316.     catch { file delete $fname }
  1317.  
  1318.     BuildConnectionMenu
  1319.     if {[GetCurrentConnection] == $name} {
  1320.     if {[llength $ConnectionInfo] == 0} {
  1321.         SwitchConnection ""
  1322.     } else {
  1323.         set name [value [lindex $ConnectionInfo 0] ConnectionName]
  1324.         SwitchConnection $name
  1325.     }
  1326.     }
  1327. }
  1328.  
  1329. #***********************************************************************
  1330. # %PROCEDURE: ReplaceConnection
  1331. # %ARGUMENTS:
  1332. #  conn -- new name/value pairs
  1333. # %RETURNS:
  1334. #  Nothing, but replaces connection in ConnectionInfo.  If no such
  1335. #  connection exists, appends new connection.
  1336. #***********************************************************************
  1337. proc ReplaceConnection { conn } {
  1338.     global ConnectionInfo
  1339.     set name [value $conn ConnectionName]
  1340.     set newInfo {}
  1341.     set found 0
  1342.     foreach thing $ConnectionInfo {
  1343.     if {[value $thing ConnectionName] == "$name"} {
  1344.         lappend newInfo $conn
  1345.         set found 1
  1346.     } else {
  1347.         lappend newInfo $thing
  1348.     }
  1349.     }
  1350.     if {!$found} {
  1351.     lappend newInfo $conn
  1352.     }
  1353.     set ConnectionInfo $newInfo
  1354. }
  1355.  
  1356. proc DeletePPPoEConnection {} {
  1357.     set conn [GetCurrentConnection]
  1358.     if {"$conn" == ""} {
  1359.     return
  1360.     }
  1361.     set ans [tk_dialog .confirm "[m {Confirm Deletion - RP-PPPoE}]" "[m {Are you sure you wish to delete the connection}] `$conn'?" warning 0 No Yes]
  1362.     if {$ans} {
  1363.     DeleteConnection $conn
  1364.     }
  1365. }
  1366.  
  1367. #***********************************************************************
  1368. # %PROCEDURE: CreateMainDialog
  1369. # %ARGUMENTS:
  1370. #  None
  1371. # %RETURNS:
  1372. #  Nothing
  1373. # %DESCRIPTION:
  1374. #  Creates the main window
  1375. #***********************************************************************
  1376. proc CreateMainDialog {} {
  1377.     global ConnectionInfoFile
  1378.     global ConnectionInfo
  1379.     global Admin
  1380.     wm title . "RP-PPPoE"
  1381.     wm iconname . "PPPoE"
  1382.     frame .f1
  1383.     label .l1 -text "Connection: "
  1384.     menubutton .m1 -text "" -indicatoron 1 -menu .m1.menu -relief raised
  1385.     menu .m1.menu -tearoff 0
  1386.     pack .l1 .m1 -in .f1 -side left -expand 0 -fill x
  1387.     canvas .c -width 40 -height 20
  1388.     pack .c -in .f1 -side left -expand 0 -fill none
  1389.  
  1390.     # Draw the LED's
  1391.     .c create rectangle 10 1 30 8 -outline "#808080" -fill "#A0A0A0" -tags xmitrect
  1392.     .c create rectangle 10 10 30 18 -outline "#808080" -fill "#A0A0A0" -tags recvrect
  1393.  
  1394.     frame .buttons
  1395.     button .start -text "[m {Start}]" -command "StartPPPoEConnection"
  1396.     button .stop -text "[m {Stop}]" -command "StopPPPoEConnection"
  1397.     button .exit -text "[m {Exit}]" -command "exit"
  1398.     canvas .graph -width 1 -height 1
  1399.     if {[file writable $ConnectionInfoFile]} {
  1400.     set Admin 1
  1401.     pack .f1 -side top -expand 1 -fill both
  1402.     pack .buttons -side top -expand 0 -fill x
  1403.     button .delete -text "[m {Delete}]" -command "DeletePPPoEConnection"
  1404.     button .new -text "[m {New Connection...}]" -command "NewPPPoEConnection"
  1405.     button .props -text "[m {Properties...}]" -command "EditConnectionProps"
  1406.     pack .graph -in .f1 -side left -expand 1 -fill both
  1407.     pack .start .stop .delete .props .new .exit -in .buttons -side left -expand 0 -fill none
  1408.     } else {
  1409.     set Admin 0
  1410.     pack .f1 -side top -expand 0 -fill x
  1411.     pack .buttons -side top -expand 1 -fill both
  1412.     pack .start .stop .exit -in .buttons -side left -expand 0 -fill none
  1413.     pack .graph -in .buttons -side left -expand 1 -fill both
  1414.     }
  1415.  
  1416.     LoadConnectionInfo
  1417.     BuildConnectionMenu
  1418.     # If no connections exist, pop up new connection dialog
  1419.     if {[llength $ConnectionInfo] == 0} {
  1420.     SwitchConnection ""
  1421.     if {$Admin} {
  1422.         update idletasks
  1423.         NewPPPoEConnection
  1424.     } else {
  1425.         tk_dialog .note [m {Note}] "[m {Note: There are no connections defined.  You must run this program as root to define connections}]" warning 0 OK
  1426.     }
  1427.     } else {
  1428.     set con [lindex $ConnectionInfo 0]
  1429.     set name [value $con ConnectionName]
  1430.     SwitchConnection $name
  1431.     }
  1432. }
  1433.  
  1434. #***********************************************************************
  1435. # %PROCEDURE: GetCurrentConnection
  1436. # %ARGUMENTS:
  1437. #  None
  1438. # %RETURNS:
  1439. #  The name of the current connection in the GUI.
  1440. #***********************************************************************
  1441. proc GetCurrentConnection {} {
  1442.     .m1 cget -text
  1443. }
  1444.  
  1445. #***********************************************************************
  1446. # %PROCEDURE: value
  1447. # %ARGUMENTS:
  1448. #  lst -- a list of key/value pairs
  1449. #  key -- key we're looking for
  1450. # %RETURNS:
  1451. #  value corresponding to $key, or "" if not found.
  1452. #***********************************************************************
  1453. proc value { lst key } {
  1454.     set idx [lsearch -exact $lst $key]
  1455.     if {$idx >= 0} {
  1456.     return [lindex $lst [expr $idx+1]]
  1457.     }
  1458.     return ""
  1459. }
  1460.  
  1461. #***********************************************************************
  1462. # %PROCEDURE: SwitchConnection
  1463. # %ARGUMENTS:
  1464. #  name -- new connection name
  1465. # %DESCRIPTION:
  1466. #  Makes $name the active connection
  1467. #***********************************************************************
  1468. proc SwitchConnection { name } {
  1469.     .m1 configure -text $name
  1470.     SetButtonStates
  1471.     UpdateConnectionState 0
  1472. }
  1473.  
  1474. #***********************************************************************
  1475. # %PROCEDURE: EditConnectionProps
  1476. # %ARGUMENTS:
  1477. #  None
  1478. # %DESCRIPTION:
  1479. #  Pops up edit window for current connection
  1480. #***********************************************************************
  1481. proc EditConnectionProps {} {
  1482.     global ConnectionInfo
  1483.     set conn [GetCurrentConnection]
  1484.     NewPPPoEConnection $conn
  1485. }
  1486.  
  1487. #***********************************************************************
  1488. # %PROCEDURE: FillConnectionGui
  1489. # %ARGUMENTS:
  1490. #  w -- connection property GUI
  1491. #  name -- name of connection
  1492. # %DESCRIPTION:
  1493. #  Fills GUI with values corresponding to $name.
  1494. #***********************************************************************
  1495. proc FillConnectionGui { w name } {
  1496.     global ConnectionInfo
  1497.     set found [GetConnection $name]
  1498.     if {"$found" != ""} {
  1499.     ListToSetupGui $w $found
  1500.     }
  1501. }
  1502.  
  1503. #***********************************************************************
  1504. # %PROCEDURE: BuildConnectionMenu
  1505. # %ARGUMENTS:
  1506. #  None
  1507. # %RETURNS:
  1508. #  Nothing
  1509. # %DESCRIPTION:
  1510. #  Builds the connection menu
  1511. #***********************************************************************
  1512. proc BuildConnectionMenu {} {
  1513.     global ConnectionInfo
  1514.     .m1.menu delete 0 end
  1515.     foreach connection $ConnectionInfo {
  1516.     set name [value $connection ConnectionName]
  1517.     .m1.menu add command -label $name -command [list SwitchConnection $name]
  1518.     }
  1519.     .m1.menu add separator
  1520.     .m1.menu add command -label "User's Manual" -command Help
  1521. }
  1522.  
  1523. #***********************************************************************
  1524. # %PROCEDURE: SetButtonStates
  1525. # %ARGUMENTS:
  1526. #  None
  1527. # %RETURNS:
  1528. #  Nothing
  1529. # %DESCRIPTION:
  1530. #  Enables or disables buttons, as appropriate
  1531. #***********************************************************************
  1532. proc SetButtonStates {} {
  1533.     global Admin
  1534.     set conn [GetCurrentConnection]
  1535.     if {"$conn" == ""} {
  1536.     .start configure -state disabled
  1537.     .stop configure -state disabled
  1538.     catch {
  1539.         .delete configure -state disabled
  1540.         .props configure -state disabled
  1541.         .new configure -state normal
  1542.     }
  1543.     } else {
  1544.     foreach {startstop updown interface} [GetConnectionStatus $conn] {break}
  1545.     if {"$startstop" == "started"} {
  1546.         .start configure -state disabled
  1547.         .stop configure -state normal
  1548.     } else {
  1549.         .start configure -state normal
  1550.         .stop configure -state disabled
  1551.     }
  1552.     catch {
  1553.         .delete configure -state normal
  1554.         .props configure -state normal
  1555.         .new configure -state normal
  1556.     }
  1557.     if {!$Admin} {
  1558.         set ok [value [GetConnection $conn] NonrootOK]
  1559.         if {!$ok} {
  1560.         .start configure -state disabled
  1561.         .stop configure -state disabled
  1562.         }
  1563.     }
  1564.     }
  1565. }
  1566.  
  1567. #***********************************************************************
  1568. # %PROCEDURE: GetEthernetInterfaces
  1569. # %ARGUMENTS:
  1570. #  None
  1571. # %RETURNS:
  1572. #  A list of Ethernet interfaces
  1573. #***********************************************************************
  1574. proc GetEthernetInterfaces {} {
  1575.     set ifs {}
  1576.     set fp [open "|/sbin/ifconfig" "r"]
  1577.     while {[gets $fp line] >= 0} {
  1578.     if {[regexp {^eth[0-9]+} $line eth]} {
  1579.         lappend ifs $eth
  1580.     }
  1581.     }
  1582.     return $ifs
  1583. }
  1584.  
  1585. #***********************************************************************
  1586. # %PROCEDURE: StartPPPoEConnection
  1587. # %ARGUMENTS:
  1588. #  None
  1589. # %RETURNS:
  1590. #  Nothing
  1591. # %DESCRIPTION:
  1592. #  Starts currently-selected PPPoE connection.
  1593. #***********************************************************************
  1594. proc StartPPPoEConnection {} {
  1595.     global Wrapper
  1596.     global StartState
  1597.     global UpdateToken
  1598.  
  1599.     set conn [GetCurrentConnection]
  1600.     if {"$conn" == ""} {
  1601.     return
  1602.     }
  1603.  
  1604.     if {"$UpdateToken" != ""} {
  1605.     after cancel $UpdateToken
  1606.     set UpdateToken ""
  1607.     }
  1608.  
  1609.     catch { unset StartState }
  1610.     set StartState(chars) ""
  1611.     set StartState(status) ""
  1612.     set StartState(msg) ""
  1613.     set StartState(flip) 0
  1614.  
  1615.     set fp [open "|$Wrapper start $conn" "r"]
  1616.  
  1617.     # Set fileevent
  1618.     fileevent $fp readable [list StartFPReadable $fp]
  1619.  
  1620.     LockGui $fp
  1621.     vwait StartState(status)
  1622.     UnlockGui
  1623.  
  1624.     if {$StartState(status) == "failed"} {
  1625.     tk_dialog .err Error "[m {Error starting connection:}] $StartState(msg)" error 0 OK
  1626.     }
  1627.     SetButtonStates
  1628.     UpdateConnectionState 0
  1629. }
  1630.  
  1631. proc LockGui { fp } {
  1632.     .start configure -state disabled
  1633.     .stop configure -state normal -command [list AbortConnection $fp]
  1634.     .exit configure -state disabled
  1635.     .m1 configure -state disabled
  1636.     grab set .stop
  1637. }
  1638.  
  1639. proc UnlockGui {} {
  1640.     .start configure -state normal
  1641.     .stop configure -state disabled -command StopPPPoEConnection
  1642.     .exit configure -state normal
  1643.     .m1 configure -state normal
  1644.     grab release .stop
  1645. }
  1646.  
  1647. proc AbortConnection { fp } {
  1648.     global StartState
  1649.     catch { StopPPPoEConnection }
  1650.     catch { close $fp }
  1651.     set StartState(msg) "[m {Connection aborted by user}]"
  1652.     set StartState(status) "[m {failed}]"
  1653. }
  1654.  
  1655. #***********************************************************************
  1656. # %PROCEDURE: StartFPReadable
  1657. # %ARGUMENTS:
  1658. #  fp -- file handle
  1659. # %RETURNS:
  1660. #  Nothing
  1661. # %DESCRIPTION:
  1662. #  Called when the "pppoe-start" file handle is readable.
  1663. #***********************************************************************
  1664. proc StartFPReadable { fp } {
  1665.     global StartState
  1666.     set char [read $fp 1]
  1667.     if {$char == ""} {
  1668.     set uhoh [catch {close $fp} err]
  1669.     if {$uhoh} {
  1670.         set StartState(status) "[m {failed}]"
  1671.         set StartState(msg) $err
  1672.     } else {
  1673.         set StartState(status) "[m {succeeded}]"
  1674.     }
  1675.     return
  1676.     }
  1677.     append StartState(chars) $char
  1678.     if {$StartState(flip)} {
  1679.     ConnectionStateDown
  1680.     } else {
  1681.     ConnectionStateOff
  1682.     }
  1683.     set StartState(flip) [expr 1 - $StartState(flip)]
  1684. }
  1685.  
  1686. #***********************************************************************
  1687. # %PROCEDURE: StopPPPoEConnection
  1688. # %ARGUMENTS:
  1689. #  None
  1690. # %RETURNS:
  1691. #  Nothing
  1692. # %DESCRIPTION:
  1693. #  Stops currently-selected PPPoE connection.
  1694. #***********************************************************************
  1695. proc StopPPPoEConnection {} {
  1696.     global Wrapper
  1697.     set conn [GetCurrentConnection]
  1698.     if {"$conn" == ""} {
  1699.     return
  1700.     }
  1701.     set fp [open "|$Wrapper stop $conn" "r"]
  1702.     while {1} {
  1703.     set char [read $fp 1]
  1704.     if {"$char" == ""} {
  1705.         break;
  1706.     }
  1707.     }
  1708.     set uhoh [catch {close $fp} err]
  1709.     if {$uhoh} {
  1710.     # Ignore a common error
  1711.     if {![string match "*appears to have died*" $err]} {
  1712.         tk_dialog .err Error "[m {Error stopping connection:}] $err" error 0 OK
  1713.     }
  1714.     }
  1715.     SetButtonStates
  1716.     UpdateConnectionState 0
  1717. }
  1718.  
  1719. #***********************************************************************
  1720. # %PROCEDURE: NewPPPoEConnection
  1721. # %ARGUMENTS:
  1722. #  name -- if supplied, we're editing the existing connection "name"
  1723. # %RETURNS:
  1724. #  Nothing
  1725. # %DESCRIPTION:
  1726. #  Creates a new PPPoE connection
  1727. #***********************************************************************
  1728. proc NewPPPoEConnection {{name ""}} {
  1729.     set w .newcon
  1730.     if {[winfo exists $w]} {
  1731.     wm deiconify $w
  1732.     raise $w
  1733.     return
  1734.     }
  1735.  
  1736.     toplevel $w
  1737.     if {"$name" == ""} {
  1738.     wm title $w "[m {New Connection}] - RP-PPPoE"
  1739.     wm iconname $w "[m {New Connection}]"
  1740.     } else {
  1741.     wm title $w "[m {Edit Connection}] - RP-PPPoE"
  1742.     wm iconname $w "[m {Edit Connection}]"
  1743.     }
  1744.     wm withdraw $w
  1745.  
  1746.     tabnotebook_create $w.tn
  1747.     set basic [tabnotebook_page $w.tn "[m {Basic}]"]
  1748.     set interface [tabnotebook_page $w.tn "[m {NIC and DNS}]"]
  1749.     set opts [tabnotebook_page $w.tn "[m {Options}]"]
  1750.     set advanced [tabnotebook_page $w.tn "[m {Advanced}]"]
  1751.  
  1752.     # ----------- BASIC PAGE -------------
  1753.     label $w.lconName -text "[m {Connection Name:}] " -anchor e
  1754.     if {"$name" != ""} {
  1755.     label $w.conName -text $name -anchor w
  1756.     } else {
  1757.     entry $w.conName -width 15
  1758.     RegisterHelpWindow $w.lconName "[m {Enter a name for this connection.  It can contain letters, numbers, undescores and the minus-sign.}]" $w.help
  1759.     RegisterHelpWindow $w.conName "[m {Enter a name for this connection.  It can contain letters, numbers, undescores and the minus-sign.}]" $w.help
  1760.     }
  1761.  
  1762.     label $w.luser -text "[m {User Name:}] " -anchor e
  1763.     entry $w.user -width 15
  1764.     RegisterHelpWindow $w.luser "[m {Enter your user name.  Do not add a domain-name after the user name.}]" $w.help
  1765.     RegisterHelpWindow $w.user "[m {Enter your user name.  Do not add a domain-name after the user name.}]" $w.help
  1766.  
  1767.     label $w.lnet -text "[m {Network:}] " -anchor e
  1768.     entry $w.network -width 15
  1769.     RegisterHelpWindow $w.lnet "[m {Some ISP's require you to enter their domain-name here (e.g. "sympatico.ca").}]" $w.help
  1770.     RegisterHelpWindow $w.network "[m {Some ISP's require you to enter their domain-name here (e.g. "sympatico.ca").}]" $w.help
  1771.  
  1772.     label $w.lpass -text "[m {Password:}] " -anchor e
  1773.     entry $w.pass -width 15 -show "*"
  1774.     RegisterHelpWindow $w.lpass "[m {Enter your password.}]" $w.help
  1775.     RegisterHelpWindow $w.pass "[m {Enter your password.}]" $w.help
  1776.  
  1777.     grid $w.lconName $w.conName -in $basic -sticky nsew
  1778.     grid $w.luser $w.user -in $basic -sticky nsew
  1779.     grid $w.lnet $w.network -in $basic -sticky nsew
  1780.     grid $w.lpass $w.pass -in $basic -sticky nsew
  1781.     grid columnconfigure $basic 1 -weight 1
  1782.  
  1783.     # ----------- INTERFACES PAGE -------------
  1784.     set ifs {}
  1785.     catch {set ifs [GetEthernetInterfaces]}
  1786.  
  1787.     label $w.lifname -text "[m {Ethernet Interface:}] " -anchor e
  1788.     entry $w.ifname -width 8
  1789.     RegisterHelpWindow $w.lifname "[m {Enter Ethernet interface to which DSL modem is attached.}]" $w.help
  1790.     RegisterHelpWindow $w.ifname "[m {Enter Ethernet interface to which DSL modem is attached.}]" $w.help
  1791.  
  1792.     if {[llength $ifs] > 0} {
  1793.     menubutton $w.ifmb -relief raised -text "..." -menu $w.ifmb.menu
  1794.     RegisterHelpWindow $w.ifmb "[m {Browse detected Ethernet interface names.}]" $w.help
  1795.     menu $w.ifmb.menu -tearoff 0
  1796.     foreach if $ifs {
  1797.         $w.ifmb.menu add command -label $if -command "$w.ifname delete 0 end; $w.ifname insert end [list $if]"
  1798.     }
  1799.     grid $w.lifname $w.ifname $w.ifmb -in $interface -sticky nsew
  1800.     } else {
  1801.     grid $w.lifname $w.ifname - -in $interface -sticky nsew
  1802.     }
  1803.  
  1804.     label $w.ldns -text "[m {DNS Setup:}] " -anchor e
  1805.     menubutton $w.dns -text "[m {From Server}]" -menu $w.dns.menu -relief raised -indicatoron 1
  1806.     menu $w.dns.menu -tearoff 0
  1807.     foreach thing [list "[m {From Server}]" "[m {Specify}]" "[m {Do not Adjust}]"] {
  1808.     $w.dns.menu add command -label $thing -command [list SetDNSOption $w $thing]
  1809.     }
  1810.     RegisterHelpWindow $w.ldns [m "DNS server options:\n'From Server'   - Let PPPoE server specify DNS servers\n'Specify'       - Enter IP addresses of DNS servers yourself\n'Do not Adjust' - Leave your DNS setup alone."] $w.help
  1811.     RegisterHelpWindow $w.dns [m "DNS server options:\n'From Server'   - Let PPPoE server specify DNS servers\n'Specify'       - Enter IP addresses of DNS servers yourself\n'Do not Adjust' - Leave your DNS setup alone."] $w.help
  1812.  
  1813.     label $w.ldns1 -text "[m {Primary DNS:}] " -anchor e
  1814.     entry $w.dns1 -width 16
  1815.     RegisterHelpWindow $w.ldns1 "[m {Enter the IP address of the primary DNS server.}]" $w.help
  1816.     RegisterHelpWindow $w.dns1 "[m {Enter the IP address of the primary DNS server.}]" $w.help
  1817.     label $w.ldns2 -text "[m {Secondary DNS:}] " -anchor e
  1818.     entry $w.dns2 -width 16
  1819.     RegisterHelpWindow $w.ldns2 "[m {Enter the IP address of the secondary DNS server.}]" $w.help
  1820.     RegisterHelpWindow $w.dns2 "[m {Enter the IP address of the secondary DNS server.}]" $w.help
  1821.  
  1822.     SetDNSOption $w "[m {From Server}]"
  1823.     grid $w.ldns $w.dns - -in $interface -sticky nsew
  1824.     grid $w.ldns1 $w.dns1 - -in $interface -sticky nsew
  1825.     grid $w.ldns2 $w.dns2 - -in $interface -sticky nsew
  1826.  
  1827.     # If only one Ethernet interface, select it by default
  1828.     if {[llength $ifs] == 1} {
  1829.     $w.ifname insert end [lindex $ifs 0]
  1830.     }
  1831.  
  1832.     grid columnconfigure $interface 1 -weight 1
  1833.     # ----------- OPTS PAGE -------------
  1834.     checkbutton $w.nonroot -text "[m {Allow use by non-root users}]" -variable OPTS(nonroot) -anchor w
  1835.     RegisterHelpWindow $w.nonroot "[m {If enabled, ordinary users can start and stop this connection.}]" $w.help
  1836.     checkbutton $w.sync -text "[m {Use synchronous PPP}]" -variable OPTS(sync) -anchor w
  1837.     RegisterHelpWindow $w.sync "[m {Use synchronous PPP (recommended -- easier on the CPU.)}]" $w.help
  1838.     label $w.lfw -text "[m {Firewalling:}] " -anchor e
  1839.     if {[llength $ifs] == 1} {
  1840.     set defaultFW "[m {Stand-Alone}]"
  1841.     } else {
  1842.     set defaultFW "[m {Masquerading}]"
  1843.     }
  1844.     menubutton $w.fw -text $defaultFW -menu $w.fw.menu -indicatoron 1 -relief raised
  1845.     menu $w.fw.menu -tearoff 0
  1846.     foreach type [list [m "Stand-Alone"] [m "Masquerading"] [m "None"]] {
  1847.     $w.fw.menu add command -label $type -command [list $w.fw configure -text $type]
  1848.     }
  1849.  
  1850.     RegisterHelpWindow $w.lfw [m "Firewalling options:\nStand-Alone  - A stand-alone machine.\nMasquerading - A gateway machine used for Internet sharing.\nNone         - Use if you already have your own firewall rules or want to run servers."] $w.help
  1851.     RegisterHelpWindow $w.fw [m "Firewalling options:\nStand-Alone  - A stand-alone machine.\nMasquerading - A gateway machine used for Internet sharing.\nNone         - Use if you already have your own firewall rules or want to run servers."] $w.help
  1852.     grid $w.nonroot - -in $opts -sticky nsew
  1853.     grid $w.sync - -in $opts -sticky nsew
  1854.     grid $w.lfw $w.fw -in $opts -sticky nsw
  1855.     grid columnconfigure $opts 1 -weight 1
  1856.  
  1857.     # ----------- ADVANCED PAGE -------------
  1858.     label $w.lsn -text "[m {Service-Name:}] " -anchor e
  1859.     entry $w.servicename -width 24
  1860.  
  1861.     label $w.lac -text "[m {AC-Name:}] " -anchor e
  1862.     entry $w.acname -width 24
  1863.  
  1864.     RegisterHelpWindow $w.lac [m "Enter access concentrator name if required.  Most ISPs do not require this; try leaving it blank."] $w.help
  1865.     RegisterHelpWindow $w.acname [m "Enter access concentrator name if required.  Most ISPs do not require this; try leaving it blank."] $w.help
  1866.     grid $w.lsn $w.servicename -in $advanced -sticky nsew
  1867.     grid $w.lac $w.acname -in $advanced -sticky nsew
  1868.     RegisterHelpWindow $w.lsn [m "Enter service name if required.  Most ISPs do not require this; try leaving it blank."] $w.help
  1869.     RegisterHelpWindow $w.servicename [m "Enter service name if required.  Most ISPs do not require this; try leaving it blank."] $w.help
  1870.  
  1871.     grid columnconfigure $advanced 1 -weight 1
  1872.  
  1873.     # ----------- BUTTONS -------------
  1874.     frame $w.buttons
  1875.     button $w.ok -text [m "OK"] -command [list NewPPPoEConnectionOK $name $w]
  1876.     button $w.cancel -text [m "Cancel"] -command [list destroy $w]
  1877.     pack $w.ok $w.cancel -in $w.buttons -expand 0 -fill none -side left
  1878.  
  1879.     pack $w.tn -side top -expand 1 -fill both
  1880.  
  1881.     text $w.help -width 60 -wrap word -state disabled -height 6
  1882.     pack $w.help -side top -expand 0 -fill both
  1883.     pack $w.buttons -side top -expand 0 -fill x
  1884.  
  1885.     # If we're editing existing connection, fill GUI with current values
  1886.     if {"$name" != ""} {
  1887.     FillConnectionGui $w $name
  1888.     }
  1889.     wm deiconify $w
  1890.     update idletasks
  1891.     raise $w
  1892. }
  1893.  
  1894. #***********************************************************************
  1895. # %PROCEDURE: SetDNSOption
  1896. # %ARGUMENTS:
  1897. #  w -- connection-editing window
  1898. #  opt -- value of DNS option
  1899. # %RETURNS:
  1900. #  Nothing
  1901. # %DESCRIPTION:
  1902. #  Adjusts GUI for specified option
  1903. #***********************************************************************
  1904. proc SetDNSOption { w opt } {
  1905.     $w.dns configure -text $opt
  1906.     if {"$opt" == "[m Specify]"} {
  1907.     $w.dns1 configure -state normal -background white
  1908.     $w.dns2 configure -state normal -background white
  1909.     } else {
  1910.     $w.dns1 configure -state disabled -background "#d9d9d9"
  1911.     $w.dns2 configure -state disabled -background "#d9d9d9"
  1912.     }
  1913. }
  1914.  
  1915. # ----------------------------------------------------------------------
  1916. # Tabbed notebook code from "Effective Tcl/Tk Programming"
  1917. # ----------------------------------------------------------------------
  1918. #  EXAMPLE: tabnotebook that can dial up pages
  1919. # ----------------------------------------------------------------------
  1920. #  Effective Tcl/Tk Programming
  1921. #    Mark Harrison, DSC Communications Corp.
  1922. #    Michael McLennan, Bell Labs Innovations for Lucent Technologies
  1923. #    Addison-Wesley Professional Computing Series
  1924. # ======================================================================
  1925. #  Copyright (c) 1996-1997  Lucent Technologies Inc. and Mark Harrison
  1926. # ======================================================================
  1927.  
  1928. option add *Tabnotebook.tabs.background #666666 widgetDefault
  1929. option add *Tabnotebook.margin 6 widgetDefault
  1930. option add *Tabnotebook.tabColor #a6a6a6 widgetDefault
  1931. option add *Tabnotebook.activeTabColor #d9d9d9 widgetDefault
  1932. option add *Tabnotebook.tabFont \
  1933.     -*-helvetica-bold-r-normal--*-120-* widgetDefault
  1934.  
  1935. proc tabnotebook_create {win} {
  1936.     global tnInfo
  1937.  
  1938.     frame $win -class Tabnotebook
  1939.     canvas $win.tabs -highlightthickness 0
  1940.     pack $win.tabs -fill x
  1941.  
  1942.     notebook_create $win.notebook
  1943.     pack $win.notebook -expand yes -fill both
  1944.  
  1945.     set tnInfo($win-tabs) ""
  1946.     set tnInfo($win-current) ""
  1947.     set tnInfo($win-pending) ""
  1948.     return $win
  1949. }
  1950.  
  1951. proc tabnotebook_page {win name} {
  1952.     global tnInfo
  1953.  
  1954.     set page [notebook_page $win.notebook $name]
  1955.     lappend tnInfo($win-tabs) $name
  1956.  
  1957.     if {$tnInfo($win-pending) == ""} {
  1958.     set id [after idle [list tabnotebook_refresh $win]]
  1959.     set tnInfo($win-pending) $id
  1960.     }
  1961.     return $page
  1962. }
  1963.  
  1964. proc tabnotebook_refresh {win} {
  1965.     global tnInfo
  1966.  
  1967.     $win.tabs delete all
  1968.  
  1969.     set margin [option get $win margin Margin]
  1970.     set color [option get $win tabColor Color]
  1971.     set font [option get $win tabFont Font]
  1972.     set x 2
  1973.     set maxh 0
  1974.  
  1975.     foreach name $tnInfo($win-tabs) {
  1976.     set id [$win.tabs create text \
  1977.         [expr $x+$margin+2] [expr -0.5*$margin] \
  1978.         -anchor sw -text $name -font $font \
  1979.         -tags [list $name]]
  1980.  
  1981.     set bbox [$win.tabs bbox $id]
  1982.     set wd [expr [lindex $bbox 2]-[lindex $bbox 0]]
  1983.     set ht [expr [lindex $bbox 3]-[lindex $bbox 1]]
  1984.     if {$ht > $maxh} {
  1985.         set maxh $ht
  1986.     }
  1987.  
  1988.     $win.tabs create polygon 0 0  $x 0 \
  1989.         [expr $x+$margin] [expr -$ht-$margin] \
  1990.         [expr $x+$margin+$wd] [expr -$ht-$margin] \
  1991.         [expr $x+$wd+2*$margin] 0 \
  1992.         2000 0  2000 10  0 10 \
  1993.         -outline black -fill $color \
  1994.         -tags [list $name tab tab-$name]
  1995.  
  1996.     $win.tabs raise $id
  1997.  
  1998.     $win.tabs bind $name <ButtonPress-1> \
  1999.         [list tabnotebook_display $win $name]
  2000.  
  2001.     set x [expr $x+$wd+2*$margin]
  2002.     }
  2003.     set height [expr $maxh+2*$margin]
  2004.     $win.tabs move all 0 $height
  2005.  
  2006.     $win.tabs configure -width $x -height [expr $height+4]
  2007.  
  2008.     if {$tnInfo($win-current) != ""} {
  2009.     tabnotebook_display $win $tnInfo($win-current)
  2010.     } else {
  2011.     tabnotebook_display $win [lindex $tnInfo($win-tabs) 0]
  2012.     }
  2013.     set tnInfo($win-pending) ""
  2014. }
  2015.  
  2016. proc tabnotebook_display {win name} {
  2017.     global tnInfo
  2018.  
  2019.     notebook_display $win.notebook $name
  2020.  
  2021.     set normal [option get $win tabColor Color]
  2022.     $win.tabs itemconfigure tab -fill $normal
  2023.  
  2024.     set active [option get $win activeTabColor Color]
  2025.     $win.tabs itemconfigure tab-$name -fill $active
  2026.     $win.tabs raise $name
  2027.  
  2028.     set tnInfo($win-current) $name
  2029. }
  2030.  
  2031. # ----------------------------------------------------------------------
  2032. #  EXAMPLE: simple notebook that can dial up pages
  2033. # ----------------------------------------------------------------------
  2034. #  Effective Tcl/Tk Programming
  2035. #    Mark Harrison, DSC Communications Corp.
  2036. #    Michael McLennan, Bell Labs Innovations for Lucent Technologies
  2037. #    Addison-Wesley Professional Computing Series
  2038. # ======================================================================
  2039. #  Copyright (c) 1996-1997  Lucent Technologies Inc. and Mark Harrison
  2040. # ======================================================================
  2041.  
  2042. option add *Notebook.borderWidth 2 widgetDefault
  2043. option add *Notebook.relief sunken widgetDefault
  2044.  
  2045. proc notebook_create {win} {
  2046.     global nbInfo
  2047.  
  2048.     frame $win -class Notebook
  2049.     pack propagate $win 0
  2050.  
  2051.     set nbInfo($win-count) 0
  2052.     set nbInfo($win-pages) ""
  2053.     set nbInfo($win-current) ""
  2054.     return $win
  2055. }
  2056.  
  2057. proc notebook_page {win name} {
  2058.     global nbInfo
  2059.  
  2060.     set page "$win.page[incr nbInfo($win-count)]"
  2061.     lappend nbInfo($win-pages) $page
  2062.     set nbInfo($win-page-$name) $page
  2063.  
  2064.     frame $page
  2065.  
  2066.     if {$nbInfo($win-count) == 1} {
  2067.     after idle [list notebook_display $win $name]
  2068.     }
  2069.     return $page
  2070. }
  2071.  
  2072. proc notebook_display {win name} {
  2073.     global nbInfo
  2074.  
  2075.     set page ""
  2076.     if {[info exists nbInfo($win-page-$name)]} {
  2077.     set page $nbInfo($win-page-$name)
  2078.     } elseif {[winfo exists $win.page$name]} {
  2079.     set page $win.page$name
  2080.     }
  2081.     if {$page == ""} {
  2082.     error "bad notebook page \"$name\""
  2083.     }
  2084.  
  2085.     notebook_fix_size $win
  2086.  
  2087.     if {$nbInfo($win-current) != ""} {
  2088.     pack forget $nbInfo($win-current)
  2089.     }
  2090.     pack $page -expand yes -fill both
  2091.     set nbInfo($win-current) $page
  2092. }
  2093.  
  2094. proc notebook_fix_size {win} {
  2095.     global nbInfo
  2096.  
  2097.     update idletasks
  2098.  
  2099.     set maxw 0
  2100.     set maxh 0
  2101.     foreach page $nbInfo($win-pages) {
  2102.     set w [winfo reqwidth $page]
  2103.     if {$w > $maxw} {
  2104.         set maxw $w
  2105.     }
  2106.     set h [winfo reqheight $page]
  2107.     if {$h > $maxh} {
  2108.         set maxh $h
  2109.     }
  2110.     }
  2111.     set bd [$win cget -borderwidth]
  2112.     set maxw [expr $maxw+2*$bd]
  2113.     set maxh [expr $maxh+2*$bd]
  2114.     $win configure -width $maxw -height $maxh
  2115. }
  2116.  
  2117. #***********************************************************************
  2118. # %PROCEDURE: SetupGuiToList
  2119. # %ARGUMENTS:
  2120. #  w -- the PPPoE connection setup window
  2121. # %RETURNS:
  2122. #  A list of (name value) pairs for the connection.
  2123. # %DESCRIPTION:
  2124. #  Reads values from the GUI; makes a list.
  2125. #***********************************************************************
  2126. proc SetupGuiToList { w } {
  2127.     global OPTS
  2128.     set ans {}
  2129.     if {[catch {lappend ans ConnectionName [$w.conName get]}]} {
  2130.     lappend ans ConnectionName [$w.conName cget -text]
  2131.     }
  2132.     lappend ans UserName       [$w.user get]
  2133.     lappend ans NetworkName    [$w.network get]
  2134.     lappend ans Password       [$w.pass get]
  2135.     lappend ans Interface      [$w.ifname get]
  2136.     lappend ans DNSType        [$w.dns cget -text]
  2137.     lappend ans DNS1           [$w.dns1 get]
  2138.     lappend ans DNS2           [$w.dns2 get]
  2139.     lappend ans NonrootOK      $OPTS(nonroot)
  2140.     lappend ans Sync           $OPTS(sync)
  2141.     lappend ans FirewallType   [$w.fw cget -text]
  2142.     lappend ans ServiceName    [$w.servicename get]
  2143.     lappend ans ACName         [$w.acname get]
  2144.  
  2145.     # Validate
  2146.     set name [value $ans ConnectionName]
  2147.     if {![regexp -nocase {^[-a-z0-9_]+$} $name]} {
  2148.     error [m "Connection name must be non-blank and contain only letters, digits, `_' and `-'"]
  2149.     }
  2150.  
  2151.     # Check DNS
  2152.     set type [value $ans DNSType]
  2153.     if {"$type" == [m "Specify"]} {
  2154.     set dns [value $ans DNS1]
  2155.     if {![regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} "$dns"]} {
  2156.         error [m "Primary DNS entry must consist of four dot-separated decimal numbers"]
  2157.     }
  2158.     set dns [value $ans DNS2]
  2159.     if {"$dns" != "" && ![regexp {[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+} "$dns"]} {
  2160.         error [m "Secondary DNS entry must consist of four dot-separated decimal numbers"]
  2161.     }
  2162.     }
  2163.     return $ans
  2164. }
  2165.  
  2166. #***********************************************************************
  2167. # %PROCEDURE: ListToSetupGui
  2168. # %ARGUMENTS:
  2169. #  w -- the PPPoE connection setup window
  2170. #  lst -- a list of name/value pairs
  2171. # %RETURNS:
  2172. #  Nothing
  2173. # %DESCRIPTION:
  2174. #  Updates GUI to reflect lst
  2175. #***********************************************************************
  2176. proc ListToSetupGui { w lst } {
  2177.     global OPTS
  2178.     foreach {key value} $lst {
  2179.     switch -exact -- $key {
  2180.         ConnectionName {
  2181.         catch {
  2182.             $w.conName delete 0 end
  2183.             $w.conName insert end $value
  2184.         }
  2185.         catch {
  2186.             $w.conName configure -text $value
  2187.         }
  2188.         }
  2189.         UserName {
  2190.         $w.user delete 0 end
  2191.         $w.user insert end $value
  2192.         }
  2193.         NetworkName {
  2194.         $w.network delete 0 end
  2195.         $w.network insert end $value
  2196.         }
  2197.         Password {
  2198.         $w.pass delete 0 end
  2199.         $w.pass insert end $value
  2200.         }
  2201.         Interface {
  2202.         $w.ifname delete 0 end
  2203.         $w.ifname insert end $value
  2204.         }
  2205.         DNSType {
  2206.         SetDNSOption $w $value
  2207.         }
  2208.         DNS1 {
  2209.         set oldstate [$w.dns1 cget -state]
  2210.         $w.dns1 configure -state normal
  2211.         $w.dns1 delete 0 end
  2212.         $w.dns1 insert end $value
  2213.         $w.dns1 configure -state $oldstate
  2214.         }
  2215.         DNS2 {
  2216.         set oldstate [$w.dns2 cget -state]
  2217.         $w.dns2 configure -state normal
  2218.         $w.dns2 delete 0 end
  2219.         $w.dns2 insert end $value
  2220.         $w.dns2 configure -state $oldstate
  2221.         }
  2222.         NonrootOK {
  2223.         set OPTS(nonroot) $value
  2224.         }
  2225.         Sync {
  2226.         set OPTS(sync) $value
  2227.         }
  2228.         FirewallType {
  2229.         $w.fw configure -text $value
  2230.         }
  2231.         ServiceName {
  2232.         $w.servicename delete 0 end
  2233.         $w.servicename insert end $value
  2234.         }
  2235.         ACName {
  2236.         $w.acname delete 0 end
  2237.         $w.acname insert end $value
  2238.         }
  2239.     }
  2240.     }
  2241. }
  2242.  
  2243. proc NewPPPoEConnectionOK { name w } {
  2244.     if {[catch {set conn [SetupGuiToList $w]} err]} {
  2245.     tk_dialog .err "Invalid Parameters" "$err" error 0 OK
  2246.     return
  2247.     }
  2248.     if {"$name" == ""} {
  2249.     set name [value $conn ConnectionName]
  2250.     set tmp [GetConnection $name]
  2251.     if {"$tmp" != ""} {
  2252.         tk_dialog .err [m "Connection Exists"] [m "The connection already exists.  Pick another name."] error 0 OK
  2253.     return
  2254.     }
  2255.     }
  2256.     ReplaceConnection $conn
  2257.     SaveConnectionInfo
  2258.     BuildConnectionMenu
  2259.     SwitchConnection $name
  2260.     destroy $w
  2261. }
  2262.  
  2263. proc SaveConnectionInfo {} {
  2264.     global ConnectionInfo ConnectionInfoFile PasswordFile
  2265.     set fp [open "$ConnectionInfoFile.new" "w"]
  2266.     puts $fp "# RP-PPPoE GUI Configuration Information."
  2267.     puts $fp "# This file may *look* human-editable, but it is NOT."
  2268.     puts $fp "# So, you with the text editor:  Keep away from this file."
  2269.     puts $fp "#"
  2270.     set expunged {}
  2271.     set passwords {}
  2272.     foreach thing $ConnectionInfo {
  2273.     set name [value $thing ConnectionName]
  2274.     set password [value $thing Password]
  2275.     set pwindex [lsearch -exact $thing Password]
  2276.     set safe [lreplace $thing $pwindex [expr $pwindex+1]]
  2277.     set pwd [list ConnectionName $name Password $password]
  2278.     lappend expunged $safe
  2279.     lappend passwords $pwd
  2280.     }
  2281.     puts $fp $expunged
  2282.     close $fp
  2283.     set fp [open "$PasswordFile.new" "w"]
  2284.     exec chmod 600 "$PasswordFile.new"
  2285.     puts $fp "# RP-PPPoE GUI Configuration Information."
  2286.     puts $fp "# This file may *look* human-editable, but it is NOT."
  2287.     puts $fp "# So, you with the text editor:  Keep away from this file."
  2288.     puts $fp "#"
  2289.     puts $fp $passwords
  2290.     close $fp
  2291.     file rename -force "$ConnectionInfoFile.new" "$ConnectionInfoFile"
  2292.     file rename -force "$PasswordFile.new" "$PasswordFile"
  2293.  
  2294.     # Generate config files for pppoe-start for each connection
  2295.     foreach thing $ConnectionInfo {
  2296.     GenerateConfigFile $thing
  2297.     }
  2298.  
  2299.     # Now update /etc/ppp/pap-secrets and /etc/ppp/chap-secrets
  2300.     foreach thing $ConnectionInfo {
  2301.     GenerateSecretsEntry $thing
  2302.     }
  2303. }
  2304.  
  2305. #***********************************************************************
  2306. # %PROCEDURE: ReadShellEscapedWord
  2307. # %ARGUMENTS:
  2308. #  str -- a string
  2309. # %RETURNS:
  2310. #  A two-element list -- the first element is a shell-escaped word
  2311. #  extracted from $str, just the way pppd parses /etc/ppp/pap-secrets.
  2312. #  The second element is the remaining portion of $str
  2313. #***********************************************************************
  2314. proc ReadShellEscapedWord { str } {
  2315.     set ans {}
  2316.     set rest $str
  2317.  
  2318.     # Chew up leading spaces
  2319.     set rest [string trimleft $rest]
  2320.  
  2321.     # If first char is a quote, read until a quote
  2322.     if {"[string index $rest 0]" == "\""} {
  2323.     set rest [string range $rest 1 end]
  2324.     set nextquote [string first "\"" $rest]
  2325.     # If no following quote, pretend we haven't seen a quote, I guess.
  2326.     if {$nextquote >= 0} {
  2327.         set ans [string range $rest 0 [expr $nextquote-1]]
  2328.         set rest [string range $rest [expr $nextquote+1] end]
  2329.         return [list $ans $rest]
  2330.     }
  2331.     }
  2332.  
  2333.     # Not a quote; chew through the string until an unescaped space
  2334.     while {[string length $rest] > 0} {
  2335.     set char [string index $rest 0]
  2336.     set rest [string range $rest 1 end]
  2337.     # Sneaky test for whitespace in Tcl 8.0
  2338.     if {"[string trim $char]" == ""} {
  2339.         return [list $ans $rest]
  2340.     }
  2341.     if {"$char" == "\\"} {
  2342.         set char [string index $rest 0]
  2343.         set rest [string range $rest 1 end]
  2344.     }
  2345.     append ans $char
  2346.     }
  2347.     return [list $ans $rest]
  2348. }
  2349.  
  2350.  
  2351. #***********************************************************************
  2352. # %PROCEDURE: GenerateSecretsEntry
  2353. # %ARGUMENTS:
  2354. #  conn -- a connection key/value list
  2355. # %RETURNS:
  2356. #  Nothing
  2357. # %DESCRIPTION:
  2358. #  Adds entries to /etc/ppp/pap-secrets and /etc/ppp/chap-secrets.
  2359. #***********************************************************************
  2360. proc GenerateSecretsEntry { conn } {
  2361.     set user [value $conn UserName]
  2362.     set net [value $conn NetworkName]
  2363.     set password [value $conn Password]
  2364.     if {"$net" != ""} {
  2365.     set user "$user@$net"
  2366.     }
  2367.     GenerateSecretsEntryForFile $user $password "/etc/ppp/pap-secrets"
  2368.     GenerateSecretsEntryForFile $user $password "/etc/ppp/chap-secrets"
  2369. }
  2370.  
  2371. #***********************************************************************
  2372. # %PROCEDURE: GenerateSecretsEntryForFile
  2373. # %ARGUMENTS:
  2374. #  user -- user name
  2375. #  password -- password
  2376. #  fname -- file to add entry to.
  2377. # %RETURNS:
  2378. #  Nothing
  2379. # %DESCRIPTION:
  2380. #  Adds entries to /etc/ppp/pap-secrets or /etc/ppp/chap-secrets.
  2381. #***********************************************************************
  2382. proc GenerateSecretsEntryForFile { user password fname } {
  2383.     # Copy $fname to $fname.new
  2384.     set out [open "$fname.new" "w"]
  2385.     exec chmod go-rwx "$fname.new"
  2386.     if {[file exists $fname]} {
  2387.     set in [open $fname "r"]
  2388.     while {[gets $in line] >= 0} {
  2389.         set trimmed [string trim $line]
  2390.         if {"$trimmed" == ""} {
  2391.         puts $out $line
  2392.         continue
  2393.         }
  2394.         if {[string match "#*" $trimmed]} {
  2395.         puts $out $line
  2396.         continue
  2397.         }
  2398.  
  2399.         # Read the user name off the line; copy it unless it's our
  2400.         # user name.
  2401.         foreach {word dummy} [ReadShellEscapedWord $line] {break}
  2402.         if {$word != $user} {
  2403.         puts $out $line
  2404.         }
  2405.     }
  2406.     close $in
  2407.     }
  2408.  
  2409.     # Now add our line
  2410.     set user [ShellEscape $user]
  2411.     set password [ShellEscape $password]
  2412.     puts $out "$user\t*\t$password\t*"
  2413.     close $out
  2414.     file rename -force $fname.new $fname
  2415. }
  2416.  
  2417. #***********************************************************************
  2418. # %PROCEDURE: ShellEscape
  2419. # %ARGUMENTS:
  2420. #  str
  2421. # %RETURNS:
  2422. #  A version of $str with shell meta-characters escaped
  2423. #***********************************************************************
  2424. proc ShellEscape { str } {
  2425.     set ans ""
  2426.     foreach char [split $str ""] {
  2427.     if {[string first $char "01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_+=-@./"] >= 0} {
  2428.         append ans $char
  2429.     } else {
  2430.         append ans "\\$char"
  2431.     }
  2432.     }
  2433.     return $ans
  2434. }
  2435.  
  2436.  
  2437. #***********************************************************************
  2438. # %PROCEDURE: GenerateConfigFile
  2439. # %ARGUMENTS:
  2440. #  conn -- a connection key/value list
  2441. # %RETURNS:
  2442. #  Nothing
  2443. # %DESCRIPTION:
  2444. #  Generates a configuration file for pppoe-start and friends under
  2445. #  /etc/ppp/rp-pppoe-gui
  2446. #***********************************************************************
  2447. proc GenerateConfigFile { conn } {
  2448.     global ConfigDir
  2449.     set name [value $conn ConnectionName]
  2450.     set fname [file join $ConfigDir conf.$name]
  2451.     set fp [open "$fname.new" w]
  2452.     puts $fp "# Configuration file for connection `$name'."
  2453.     puts $fp "# Automatically generated.  Do not edit by hand."
  2454.     puts $fp ""
  2455.     foreach {var val} $conn {
  2456.     switch -exact $var {
  2457.         UserName {
  2458.         set net [value $conn NetworkName]
  2459.         if {"$net" != ""} {
  2460.             set user "$val@$net"
  2461.         } else {
  2462.             set user "$val"
  2463.         }
  2464.         puts $fp [ShellEscape "USER=$user"]
  2465.         }
  2466.         Interface {
  2467.         puts $fp [ShellEscape "ETH=$val"]
  2468.         }
  2469.         DNSType {
  2470.         if {"$val" == "[m {From Server}]"} {
  2471.             puts $fp "DNSTYPE=SERVER"
  2472.             puts $fp "PEERDNS=yes"
  2473.         } elseif {"$val" == "[m {Specify}]"} {
  2474.             puts $fp "DNSTYPE=SPECIFY"
  2475.             puts $fp "PEERDNS=no"
  2476.         } else {
  2477.             puts $fp "DNSTYPE=NOCHANGE"
  2478.             puts $fp "PEERDNS=no"
  2479.         }
  2480.         }
  2481.         DNS1 {
  2482.         puts $fp [ShellEscape "DNS1=$val"]
  2483.         }
  2484.         DNS2 {
  2485.         puts $fp [ShellEscape "DNS2=$val"]
  2486.         }
  2487.         NonrootOK {
  2488.         if {$val} {
  2489.             puts $fp "NONROOT=OK"
  2490.         }
  2491.         }
  2492.         ACName {
  2493.         puts $fp [ShellEscape "ACNAME=$val"]
  2494.         }
  2495.         ServiceName {
  2496.         puts $fp [ShellEscape "SERVICENAME=$val"]
  2497.         }
  2498.         FirewallType {
  2499.         if {"$val" == "[m {None}]"} {
  2500.             puts $fp "FIREWALL=NONE"
  2501.         } elseif {"$val" == "[m {Masquerading}]"} {
  2502.             puts $fp "FIREWALL=MASQUERADE"
  2503.         } else {
  2504.             puts $fp "FIREWALL=STANDALONE"
  2505.         }
  2506.         }
  2507.         Sync {
  2508.         if {$val} {
  2509.             puts $fp "SYNCHRONOUS=yes"
  2510.         } else {
  2511.             puts $fp "SYNCHRONOUS=no"
  2512.         }
  2513.         }
  2514.     }
  2515.     }
  2516.     puts $fp "CONNECT_TIMEOUT=30"
  2517.     puts $fp "CONNECT_POLL=1"
  2518.     puts $fp "FORCEPING=\".\""
  2519.     puts $fp "PIDFILE=/var/run/pppoe-$name.pid"
  2520.     puts $fp "CLAMPMSS=1412"
  2521.     puts $fp "LCP_INTERVAL=20"
  2522.     puts $fp "LCP_FAILURE=3"
  2523.     puts $fp "PPPOE_TIMEOUT=80"
  2524.     puts $fp "LINUX_PLUGIN="
  2525.     puts $fp "DEMAND=no"
  2526.     puts $fp "DEFAULTROUTE=yes"
  2527.     close $fp
  2528.     file rename -force "$fname.new" "$fname"
  2529. }
  2530.  
  2531. #***********************************************************************
  2532. # %PROCEDURE: GetConnectionStatus
  2533. # %ARGUMENTS:
  2534. #  conn -- connection name
  2535. # %RETURNS:
  2536. #  A three-element list:
  2537. #  {started/stopped up/down if}
  2538. #  If first element is "started", then connection has been started.
  2539. #  If second element is "up", then connection is up.
  2540. #  If connection is up, third element is PPP interface.
  2541. #***********************************************************************
  2542. proc GetConnectionStatus { conn } {
  2543.     set pidfile "/var/run/pppoe-$conn.pid"
  2544.  
  2545.     # Check for PID file
  2546.     if {![file readable $pidfile]} {
  2547.     return {stopped down ""}
  2548.     }
  2549.     set fp [open $pidfile "r"]
  2550.     gets $fp pid
  2551.     close $fp
  2552.  
  2553.     # Check if process is dead
  2554.     if {![file exists "/proc/$pid"]} {
  2555.     # The pppd might still be running... doh...
  2556.     if {![file readable "$pidfile.pppd"]} {
  2557.         return {stopped down ""}
  2558.     }
  2559.     set fp [open "$pidfile.pppd" "r"]
  2560.     gets $fp pid
  2561.     close $fp
  2562.     if {![file exists "/proc/$pid"]} {
  2563.         return {stopped down ""}
  2564.     }
  2565.     }
  2566.  
  2567.     # Now get PID of pppd
  2568.     if {![file readable "$pidfile.pppd"]} {
  2569.     return {started down ""}
  2570.     }
  2571.     set fp [open "$pidfile.pppd" "r"]
  2572.     gets $fp pid
  2573.     close $fp
  2574.  
  2575.     # Find interface to which it corresponds
  2576.     set pppdfiles [glob -nocomplain "/var/run/ppp*.pid"]
  2577.     set found {}
  2578.     foreach file $pppdfiles {
  2579.     set fp [open $file "r"]
  2580.     gets $fp ifpid
  2581.     close $fp
  2582.     if {$ifpid == $pid} {
  2583.         set found [file rootname [file tail $file]]
  2584.         break
  2585.     }
  2586.     }
  2587.     if {"$found" == ""} {
  2588.     return {started down ""}
  2589.     }
  2590.     return [list started up $found]
  2591. }
  2592.  
  2593. #***********************************************************************
  2594. # %PROCEDURE: UpdateConnectionState
  2595. # %ARGUMENTS:
  2596. #  fromAfter -- if 1, was called from an "after" callback.
  2597. # %RETURNS:
  2598. #  Nothing
  2599. # %DESCRIPTION:
  2600. #  Updates the "LED" displays; periodically reschedules itself to keep
  2601. #  updating display.
  2602. #***********************************************************************
  2603. proc UpdateConnectionState {{fromAfter 1}} {
  2604.     global UpdateToken
  2605.     global Packets
  2606.     global Bytes
  2607.     global UpdateInterval
  2608.     global MeasureTime
  2609.     if {$fromAfter} {
  2610.     set UpdateToken ""
  2611.     }
  2612.  
  2613.     set conn [GetCurrentConnection]
  2614.     if {"$conn" == ""} {
  2615.     ConnectionStateOff
  2616.     ResetGraph
  2617.     if {"$UpdateToken" != ""} {
  2618.         after cancel $UpdateToken
  2619.         set UpdateToken {}
  2620.     }
  2621.     return
  2622.     }
  2623.  
  2624.     foreach {startstop updown interface} [GetConnectionStatus $conn] {break}
  2625.     if {"$startstop" == "stopped"} {
  2626.     ConnectionStateOff
  2627.     ResetGraph
  2628.     } elseif {"$updown" == "down"} {
  2629.     ConnectionStateDown
  2630.     ResetGraph
  2631.     } else {
  2632.     # Get the packet counts
  2633.     set found 0
  2634.     set fp [open "/proc/net/dev" "r"]
  2635.     while {[gets $fp line] >= 0} {
  2636.         if {![string match "*$interface:*" $line]} {
  2637.         continue
  2638.         }
  2639.         set colon [string first ":" $line]
  2640.         if {$colon < 0} {
  2641.         continue
  2642.         }
  2643.         set line [string range $line [expr $colon+1] end]
  2644.         set found 1
  2645.         set MeasureTime [clock seconds]
  2646.         break
  2647.     }
  2648.     close $fp
  2649.     if {$found} {
  2650.         foreach {rbytes rpacks rerrs rdrop rfifo rframe rcomp rmulti tbytes tpacks} $line {break}
  2651.         if {!$fromAfter} {
  2652.         set Packets(in) $rpacks
  2653.         set Packets(out) $tpacks
  2654.         set Bytes(in) $rbytes
  2655.         set Bytes(out) $tbytes
  2656.         ConnectionStateUp
  2657.         ResetGraph
  2658.         } else {
  2659.         if {$rpacks != $Packets(in)} {
  2660.             ConnectionReceiveActive
  2661.         } else {
  2662.             ConnectionReceiveUp
  2663.         }
  2664.         if {$tpacks != $Packets(out)} {
  2665.             ConnectionTransmitActive
  2666.         } else {
  2667.             ConnectionTransmitUp
  2668.         }
  2669.         set Packets(in) $rpacks
  2670.         set Packets(out) $tpacks
  2671.         set Bytes(in) $rbytes
  2672.         set Bytes(out) $tbytes
  2673.         UpdateGraph
  2674.         }
  2675.     } else {
  2676.         ConnectionStateUp
  2677.         ResetGraph
  2678.     }
  2679.     }
  2680.     if {"$UpdateToken" == ""} {
  2681.     set UpdateToken [after $UpdateInterval UpdateConnectionState]
  2682.     }
  2683.     if {$fromAfter} {
  2684.     SetButtonStates
  2685.     }
  2686. }
  2687.  
  2688. proc ConnectionStateOff {} {
  2689.     .c itemconfigure xmitrect -fill "#A0A0A0"
  2690.     .c itemconfigure recvrect -fill "#A0A0A0"
  2691. }
  2692.  
  2693. proc ConnectionStateDown {} {
  2694.     .c itemconfigure xmitrect -fill "#A00000"
  2695.     .c itemconfigure recvrect -fill "#A00000"
  2696. }
  2697.  
  2698. proc ConnectionStateUp {} {
  2699.     .c itemconfigure xmitrect -fill "#00D000"
  2700.     .c itemconfigure recvrect -fill "#00D000"
  2701. }
  2702.  
  2703. proc ConnectionTransmitActive {} {
  2704.     .c itemconfigure xmitrect -fill "#FFFF00"
  2705. }
  2706.  
  2707. proc ConnectionTransmitUp {} {
  2708.     .c itemconfigure xmitrect -fill "#00D000"
  2709. }
  2710.  
  2711. proc ConnectionReceiveActive {} {
  2712.     .c itemconfigure recvrect -fill "#FFFF00"
  2713. }
  2714.  
  2715. proc ConnectionReceiveUp {} {
  2716.     .c itemconfigure recvrect -fill "#00D000"
  2717. }
  2718.  
  2719. proc ResetGraph {} {
  2720.     global GraphPoints
  2721.     set GraphPoints(in) {}
  2722.     set GraphPoints(out) {}
  2723.     set GraphPoints(times) {}
  2724.     .graph delete all
  2725.     UpdateGraph
  2726. }
  2727.  
  2728. proc UpdateGraph {} {
  2729.     global GraphPoints Bytes UpdateInterval MeasureTime
  2730.     lappend GraphPoints(times) $MeasureTime
  2731.     lappend GraphPoints(in) $Bytes(in)
  2732.     lappend GraphPoints(out) $Bytes(out)
  2733.  
  2734.     set w [winfo width .graph]
  2735.     set w2 [expr $w/2]
  2736.  
  2737.     set h [winfo height .graph]
  2738.     set toChop [expr [llength $GraphPoints(in)] - $w2 - 1]
  2739.     if {$toChop > 0} {
  2740.     set GraphPoints(in) [lrange $GraphPoints(in) $toChop end]
  2741.     }
  2742.     set toChop [expr [llength $GraphPoints(out)] - $w2 - 1]
  2743.     if {$toChop > 0} {
  2744.     set GraphPoints(out) [lrange $GraphPoints(out) $toChop end]
  2745.     }
  2746.     set toChop [expr [llength $GraphPoints(times)] - $w2 - 1]
  2747.     if {$toChop > 0} {
  2748.     set GraphPoints(times) [lrange $GraphPoints(times) $toChop end]
  2749.     }
  2750.  
  2751.     set prev [lindex $GraphPoints(in) 0]
  2752.     set incoords {}
  2753.     set outcoords {}
  2754.     set inmax 0
  2755.     set outmax 0
  2756.     foreach thing [lrange $GraphPoints(in) 1 end] {
  2757.     set diff [expr $thing - $prev]
  2758.     set prev $thing
  2759.     lappend incoords $diff
  2760.     if {$diff > $inmax} {
  2761.         set inmax $diff
  2762.     }
  2763.     }
  2764.  
  2765.     set prev [lindex $GraphPoints(out) 0]
  2766.     foreach thing [lrange $GraphPoints(out) 1 end] {
  2767.     set diff [expr $thing - $prev]
  2768.     set prev $thing
  2769.     lappend outcoords $diff
  2770.     if {$diff > $outmax} {
  2771.         set outmax $diff
  2772.     }
  2773.     }
  2774.  
  2775.     if {$inmax == 0} { set inmax 1 }
  2776.     if {$outmax == 0} { set outmax 1 }
  2777.     # Draw the transmit line
  2778.     set x 0
  2779.     set hh [expr $h-4]
  2780.     set scaled {}
  2781.     foreach thing $outcoords {
  2782.     lappend scaled $x [expr double($h) - 2 - (double($hh) * double($thing) / double($outmax))]
  2783.     incr x
  2784.     }
  2785.  
  2786.     .graph delete all
  2787.     if {[llength $scaled] >= 4} {
  2788.     eval ".graph create line $scaled -fill #A00000"
  2789.     set bits [expr 8.0 * ([lindex $GraphPoints(out) end] - [lindex $GraphPoints(out) 0])]
  2790.     set timediff [expr [lindex $GraphPoints(times) end] - [lindex $GraphPoints(times) 0]]
  2791.     if {$timediff != 0} {
  2792.         set bps [Pretty [expr double($bits) / $timediff]]
  2793.         .graph create text 2 2 -anchor nw -font fixed -text "$bps"
  2794.     }
  2795.     }
  2796.  
  2797.     # Draw the receive line
  2798.     set x $w2
  2799.     set scaled {}
  2800.     foreach thing $incoords {
  2801.     lappend scaled $x [expr double($h) - 2 - (double($hh) * double($thing) / double($inmax))]
  2802.     incr x
  2803.     }
  2804.  
  2805.     if {[llength $scaled] >= 4} {
  2806.     eval ".graph create line $scaled -fill #00A000"
  2807.     set bits [expr 8.0 * ([lindex $GraphPoints(in) end] - [lindex $GraphPoints(in) 0])]
  2808.     set timediff [expr [lindex $GraphPoints(times) end] - [lindex $GraphPoints(times) 0]]
  2809.     if {$timediff != 0} {
  2810.         set bps [Pretty [expr double($bits) / $timediff]]
  2811.         .graph create text [expr $w2+2] 2 -anchor nw -font fixed -text "$bps"
  2812.     }
  2813.     }
  2814. }
  2815.  
  2816. proc Pretty { n } {
  2817.     if {$n < 0} {
  2818.     return "***"
  2819.     }
  2820.     if {$n < 1000} {
  2821.     return [format "%.1f" $n]
  2822.     }
  2823.     set n [expr $n/1000.0]
  2824.     if {$n < 1000} {
  2825.     return [format "%.1fk" $n]
  2826.     }
  2827.     set n [expr $n/1000.0]
  2828.     if {$n < 1000} {
  2829.     return [format "%.1fM" $n]
  2830.     }
  2831.     set n [expr $n/1000.0]
  2832.     return [format "%.1fG" $n]
  2833. }
  2834.  
  2835. #***********************************************************************
  2836. # %PROCEDURE: Help
  2837. # %ARGUMENTS:
  2838. #  None
  2839. # %RETURNS:
  2840. #  Nothing
  2841. # %DESCRIPTION:
  2842. #  Opens help page
  2843. #***********************************************************************
  2844. proc Help {} {
  2845.     set file [file join "/usr/share" tkpppoe tkpppoe.html]
  2846.     if {![file readable $file]} {
  2847.     tk_dialog .err [m "Error"] [m "Help file is not installed"] error 0 OK
  2848.     return
  2849.     }
  2850.     catch { exec /bin/sh -c "netscape -remote 'openURL($file)' || netscape $file" > /dev/null 2>/dev/null & }
  2851. }
  2852.  
  2853.  
  2854.  
  2855. #***********************************************************************
  2856. # %PROCEDURE: doLogo
  2857. # %ARGUMENTS:
  2858. #  None
  2859. # %RETURNS:
  2860. #  Nothing
  2861. # %DESCRIPTION:
  2862. #  Does the logo thing
  2863. #***********************************************************************
  2864. proc doLogo {} {
  2865.     global AlreadyRunFile ConfigDir
  2866.     if {[file exists $AlreadyRunFile]} {
  2867.     return
  2868.     }
  2869.     catch { file mkdir $ConfigDir }
  2870.     catch { close [open $AlreadyRunFile "w"] }
  2871.     canvas .c -width 374 -height 286 -bg #FFFFCC
  2872.     pack .c
  2873.     drawLogo .c #FFFFCC
  2874.  
  2875.     # Funky effect
  2876.     .c create text 4 4 -anchor nw -text [m "Welcome to RP-PPPoE"] \
  2877.         -fill red -font {-family times -size -24 -weight bold} -tags pppoe
  2878.     .c lower pppoe
  2879.  
  2880.     .c move logo -300 0
  2881.  
  2882.     update idletasks
  2883.  
  2884.     for {set i 0} {$i < 15} {incr i} {
  2885.     .c move logo 20 0
  2886.     update idletasks
  2887.     after 25
  2888.     }
  2889.  
  2890.     .c create text 4 28 -anchor nw -text "http://www.roaringpenguin.com" \
  2891.         -fill red -font {-family courier -size -14 -weight bold}
  2892.     update idletasks
  2893.     after 2500
  2894. }
  2895.  
  2896. # If config dir is not readable, die
  2897. if {![file readable $ConfigDir]} {
  2898.     wm withdraw .
  2899.     tk_dialog .err Error "Error: Cannot read the directory $ConfigDir.  You must have permission to read this directory to use tkpppoe" error 0 OK
  2900.     exit 1
  2901. }
  2902.  
  2903. doLogo
  2904. catch { destroy .c }
  2905.  
  2906. # Try creating an empty config file if none exists
  2907. if {![file readable $ConnectionInfoFile]} {
  2908.     catch { file mkdir $ConfigDir }
  2909.     catch {
  2910.     set fp [open $ConnectionInfoFile "w"]
  2911.     close $fp
  2912.     }
  2913. }
  2914.  
  2915. CreateMainDialog
  2916.