octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pipe() function in syscalls.cc


From: Steve Lipa
Subject: pipe() function in syscalls.cc
Date: Thu, 10 Oct 2002 18:12:09 -0400
User-agent: Mutt/1.2.5i

Dear Octave-maintainers:

First, let me apologize if this is a stupid question!

Could someone please give me a hint where to find the
routine in the Octave source code that is responsible for
printing out the numbers indicated below?

( I am using version 2.1.36 )

octave:1> x = pipe
x =
(
  [1] =
  {
    id = 4       // I WANT THIS ONE
    name = 
    mode = r
    arch = native
    status = open
  }
  [2] =
  {
    id = 3       // I WANT THIS ONE
    name = 
    mode = w
    arch = native
    status = open
  }
)

So far I haven't been able to figure out a way to assign these
numbers to a variable (using something like nth(x,2).id). Everything
I try seems to displease Octave.

So I cloned the pipe() function in syscalls.cc, so I could
have it return the numbers I need (gpipe.cc attached below)
Using "mkoctfile gpipe.cc" gives me the new function gpipe,
and this works great from the command line but gives me the
wrong answer when I invoke it from a script:

octave:2> y = gpipe   // correct behavior from command line
y =
(
  [1] =
  {
    id = 6
    name = 
    mode = r
    arch = native
    status = open
  }
  [2] =
  {
    id = 5
    name = 
    mode = w
    arch = native
    status = open
  }
  [3] = 6          // these numbers agree
  [4] = 5
)
octave:3> inpipe = nth(y,4)
inpipe = 5

octave:4> gptest   //gptest.m just contains one word: gpipe
ans =
(
  [1] =
  {
    id = 8
    name = 
    mode = r
    arch = native
    status = open
  }
  [2] =
  {
    id = 7
    name = 
    mode = w
    arch = native
    status = open
  }
  [3] = 9          // these numbers are wrong!
  [4] = 8
)

If anyone can give me some sort of clue what I am doing wrong 
here I'd really appreciate it. This seems like it should be 
much simpler than I am making it. My plan is to find the routine 
that prints out the correct numbers and figure out where it is 
getting them. 

Thanks 1E6 for any help you might offer!

Steve

-- 

Steve Lipa
address@hidden
gpg fingerprint = 8B68 77D7 9E09 9991 C97E  25FF 6A12 D2B9 EC7D 66C1

Attachment: gpipe.cc
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]