misc_file.h 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * misc_file.h
  3. * prototypes for misc_file.c
  4. *
  5. */
  6. #ifndef _EGG_MISC_FILE_H
  7. #define _EGG_MISC_FILE_H
  8. #include <stdio.h>
  9. int copyfile(const char *, const char *);
  10. int movefile(const char *, const char *);
  11. int is_file(const char *);
  12. int can_stat(const char *);
  13. int can_lstat(const char *);
  14. int is_symlink(const char *);
  15. int is_dir(const char *);
  16. int fixmod(const char *);
  17. class Tempfile
  18. {
  19. public:
  20. Tempfile() { Tempfile(NULL); }; //constructor
  21. Tempfile(const char *prefix); //constructor with file prefix
  22. void AllocTempfile(); //constructor with file prefix
  23. void Tempfile::my_close();
  24. ~Tempfile(); //destructor
  25. static bool FindDir();
  26. bool error; //exceptions are lame.
  27. FILE *f;
  28. char *file;
  29. int fd;
  30. size_t len;
  31. private:
  32. char *prefix;
  33. int plen;
  34. void MakeTemp(); //Used for mktemp() and checking
  35. };
  36. #endif /* _EGG_MISC_FILE_H */