File: snprintf.c

package info (click to toggle)
npadmin 0.8-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 524 kB
  • ctags: 792
  • sloc: cpp: 3,514; ansic: 1,176; sh: 327; makefile: 52
file content (26 lines) | stat: -rw-r--r-- 421 bytes parent folder | download | duplicates (3)
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
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>

/*
 * Simple substitute snprintf().  Ignores the size param and works like the
 * old unsafe sprintf().
 */
int 
snprintf(char *string1, 
         size_t size, 
         const char *format,
         ...)

{
  int result;
  va_list varlist;

  va_start(varlist, format);

  result = vsprintf(string1, format, varlist);

  va_end(varlist);

  return result;
}