utilvfs.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * \file
  3. * \brief Header: Utilities for VFS modules
  4. * \author Miguel de Icaza
  5. * \date 1995, 1996
  6. */
  7. #ifndef MC_VFS_UTILVFS_H
  8. #define MC_VFS_UTILVFS_H
  9. #include <sys/stat.h>
  10. #include "lib/global.h"
  11. #include "path.h"
  12. /*** typedefs(not structures) and defined constants **********************************************/
  13. /*** enums ***************************************************************************************/
  14. /** Bit flags for vfs_url_split()
  15. *
  16. * Modify parsing parameters according to flag meaning.
  17. * @see vfs_url_split()
  18. */
  19. typedef enum
  20. {
  21. URL_FLAGS_NONE = 0,
  22. URL_USE_ANONYMOUS = 1, /**< if set, empty *user will contain NULL instead of current */
  23. URL_NOSLASH = 2 /**< if set, 'proto://' part in url is not searched */
  24. } vfs_url_flags_t;
  25. /*** structures declarations (and typedefs of structures)*****************************************/
  26. /*** global variables defined in .c file *********************************************************/
  27. /*** declarations of public functions ************************************************************/
  28. int vfs_finduid (const char *name);
  29. int vfs_findgid (const char *name);
  30. vfs_path_element_t *vfs_url_split (const char *path, int default_port, vfs_url_flags_t flags);
  31. int vfs_split_text (char *p);
  32. int vfs_mkstemps (vfs_path_t ** pname_vpath, const char *prefix, const char *basename);
  33. MC_MOCKABLE void vfs_die (const char *msg);
  34. char *vfs_get_password (const char *msg);
  35. char *vfs_get_local_username (void);
  36. gboolean vfs_parse_filetype (const char *s, size_t *ret_skipped, mode_t * ret_type);
  37. gboolean vfs_parse_fileperms (const char *s, size_t *ret_skipped, mode_t * ret_perms);
  38. gboolean vfs_parse_filemode (const char *s, size_t *ret_skipped, mode_t * ret_mode);
  39. gboolean vfs_parse_raw_filemode (const char *s, size_t *ret_skipped, mode_t * ret_mode);
  40. void vfs_parse_ls_lga_init (void);
  41. gboolean vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, char **linkname,
  42. size_t *filename_pos);
  43. size_t vfs_parse_ls_lga_get_final_spaces (void);
  44. gboolean vfs_parse_month (const char *str, struct tm *tim);
  45. int vfs_parse_filedate (int idx, time_t * t);
  46. int vfs_utime (const char *path, mc_timesbuf_t *times);
  47. void vfs_get_timespecs_from_timesbuf (mc_timesbuf_t *times, mc_timespec_t *atime,
  48. mc_timespec_t *mtime);
  49. void vfs_get_timesbuf_from_stat (const struct stat *s, mc_timesbuf_t *times);
  50. void vfs_copy_stat_times (const struct stat *src, struct stat *dst);
  51. void vfs_zero_stat_times (struct stat *s);
  52. /*** inline functions ****************************************************************************/
  53. #endif