1 ################################################################################
5 ## $Date: 2006/05/18 23:12:23 +0200 $
7 ################################################################################
9 ## Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
10 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
11 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
13 ## This program is free software; you can redistribute it and/or
14 ## modify it under the same terms as Perl itself.
16 ################################################################################
24 #if !defined(my_snprintf)
25 #if { NEED my_snprintf }
28 my_snprintf(char *buffer, const Size_t len, const char *format, ...)
35 retval = vsnprintf(buffer, len, format, ap);
37 retval = vsprintf(buffer, format, ap);
40 if (retval >= (int)len)
41 Perl_croak(aTHX_ "panic: my_snprintf buffer overflow");
50 #define NEED_my_snprintf
60 len = my_snprintf(buf, sizeof buf, "foo%s%d", "bar", 42);
62 XPUSHs(newSVpv(buf, 0));
67 my($l, $s) = Devel::PPPort::my_snprintf();