files.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*====================================================================*
  2. *
  3. * files.h - custom filesystem definitions and declarations;
  4. *
  5. * this file is a subset of the original that includes only those
  6. * definitions and declaration needed for toolkit programs;
  7. *
  8. * Motley Tools by Charles Maier;
  9. * Copyright 2001-2006 by Charles Maier Associates;
  10. * Licensed under the Internet Software Consortium License;
  11. *
  12. *--------------------------------------------------------------------*/
  13. #ifndef FILES_HEADER
  14. #define FILES_HEADER
  15. /*====================================================================*
  16. * system header files;
  17. *--------------------------------------------------------------------*/
  18. #include <stdio.h>
  19. #include <fcntl.h>
  20. #include <sys/stat.h>
  21. /*====================================================================*
  22. * system header files;
  23. *--------------------------------------------------------------------*/
  24. #include "../tools/types.h"
  25. /*====================================================================*
  26. * path and file extenders;
  27. *--------------------------------------------------------------------*/
  28. #ifdef WIN32
  29. #define PATH_C_EXTENDER '\\'
  30. #define FILE_C_EXTENDER '.'
  31. #else
  32. #define PATH_C_EXTENDER '/'
  33. #define FILE_C_EXTENDER '.'
  34. #endif
  35. /*====================================================================*
  36. *
  37. *--------------------------------------------------------------------*/
  38. #define FILE_CANTSTAT "%s can't stat %s", __func__
  39. #define FILE_CANTOPEN "%s can't open %s", __func__
  40. #define FILE_CANTHOME "%s can't home %s", __func__
  41. #define FILE_CANTSIZE "%s can't size %s", __func__
  42. #define FILE_CANTSEEK "%s can't seek %s", __func__
  43. #define FILE_CANTREAD "%s can't read %s", __func__
  44. #define FILE_CANTLOAD "%s can't load %s", __func__
  45. #define FILE_CANTEDIT "%s can't edit %s", __func__
  46. #define FILE_CANTSAVE "%s can't save %s", __func__
  47. #define FILE_CANTSPAN "%s won't span %s", __func__
  48. #define FILE_WONTREAD "%s won't read %s", __func__
  49. /*====================================================================*
  50. * file create and access modes;
  51. *--------------------------------------------------------------------*/
  52. #ifdef WIN32
  53. #define FILE_FILEMODE S_IREAD|S_IWRITE
  54. #else
  55. #define FILE_FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH
  56. #define O_BINARY 0
  57. #endif
  58. /*====================================================================*
  59. * functions;
  60. *--------------------------------------------------------------------*/
  61. FILE *efopen (char const *filename, char const *openmode);
  62. FILE *efreopen (char const *filename, char const *openmode, FILE *fp);
  63. bool checkfilename (char const * string);
  64. char const * filepart (char const * string);
  65. /*====================================================================*
  66. *
  67. *--------------------------------------------------------------------*/
  68. #endif