File: snprintf.c

package info (click to toggle)
dictd 1.10.2-3.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,964 kB
  • ctags: 3,321
  • sloc: ansic: 29,082; sh: 4,646; makefile: 1,008; yacc: 436; perl: 410; cpp: 275; lex: 243
file content (23 lines) | stat: -rw-r--r-- 421 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "dictP.h"

#include <stdarg.h>
#include <stddef.h>
#include <maa.h>
#include <string.h>

/*
  partial snprintf implementation:
  - size PARAMETER IS COMPLETELY IGNORED
*/

int snprintf(char *str, size_t size, const char *format, ...)
{
   va_list ap;

   va_start (ap, format);
   vsprintf (str, format, ap);
   va_end (ap);

   if (strlen (str) >= size)
      err_fatal( __FUNCTION__, "Buffer too small\n" );
}