1.1.34. scriba_SetEnvironment()

[<<<] [>>>]

You can call this function to define a special environment query function. This pointer should point to a function that accepts a (void *, char *, long ) arguments.

Whenever the ScriptBasic program tries to get the value of an enviroment variable it calls this function. The first argument is the embedder pointer.

The second argument is the name of the environment variable to retrieve or NULL.

The third argument is either zero or is the serial number of the environment variable.

ScriptBasic never calls this function with both specifying the environment variable name and the serial number.

The return value of the function should either be NULL or should point to a string that holds the zero character terminated value of the environment variable. This string is not changed by ScriptBasic.

If the special environment function is not defined or is NULL ScriptBasic uses the usual environment of the process calling the system functiongetenv.

void scriba_SetEnvironment(pSbProgram pProgram,
                           void *fpEnvirFunction
);
For a good example of a self-written environment function see the source of the Eszter SB Engine that alters the environment function so that the ScriptBasic programs feel as if they were executed in a real CGI environment.
[<<<] [>>>]