Back to libut API Reference


SYNOPSIS

    #include "libut/ut.h"
    int UT_shlf(char *fmt, ...);


DESCRIPTION

This function appends text to the result buffer of the currently executing control port command.

This function is used only within a callback that implements a control port command. (See the COMMAND CALLBACK in UT_shl_cmd_create(3) for background information).

The fmt argument is a printf(3)-format string, followed by the required printf arguments.

Note that the callback's return value (SHL_OK or SHL_ERROR) ultimately determine whether the command is considered to have succeeded or failed. If the callback returns SHL_OK, the result buffer populated by UT_shlf(3) is written to the control port; but if the callback returns SHL_ERROR, the error result buffer populated by UT_shle(3) is written to the control port instead.


RETURN VALUE

This function always returns 0.


NOTES

If libut invokes a command callback because it is parsing a configuration file containing that command, any output that the command generates using UT_shlf(3) or UT_shle(3) is logged (since there is no control port connection to which it can be written). When logged, newlines are converted to '\' characters and truncated if they are too long.


SEE ALSO

UT_shl_cmd_create(3), UT_shl_hdr(3), UT_shle(3)


AUTHOR

Troy D. Hanson <thanson@users.sourceforge.net>