file_util.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* file_util.h - convenience routines for common file operations
  2. Carl D. Worth
  3. Copyright (C) 2001 University of Southern California
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation; either version 2, or (at
  7. your option) any later version.
  8. This program is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. */
  13. #ifndef FILE_UTIL_H
  14. #define FILE_UTIL_H
  15. int file_exists(const char *file_name);
  16. int file_is_dir(const char *file_name);
  17. char *file_read_line_alloc(FILE * file);
  18. int file_move(const char *src, const char *dest);
  19. int file_copy(const char *src, const char *dest);
  20. int file_mkdir_hier(const char *path, long mode);
  21. char *file_md5sum_alloc(const char *file_name);
  22. char *file_sha256sum_alloc(const char *file_name);
  23. int rm_r(const char *path);
  24. char *checksum_bin2hex(const char *src, size_t len);
  25. char *checksum_hex2bin(const char *src, size_t *len);
  26. char *urlencode_path(const char *filename);
  27. char *urldecode_path(const char *filename);
  28. #endif