FairCom Corporation


F.47 CtreeUserOperation


Execute a developer-defined function.

Short Name

CTUSER

TYPE

Low level function

DECLARATION

LONG CtreeUserOperation(pTEXT command, pTEXT bufptr, VRLEN bufsiz)

DESCRIPTION

CtreeUserOperation executes a developer-defined function on the c-tree Server machine at the request of a c-tree Plus client. command points to the buffer holding the commands to be sent to the c-tree Server. bufptr points to the return buffer. bufsiz contains the number of bytes returned in bufptr.

On Windows and Unix systems, use the command parameter to do the following:

Execute a System Call with the string found in command. The c-tree Server checks the first byte of command for an exclamation point, '!'. If found, it issues a system() call with the string found in command. This requires the first character in command to contain '!'. Example: "!mkdir faircom".

Load a specific Library and Execute a Specific Function. The syntax of command is reviewed by the c-tree Server. If the first byte is a colon, ':', the characters immediately following, with no blanks, are considered the name of the library to load. command is also searched for the at sign, '@'. If an at sign is found, the characters immediately following, with no blanks, are considered to be the function name within the library to execute. The following example loads the library named "mylib.so" and executes the function "myfunction":

:mylib.so@myfunction
Note: All functions must have the same prototype as CT_USER found in ctuser.c.

On Macintosh systems, when the client calls CtreeUserOperation, the c-tree Server attempts to find and load an FUSR code resource. Currently the resource is loaded and freed each time CtreeUserOperation is called.

RETURN

CtreeUserOperation returns the LONG returned in your function. Our sample CtreeUserOperation returns the length of the return buffer.

LIMITATIONS

The full version of CtreeUserOperation is available to our maintenance customers on request. The function shipped with c-tree Plus simply returns NO_ERROR.


FairCom Corporation
www.faircom.com