Back to index

php5  5.3.10
php_sprintf.c
Go to the documentation of this file.
00001 /* 
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2012 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Jaakko Hyvätti <jaakko.hyvatti@iki.fi>                       |
00016    +----------------------------------------------------------------------+
00017  */
00018 
00019 /* $Id: php_sprintf.c 321634 2012-01-01 13:15:04Z felipe $ */
00020 
00021 #include <stdio.h>
00022 #include <stdarg.h>
00023 #include "php.h"
00024 #ifdef PHP_WIN32
00025 #include "config.w32.h"
00026 #else
00027 #include <php_config.h>
00028 #endif
00029 
00030 PHPAPI int
00031 php_sprintf (char*s, const char* format, ...)
00032 {
00033   va_list args;
00034   int ret;
00035 
00036   va_start (args, format);
00037   s[0] = '\0';
00038   ret = vsprintf (s, format, args);
00039   va_end (args);
00040   return (ret < 0) ? -1 : ret;
00041 }
00042 
00043 /*
00044  * Local variables:
00045  * tab-width: 4
00046  * c-basic-offset: 4
00047  * End:
00048  * vim600: sw=4 ts=4 fdm=marker
00049  * vim<600: sw=4 ts=4
00050  */