⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tkpppoe.in

📁 PPPoE在Linux上的源代码
💻 IN
📖 第 1 页 / 共 5 页
字号:
#!/bin/sh
# -*-Mode: TCL;-*-
# LIC: GPL

#--------------------------------------------------------------
#   tkpppoe
#
#   A graphical front-end for configuring and using rp-pppoe.
#
#   Copyright (C) 2001 by Roaring Penguin Software Inc.
#   This file may be distributed under the terms of the GNU General Public
#   License, Version 2, or (at your option) any later version.
#
#   The "Roaring Penguin" logo is a trademark of Roaring Penguin Software Inc.
#
#   http://www.roaringpenguin.com
#
#--------------------------------------------------------------

# $Id: tkpppoe.in,v 1.47 2002/04/09 17:28:38 dfs Exp $

# the next line restarts using wish \
umask 022; \
exec wish "$0" "$@" || clear; echo "*****"; echo "Cannot find 'wish' -- you need Tcl/Tk installed to run this program"; exit 1

# Try requiring msgcat (Tcl 8.1 and later)

set problem [catch {package require msgcat} err]
if {!$problem} {
    set problem [catch {::msgcat::mcload [file join "@datadir_evaluated@" tkpppoe]} err]
}
if {$problem} {
    puts "$problem - $err"
    # Oops... leave as English
    proc m { str } { return $str }
} else {
    proc m { str } { ::msgcat::mc $str }
}
# Set app name
tk appname TkPPPoE

# Set this to one if you want to allow multiple instances of TkPPPoE
set AllowMultipleInstances 0

# Check for other instances
if {"[tk appname]" != "TkPPPoE"} {
    # Must be another instance running...
    if {!$AllowMultipleInstances} {
	send TkPPPoE AnotherInstance
	exit 0
    }
}

# Location of config directory
set ConfigDir /etc/ppp/rp-pppoe-gui

# Are we running as root?
set Admin 0

# Location of connection info file
set ConnectionInfoFile [file join $ConfigDir connection-info]

# Location of password file
set PasswordFile [file join $ConfigDir passwd]

# Location of "already run" file
set AlreadyRunFile [file join $ConfigDir gui-already-run]

# Connection information
set ConnectionInfo {}

# Connection options
set OPTS(nonroot) 0
set OPTS(sync) 1

# Location of wrapper
set Wrapper "@WRAPPER@"

# Timer token for UpdateConnectionState
set UpdateToken {}

# Update interval in milliseconds
set UpdateInterval 500

# Packet counters for signalling activity
set Packets(in) 0
set Packets(out) 0
set Bytes(in) 0
set Bytes(out) 0
set MeasureTime 0

# Set up some options to make it look better
option add *Button.borderWidth 1
option add *Button.Pad 1
option add *Menubutton.borderWidth 1
option add *Menubutton.Pad 1
option add *Entry.Background white

# Array holding help strings for windows
array set HelpData {}

bind HelpWin <Enter> "HelpWindowEntered %W"
bind HelpWin <Leave> "HelpWindowLeft %W"

proc AnotherInstance {} {
    wm deiconify .
    raise .
}

#***********************************************************************
# %PROCEDURE: HelpWindowEntered
# %ARGUMENTS:
#  w -- window
# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  Looks for procedure in HelpData; evals it if found.
#***********************************************************************
proc HelpWindowEntered { w } {
    global HelpData
    if {[info exists HelpData($w)]} {
	set cmd "$HelpData($w) Enter"
	uplevel #0 $cmd
    }
}

#***********************************************************************
# %PROCEDURE: HelpWindowLeft
# %ARGUMENTS:
#  w -- window
# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  Looks for procedure in HelpData; evals it if found.
#***********************************************************************
proc HelpWindowLeft { w } {
    global HelpData
    if {[info exists HelpData($w)]} {
	set cmd "$HelpData($w) Leave"
	uplevel #0 $cmd
    }
}

#***********************************************************************
# %PROCEDURE: RegisterHelpWindow
# %ARGUMENTS:
#  w -- window we need help about
#  helptext -- the help text
#  win -- window in which to put help messages
# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  Sets things up so help text appears in "$win" when mouse enters "$w"
#***********************************************************************
proc RegisterHelpWindow {w helptext win} {
    global HelpData
    set tags [bindtags $w]
    if {[lsearch -exact $tags HelpWin] < 0} {
	lappend tags HelpWin
	bindtags $w $tags
    }
    set HelpData($w) [list HelpInTextWin $helptext $win]
}

#***********************************************************************
# %PROCEDURE: HelpInTextWin
# %ARGUMENTS:
#  text -- help text
#  tw -- window in which to write text
#  what -- one of "Enter" or "Leave"
# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  Clears out $tw; if $what is "Enter", puts $text in $tw.
#***********************************************************************
proc HelpInTextWin {text tw what} {
    $tw configure -state normal
    $tw delete 1.0 end
    if {"$what" == "Enter"} {
	$tw insert end $text
    }
    $tw configure -state disabled
}


