コード例 #1
0
ファイル: snprintf.cpp プロジェクト: doong123/altibase
/*------------------------------------------------------------------------*//*!
\fn      int vsnprintf(
             char           *buf,
             int             siz,
             const char     *fmt,
             va_list        list
         )
\brief   Implement the standard vsnprintf() routine with VxWorks tools 

\param   buf  (in) Pointer to current location in output buffer
\param   siz  (in) Size remaining in output buffer
\param   fmt  (in) Formatting string
\param   list (in) Varaible argument list description

VxWorks does not provide a vsnprintf() entry point, but a substitute can be
constructed using VxWorks provided tools.  This is it.
*//*-------------------------------------------------------------------------*/
int vsnprintf
(
    char        *buf,
    int          siz,
    const char  *fmt,
    va_list     list
)
{

int
    cnt;

struct _fioFormatV_Prm
    out;

/*
 | Pass the boundary condition parameters through the fioFormatV parameter.
*/
out.buf = buf;
out.siz = siz;

/*
 | This is already a variable argument string list.
*/
cnt = fioFormatV( fmt, list, (FUNCPTR) fioFormatV_cb, (int) &out );

/*
 | Return total length.
*/
return( cnt );
}
コード例 #2
0
IP_PUBLIC int
ipcom_fw_logmsg(char * fmt, ...)
{
    va_list ap;
    int nchars;

    va_start(ap, fmt);
    nchars = fioFormatV(fmt, ap, ipcom_fw_log_cb, 1);
    va_end(ap);

    return nchars;
}
コード例 #3
0
ファイル: osip_port.c プロジェクト: avis/osip
int osip_vsnprintf(char *buf, int max, const char *fmt, va_list ap)
{
	_context ctx;

	ctx.str = buf;
	ctx.max = max;
	ctx.len = 0;

	if (fioFormatV(fmt, ap, _cb_snprintf, (int) &ctx) != OK) {
		return OSIP_UNDEFINED_ERROR;
	}

	return ctx.len;
}
コード例 #4
0
ファイル: snprintf.c プロジェクト: ariavie/bcm
int vsnprintf
    (
    char *	 buffer,  /* buffer to write to */
    size_t 	 count,	  /* max number of characters to store in buffer */
    const char * fmt,	  /* format string */
    va_list	 vaList	  /* optional arguments to format */
    )
    {
    int		  nChars;
    SNPUTBUF_ARG  snputbufArg;

    snputbufArg.pBuf 	= buffer;
    snputbufArg.pBufEnd	= (char *)(buffer + count);

    nChars = fioFormatV (fmt, vaList, fioSnBufPut, (int) &snputbufArg);

    if (count != 0)
	*snputbufArg.pBuf = EOS; /* null-terminate the string */

    return (nChars);
    }
コード例 #5
0
ファイル: snprintf.cpp プロジェクト: doong123/altibase
/*------------------------------------------------------------------------*//*!
\fn      int snprintf(
             char           *buf,
             int             siz,
             const char     *fmt,
             ...
         )
\brief   Implement the standard snprintf() routine with VxWorks tools 

\param   buf  (in) Pointer to current location in output buffer
\param   siz  (in) Size remaining in output buffer
\param   fmt  (in) Formatting string

VxWorks does not provide a snprintf() entry point, but a substitute can be
constructed using VxWorks provided tools.  This is it.
*//*-------------------------------------------------------------------------*/
int snprintf
(
    char        *buf,
    int          siz,
    const char  *fmt,
    ...
)
{

int
    cnt;

va_list
    list;

struct _fioFormatV_Prm
    out;

/*
 | Pass the boundary condition parameters through the fioFormatV parameter.
*/
out.buf = buf;
out.siz = siz;

/*
 | Turn this into a variable argument string list.
*/
va_start( list, fmt );
cnt = fioFormatV( fmt, list, (FUNCPTR) fioFormatV_cb, (int) &out );
va_end( list );

/*
 | Return total length.
*/
return( cnt );
}