inifile.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. /* $Id$ */
  19. #ifndef PHP_LIB_INIFILE_H
  20. #define PHP_LIB_INIFILE_H
  21. typedef struct {
  22. char *group;
  23. char *name;
  24. } key_type;
  25. typedef struct {
  26. char *value;
  27. } val_type;
  28. typedef struct {
  29. key_type key;
  30. val_type val;
  31. size_t pos;
  32. } line_type;
  33. typedef struct {
  34. char *lockfn;
  35. int lockfd;
  36. php_stream *fp;
  37. int readonly;
  38. line_type curr;
  39. line_type next;
  40. } inifile;
  41. val_type inifile_fetch(inifile *dba, const key_type *key, int skip TSRMLS_DC);
  42. int inifile_firstkey(inifile *dba TSRMLS_DC);
  43. int inifile_nextkey(inifile *dba TSRMLS_DC);
  44. int inifile_delete(inifile *dba, const key_type *key TSRMLS_DC);
  45. int inifile_replace(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
  46. int inifile_append(inifile *dba, const key_type *key, const val_type *val TSRMLS_DC);
  47. char *inifile_version();
  48. key_type inifile_key_split(const char *group_name);
  49. char * inifile_key_string(const key_type *key);
  50. void inifile_key_free(key_type *key);
  51. void inifile_val_free(val_type *val);
  52. void inifile_line_free(line_type *ln);
  53. inifile * inifile_alloc(php_stream *fp, int readonly, int persistent TSRMLS_DC);
  54. void inifile_free(inifile *dba, int persistent);
  55. #endif