Group :: Development/Tcl
RPM: tcl-dp
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: tcl-dp-4.0b2-alt1-fix-syntax.patch
Download
Download
diff --git a/examples/ftp/client.tcl b/examples/ftp/client.tcl
old mode 100755
new mode 100644
index 8129c77..416e892
--- a/examples/ftp/client.tcl
+++ b/examples/ftp/client.tcl
@@ -23,7 +23,7 @@
# Minimal error handling at best. Need to catch more.
#
-package require dp 4.0
+package require dp 4.0
#//////////////////////////////////////
@@ -31,109 +31,109 @@ proc oops {errMsg} {
puts stdout "Remote server returned error:"
puts stdout "$errMsg"
}
-
-#//////////////////////////////////////
-
-proc fget {filename} {
- global f_chan dataPort host
-
-# Make data channel
-# On server side
-
- if [catch {
- dp_RPC $f_chan eval {set dataServ [dp_connect tcp -server 1 -myport} $dataPort {]}
- dp_RDO $f_chan eval {set dataSC [dp_accept $dataServ]}
- } msg] {
- puts stdout "Error opening dataServer socket (fget): $msg"
- close $f_chan
- return
- }
-
-# And on Client side
-
- if [catch {
- set dataClient [dp_connect tcp -host $host -port $dataPort]
- } msg] {
- puts stdout "Error connecting to dataServer socket: $msg"
- close $f_chan
- return
- }
-
-# Tell server to send file
-
- dp_RPC $f_chan eval {set srcFile [open} $filename {r]}
- dp_RPC $f_chan eval {dp_send [lindex $dataSC 0] [dp_recv $srcFile]}
-
-# Open output file on client
- set destfile [open $filename {CREAT WRONLY}]
-
- puts stdout "Getting $filename from remote host."
-
-# Put all coming stuff to $newfile and close it
-
- dp_send $destfile [dp_recv $dataClient]
- close $destfile
-
-# First close the Client, before you close the server !!
-
- close $dataClient
-
-# Close Server now
- dp_RPC $f_chan eval {close $srcFile}
- dp_RPC $f_chan eval {close [lindex $dataSC 0]}
- dp_RPC $f_chan eval {close $dataServ}
-}
-
+
#//////////////////////////////////////
-proc fput {filename} {
- global f_chan dataPort host
-
-# Make data channel
-# On server side
-
- if [catch {
- dp_RPC $f_chan eval {set dataServ [dp_connect tcp -server 1 -myport} $dataPort {]}
- dp_RDO $f_chan eval {set dataSC [dp_accept $dataServ]}
- } msg] {
- puts stdout "Error opening dataServer socket (fput): $msg"
- close $f_chan
- return
- }
-
-# And on client side
-
- if [catch {
- set dataClient [dp_connect tcp -host $host -port $dataPort]
- } msg] {
- puts stdout "Error connecting to dataServer socket: $msg"
- close $f_chan
- return
- }
-
-# Sending on client side (local)
- set srcfile [open $filename r]
- puts stdout "Putting $filename to remote host."
- dp_send $dataClient [dp_recv $srcfile]
-
-# Tell server to recv file
-
- dp_RPC $f_chan eval {set destFile [open} $filename {w]}
- dp_RPC $f_chan eval {dp_send $destFile [dp_recv [lindex $dataSC 0]]}
-
-#Close client BEFORE you close Server !!
-
- close $dataClient
- close $srcfile
-
-# Now close Server
- dp_RPC $f_chan eval {close $destFile}
- dp_RPC $f_chan eval {close [lindex $dataSC 0]}
- dp_RPC $f_chan eval {close $dataServ}
-
-}
-
-#//////////////////////////////////////
+proc fget {filename} {
+ global f_chan dataPort host
+
+# Make data channel
+# On server side
+
+ if [catch {
+ dp_RPC $f_chan eval {set dataServ [dp_connect tcp -server 1 -myport} $dataPort {]}
+ dp_RDO $f_chan eval {set dataSC [dp_accept $dataServ]}
+ } msg] {
+ puts stdout "Error opening dataServer socket (fget): $msg"
+ close $f_chan
+ return
+ }
+
+# And on Client side
+
+ if [catch {
+ set dataClient [dp_connect tcp -host $host -port $dataPort]
+ } msg] {
+ puts stdout "Error connecting to dataServer socket: $msg"
+ close $f_chan
+ return
+ }
+
+# Tell server to send file
+
+ dp_RPC $f_chan eval {set srcFile [open} $filename {r]}
+ dp_RPC $f_chan eval {dp_send [lindex $dataSC 0] [dp_recv $srcFile]}
+
+# Open output file on client
+ set destfile [open $filename {CREAT WRONLY}]
+
+ puts stdout "Getting $filename from remote host."
+
+# Put all coming stuff to $newfile and close it
+
+ dp_send $destfile [dp_recv $dataClient]
+ close $destfile
+
+# First close the Client, before you close the server !!
+
+ close $dataClient
+
+# Close Server now
+ dp_RPC $f_chan eval {close $srcFile}
+ dp_RPC $f_chan eval {close [lindex $dataSC 0]}
+ dp_RPC $f_chan eval {close $dataServ}
+}
+
+#//////////////////////////////////////
+
+proc fput {filename} {
+ global f_chan dataPort host
+
+# Make data channel
+# On server side
+
+ if [catch {
+ dp_RPC $f_chan eval {set dataServ [dp_connect tcp -server 1 -myport} $dataPort {]}
+ dp_RDO $f_chan eval {set dataSC [dp_accept $dataServ]}
+ } msg] {
+ puts stdout "Error opening dataServer socket (fput): $msg"
+ close $f_chan
+ return
+ }
+
+# And on client side
+
+ if [catch {
+ set dataClient [dp_connect tcp -host $host -port $dataPort]
+ } msg] {
+ puts stdout "Error connecting to dataServer socket: $msg"
+ close $f_chan
+ return
+ }
+
+# Sending on client side (local)
+ set srcfile [open $filename r]
+ puts stdout "Putting $filename to remote host."
+ dp_send $dataClient [dp_recv $srcfile]
+
+# Tell server to recv file
+
+ dp_RPC $f_chan eval {set destFile [open} $filename {w]}
+ dp_RPC $f_chan eval {dp_send $destFile [dp_recv [lindex $dataSC 0]]}
+
+#Close client BEFORE you close Server !!
+
+ close $dataClient
+ close $srcfile
+
+# Now close Server
+ dp_RPC $f_chan eval {close $destFile}
+ dp_RPC $f_chan eval {close [lindex $dataSC 0]}
+ dp_RPC $f_chan eval {close $dataServ}
+
+}
+
+#//////////////////////////////////////
proc fpwd {} {
global f_chan
@@ -186,11 +186,11 @@ proc fquit {} {
proc fconnect {host_add {port 19743}} {
global f_chan dataPort host
-
+
set host $host_add
set f_chan [dp_MakeRPCClient $host $port]
puts stdout "Connected to $host..."
- puts stdout "Channel: $f_chan"
+ puts stdout "Channel: $f_chan"
set dataPort [incr port -1]
puts stdout "--------- Directory Listing ----------"
diff --git a/examples/ftp/server.tcl b/examples/ftp/server.tcl
old mode 100755
new mode 100644
index adf7faf..f8453ce
--- a/examples/ftp/server.tcl
+++ b/examples/ftp/server.tcl
@@ -1,23 +1,23 @@
-#########################################
-#
-# This is the file transfer server
-#
-# (Not too impressive, huh?)
-#
-# mperham 3/97
-#
-package forget dp
-package require dp 4.0
-
-# set dataPort 19742
-
-proc fserver {{port 19743}} {
- dp_MakeRPCServer $port
-}
-
-# call procedure fserver
-# You'll need a vwait here if you want to run this in a tclsh.
-# vwait forever
-
-
-
+#########################################
+#
+# This is the file transfer server
+#
+# (Not too impressive, huh?)
+#
+# mperham 3/97
+#
+package forget dp
+package require dp 4.0
+
+# set dataPort 19742
+
+proc fserver {{port 19743}} {
+ dp_MakeRPCServer $port
+}
+
+# call procedure fserver
+# You'll need a vwait here if you want to run this in a tclsh.
+# vwait forever
+
+
+
diff --git a/examples/whiteboard/wbServer.tcl b/examples/whiteboard/wbServer.tcl
old mode 100755
new mode 100644
index f0d95d6..1a30bf3
--- a/examples/whiteboard/wbServer.tcl
+++ b/examples/whiteboard/wbServer.tcl
@@ -1,30 +1,31 @@
-#package require dp 4.0
-
-dp_MakeRPCServer 2002
-
-set files {}
-set log {}
-
-proc JoinGroup {} {
- global dp_rpcFile files log
- lappend files $dp_rpcFile
- foreach cmd $log {
- eval dp_RDO $dp_rpcFile $cmd
- }
- dp_atclose $dp_rpcFile append "dp_Leave $dp_rpcFile"
-}
-
-proc dp_Leave {file} {
- global files
- set files [ldelete $files $file]
-}
-
-proc BroadCast {args} {
- global files log
- lappend log $args
- foreach i $files {
- eval "dp_RDO $i $args"
- }
-}
-
-
+package require dp 4.0
+
+
+dp_MakeRPCServer 4544
+
+set files {}
+set log {}
+
+proc JoinGroup {} {
+ global dp_rpcFile files log
+ lappend files $dp_rpcFile
+ foreach cmd $log {
+ eval dp_RDO $dp_rpcFile $cmd
+ }
+ dp_atclose $dp_rpcFile append "dp_Leave $dp_rpcFile"
+}
+
+proc dp_Leave {file} {
+ global files
+ set files [ldelete $files $file]
+}
+
+proc BroadCast {args} {
+ global files log
+ lappend log $args
+ foreach i $files {
+ eval "dp_RDO $i $args"
+ }
+}
+
+
diff --git a/library/rpc.tcl b/library/rpc.tcl
old mode 100755
new mode 100644
index 13f7495..c68af9d
--- a/library/rpc.tcl
+++ b/library/rpc.tcl
@@ -2,9 +2,9 @@
#
# Utilities to create reentrant RPC clients and servers (full duplex)
#
-# This file contains the utility procedures to help implement
-# user-friendly remote procedure calls (RPC's) on top of the
-# network primitives provided by the dp_connect, dp_accept, etc. and
+# This file contains the utility procedures to help implement
+# user-friendly remote procedure calls (RPC's) on top of the
+# network primitives provided by the dp_connect, dp_accept, etc. and
# by various other primitives.
#
# Copyright 1992 Regents of the University of California
@@ -92,6 +92,7 @@ proc dp_CheckHost {file inetAddr} {
proc dp_AcceptRPCConnection {loginFunc checkCmd file} {
# puts "dp_AcceptRPCConnection $loginFunc $checkCmd $file"
set connection [dp_accept $file]
+
# puts "connection = $connection"
set newFile [lindex $connection 0]
set inetAddr [lindex $connection 1]
@@ -307,7 +308,7 @@ proc auto_load_all {} {
if {[string compare $catchout "itcl"] == 0} {
set noitcl 0
}
-
+
if {$noitcl} {
foreach name [array names auto_index] {
if {[string length [info commands $name]] == 0} {