Main Page   Compound List   File List   Compound Members   File Members   Related Pages  

gsubrc.h File Reference

API for loadable gsub modules. More...


v0.14

Extended 'nonforking' interface.

To use this interface, export a function with this signature. It will take precedence over the previous interface.

This is a somewhat more sophisticated hook. The gsub will not fork before calling this function, so you can easily keep persistent state, but you must also take care to avoid damaging the process or leaking resources.

The function should not exit (since it runs in the same process as gsub).

typedef int (gsubrc2_t)(char * const * const env, const char *msg,int len)
 Signature of the function you should write. More...

gsubrc2_t gsubrc2
 Call your function 'gsubrc2'.


v0.13b

Simple 'forking' interface.

To use this interface, export a function with the this signature.

Rather than looking for an external "gsubrc", gsub will simply call the following function under the same conditions. Information is communicated with environment variables and standard input, just as with gsubrc.

To support this, gsub forks once per message. You therefore do not need to clean up after yourself in this function, but you also cannot keep track of persistent state without using the filesystem or another external mechanism.

The function can return status directly, or call exit() with status value. Nonzero status will cause gsub to suppress any return receipts.

typedef int (gsubrc_t)(void)
 Signature of the function you should write.

gsubrc_t gsubrc
 Call your function 'gsubrc'.


Detailed Description

API for loadable gsub modules.

To use either of these interfaces, create a shared library exporting the correct function and place it in the same place as a standard "gsubrc", but name it "gsubrc.so". The gsub will dynamically load the library and call the function as appropriate.


Function Documentation

typedef int ( gsubrc2_t ) const
 

Signature of the function you should write.

Parameters:
env   The environment that would be passed to a regular gsubrc, as a NULL-terminated array of string pointers of the form "VAR=VALUE". This includes the system environment as well as GALE_* and HEADER_* variables.
msg   The message body text. This is not NUL-terminated!
len   The length of the message body text.
Returns:
Nonzero (failure) to suppress return receipts.


Generated at Sun Sep 7 13:55:27 2003 for Gale by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000