📄 file.pli
字号:
# NetPlug -*- tcl -*- # simple plugin that open a file (or a more usefull a pipe) instead of a socket# (c) 1996 Laurent demailly <dl@hplyot.obspm.fr>## $Id: file.pli,v 2.1 1996/10/02 19:29:30 dl Exp $## $Log: file.pli,v $# Revision 2.1 1996/10/02 19:29:30 dl# change for the tk-less version of netplug## Revision 1.3 1996/08/20 14:22:55 dl# replaced connection closed by EOF in eof message## Revision 1.2 1996/08/20 14:02:44 dl# added 2>@stdout to default pipe so we see stderr## Revision 1.1 1996/08/20 13:35:10 dl# Initial revision### the plugin proc:proc FileOpenInit {onoff} { global host port netmod GUI set w .conn if {$onoff} { if {$GUI} { $w.fh.lh configure -text "File/Pipe:" $w.fh.host configure -width 25; $w.fp.lp configure -text "Mode (r/r+/...):"; $w.fp.b configure -text "Open" } if {!$netmod} { set host "|csh 2>@stdout"; set port "r+"; } ChangeNewConnectCmd "FileOpen \$host \$port"; } else { if {$GUI} { $w.fh.lh configure -text "Host:"; $w.fh.host configure -width 30; $w.fp.lp configure -text "Port:"; $w.fp.b configure -text "New Connection"; } ChangeNewConnectCmd ; }}array set file { attrib,in "-foreground blue3" attrib,out ""}proc FileOpen {path mode} { global conn file GUI; puts "FileOpen $path $mode"; set n [Connect $path $mode [open $path $mode] fileOut fileIn]; if {$n!=-1 && $GUI} { if {![string match {*[aw+]*} $mode]} {destroy $conn($n,entry)} set w $conn($n,txt); regTag $w "in" $file(attrib,in); regTag $w "out" $file(attrib,out); }}proc fileIn {n what} { Send $n "$what\n"; defOut $n 0 "$what\n" in; update;}proc fileOut {n errflag txt} { if {$errflag} {regsub "\n- Connection Closed -" $txt {-EOF-} txt} defOut $n $errflag $txt out; update;}list "File/Pipe ..." FileOpenInit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -