| Function silc_buffer_format
 
 SYNOPSIS
 
    int silc_buffer_format(SilcBuffer dst, ...);
DESCRIPTION
    Formats a buffer from a variable argument list.  Returns -1 on error
    and the length of the formatted buffer otherwise.  The buffer is
    enlarged automatically during formatting, if it doesn't already have
    enough space.
EXAMPLE
    Three basic ways of using silc_buffer_format:
    // Statically allocated zero size buffer
    SilcBufferStruct buffer;
    memset(&buffer, 0, sizeof(buffer));
    ret = silc_buffer_format(&buffer,
                             SILC_STR_UI_INT(intval),
                             SILC_STR_CHAR(charval),
                             SILC_STR_UI_INT(intval),
                             SILC_STR_SHORT(str_len),
                             SILC_STR_DATA(str, str_len),
                             SILC_STR_END);
    if (ret < 0)
      error;
    // Free the allocated data
    silc_buffer_purge(&buffer);
    // Dynamically allocated zero size buffer
    SilcBuffer buf;
    buf = silc_buffer_alloc(0);
    ret = silc_buffer_format(buf,
                             SILC_STR_UI_INT(intval),
                             SILC_STR_CHAR(charval),
                             SILC_STR_END);
    if (ret < 0)
      error;
    // Free the allocated buffer
    silc_buffer_free(buf);
    // Dynamically allocated buffer with enough space
    SilcBuffer buf;
    buf = silc_buffer_alloc(2 + str_len);
    ret = silc_buffer_format(buf,
                             SILC_STR_UI_SHORT(str_len),
                             SILC_STR_DATA(str, str_len),
                             SILC_STR_END);
    if (ret < 0)
      error;
 
 
 
 |