File: Csnprintf.c

package info (click to toggle)
lcgdm 1.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 14,044 kB
  • sloc: ansic: 149,126; sh: 13,441; perl: 11,498; python: 5,778; cpp: 5,113; sql: 1,805; makefile: 1,388; fortran: 113
file content (35 lines) | stat: -rw-r--r-- 891 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * $Id: Csnprintf.c,v 1.1 2005/03/29 09:27:18 baud Exp $
 */

#include "Csnprintf.h"

/* Hide the snprintf and al. call v.s. different OS. */
/* Sometimes a different name, sometimes do not exist */

int DLL_DECL Csnprintf(char *str, size_t size, char *format, ...) {
	int rc;
	va_list args;

	va_start (args, format);
	/* Note: we cannot call sprintf again, because a va_list is a real */
	/* parameter on its own - it cannot be changed to a real list of */
	/* parameters on the stack without being not portable */
	rc = Cvsnprintf(str,size,format,args);
	va_end (args);
	return(rc);
}

int DLL_DECL Cvsnprintf(char *str, size_t size, char *format, va_list args)
{
#if (defined(__osf__) && defined(__alpha))
	return(vsprintf(str, format, args));
#else
#if defined(_WIN32)
	return(_vsnprintf(str, size, format, args));
#else
	return(vsnprintf(str, size, format, args));
#endif
#endif
}