[comp.sys.amiga.tech] Dos 2.0 System

ricks@hawk.isc-br.com (Rick Schaeffer) (11/13/90)

I've been playing with the AmigaDos 2.0 "System" function and have
run into a couple of problems.  The first is that the failat level
set in the shell from which I run System() is not observed in the
shell that System() uses to run the command.  In other words if I
set the Failat level to 999, and run a little command that exits
with a 12, System() still prints out:
   "command" failed returncode 12

I can prefix "command" with "failat 999\n" before calling System() and
then get no message...which is what I want for the popen function that
I am playing with.

The above is not really a problem except that I'd rather just be able to
set the FailAt level of the current shell to some value and have the
value inherited by System().  However, I'm having a real problem when
the command doesn't exist in the current Path.  For instance, if I call
System() like this:
   exitval = System("xxx",tags);
(assuming that "xxx" doesn't exist) then I get an exitval of 10 and
a message printed to stdout of "xxx: Unknown command" no matter what
the Failat level is set at.  This message winds up coming in through
the pipe which screws up programs which are expecting specific data
formats.  Another application I am trying to use System() with is Matt
Dillon's old CShell.  In that case, after discovering that the command
doesn't exist I want to be able to look for "xxx.sh".  I can do that
by looking for the return value of 10 but can't seem to prevent that
"Unknown command" message from going out.

There are really two questions here:
1.  Is there a function which will perform the search for a command in
the path without actually executing the command (including the resident
list)? That way I can have popen() fail before actually creating the
new process and avoid the whole problem. This also avoids the problem
in Cshell.

2.  If not, how can I prevent the message from going to stdout?