Function CDM_Exec


Definition:#include <CDM.h>
Prototype:int CDM_Exec(Tcl_Interp *, arg1);
Arguments:

Interp: Interpreter Pointer (Tcl_Interp *)
arg1: A (NULL terminated) sequence of strings (char *)

C/C++ API Sections
Tcl API Sections
Description
Return Value
Notes
See Also
Index

Description:

This function will accept a variable number of strings that will try to execute as an operating system command. Plugin modules that want to execute an external (operating system) command are advised to use this function instead of the "system" ANSI C function. The main advantage of CDM_Exec over "system" is the use of the Execution Server. The Execution Server acts like a deamon whoose its main purpose is to execute operating system commands. Its use is especially encouraged, especially when processing memory intensive systems, as it eliminates the need for the whole platform to fork. During a fork, a copy of the parental running process is created in the memory, thus requiring twice as much memory as is currently occupied by the parent process. If this process is the Execution Server, the additional required memory will be a steady amount for every command that is executed, totally indepented from the amound of memory that the platform occupies at that particular time instance.

Return Value:

The return value from this function will be a standart Tcl completion code (of type int) with one of the values TCL_OK and TCL_ERROR. If an error occurs, the return value will be TCL_ERROR and an error message describing the error will be left at the specified Tcl interpreter. Note that if the executed command writes anything to its stderr an error will be also returned. If the command completes succesfully, TCL_OK will be returned.

Notes:

Note that every string given as an argument to this fuction will be passed as a single argument to the operating system, even if it contains spaces. For example, the following call:
CDM_Exec(interp, "vi", "file with spaces", NULL);

is equivelant to the following command (assuming written to a shell):
$> vi "file with spaces"

An error condition will be raised if the operating system returns an error condition or when the executed command writes anything to its stderr.

Also note that this call is equivelant to the "exec" Tcl command.

See Also:

CDM_Eval, exec


Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.