xref: /php-src/ext/standard/scanf.h (revision 01b3fc03)
1 /*
2    +----------------------------------------------------------------------+
3    | Copyright (c) The PHP Group                                          |
4    +----------------------------------------------------------------------+
5    | This source file is subject to version 3.01 of the PHP license,      |
6    | that is bundled with this package in the file LICENSE, and is        |
7    | available through the world-wide-web at the following url:           |
8    | https://www.php.net/license/3_01.txt                                 |
9    | If you did not receive a copy of the PHP license and are unable to   |
10    | obtain it through the world-wide-web, please send a note to          |
11    | license@php.net so we can mail you a copy immediately.               |
12    +----------------------------------------------------------------------+
13    | Author: Clayton Collie <clcollie@mindspring.com>                     |
14    +----------------------------------------------------------------------+
15 */
16 
17 #ifndef  SCANF_H
18 #define  SCANF_H
19 
20 
21 #define SCAN_MAX_ARGS   0xFF    /* Maximum number of variable which can be      */
22                                 /* passed to (f|s)scanf. This is an artificial   */
23                                 /* upper limit to keep resources in check and   */
24                                 /* minimize the possibility of exploits         */
25 
26 #define SCAN_SUCCESS			SUCCESS
27 #define SCAN_ERROR_EOF			-1	/* indicates premature termination of scan 	*/
28 									/* can be caused by bad parameters or format*/
29 									/* string.									*/
30 #define SCAN_ERROR_INVALID_FORMAT		(SCAN_ERROR_EOF - 1)
31 #define SCAN_ERROR_WRONG_PARAM_COUNT	(SCAN_ERROR_INVALID_FORMAT - 1)
32 
33 /*
34  * The following are here solely for the benefit of the scanf type functions
35  * e.g. fscanf
36  */
37 PHPAPI int ValidateFormat(char *format, int numVars, int *totalVars);
38 PHPAPI int php_sscanf_internal(char *string,char *format,int argCount,zval *args,
39 				int varStart, zval *return_value);
40 
41 
42 #endif /* SCANF_H */
43