Re: Executing Outside Programs

From: Mark A. Heilpern (mark@heilpern.com)
Date: 03/06/00


At 09:59 AM 3/4/00 -0800, you wrote:
>On Sat, 4 Mar 2000, Pat O'Laughlin wrote:
>
> > execl("gdb", "gdb", "bin/circle", "-c", "lib/core", "-x",
> > ".gdb_command", "-batch", ">>", "lib/crash_info");
>
>The last argument must be NULL.  Read the man page.


Also, execl(), to my understanding, does not spawn a shell
to spawn your program, so the redirection part (your last
two parameters before the missing NULL) will be fed as
command options (argv[]'s) to gdb, instead of having the
intended redirection effect. Use George's suggestion of
using system("gdb bin/circle -c lib/core -x...... >> lib/.....")
instead, as system() will spawn a shell first.

If called from inside your running mud, this won't work (without
first changing your directory) as you seem to have
discovered, based on your email asking how to determine
your current dirrectory. CircleMUD changes directory to lib,
and your paths are based on being one level higher.

There is no clean way to discover your current directory in
*nix, but you might consider reading the line that comes
out of a popen("pwd", "r") file descriptor.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT