Hello,
I am trying to fork a unix shell command from which I
can use its output to parse with in Poplog. Here is an
example from "run_unix_program" that I am trying to
make work.
/* Run the find command to give me each line of output
as if I were using readline() from a terminal.
so that I could parse finds output accordingly */
define run_foo.sh();
vars indev, outdev, errdev, status, pid;
run_unix_program('find', ['/home/mine -type f
-name "*.o"'], false, true, 1, false)
-> (indev, outdev, errdev, status, pid);
define send(input, dev);
lvars input, dev;
syswrite(dev, 1, input, length(input));
sysflush(dev)
enddefine;
define rec(dev) -> output;
lvars dev, output, n;
lconstant buff = inits(127);
'' -> output;
while sys_input_waiting(dev) do
sysread(dev, 1, buff, 127) -> n;
output <> substring(1, n, buff) -> output
endwhile
enddefine;
/* I need to get the output from find as a string I
can process, do I use the following command? Then
what*/
pr(rec(outdev));
enddefine
__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
|