Previous Topic

Next Topic

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 a 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.

When the CTUSER() module is linked against a c-tree Server .dll (shared object) many standard c-tree API functions exported by the server object may then be called for extended flexibility. Note that you do not wish to do activities in this module that may take a long time to return.

Also consider the c-tree Server SDK module ctcust.c for building your own unique custom functions. (Advanced Server SDK Options)

Return

CtreeUserOperation() returns the LONG returned in your function. The default template implementation of CtreeUserOperation() returns the length of the return buffer.

Limitations

The full version of CtreeUserOperation() is available to maintenance customers on request. The standard function as implemented simply returns NO_ERROR.

See Also

CTUSERX()