This is a multi-part message in MIME format.
--------------8529805F2F84B3590B273C26
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
der poppers,
i want to invoke an unix program from pop11. i also found the
program "run_unix_program.p" - however this obviously wants the command
in the form
program options < input
this is my problem, since my program expects a command in the form
program options input
is there anybody out there who knows to solve this problem ?
i'll attach the run_unix_program.p
ciao
-moni
--
-------------------------------------------------------------------
dr. monika sester -- institut fuer photogrammetrie -- uni-stuttgart
geschwister-scholl-strasse 24 -- 70174 stuttgart
0711 121 3384
--------------8529805F2F84B3590B273C26
Content-Type: text/plain; charset=us-ascii;
name="rup.p"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="rup.p"
/* --- Copyright University of Sussex 1994. All rights reserved. ----------
> File: C.unix/lib/auto/run_unix_program.p
> Purpose: Run Unix command from within Poplog
> Author: John Williams, Mar 30 1990 (see revisions)
> Documentation: HELP * RUN_UNIX_PROGRAM
> Related Files: C.unix/lisp/modules/run-unix-program.lsp
*/
compile_mode :pop11 +strict;
section;
define global run_unix_program(name, args, input, output, errs, wait);
lvars args, errs, input, name, output, pid, wait;
lvars arg, child_deverr, child_devin, child_devout,
parent_errs, parent_get, parent_send, path, status;
/* Check out <name> */
sysfileok(name) -> path;
unless path = nullstring
or fast_subscrs(1, path) == `/` do
sys_search_unix_path(path, systranslate('PATH')) -> path;
unless path do
mishap(name, 1, 'COMMAND NOT FOUND')
endunless
endunless;
/* Check out <args> */
path :: maplist(args, $-lisp$-get_simple_string) -> args;
/* <input>, <output>, <errs> may be true, filename, device, or false */
if input == true then
syspipe(false) -> child_devin -> parent_send
elseif isstring(input) then
sysopen(input, 0, false) -> child_devin
else
input -> child_devin
endif;
if output == true then
syspipe("line") -> parent_get
elseif isstring(output) then
syscreate(output, 1, "line")
else
output
endif -> child_devout;
if errs == true then
syspipe("line") -> parent_errs
elseif errs == 1 then
child_devout
elseif isstring(errs) then
syscreate(errs, 1, "line")
else
errs
endif -> child_deverr;
if (sys_fork(true) ->> pid) then
;;; parent
if input == true then
false -> wait;
sysclose(child_devin)
endif;
if output == true then
false -> wait;
sysclose(child_devout)
endif;
if errs == true then
false -> wait;
sysclose(child_deverr)
endif;
if wait then
sys_wait(pid) -> (, status)
endif
else
;;; child
if isdevice(child_devin) then
child_devin -> popdevin
endif;
if isdevice(child_devout) then
child_devout -> popdevout
endif;
if isdevice(child_deverr) then
child_deverr -> popdeverr
endif;
if input == true then
sysclose(parent_send)
endif;
if output == true then
sysclose(parent_get)
endif;
if errs == true then
sysclose(parent_errs)
endif;
sysexecute(path, args, false);
fast_sysexit()
endif;
/* Results (5) */
if input == true then
parent_send
else
false
endif;
if output == true then
parent_get
else
false
endif;
if errs == true then
parent_errs
else
false
endif;
if wait then
status
else
true
endif;
pid
enddefine;
endsection;
/* --- Revision History ---------------------------------------------------
--- John Gibson, Jun 9 1994
Changed arg to first call of syspipe to be false.
--- John Williams, Jun 6 1994
Fixed incorrect use of string quotes.
--- John Gibson, Apr 21 1994
Changed to use new sys_fork etc
*/
--------------8529805F2F84B3590B273C26--
|