| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

sendfmt

#include "smtlib.h"
int
sendfmt (const QID *to_queue, char *name, char *format, ...)

Synopsis

Sends a text message to the specified queue. The caller can specify a printf()-type format string and insertion values. Return values are the same as for event send().

Examples

    sendfmt (&console, "INFO", "Error accessing %s file", filename);

Source Code - (smtlib.c)

{
    static char
        formatted [4096];               /*  Formatted string                 */
    va_list
        argptr;                         /*  Argument list pointer            */

#if (defined (SMT_TRACE))
    trace ("sendfmt: name=%s format=%s", name, format);
#endif

    va_start (argptr, format);          /*  Start variable args processing   */
#if (defined (DOES_SNPRINTF))
    vsnprintf (formatted, 4096, format, argptr);
#else
    vsprintf  (formatted, format, argptr);
#endif
    va_end (argptr);                    /*  End variable args processing     */

    return (event send (
        to_queue,                       /*  Send to specified queue          */
        NULL,                           /*  No queue for reply               */
        name,                           /*  Name of event to send            */
        (byte *) formatted,             /*  Event body to send               */
        strlen (formatted) + 1,         /*  Event body size, including null  */
        NULL, NULL, NULL,               /*  No response events               */
        0));                            /*  No timeout                       */
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation