STRPRINT(3X)

NAME
str_sprint, tr_sprintv, str_nprint, str_nprintv, str_print, str_printv, strx_sprint, strx_sprintv, strx_nprint, strx_nprintv, strx_print, strx_printv -- formatted conversion to string

SYNOPSIS

#include "str.h"

char *str_sprint( buf, format, ... )
char *buf ;
char *format ;

char *str_sprintv( buf, format, ap )
char *buf ;
char *format ;
va_list ap ;

int str_nprint( buf, format, ... )
char *buf ;
char *format ;

int str_nprintv( buf, format, ap )
char *buf ;
char *format ;
va_list ap ;

void str_print( countp, buf, format, ... )
int *countp ;
char *buf ;
char *format ;

void str_printv( countp, buf, format, ap )
int *countp ;
char *buf ;
char *format ;
va_list ap ;

char *strx_sprint( buf, len, format, ... )
char *buf ;
int len ;
char *format ;

char *strx_sprintv( buf, len, format, ap )
char *buf ;
int len ;
char *format ;
va_list ap ;

int strx_nprint( buf, len, format, ... )
char *buf ;
int len ;
char *format ;

int strx_nprintv( buf, len, format, ap )
char *buf ;
int len ;
char *format ;
va_list ap ;

void strx_print( countp, buf, len, format, ... )
int *countp ;
char *buf ;
int len ;
char *format ;

void strx_printv( countp, buf, len, format, ap )
int *countp ;
char *buf ;
int len ;
char *format ;
va_list ap ;

DESCRIPTION

All functions are similar in functionality to sprintf(). Their only difference is in their return values. For information about their conversion capabilities, check Sprint(3).

The difference between the str_* and the strx_* functions is that the latter take an extra argument, the size of the buffer, so that they will never write beyond the end of the buffer. Writing beyond the end of the buffer is possible with the str_* functions. Invoking any of the strx_* functions with the len argument set to 0 is the same as calling the equivalent str_* function.

All functions will append a NUL at the end of buf (the strx_* functions will not do this if it would cause a buffer overrun).

str_print(), str_printv(), strx_print(), and strx_printv() will put in *countp the number of characters placed in buf excluding the ending NUL (this happens only if *countp is not NULL ).

The functions that have a name ending in 'v' are similar to those without the 'v' at the end of their name except that instead of accepting a variable number of arguments, they expect a varargs(3) argument list.

RETURN VALUES

str_sprint(), str_sprintv(), strx_sprint(), and strx_sprintv() return buf.

str_nprint(), str_nprintv(), strx_nprint(), and strx_nprintv() return the number of characters placed in buf excluding the ending NUL.

SEE ALSO
Sprint(3)