This is Unofficial EPICS BASE Doxygen Site
osdStdio.c
Go to the documentation of this file.
1 /* osdStdio.c */
2 /*************************************************************************\
3 * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
4 * National Laboratory.
5 * Copyright (c) 2002 The Regents of the University of California, as
6 * Operator of Los Alamos National Laboratory.
7 * EPICS BASE is distributed subject to a Software License Agreement found
8 * in file LICENSE that is included with this distribution.
9 \*************************************************************************/
10 
11 #include <stdio.h>
12 #include <stdarg.h>
13 
14 #ifndef _MSC_VER
15 /* Older versions of MinGW omitted this prototype from stdio.h */
16 _CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf (const char*, va_list);
17 #endif
18 
19 #include "epicsStdio.h"
20 
21 int epicsStdCall epicsVsnprintf(char *str, size_t len,
22  const char *fmt, va_list ap)
23 {
24  int retval = _vsnprintf(str, len, fmt, ap);
25  int needed = _vscprintf(fmt, ap);
26 
27  if ((int) len < needed + 1) {
28  str[len - 1] = 0;
29  return needed;
30  }
31 
32  return retval;
33 }
34 
35 int epicsStdCall epicsSnprintf (char *str, size_t len, const char *fmt, ...)
36 {
37  int rtn;
38  va_list pvar;
39 
40  va_start (pvar, fmt);
41  rtn = epicsVsnprintf (str, len, fmt, pvar);
42  va_end (pvar);
43  return (rtn);
44 }
_CRTIMP int __cdecl __MINGW_NOTHROW _vscprintf(const char *, va_list)
#define str(v)
LIBCOM_API int epicsStdCall epicsSnprintf(char *str, size_t size, const char *format,...)
Definition: osdStdio.c:14
LIBCOM_API int epicsStdCall epicsVsnprintf(char *str, size_t size, const char *format, va_list ap)
Definition: osdStdio.c:26