ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/libio/string/snprintf.c
Revision: 524
Committed: Sun Mar 12 20:09:01 2006 UTC (20 years, 5 months ago) by adx
Content type: text/x-csrc
File size: 18694 byte(s)
Log Message:
- %p should never be treated as signed

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * snprintf.c: Functions for printing to a length-limited string.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 /**************************************************************
26 * Original header, taken from mutt...:
27 * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
28 * A bombproof version of doprnt (dopr) included.
29 * Sigh. This sort of thing is always nasty do deal with. Note that
30 * the version here does not include floating point...
31 *
32 * snprintf() is used instead of sprintf() as it does limit checks
33 * for string length. This covers a nasty loophole.
34 *
35 * The other functions are there to prevent NULL pointers from
36 * causing nast effects.
37 *
38 * More Recently:
39 * Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
40 * This was ugly. It is still ugly. I opted out of floating point
41 * numbers, but the formatter understands just about everything
42 * from the normal C string format, at least as far as I can tell from
43 * the Solaris 2.5 printf(3S) man page.
44 *
45 * Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
46 * Ok, added some minimal floating point support, which means this
47 * probably requires libm on most operating systems. Don't yet
48 * support the exponent (e,E) and sigfig (g,G). Also, fmtint()
49 * was pretty badly broken, it just wasn't being exercised in ways
50 * which showed it, so that's been fixed. Also, formated the code
51 * to mutt conventions, and removed dead code left over from the
52 * original. Also, there is now a builtin-test, just compile with:
53 * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
54 * and run snprintf for results.
55 *
56 * Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
57 * The PGP code was using unsigned hexadecimal formats.
58 * Unfortunately, unsigned formats simply didn't work.
59 *
60 * Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
61 * The original code assumed that both snprintf() and vsnprintf() were
62 * missing. Some systems only have snprintf() but not vsnprintf(), so
63 * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
64 *
65 **************************************************************/
66
67 #include "stdinc.h"
68 #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
69
70
71
72 /* varargs declarations: */
73
74 # include <stdarg.h>
75 # define HAVE_STDARGS /* let's hope that works everywhere (mj) */
76 # define VA_LOCAL_DECL va_list ap
77 # define VA_START(f) va_start(ap, f)
78 # define VA_SHIFT(v,t) ; /* no-op for ANSI */
79 # define VA_END va_end(ap)
80
81 /*int snprintf (char *str, size_t count, const char *fmt, ...);*/
82 /*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/
83
84 static void dopr (char *buffer, size_t maxlen, const char *format,
85 va_list args);
86 static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
87 char *value, int flags, int min, int max);
88 static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
89 long value, int base, int min, int max, int flags);
90 static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
91 long double fvalue, int min, int max, int flags);
92 static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c );
93
94 /*
95 * dopr(): poor man's version of doprintf
96 */
97
98 /* format read states */
99 #define DP_S_DEFAULT 0
100 #define DP_S_FLAGS 1
101 #define DP_S_MIN 2
102 #define DP_S_DOT 3
103 #define DP_S_MAX 4
104 #define DP_S_MOD 5
105 #define DP_S_CONV 6
106 #define DP_S_DONE 7
107
108 /* format flags - Bits */
109 #define DP_F_MINUS (1 << 0)
110 #define DP_F_PLUS (1 << 1)
111 #define DP_F_SPACE (1 << 2)
112 #define DP_F_NUM (1 << 3)
113 #define DP_F_ZERO (1 << 4)
114 #define DP_F_UP (1 << 5)
115 #define DP_F_UNSIGNED (1 << 6)
116
117 /* Conversion Flags */
118 #define DP_C_SHORT 1
119 #define DP_C_LONG 2
120 #define DP_C_LDOUBLE 3
121
122 #define char_to_int(p) (p - '0')
123 #undef MAX
124 #define MAX(p,q) ((p >= q) ? p : q)
125
126 static void dopr (char *buffer, size_t maxlen, const char *format, va_list args)
127 {
128 char ch;
129 long value;
130 long double fvalue;
131 char *strvalue;
132 int min;
133 int max;
134 int state;
135 int flags;
136 int cflags;
137 size_t currlen;
138
139 state = DP_S_DEFAULT;
140 currlen = flags = cflags = min = 0;
141 max = -1;
142 ch = *format++;
143
144 while (state != DP_S_DONE)
145 {
146 if ((ch == '\0') || (currlen >= maxlen))
147 state = DP_S_DONE;
148
149 switch(state)
150 {
151 case DP_S_DEFAULT:
152 if (ch == '%')
153 state = DP_S_FLAGS;
154 else
155 dopr_outch (buffer, &currlen, maxlen, ch);
156 ch = *format++;
157 break;
158 case DP_S_FLAGS:
159 switch (ch)
160 {
161 case '-':
162 flags |= DP_F_MINUS;
163 ch = *format++;
164 break;
165 case '+':
166 flags |= DP_F_PLUS;
167 ch = *format++;
168 break;
169 case ' ':
170 flags |= DP_F_SPACE;
171 ch = *format++;
172 break;
173 case '#':
174 flags |= DP_F_NUM;
175 ch = *format++;
176 break;
177 case '0':
178 flags |= DP_F_ZERO;
179 ch = *format++;
180 break;
181 default:
182 state = DP_S_MIN;
183 break;
184 }
185 break;
186 case DP_S_MIN:
187 if (isdigit((unsigned char)ch))
188 {
189 min = 10*min + char_to_int (ch);
190 ch = *format++;
191 }
192 else if (ch == '*')
193 {
194 min = va_arg (args, int);
195 ch = *format++;
196 state = DP_S_DOT;
197 }
198 else
199 state = DP_S_DOT;
200 break;
201 case DP_S_DOT:
202 if (ch == '.')
203 {
204 state = DP_S_MAX;
205 ch = *format++;
206 }
207 else
208 state = DP_S_MOD;
209 break;
210 case DP_S_MAX:
211 if (isdigit((unsigned char)ch))
212 {
213 if (max < 0)
214 max = 0;
215 max = 10*max + char_to_int (ch);
216 ch = *format++;
217 }
218 else if (ch == '*')
219 {
220 max = va_arg (args, int);
221 ch = *format++;
222 state = DP_S_MOD;
223 }
224 else
225 state = DP_S_MOD;
226 break;
227 case DP_S_MOD:
228 /* Currently, we don't support Long Long, bummer */
229 switch (ch)
230 {
231 case 'h':
232 cflags = DP_C_SHORT;
233 ch = *format++;
234 break;
235 case 'l':
236 cflags = DP_C_LONG;
237 ch = *format++;
238 break;
239 case 'L':
240 cflags = DP_C_LDOUBLE;
241 ch = *format++;
242 break;
243 default:
244 break;
245 }
246 state = DP_S_CONV;
247 break;
248 case DP_S_CONV:
249 switch (ch)
250 {
251 case 'd':
252 case 'i':
253 if (cflags == DP_C_SHORT)
254 value = va_arg (args, short int);
255 else if (cflags == DP_C_LONG)
256 value = va_arg (args, long int);
257 else
258 value = va_arg (args, int);
259 fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
260 break;
261 case 'o':
262 flags |= DP_F_UNSIGNED;
263 if (cflags == DP_C_SHORT)
264 value = va_arg (args, unsigned short int);
265 else if (cflags == DP_C_LONG)
266 value = va_arg (args, unsigned long int);
267 else
268 value = va_arg (args, unsigned int);
269 fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
270 break;
271 case 'u':
272 flags |= DP_F_UNSIGNED;
273 if (cflags == DP_C_SHORT)
274 value = va_arg (args, unsigned short int);
275 else if (cflags == DP_C_LONG)
276 value = va_arg (args, unsigned long int);
277 else
278 value = va_arg (args, unsigned int);
279 fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
280 break;
281 case 'X':
282 flags |= DP_F_UP;
283 case 'x':
284 flags |= DP_F_UNSIGNED;
285 if (cflags == DP_C_SHORT)
286 value = va_arg (args, unsigned short int);
287 else if (cflags == DP_C_LONG)
288 value = va_arg (args, unsigned long int);
289 else
290 value = va_arg (args, unsigned int);
291 fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
292 break;
293 case 'f':
294 if (cflags == DP_C_LDOUBLE)
295 fvalue = va_arg (args, long double);
296 else
297 fvalue = va_arg (args, double);
298 /* um, floating point? */
299 fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
300 break;
301 case 'E':
302 flags |= DP_F_UP;
303 case 'e':
304 if (cflags == DP_C_LDOUBLE)
305 fvalue = va_arg (args, long double);
306 else
307 fvalue = va_arg (args, double);
308 break;
309 case 'G':
310 flags |= DP_F_UP;
311 case 'g':
312 if (cflags == DP_C_LDOUBLE)
313 fvalue = va_arg (args, long double);
314 else
315 fvalue = va_arg (args, double);
316 break;
317 case 'c':
318 dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
319 break;
320 case 's':
321 strvalue = va_arg (args, char *);
322 if (max < 0)
323 max = maxlen; /* ie, no max */
324 fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
325 break;
326 case 'p':
327 flags |= DP_F_UNSIGNED;
328 strvalue = va_arg (args, void *);
329 fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
330 break;
331 case 'n':
332 if (cflags == DP_C_SHORT)
333 {
334 short int *num;
335 num = va_arg (args, short int *);
336 *num = currlen;
337 }
338 else if (cflags == DP_C_LONG)
339 {
340 long int *num;
341 num = va_arg (args, long int *);
342 *num = currlen;
343 }
344 else
345 {
346 int *num;
347 num = va_arg (args, int *);
348 *num = currlen;
349 }
350 break;
351 case '%':
352 dopr_outch (buffer, &currlen, maxlen, ch);
353 break;
354 case 'w':
355 /* not supported yet, treat as next char */
356 ch = *format++;
357 break;
358 default:
359 /* Unknown, skip */
360 break;
361 }
362 ch = *format++;
363 state = DP_S_DEFAULT;
364 flags = cflags = min = 0;
365 max = -1;
366 break;
367 case DP_S_DONE:
368 break;
369 default:
370 /* hmm? */
371 break; /* some picky compilers need this */
372 }
373 }
374 if (currlen < maxlen - 1)
375 buffer[currlen] = '\0';
376 else
377 buffer[maxlen - 1] = '\0';
378 }
379
380 static void fmtstr (char *buffer, size_t *currlen, size_t maxlen,
381 char *value, int flags, int min, int max)
382 {
383 int padlen, strln; /* amount to pad */
384 int cnt = 0;
385
386 if (value == 0)
387 {
388 value = "<NULL>";
389 }
390
391 for (strln = 0; value[strln]; ++strln); /* strlen */
392 padlen = min - strln;
393 if (padlen < 0)
394 padlen = 0;
395 if (flags & DP_F_MINUS)
396 padlen = -padlen; /* Left Justify */
397
398 while ((padlen > 0) && (cnt < max))
399 {
400 dopr_outch (buffer, currlen, maxlen, ' ');
401 --padlen;
402 ++cnt;
403 }
404 while (*value && (cnt < max))
405 {
406 dopr_outch (buffer, currlen, maxlen, *value++);
407 ++cnt;
408 }
409 while ((padlen < 0) && (cnt < max))
410 {
411 dopr_outch (buffer, currlen, maxlen, ' ');
412 ++padlen;
413 ++cnt;
414 }
415 }
416
417 /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
418
419 static void fmtint (char *buffer, size_t *currlen, size_t maxlen,
420 long value, int base, int min, int max, int flags)
421 {
422 int signvalue = 0;
423 unsigned long uvalue;
424 char convert[20];
425 int place = 0;
426 int spadlen = 0; /* amount to space pad */
427 int zpadlen = 0; /* amount to zero pad */
428 int caps = 0;
429
430 if (max < 0)
431 max = 0;
432
433 uvalue = value;
434
435 if(!(flags & DP_F_UNSIGNED))
436 {
437 if( value < 0 ) {
438 signvalue = '-';
439 uvalue = -value;
440 }
441 else
442 if (flags & DP_F_PLUS) /* Do a sign (+/i) */
443 signvalue = '+';
444 else
445 if (flags & DP_F_SPACE)
446 signvalue = ' ';
447 }
448
449 if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
450
451 do {
452 convert[place++] =
453 (caps? "0123456789ABCDEF":"0123456789abcdef")
454 [uvalue % (unsigned)base ];
455 uvalue = (uvalue / (unsigned)base );
456 } while(uvalue && (place < 20));
457 if (place == 20) place--;
458 convert[place] = 0;
459
460 zpadlen = max - place;
461 spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
462 if (zpadlen < 0) zpadlen = 0;
463 if (spadlen < 0) spadlen = 0;
464 if (flags & DP_F_ZERO)
465 {
466 zpadlen = MAX(zpadlen, spadlen);
467 spadlen = 0;
468 }
469 if (flags & DP_F_MINUS)
470 spadlen = -spadlen; /* Left Justifty */
471
472 #ifdef DEBUG_SNPRINTF
473 dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
474 zpadlen, spadlen, min, max, place));
475 #endif
476
477 /* Spaces */
478 while (spadlen > 0)
479 {
480 dopr_outch (buffer, currlen, maxlen, ' ');
481 --spadlen;
482 }
483
484 /* Sign */
485 if (signvalue)
486 dopr_outch (buffer, currlen, maxlen, signvalue);
487
488 /* Zeros */
489 if (zpadlen > 0)
490 {
491 while (zpadlen > 0)
492 {
493 dopr_outch (buffer, currlen, maxlen, '0');
494 --zpadlen;
495 }
496 }
497
498 /* Digits */
499 while (place > 0)
500 dopr_outch (buffer, currlen, maxlen, convert[--place]);
501
502 /* Left Justified spaces */
503 while (spadlen < 0) {
504 dopr_outch (buffer, currlen, maxlen, ' ');
505 ++spadlen;
506 }
507 }
508
509 static long double abs_val (long double value)
510 {
511 long double result = value;
512
513 if (value < 0)
514 result = -value;
515
516 return result;
517 }
518
519 static long double pow10 (int exp)
520 {
521 long double result = 1;
522
523 while (exp)
524 {
525 result *= 10;
526 exp--;
527 }
528
529 return result;
530 }
531
532 static long round (long double value)
533 {
534 long intpart;
535
536 intpart = value;
537 value = value - intpart;
538 if (value >= 0.5)
539 intpart++;
540
541 return intpart;
542 }
543
544 static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
545 long double fvalue, int min, int max, int flags)
546 {
547 int signvalue = 0;
548 long double ufvalue;
549 char iconvert[20];
550 char fconvert[20];
551 int iplace = 0;
552 int fplace = 0;
553 int padlen = 0; /* amount to pad */
554 int zpadlen = 0;
555 int caps = 0;
556 long intpart;
557 long fracpart;
558
559 /*
560 * AIX manpage says the default is 0, but Solaris says the default
561 * is 6, and sprintf on AIX defaults to 6
562 */
563 if (max < 0)
564 max = 6;
565
566 ufvalue = abs_val (fvalue);
567
568 if (fvalue < 0)
569 signvalue = '-';
570 else
571 if (flags & DP_F_PLUS) /* Do a sign (+/i) */
572 signvalue = '+';
573 else
574 if (flags & DP_F_SPACE)
575 signvalue = ' ';
576
577 intpart = ufvalue;
578
579 /*
580 * Sorry, we only support 9 digits past the decimal because of our
581 * conversion method
582 */
583 if (max > 9)
584 max = 9;
585
586 /* We "cheat" by converting the fractional part to integer by
587 * multiplying by a factor of 10
588 */
589 fracpart = round ((pow10 (max)) * (ufvalue - intpart));
590
591 if (fracpart >= pow10 (max))
592 {
593 intpart++;
594 fracpart -= pow10 (max);
595 }
596
597 #ifdef DEBUG_SNPRINTF
598 dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart));
599 #endif
600
601 /* Convert integer part */
602 do {
603 iconvert[iplace++] =
604 (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
605 intpart = (intpart / 10);
606 } while(intpart && (iplace < 20));
607 if (iplace == 20) iplace--;
608 iconvert[iplace] = 0;
609
610 /* Convert fractional part */
611 do {
612 fconvert[fplace++] =
613 (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
614 fracpart = (fracpart / 10);
615 } while(fracpart && (fplace < 20));
616 if (fplace == 20) fplace--;
617 fconvert[fplace] = 0;
618
619 /* -1 for decimal point, another -1 if we are printing a sign */
620 padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
621 zpadlen = max - fplace;
622 if (zpadlen < 0)
623 zpadlen = 0;
624 if (padlen < 0)
625 padlen = 0;
626 if (flags & DP_F_MINUS)
627 padlen = -padlen; /* Left Justifty */
628
629 if ((flags & DP_F_ZERO) && (padlen > 0))
630 {
631 if (signvalue)
632 {
633 dopr_outch (buffer, currlen, maxlen, signvalue);
634 --padlen;
635 signvalue = 0;
636 }
637 while (padlen > 0)
638 {
639 dopr_outch (buffer, currlen, maxlen, '0');
640 --padlen;
641 }
642 }
643 while (padlen > 0)
644 {
645 dopr_outch (buffer, currlen, maxlen, ' ');
646 --padlen;
647 }
648 if (signvalue)
649 dopr_outch (buffer, currlen, maxlen, signvalue);
650
651 while (iplace > 0)
652 dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
653
654 /*
655 * Decimal point. This should probably use locale to find the correct
656 * char to print out.
657 */
658 dopr_outch (buffer, currlen, maxlen, '.');
659
660 while (fplace > 0)
661 dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
662
663 while (zpadlen > 0)
664 {
665 dopr_outch (buffer, currlen, maxlen, '0');
666 --zpadlen;
667 }
668
669 while (padlen < 0)
670 {
671 dopr_outch (buffer, currlen, maxlen, ' ');
672 ++padlen;
673 }
674 }
675
676 static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c)
677 {
678 if (*currlen < maxlen)
679 buffer[(*currlen)++] = c;
680 }
681 #endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
682
683 #ifndef HAVE_VSNPRINTF
684 int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
685 {
686 str[0] = 0;
687 dopr(str, count, fmt, args);
688 return(strlen(str));
689 }
690 #endif /* !HAVE_VSNPRINTF */
691
692 #ifndef HAVE_SNPRINTF
693 /* VARARGS3 */
694 #ifdef HAVE_STDARGS
695 int snprintf (char *str,size_t count,const char *fmt,...)
696 #else
697 int snprintf (va_alist) va_dcl
698 #endif
699 {
700 #ifndef HAVE_STDARGS
701 char *str;
702 size_t count;
703 char *fmt;
704 #endif
705 VA_LOCAL_DECL;
706
707 VA_START (fmt);
708 VA_SHIFT (str, char *);
709 VA_SHIFT (count, size_t );
710 VA_SHIFT (fmt, char *);
711 (void) vsnprintf(str, count, fmt, ap);
712 VA_END;
713 return(strlen(str));
714 }
715
716 #ifdef TEST_SNPRINTF
717 #ifndef LONG_STRING
718 #define LONG_STRING 1024
719 #endif
720 int main (void)
721 {
722 char buf1[LONG_STRING];
723 char buf2[LONG_STRING];
724 char *fp_fmt[] = {
725 "%-1.5f",
726 "%1.5f",
727 "%123.9f",
728 "%10.5f",
729 "% 10.5f",
730 "%+22.9f",
731 "%+4.9f",
732 "%01.3f",
733 "%4f",
734 "%3.1f",
735 "%3.2f",
736 NULL
737 };
738 double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
739 0.9996, 1.996, 4.136, 0};
740 char *int_fmt[] = {
741 "%-1.5d",
742 "%1.5d",
743 "%123.9d",
744 "%5.5d",
745 "%10.5d",
746 "% 10.5d",
747 "%+22.33d",
748 "%01.3d",
749 "%4d",
750 NULL
751 };
752 long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
753 int x, y;
754 int fail = 0;
755 int num = 0;
756
757 printf ("Testing snprintf format codes against system sprintf...\n");
758
759 for (x = 0; fp_fmt[x] != NULL ; x++)
760 for (y = 0; fp_nums[y] != 0 ; y++)
761 {
762 snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]);
763 sprintf (buf2, fp_fmt[x], fp_nums[y]);
764 if (strcmp (buf1, buf2))
765 {
766 printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */
767 fp_fmt[x], buf1, buf2);
768 fail++;
769 }
770 num++;
771 }
772
773 for (x = 0; int_fmt[x] != NULL ; x++)
774 for (y = 0; int_nums[y] != 0 ; y++)
775 {
776 snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]);
777 sprintf (buf2, int_fmt[x], int_nums[y]);
778 if (strcmp (buf1, buf2))
779 {
780 printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */
781 int_fmt[x], buf1, buf2);
782 fail++;
783 }
784 num++;
785 }
786 printf ("%d tests failed out of %d.\n", fail, num);
787 }
788 #endif /* SNPRINTF_TEST */
789
790 #endif /* !HAVE_SNPRINTF */

Properties

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