#***********************************************************************
# %PROCEDURE: drawLogo
# %ARGUMENTS:
#  c -- canvas to draw logo in
#  bg -- background color of canvas
#  pencolor -- color of the word "Penguin"
# %RETURNS:
#  Nothing
# %DESCRIPTION:
#  Draws Roaring Penguin logo in a Tcl canvas
#***********************************************************************
proc drawLogo { c bg {pengcolor #6699cc} } {
    $c create polygon 372.249 5.182 361.23 5.519 \
	    346.164 8.892 316.482 20.023 305.463 17.774 296.468 \
	    19.573 288.935 24.97 282.864 33.177 267.348 55.102 \
	    254.531 77.814 236.204 125.26 225.635 174.844 \
	    221.026 226.113 213.605 228.025 208.658 232.634 \
	    225.523 240.28 250.708 243.316 282.752 242.416 \
	    320.079 238.818 330.985 193.17 338.181 146.735 \
	    338.743 99.963 335.483 76.577 329.524 53.191 345.602 \
	    48.131 353.135 45.995 359.768 41.048 342.679 43.184 \
	    324.689 40.036 334.583 28.905 348.3 18.674 372.249 \
	    5.182 -fill #000000 -outline {} -width 1 -tags logo

    $c create line 372.249 5.182 361.23 5.519 \
	    346.164 8.892 316.482 20.023 305.463 17.774 296.468 \
	    19.573 288.935 24.97 282.864 33.177 267.348 55.102 \
	    254.531 77.814 236.204 125.26 225.635 174.844 \
	    221.026 226.113 213.605 228.025 208.658 232.634 \
	    225.523 240.28 250.708 243.316 282.752 242.416 \
	    320.079 238.818 330.985 193.17 338.181 146.735 \
	    338.743 99.963 335.483 76.577 329.524 53.191 345.602 \
	    48.131 353.135 45.995 359.768 41.048 342.679 43.184 \
	    324.689 40.036 334.583 28.905 348.3 18.674 372.249 \
	    5.182  -tags logo

    $c create polygon 298.605 109.632 290.734 \
	    159.328 282.752 182.939 271.958 205.65 262.851 \
	    171.133 263.75 138.752 264.537 164.5 271.958 192.833 \
	    286.687 157.192 298.605 109.632 -fill #ffffff \
	    -outline {} -width 1  -tags logo

    $c create line 298.605 109.632 290.734 159.328 \
	    282.752 182.939 271.958 205.65 262.851 171.133 \
	    263.75 138.752 264.537 164.5 271.958 192.833 286.687 \
	    157.192 298.605 109.632  -tags logo

    $c create polygon 312.546 30.592 315.132 35.876 \
	    310.747 39.586 308.161 34.414 312.546 30.592 -fill \
	    #ffffff -outline {} -width 1  -tags logo

    $c create line 312.546 30.592 315.132 35.876 \
	    310.747 39.586 308.161 34.414 312.546 30.592  -tags logo

    $c create polygon 328.624 54.427 322.665 58.7 \
	    314.458 61.286 289.16 59.15 284.55 74.665 285.338 \
	    90.181 303.214 98.951 308.499 106.259 310.523 \
	    116.378 305.913 130.208 312.771 141.563 308.049 \
	    167.76 299.729 192.158 279.041 238.593 313.558 \
	    233.871 327.388 185.75 335.033 139.989 335.82 96.253 \
	    328.624 54.427 -fill #ffffff -outline {} -width 1  -tags logo

    $c create line 328.624 54.427 322.665 58.7 \
	    314.458 61.286 289.16 59.15 284.55 74.665 285.338 \
	    90.181 303.214 98.951 308.499 106.259 310.523 \
	    116.378 305.913 130.208 312.771 141.563 308.049 \
	    167.76 299.729 192.158 279.041 238.593 313.558 \
	    233.871 327.388 185.75 335.033 139.989 335.82 96.253 \
	    328.624 54.427  -tags logo

    $c create polygon 53.837 185.412 54.399 185.862 \
	    53.837 188.223 54.399 188.673 53.837 188.673 53.837 \
	    189.572 53.837 190.472 53.387 191.034 52.938 192.833 \
	    50.577 195.644 49.677 196.656 49.677 197.105 48.215 \
	    198.455 47.316 198.904 46.866 198.904 44.505 200.816 \
	    43.606 200.366 42.594 201.265 42.144 201.715 41.245 \
	    202.277 40.795 202.727 40.345 202.277 39.783 202.277 \
	    36.972 203.177 36.522 203.177 36.073 203.177 35.623 \
	    203.627 34.723 203.627 34.161 203.627 34.161 204.076 \
	    30.901 204.526 28.54 205.538 26.291 205.088 25.729 \
	    205.088 24.829 205.088 24.38 204.526 23.93 204.526 \
	    23.48 204.526 22.918 205.088 22.918 206.437 22.918 \
	    206.887 22.918 207.337 22.468 207.337 22.468 208.798 \
	    22.018 209.248 22.018 211.16 22.018 211.609 21.569 \
	    213.521 21.119 215.769 21.569 216.781 20.669 218.13 \
	    20.669 219.592 20.669 220.042 20.107 220.941 20.107 \
	    221.953 20.107 223.752 19.657 225.664 19.208 226.113 \
	    19.657 227.013 18.308 230.835 17.858 240.167 17.296 \
	    248.15 17.296 249.05 16.846 250.062 15.947 250.062 \
	    15.048 250.062 15.048 250.511 12.686 251.86 12.237 \
	    251.86 11.675 251.411 11.675 250.511 11.675 246.689 \
	    11.225 245.339 11.225 243.878 10.775 240.617 11.225 \
	    239.268 11.225 238.818 10.775 238.256 10.325 237.357 \
	    10.325 236.007 9.876 232.634 9.876 231.735 9.876 \
	    231.285 9.876 230.835 9.876 230.386 9.876 229.824 \
	    9.426 229.374 9.426 226.113 9.876 226.113 9.876 \
	    225.664 9.426 224.202 9.426 223.752 9.426 223.302 \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -