Hi

I've been working on the zenity package for some time but I'm stuck on
zenity_scale.

Basically zenity opens a dialog window with a bar and every time it is
moved, it prints that number followed by a newline. The idea is to
start zenity with popen and then read the values from the pipe. If I
understood correctly, fgets should return -1 when there's nothing else
to read but instead octave seems to hang.

I believe that octave can't handle whatever is sent at the end of each
value because when using fgets to read one character at a time, it
does read all of them, hanging only when it should read the newline
character. Also, zenity works just fine in bash.

This should replicate my problem:

octave-3.2.4 > fid = popen("zenity --scale --print-partial", "r")
## adjust bar to value 16
## adjust bar to value 24
octave-3.2.4 > fgets(fid)
ans = 16

octave-3.2.4 > fgets(fid)
## octave hangs here
## adjust bar to value 46
ans = 24

octave-3.2.4 > fgets(fid)
## octave hangs here
## press OK on the zenity dialog
ans = 46

This example shows the problem being on the last character of the
value by using fgets to read one character at a time

octave-3.2.4 > fid = popen("zenity --scale --print-partial", "r")
## adjust bar to value 16
octave-3.2.4 > fgets(fid,1)
ans = 1
octave-3.2.4 > fgets(fid,1)
ans = 6
octave-3.2.4 > fgets(fid,1)
## octave hangs here instead of returning -1

This shows that zenity works fine in bash
$ zenity --scale --print-partial
## move bar to 16
16

## move bar to 27
27

## move bar to 54
54

## press ok
54

Is this a bug in octave? Or am I doing it wrong? Thanks in advance for any help
Carnë Draug

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to