> I don't remember the details but there was something more in the patch.

I do. Here's Luca's patch ....

- --- diald-0.16/bin/dctrl      Tue Jan 28 00:21:42 1997
+++ diald-0.16.new/bin/dctrl    Mon Mar  9 16:50:08 1998
@@ -9,6 +9,7 @@
 set monfifo ""
 set monfd ""
 set fifofd ""
+set fifo_counter 0
 
 # strip chart code
 proc stripchart {win x y label} {
@@ -40,6 +41,7 @@
        # get the new scale
        set ns [expr "int($val)"]
        if {$val > $ns} { incr ns }
+       if {"$ns" == "0"} { set ns 1}
        set r [expr "($s+0.0)/$ns"]
        $win scale all 0 $o 1 $r
        set s $ns
@@ -51,6 +53,7 @@
        set ns [expr "int($fs)"]
        if {$fs > $ns} {incr ns}
        if {$ns != $s} {
+               if {"$ns" == "0"} { set ns 1}
                set r [expr "($s+0.0)/$ns"]
                $win scale all 0 $o 1 $r
                set s $ns
@@ -171,7 +174,7 @@
 
 proc make_icon {} {
        toplevel .dctrlIcon -class DctrlIcon -width 50 -height 50
- -     canvas .dctrlIcon.canv -width 50 -height 32
+       canvas .dctrlIcon.canv -width 50 -height 33
        .dctrlIcon.canv create text 2 2 \
                -font -adobe-times-medium-r-*-*-12-*-*-*-*-*-*-* \
                -text "Diald" -anchor nw
@@ -210,20 +213,34 @@
 # MONITOR_QUEUE           0x0020
 #
 
+proc killFifo {} {
+    global monfifo monfd
+    if {$monfd!=""} {close $monfd}
+    if {$monfifo!=""} {catch {exec rm -f $monfifo}}
+    set monfd ""
+    set monfifo ""
+}
+
 proc openFifo {} {
- -    global fifofd monfifo monfd default_FIFO
+    global fifofd monfifo monfd default_FIFO fifo_counter
 
     # Turn off any previous monitoring
- -    if {$monfd!=""} {close $monfd}
- -    if {$monfifo!=""} {catch {exec rm -f $monfifo}}
+    killFifo
 
     # get new monitoring fifo
     set fifofd [open $default_FIFO w]
 
- -    set monfifo /tmp/dctrl.[pid]
+    #
+    set fifo_counter [expr "$fifo_counter+1"]
+    set monfifo /tmp/dctrl.[pid]-$fifo_counter
+    # If an event comes along that causes a signal, then
+    # it is possible the exec above gets exited BEFORE
+    # it finishes waiting. Nasty stuff.
+    # so, we do a little loop until we can confirm the fifo exists
+    # before we ask diald to deal with it.
     catch {exec mkfifo -m 0600 $monfifo}
+    set monfd [open $monfifo r+]
     fifoCmd "monitor $monfifo"
- -    set monfd [open $monfifo r]
     fileevent $monfd readable {stateChange}
 }
 
@@ -264,7 +281,12 @@
 
 proc stateChange {} {
     global monfd status trans colors gload tload
- -    set foo [gets $monfd]
+    set error [gets $monfd foo]
+    if ($error=="-1") {
+       # Make sure to clean up if the pipe goes south...
+       killFifo
+       return
+    }
     if {$foo=="STATE"} {
        set status(fsm) [gets $monfd]
        if {$status(fsm)=="CONNECT"} {.message.vis.text delete 0.0 end}
@@ -335,8 +357,8 @@
 proc dctrlQuit {} {
     global fifofd monfifo fancy_icon
 
+    killFifo
     if {$fifofd!=""} {
- -     if {$monfifo!=""} {catch {exec rm -f $monfifo}}
        catch {flush $fifofd}
     }
     if {"$fancy_icon" != 0} {
@@ -352,7 +374,7 @@
 frame .menu -relief raised -bd 2
 pack .menu -side top -fill x -expand 0
 
- -frame .spacer -width 480 -height 0
+frame .spacer -width 500 -height 0
 pack .spacer -side top
 
 menubutton .menu.file -text "File" -menu .menu.file.m -underline 0
@@ -600,4 +622,5 @@
 load_init
 
 update
+
 openFifo


- -- 

-- 
Peter J. MASON
email: [EMAIL PROTECTED]
home:  http://www.fl.net.au/~petem



-
To unsubscribe from this list: send the line "unsubscribe linux-diald" in
the body of a message to [EMAIL PROTECTED]

Reply via email to