1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Author: Marcus Boerger <helly@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 #ifndef PHP_LIB_INIFILE_H 20 #define PHP_LIB_INIFILE_H 21 22 typedef struct { 23 char *group; 24 char *name; 25 } key_type; 26 27 typedef struct { 28 char *value; 29 } val_type; 30 31 typedef struct { 32 key_type key; 33 val_type val; 34 size_t pos; 35 } line_type; 36 37 typedef struct { 38 char *lockfn; 39 int lockfd; 40 php_stream *fp; 41 int readonly; 42 line_type curr; 43 line_type next; 44 } inifile; 45 46 val_type inifile_fetch(inifile *dba, const key_type *key, int skip); 47 int inifile_firstkey(inifile *dba); 48 int inifile_nextkey(inifile *dba); 49 int inifile_delete(inifile *dba, const key_type *key); 50 int inifile_delete_ex(inifile *dba, const key_type *key, zend_bool *found); 51 int inifile_replace(inifile *dba, const key_type *key, const val_type *val); 52 int inifile_replace_ex(inifile *dba, const key_type *key, const val_type *val, zend_bool *found); 53 int inifile_append(inifile *dba, const key_type *key, const val_type *val); 54 char *inifile_version(); 55 56 key_type inifile_key_split(const char *group_name); 57 char * inifile_key_string(const key_type *key); 58 59 void inifile_key_free(key_type *key); 60 void inifile_val_free(val_type *val); 61 void inifile_line_free(line_type *ln); 62 63 inifile * inifile_alloc(php_stream *fp, int readonly, int persistent); 64 void inifile_free(inifile *dba, int persistent); 65 66 #endif 67