ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/contrib/libc_vprintf.c
Revision: 31
Committed: Sun Oct 2 20:34:05 2005 UTC (18 years, 6 months ago) by knight
Content type: text/x-csrc
File size: 786 byte(s)
Log Message:
- Fix svn:keywords

File Contents

# Content
1 /* $Id$ */
2 #include <stdio.h>
3 #include <stdarg.h>
4 #include <stdlib.h>
5
6 #define BUFLEN 1024
7
8 static void checkbug(const char *fmt, ...);
9
10 int main(int argc, char *argv[])
11 {
12 checkbug("Constant Format String");
13 checkbug("1=%d, foo=%s", 1, "foo");
14
15 exit(0); /*NOTREACHED*/
16 }
17
18 static void checkbug(const char *fmt, ...)
19 {
20 char buf_a[BUFLEN];
21 char buf_b[BUFLEN];
22 char buf_c[BUFLEN];
23 int n;
24 va_list ap, ap2;
25
26 printf("checkbug(%s)\n", fmt);
27
28 va_start(ap, fmt);
29 va_copy(ap2, ap);
30
31 n = vsnprintf(buf_a, BUFLEN, fmt, ap);
32 printf(" buf_a (len=%4d): %s\n", n, buf_a);
33 vsnprintf(buf_b, BUFLEN, fmt, ap);
34 printf(" buf_b (len=%4d): %s\n", n, buf_b);
35 vsnprintf(buf_c, BUFLEN, fmt, ap2);
36 printf(" buf_c (len=%4d): %s\n", n, buf_c);
37
38 va_end(ap);
39 va_end(ap2);
40 }
41

Properties

Name Value
svn:eol-style native
svn:keywords "Id Revision"