inifile.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: Marcus Boerger <helly@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_LIB_INIFILE_H
  17. #define PHP_LIB_INIFILE_H
  18. typedef struct {
  19. char *group;
  20. char *name;
  21. } key_type;
  22. typedef struct {
  23. char *value;
  24. } val_type;
  25. typedef struct {
  26. key_type key;
  27. val_type val;
  28. size_t pos;
  29. } line_type;
  30. typedef struct {
  31. char *lockfn;
  32. int lockfd;
  33. php_stream *fp;
  34. int readonly;
  35. line_type curr;
  36. line_type next;
  37. } inifile;
  38. val_type inifile_fetch(inifile *dba, const key_type *key, int skip);
  39. int inifile_firstkey(inifile *dba);
  40. int inifile_nextkey(inifile *dba);
  41. int inifile_delete(inifile *dba, const key_type *key);
  42. int inifile_delete_ex(inifile *dba, const key_type *key, bool *found);
  43. int inifile_replace(inifile *dba, const key_type *key, const val_type *val);
  44. int inifile_replace_ex(inifile *dba, const key_type *key, const val_type *val, bool *found);
  45. int inifile_append(inifile *dba, const key_type *key, const val_type *val);
  46. char *inifile_version(void);
  47. key_type inifile_key_split(const char *group_name);
  48. char * inifile_key_string(const key_type *key);
  49. void inifile_key_free(key_type *key);
  50. void inifile_val_free(val_type *val);
  51. void inifile_line_free(line_type *ln);
  52. inifile * inifile_alloc(php_stream *fp, int readonly, int persistent);
  53. void inifile_free(inifile *dba, int persistent);
  54. #endif