1. Re: system/system_exec problem SOLVED
- Posted by irvm at ellijay.com Jun 17, 2003
- 410 views
On Tuesday 17 June 2003 04:40 pm, jbrown wrote: > Ah, well I ran over the man page for system(), and I found out that it is > a cross between Eu's system() and system_exec()....the libc system() sends > the string to /bin/sh (POSIX version of command.com) and lets the shell > do the dirty work, which includes running shell scripts (Unix version of > batch files), redirection, and in theory even commands builtin to the > shell. It will also return the exit code of the command it was given, or > 127 if there was an error. I added the following code to override the built-in system_exec: It seems to work just fine. Thanks for the help! constant STDLIB = open_dll("") constant SYSTEM_EXEC = define_c_func(STDLIB,"system",{C_POINTER},C_POINTER) without warning -- about redefinition of built-in; global function system_exec(object str) atom buffer, result buffer = allocate_string(str) result = c_func(SYSTEM_EXEC,{buffer}) free(buffer) return result = 0 end function Irv